summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-rtnl/sd-rtnl.c
AgeCommit message (Collapse)Author
2015-03-13sd-rtnl: process - only apply matches to broadcast messagesTom Gundersen
2015-03-13sd-rtnl: improve detection of broadcast messagesTom Gundersen
Do not rely on nl_pid == 0, but check the groups instead. We currently avoid using nl_pid == 0 for unicast anyway, so this should be redundant, but let's try to be correct.
2015-03-13sd-rtnl: never set serial to 0Tom Gundersen
In the unlikely event that we wrap the counter, skip 0 as this is used for broadcasts. Suggested by Richard Maw.
2015-03-13tree-wide: there is no ENOTSUP on linuxDavid Herrmann
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
2015-03-12networkd: Begin with serial number 1 for netlink requestsRichard Maw
"Notifications are of informal nature and no reply is expected, therefore the sequence number is typically set to 0."[1] If networkd is started soon after recent netlink activity, then there will be messages with sequence number 0 in the buffer. The first thing networkd does is to request a dump of all the links. If it uses sequence number 0 for this, then it may confuse the dump request's response with that of a notification. This will result in it failing to properly enumerate all the links, but more importantly, when it comes to enumerate all the addresses, it will still have the link dump in progress, so the address enumeration will fail with -EBUSY. [1]: http://www.infradead.org/~tgr/libnl/doc/core.html#core_msg_types [tomegun: sequence -> serial]
2015-02-03sd-rtnl: allow sd_rtnl_open_fd() to be used on bound socketsTom Gundersen
2015-02-02networkd: support socket activationTom Gundersen
Still keep the non-socket activation code around for starting from the commandline, but will likely drop that too in the future.
2015-02-02sd-rtnl: introduce sd_rtnl_new_from_netlinkTom Gundersen
2015-01-31sd-rtnl: don't fail event handler when callback failsTom Gundersen
As in sd-bus, simply log at debug level when a callback fails, but don't fail the event handler. Otherwise any error returned by any callback will disable the rtnl event handler. We should only do that on serious internal errors in sd-rtnl that we know cannot be recovered from.
2015-01-13refcnt: refcnt is unsigned, fix comparisonsTom Gundersen
This does not make a difference, but the code was confusing.
2015-01-13nspawn: add new option "--port=" for exposing container ports on the local hostLennart Poettering
This exposes an IP port on the container as local port using DNAT.
2014-12-29sd-rtnl: rtnl_call - don't dispatch wqueue after timeout has passedTom Gundersen
Only a minor change as the timeout would be hit soon thereafetr at the next loop.
2014-12-29sd-rtnl: rtnl_poll - fix typoTom Gundersen
This caused rtnl_poll to always return true immediately in sd_rtnl_call().
2014-11-27networkd: fix kernel rtnl receive buffer overrun errorAlin Rauta
We got the following error when running systemd on a device with many ports: "rtnl: kernel receive buffer overrun Event source 'rtnl-receive-message' returned error, disabling: No buffer space available" I think the kernel socket receive buffer queue should be increased. The default value is taken from: "/proc/sys/net/core/rmem_default", but we can overwrite it using SO_RCVBUF socket option. This is already done in networkd for other sockets. For example, the bus socket (sd-bus/bus-socket.c) has a receive queue of 8MB. In our case, the default is 208KB. Increasing the buffer receive queue for manager socket to 512KB should be enough to get rid of the above error. [tomegun: bump the limit even higher to 8M]
2014-11-04sd-event: rename sd_event_source_set_name() to sd_event_source_get_name()Lennart Poettering
To mirror the recent name change of the concept for sd_bus objects, follow the same logic for sd_event_source objects, too.
2014-09-15hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt
It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
2014-08-29Fix a few typos in log messagesRuben Kerkhof
2014-08-28sd-event: name event sources used in librariesTom Gundersen
This should help in debugging failing event sources.
2014-07-29time-util: add and use USEC/NSEC_INFINIYKay Sievers
2014-05-10rtnl: message - read group membership of incoming messagesTom Gundersen
2014-05-10rtnl: change from bitmask to enum for rtnl groupsTom Gundersen
The bitmask is deprecated in the kernel, so move to the new interface. At the moment this does not make a difference for us, but it avoids having to change the API in the future.
2014-04-20sd-rtnl: log when queues are exhaustedTom Gundersen
2014-04-19sd-rtnl: message - concatenate multi-part messages from different packetsTom Gundersen
2014-04-14sd-rtnl: socket_read - use a read bufferTom Gundersen
Rather than allocating/freeing memory for each message read, keep a global read buffer in the rtnl object. Also, rather than using a fixed size, peek at the pending message header to get the message size and reallocate as necessary.
2014-04-11sd-rtnl: use SO_PASSCREDTom Gundersen
This unifies the socket handling with other sd-* libraries.
2014-04-10sd-rtnl: don't drop multi-part messagesTom Gundersen
We still only return the first message part in callback/synchronous calls.
2014-04-10sd-rtnl: use GREEDY_REALLOC for message queuesTom Gundersen
2014-03-31sd-rtnl: modernize a bitTom Gundersen
2014-03-28sd-rtnl: message - don't reference associated rtnl objectTom Gundersen
The object is not currently used, so just drop the refenence. If/when we end up using the object in the future, we must make sure to deal with possible mutual references between rtnl busses and their queued messages; as is done in sd-bus.
2014-03-24networkd: fix a couple of memory leaksLennart Poettering
2014-03-24sd-rtnl: add sd_rtnl_message_enter_container()Tom Gundersen
Extend rta_offset_tb into a stack of offset tables, one for each parent of the current container, and make sd_rtnl_message_{enter,exit}_container() pop/push to this stack. Also make sd_rtnl_message_rewind() parse the top-level container, and use this when reading a message from the socket. This changes the API by dropping the now redundant sd_rtnl_message_read() method.
2014-03-24sd-event: rework API to support CLOCK_REALTIME_ALARM and ↵Lennart Poettering
CLOCK_BOOTTIME_ALARM, too
2014-03-22sd-rtnl: fix self-reference leaksDavid Herrmann
Like sd-bus, sd-rtnl can have self-references through queued messages. In particular, each queued message has the following self-ref loop: rtnl->wqueue[i]->rtnl == rtnl Same is true for "rqueue". When sd_rtnl_unref() gets called, we must therefore make sure we correctly consider each self-reference when deciding to destroy the object. For each queued message, there _might_ be one ref. However, rtnl-messages can be created _without_ a bus-reference, therefore we need to verify the actually required ref-count. Once we know exactly how many self-refs exist, and we verified none of the queued messages has external references, we can destruct the object. We must immediately drop our own reference, then flush all queues and destroy the bus object. Otherwise, each sd_rtnl_message_unref() call would recurse into the same destruction logic as they enter with the same rtnl-refcnt. Note: We really should verify _all_ queued messages have m->rtnl set to the bus they're queued on. If that's given, we can change: if (REFCNT_GET(rtnl->n_ref) <= refs) to if (REFCNT_GET(rtnl->n_ref) == refs) and thus avoid recalculating the required refs for each message we remove from the queue during destruction.
2014-03-18util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering
safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
2014-03-16sd-rtnl: never treat broadcasts as repliesTom Gundersen
Otherwise the sequence number of a broadcast may match the sequence number of a pending unicast message and cause confusion.
2014-02-20api: in constructor function calls, always put the returned object pointer ↵Lennart Poettering
first (or second) Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
2014-02-13rtnl: drop "sd_" prefix from cleanup macrosLennart Poettering
The "sd_" prefix is supposed to be used on exported symbols only, and not in the middle of names. Let's drop it from the cleanup macros hence, to make things simpler. The bus cleanup macros don't carry the "sd_" either, so this brings the APIs a bit nearer.
2014-01-30sd-rtnl: beef up rtnl-util a bitTom Gundersen
2014-01-21libsystemd: split up into subdirsTom Gundersen
We still only produce on .so, but let's keep the sources separate to make things a bit less messy.