summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-rtnl/rtnl-message.c
AgeCommit message (Collapse)Author
2015-06-13sd-netlink: rename from sd-rtnlTom Gundersen
2015-06-11sd-rtnl: use netlink header rather than ucred in socket_recv_message()Tom Gundersen
Lets us simplify the function and drop SO_PASSCRED. Thanks to Alexander Larsson and David Herrmann.
2015-06-10util: introduce CMSG_FOREACH() macro and make use of it everywhereLennart Poettering
It's only marginally shorter then the usual for() loop, but certainly more readable.
2015-05-11treewide: Correct typos and spell plural of bus consistentTorstein Husebø
2015-04-10shared: add formats-util.hRonny Chevalier
2015-03-23sd-rtnl: handle empty multi-part message from the kernelAlin Rauta
We strips out NLMSG_DONE piece from a multi-part message adding into the receive queue only the messages containing actual data. If we send a request to the kernel for getting the forwarding database table (just an example), the response will be a multi-part message like below: 1. FDB entry 1; 2. FDB entry 2; 3. NLMSG_DONE; We strip out "3. NLMSG_DONE;" part and places into the receive queue a pointer to "1. FDB entry 1; 2. FDB entry 2". But if the FDB table is empty, the respose from the kernel will look like below: 1. NLMSG_DONE; We strip out "1. NLMSG_DONE;" part and since there is no actual data got, it continues waiting until reaching timeout. Therefore, a call to "sd_rtnl_call" to send and wait for a response from kernel will exit with timeout which is interpreted as error in communication. This patch puts the NLMSG_DONE message on the receive queue if it ends an empty multi-part message. This situation is detected in sd_rtnl_call() and in the callback code and NULL is returned to the caller instead. [tomegun: - added/reworded commit message - extend the same support to sd_rtnl_call_async() - drop debug logging from library, we only do this if something is really wrong, but an empty multi-part message is perfectly normal - modernize the code we touch whilst we are at it]
2015-03-13sd-rtnl: read_message - don't set group if not neededTom 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-13tree-wide: there is no ENOTSUP on linuxDavid Herrmann
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
2015-02-12Revert "tree-wide: Always use recvmsg with MSG_CMSG_CLOEXEC"Lennart Poettering
This reverts commit d6d810fbf8071f8510450dbacd1d083f37603656. It's apparently not OK to pass MSG_CMSG_CLOEXEC to recvmsg() of raw sockets.
2015-02-10tree-wide: Always use recvmsg with MSG_CMSG_CLOEXECCristian Rodríguez
2015-02-08sd-rtnl: extend type system to allow address-family to decide the union membersTom Gundersen
So far we only supported selecting them by sibling attributes. (This stuff is all a bit crazy, but there seems to be no other way...)
2015-02-08sd-rtnl: don't treat 0-length messages speciallyTom Gundersen
Still parse the CMSG data, and most importantly make sure we drop the message when peeking.
2015-02-06sd-rtnl: don't fall over when receiving 0 bytes from the socketTom Gundersen
causes EOF. Seems like a kernel bug. Ignoring it seems to work be the best we can do for now... See https://bugs.freedesktop.org/show_bug.cgi?id=88397
2015-02-06sd-rtnl: fix creation of synthetic error repliesTom Gundersen
2015-01-22Assorted format fixesZbigniew Jędrzejewski-Szmek
Types used for pids and uids in various interfaces are unpredictable. Too bad.
2015-01-22Fix some format strings for enums, they are signedZbigniew Jędrzejewski-Szmek
2015-01-13refcnt: refcnt is unsigned, fix comparisonsTom Gundersen
This does not make a difference, but the code was confusing.
2014-12-30tree-wide: spelling fixesVeres Lajos
https://github.com/vlajos/misspell_fixer https://github.com/torstehu/systemd/commit/b6fdeb618cf2f3ce1645b3315f15f482710c7ffa Thanks to Torstein Husebo <torstein@huseboe.net>.
2014-12-29rtnl: recv_message - don't enforce sender uidTom Gundersen
All we care about is that the kernel (pid==0) sent the message. Verifying the sender uid seems to break when using userns. Reported by Stéphane Graber.
2014-12-29sd-rtnl: recv_message - drop message when peeking failsTom Gundersen
Read the message form the socket or we will loop trying to read the same message repeatedly.
2014-12-29sd-rtnl: recv_message - don't fail on interruptTom Gundersen
We should just try again instead.
2014-12-29sd-rtnl: recv_message - log when dropping messageTom Gundersen
We drop messages received from the wrong uid/pid, log this at debug level.
2014-12-18networkd: add FDB supportAlin Rauta
2014-12-09sd-rtnl: fix size check in sd_rtnl_message_append_string()Lennart Poettering
2014-12-08networkd: manager - enumerate addresses globally, rather than per-linkTom Gundersen
The kernel always returns all addresses, rather than only for the given link, so let's only enumerate once.
2014-12-08sd-rtnl: fix bogus warning about dropping 20 bytes from multi-part messagesTom Gundersen
Nothing was being dropped, we just failed to account for the NLMSG_DONE.
2014-12-04sd-rtnl: rename sd_rtnl_message_route_get_{dst,src}_len to *_prefixlenTom Gundersen
This makes the API more consistent.
2014-12-04networkd: add support for source routingTom Gundersen
2014-12-03rtnl: make checks for default routes more strictLennart Poettering
Also check that the source netmask is 0, not only the destination netmask.
2014-12-03nss-myhostname: always resolve the host name "gateway" to the local default ↵Lennart Poettering
gateway This is useful inside of containers or local networks to intrdouce a stable name of the default gateway host (in case of containers usually the host, in case of LANs usually local router).
2014-12-02sd-rtnl: route - allow GETROUTE with AF_UNSPECTom Gundersen
2014-12-02sd-rtnl: add sd_rtnl_message_{new_neigh,neigh_get_{family,ifindex}}Tom Gundersen
2014-12-02sd-rtnl: add a bit more debugging in case a message is droppedTom Gundersen
2014-12-02sd-rtnl: message - allow checking for attributes without reading out their ↵Tom Gundersen
contents
2014-12-02sd-rtnl: add sd_rtnl_message_route_get_familyTom Gundersen
2014-10-29sd-rtnl: add support to set packet family typeSusant Sahani
This patch adds functionality to set family type in the rtnl message for example PF_BRIDGE.
2014-10-29sd-rtnl: mark nested attributes with the NLA_F_NESTED flagTom Gundersen
The kernel mostly does not check this, but let's be consisntent and allways set it anyway. Based on patch from Susant Sahani.
2014-10-29sd-rtnl: fix reading of nla typeTom Gundersen
We must filter out the 'network-byteorder' and 'nested' flags.
2014-09-18sd-rtnl: rtnl-message: remove unneeded linux includesEmil Renner Berthing
2014-09-01sd-rtnl: don't assign to unused variableTom Gundersen
Reported by Thomas H.P. Andersen <phomes@gmail.com>.
2014-08-28sd-rtnl: log if kernel buffer is overrun as we currently can't handle that caseTom Gundersen
2014-08-12networkd: add minimal client tool "networkd" to query network statusLennart Poettering
In the long run this should become a full fledged client to networkd (but not before networkd learns bus support). For now, just pull interesting data out of networkd, udev, and rtnl and present it to the user, in a simple but useful output.
2014-07-23networkd: set route protocolDan Williams
All routes added by networkd are currently set RTPROT_BOOT, which according to the kernel means "Route installed during boot" (rtnetlink.h). But this is not always the case as networkd changes routing after boot too. Since the kernel gives more detailed protocols, use them. With this patch, user-configured static routes now use RTPROT_STATIC (which they are) and DHCP routes use RTPROT_DHCP. There is no define for IPv4LL yet, so those are installed as RTPROT_STATIC (though perhaps RTPROT_RA is better?). [tomegun: fixup src/network/networkd-link.c:972:33: error: too few arguments to function 'route_new_dynamic']
2014-07-18change type for address family to "int"Lennart Poettering
Let's settle on a single type for all address family values, even if UNIX is very inconsitent on the precise type otherwise. Given that socket() is the primary entrypoint for the sockets API, and that uses "int", and "int" is relatively simple and generic, we settle on "int" for this.
2014-07-18sd-rtnl: make string returned by sd_rtnl_message_read_string() constLennart Poettering
2014-05-10rtnl: message - fix check for broadcast messagesTom Gundersen
2014-05-10rtnl: message - read group membership of incoming messagesTom Gundersen
2014-05-10rtnl: message - verify that we read the pending message size from the kernelTom Gundersen
Reuse the auth-checking for both the peek and the real read.