Systemd/src/libsystemd
Alin Rauta ea342a99fd sd-rtnl: handle empty multi-part message from the kernel
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-23 22:36:17 +01:00
..
sd-bus bus: explicitly ignore failure during error handling 2015-03-13 23:42:17 -04:00
sd-daemon sd-daemon: simplify sd_pid_notify_with_fds 2015-03-13 23:42:17 -04:00
sd-event sd-event: sd_event_run - only return 0 on timeout 2015-03-14 12:17:24 +01:00
sd-hwdb remove unused includes 2015-02-23 23:53:42 +01:00
sd-id128 Introduce loop_read_exact helper 2015-03-09 22:10:54 -04:00
sd-login include <poll.h> instead of <sys/poll.h> 2015-02-12 20:47:38 +01:00
sd-network networkd: add support for Uplink Failure Detection 2015-02-27 13:58:30 -05:00
sd-path tree-wide: there is no ENOTSUP on linux 2015-03-13 14:10:39 +01:00
sd-resolve Add (void) where we don't care about return value 2015-03-15 17:26:58 -04:00
sd-rtnl sd-rtnl: handle empty multi-part message from the kernel 2015-03-23 22:36:17 +01:00
sd-utf8 libsystemd: split up into subdirs 2014-01-21 14:41:35 +01:00
.gitignore build-sys: export experimental symbols only with --enable-kdbus 2014-02-19 20:53:18 +01:00
libsystemd.pc.in build-sys: update .pc.in files 2014-01-25 18:55:58 -05:00
libsystemd.sym.m4 sd-bus: allow setting a per-connection default value for the "allow-interactive-authentication" message flag 2015-02-18 11:43:18 +01:00
Makefile libsystemd-bus: rename to libsystemd 2014-01-13 18:54:19 +01:00