[systemd-devel] [PATCH] libsystemd doesn't handle properly empty messages from kernel
alin.rauta at intel.com
Wed Mar 18 05:06:18 PDT 2015
Systemd 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;
libsystemd strips out "3. NLMSG_DONE;" part and places into the receive queue a pointer to "1. FDB entry 1;".
But if the FDB table is empty, the respose from the kernel will look like below:
libsystemd strips 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.
The patch I've attached, adds "1. NLMSG_DONE;" to the receive queue only when getting empty response from kernel.
This way, a call like "sd_rtnl_call" will not block anymore.
It works fine, but it may be just an workaround. Let me know what you think.
Alin Rauta (1):
libsystemd doesn't handle properly empty messages from kernel
src/libsystemd/sd-rtnl/rtnl-message.c | 4 +++-
src/libsystemd/sd-rtnl/rtnl-types.c | 1 +
src/libsystemd/sd-rtnl/sd-rtnl.c | 14 ++++++++++++++
3 files changed, 18 insertions(+), 1 deletion(-)
More information about the systemd-devel