diff options
author | Tom Gundersen <teg@jklm.no> | 2015-03-13 16:12:57 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-03-13 16:12:57 +0100 |
commit | 3f42446d286a12292f1693d5cf9cb3ec3844e1a4 (patch) | |
tree | c0eda6f1a12d051bbd6c079518c838aba09326b6 /src/libsystemd/sd-rtnl/rtnl-message.c | |
parent | 913b0eef1a01e0c78f0453b0174e75d5caae1023 (diff) |
sd-rtnl: improve detection of broadcast messages
Do not rely on nl_pid == 0, but check the groups instead. We currently avoid using
nl_pid == 0 for unicast anyway, so this should be redundant, but let's try to be
correct.
Diffstat (limited to 'src/libsystemd/sd-rtnl/rtnl-message.c')
-rw-r--r-- | src/libsystemd/sd-rtnl/rtnl-message.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index 8bb7bcdd05..d24769b4b9 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -654,7 +654,7 @@ int sd_rtnl_message_get_family(sd_rtnl_message *m, int *family) { int sd_rtnl_message_is_broadcast(sd_rtnl_message *m) { assert_return(m, -EINVAL); - return !m->hdr->nlmsg_pid; + return m->broadcast; } int sd_rtnl_message_link_get_ifindex(sd_rtnl_message *m, int *ifindex) { @@ -1577,6 +1577,8 @@ int socket_read_message(sd_rtnl *rtnl) { if (r < 0) return r; + m->broadcast = !!group; + m->hdr = memdup(new_msg, new_msg->nlmsg_len); if (!m->hdr) return -ENOMEM; |