--- 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(-)
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index 5a71900..c938471 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -1554,7 +1554,9 @@ int socket_read_message(sd_rtnl *rtnl) { /* finished reading multi-part message */ done = true; - continue; + /* if first is not defined, put NLMSG_DONE into the receive queue. */ + if (first) + continue; } /* check that we support this message type */ diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c index e21c898..bf7278f 100644 --- a/src/libsystemd/sd-rtnl/rtnl-types.c +++ b/src/libsystemd/sd-rtnl/rtnl-types.c @@ -411,6 +411,7 @@ static const NLTypeSystem rtnl_neigh_type_system = { }; static const NLType rtnl_types[RTM_MAX + 1] = { + [NLMSG_DONE] = { .type = NLA_META, .size = 0 }, [NLMSG_ERROR] = { .type = NLA_META, .size = sizeof(struct nlmsgerr) }, [RTM_NEWLINK] = { .type = NLA_NESTED, .type_system = &rtnl_link_type_system, .size = sizeof(struct ifinfomsg) }, [RTM_DELLINK] = { .type = NLA_NESTED, .type_system = &rtnl_link_type_system, .size = sizeof(struct ifinfomsg) }, diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c index 50162c3..abec6f7 100644 --- a/src/libsystemd/sd-rtnl/sd-rtnl.c +++ b/src/libsystemd/sd-rtnl/sd-rtnl.c @@ -726,6 +726,8 @@ int sd_rtnl_call(sd_rtnl *rtnl, received_serial = rtnl_message_get_serial(incoming); if (received_serial == serial) { + uint16_t type; + /* found a match, remove from rqueue and return it */ memmove(rtnl->rqueue + i,rtnl->rqueue + i + 1, sizeof(sd_rtnl_message*) * (rtnl->rqueue_size - i - 1)); @@ -737,6 +739,18 @@ int sd_rtnl_call(sd_rtnl *rtnl, return r; } + r = sd_rtnl_message_get_type(incoming, &type); + if (r < 0) { + sd_rtnl_message_unref(incoming); + return r; + } + + if (type == NLMSG_DONE) { + log_debug("Got empty message"); + sd_rtnl_message_unref(incoming); + return 1; + } + if (ret) { *ret = incoming; } else -- 1.9.3 _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel