[systemd-commits] src/libsystemd src/systemd
Tom Gundersen
tomegun at kemper.freedesktop.org
Sun Mar 16 05:06:37 PDT 2014
src/libsystemd/sd-rtnl/rtnl-message.c | 6 ++++++
src/libsystemd/sd-rtnl/sd-rtnl.c | 3 +++
src/systemd/sd-rtnl.h | 1 +
3 files changed, 10 insertions(+)
New commits:
commit 1f0db3ed88015a0510b8bf4723af2121ee55d9a8
Author: Tom Gundersen <teg at jklm.no>
Date: Sun Mar 16 13:02:16 2014 +0100
sd-rtnl: never treat broadcasts as replies
Otherwise the sequence number of a broadcast may match the sequence number of a
pending unicast message and cause confusion.
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c
index 7ea68f1..e243c7b 100644
--- a/src/libsystemd/sd-rtnl/rtnl-message.c
+++ b/src/libsystemd/sd-rtnl/rtnl-message.c
@@ -295,6 +295,12 @@ int sd_rtnl_message_get_type(sd_rtnl_message *m, uint16_t *type) {
return 0;
}
+int sd_rtnl_message_is_broadcast(sd_rtnl_message *m) {
+ assert_return(m, -EINVAL);
+
+ return !m->hdr->nlmsg_pid;
+}
+
int sd_rtnl_message_link_get_ifindex(sd_rtnl_message *m, int *ifindex) {
struct ifinfomsg *ifi;
diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c
index 1b9f583..1c2c890 100644
--- a/src/libsystemd/sd-rtnl/sd-rtnl.c
+++ b/src/libsystemd/sd-rtnl/sd-rtnl.c
@@ -277,6 +277,9 @@ static int process_reply(sd_rtnl *rtnl, sd_rtnl_message *m) {
assert(rtnl);
assert(m);
+ if (sd_rtnl_message_is_broadcast(m))
+ return 0;
+
serial = rtnl_message_get_serial(m);
c = hashmap_remove(rtnl->reply_callbacks, &serial);
if (!c)
diff --git a/src/systemd/sd-rtnl.h b/src/systemd/sd-rtnl.h
index a171978..0a24873 100644
--- a/src/systemd/sd-rtnl.h
+++ b/src/systemd/sd-rtnl.h
@@ -78,6 +78,7 @@ sd_rtnl_message *sd_rtnl_message_unref(sd_rtnl_message *m);
int sd_rtnl_message_get_errno(sd_rtnl_message *m);
int sd_rtnl_message_get_type(sd_rtnl_message *m, uint16_t *type);
+int sd_rtnl_message_is_broadcast(sd_rtnl_message *m);
int sd_rtnl_message_addr_set_prefixlen(sd_rtnl_message *m, unsigned char prefixlen);
int sd_rtnl_message_addr_set_scope(sd_rtnl_message *m, unsigned char scope);
More information about the systemd-commits
mailing list