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

Tom Gundersen teg at jklm.no
Mon Mar 23 14:44:47 PDT 2015


Hi Alin,

Thanks for the fix!

I made some changes to it, but kept the commit message and authorship
as the idea is unchanged.

Please take a look that this still solves your problem.

Cheers,

Tom

On Wed, Mar 18, 2015 at 1:06 PM, Alin Rauta <alin.rauta at intel.com> 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.
>
> 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