[systemd-devel] [PATCH] libsystemd doesn't handle properly empty messages from kernel

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Tue Mar 24 15:27:24 PDT 2015


On Wed, Mar 18, 2015 at 05:06:18AM -0700, Alin Rauta wrote:
> Hi,
> 
> 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;
> 3. NLMSG_DONE;
> 
> 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:
> 1. NLMSG_DONE;
> 
> 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.
This text should really be part of the commit.

Dunno, this looks like it would work, but I'm not sure if this is the best
way to do it. Tom?

Zbyszek

> 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(-)
> 
> -- 
> 1.9.3
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list