diff options
Diffstat (limited to 'src/libsystemd')
-rw-r--r-- | src/libsystemd/sd-rtnl/rtnl-internal.h | 1 | ||||
-rw-r--r-- | src/libsystemd/sd-rtnl/rtnl-message.c | 4 | ||||
-rw-r--r-- | src/libsystemd/sd-rtnl/sd-rtnl.c | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-internal.h b/src/libsystemd/sd-rtnl/rtnl-internal.h index a192198419..05b88b1ad8 100644 --- a/src/libsystemd/sd-rtnl/rtnl-internal.h +++ b/src/libsystemd/sd-rtnl/rtnl-internal.h @@ -109,6 +109,7 @@ struct sd_rtnl_message { size_t *rta_offset_tb[RTNL_CONTAINER_DEPTH]; unsigned short rta_tb_size[RTNL_CONTAINER_DEPTH]; bool sealed:1; + bool broadcast:1; sd_rtnl_message *next; /* next in a chain of multi-part messages */ }; 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; diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c index f483af991b..c7a36b9efb 100644 --- a/src/libsystemd/sd-rtnl/sd-rtnl.c +++ b/src/libsystemd/sd-rtnl/sd-rtnl.c @@ -262,6 +262,8 @@ static void rtnl_seal_message(sd_rtnl *rtnl, sd_rtnl_message *m) { assert(m); assert(m->hdr); + /* don't use seq == 0, as that is used for broadcasts, so we + would get confused by replies to such messages */ m->hdr->nlmsg_seq = rtnl->serial++ ? : rtnl->serial++; rtnl_message_seal(m); |