[systemd-commits] 5 commits - src/libsystemd-rtnl src/network src/systemd TODO
Tom Gundersen
tomegun at kemper.freedesktop.org
Wed Dec 4 05:11:41 PST 2013
TODO | 7 ++
src/libsystemd-rtnl/rtnl-internal.h | 11 +++
src/libsystemd-rtnl/rtnl-message.c | 21 +++++-
src/libsystemd-rtnl/sd-rtnl.c | 80 +++++++++++++++++++++++
src/libsystemd-rtnl/test-rtnl.c | 17 ++++
src/network/networkd-bridge.c | 8 +-
src/network/networkd-link.c | 123 +++++++++++++++++++++++++-----------
src/network/networkd-manager.c | 31 ++++++++-
src/network/networkd.h | 3
src/systemd/sd-rtnl.h | 4 +
10 files changed, 260 insertions(+), 45 deletions(-)
New commits:
commit 0a4b9a07872dfbcce523baa795c71eefd1bed7fa
Author: Tom Gundersen <teg at jklm.no>
Date: Wed Dec 4 13:14:23 2013 +0100
TODO: add networkd entries
diff --git a/TODO b/TODO
index eb3805e..9698082 100644
--- a/TODO
+++ b/TODO
@@ -671,6 +671,13 @@ Features:
- improve container support, and add support for entering containers when reading
- add support for more attribute types
+* networkd:
+ - unify and clarify logging, also use proper structured log messages
+ - add [Route] sections
+ - add more keys to [Address] sections
+ - add DHCPv4 support (and, longer term, other kinds of dynamic config)
+ - add proper initrd support (in particular generate .network/.link files based on /proc/cmdline)
+
External:
* dbus:
commit dd3efc0993b6e95ff04775e9125e2fc9d30fe261
Author: Tom Gundersen <teg at jklm.no>
Date: Tue Dec 3 18:48:20 2013 +0100
networkd: add link-sense and simplify state-machine a bit
This listens to rtnetlink for changes to IFF_UP and IFF_LOWER_UP (link sense). The latter
is simply logged at the moment, but will be useful once we add dhcp support.
diff --git a/src/network/networkd-bridge.c b/src/network/networkd-bridge.c
index e9dceab..1704f65 100644
--- a/src/network/networkd-bridge.c
+++ b/src/network/networkd-bridge.c
@@ -132,15 +132,17 @@ static int bridge_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userda
r = sd_rtnl_message_get_errno(m);
if (r < 0) {
log_warning("Bridge '%s' failed: %s", bridge->name, strerror(-r));
- return bridge_enter_failed(bridge);
+ bridge_enter_failed(bridge);
+
+ return 1;
}
if (bridge->link)
- return bridge_enter_ready(bridge);
+ bridge_enter_ready(bridge);
bridge->state = BRIDGE_STATE_CREATED;
- return 0;
+ return 1;
}
static int bridge_create(Bridge *bridge) {
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 09de862..8c7b0fc 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -128,28 +128,11 @@ static int link_enter_configured(Link *link) {
}
static int link_enter_failed(Link *link) {
- log_warning("Could not configure link '%s'", link->ifname);
-
link->state = LINK_STATE_FAILED;
return 0;
}
-static bool link_is_up(Link *link) {
- return link->flags & IFF_UP;
-}
-
-static int link_enter_routes_set(Link *link) {
- log_info("Routes set for link '%s'", link->ifname);
-
- if (link_is_up(link))
- return link_enter_configured(link);
-
- link->state = LINK_STATE_ROUTES_SET;
-
- return 0;
-}
-
static int route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
Link *link = userdata;
int r;
@@ -167,8 +150,10 @@ static int route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
log_warning("Could not set route on interface '%s': %s",
link->ifname, strerror(-r));
- if (link->rtnl_messages == 0)
- return link_enter_routes_set(link);
+ if (link->rtnl_messages == 0) {
+ log_info("Routes set for link '%s'", link->ifname);
+ link_enter_configured(link);
+ }
return 1;
}
@@ -185,12 +170,14 @@ static int link_enter_set_routes(Link *link) {
link->state = LINK_STATE_SET_ROUTES;
if (!link->network->routes)
- return link_enter_routes_set(link);
+ return link_enter_configured(link);
LIST_FOREACH(routes, route, link->network->routes) {
r = route_configure(route, link, &route_handler);
- if (r < 0)
+ if (r < 0) {
+ log_warning("Could not set routes for link '%s'", link->ifname);
return link_enter_failed(link);
+ }
link->rtnl_messages ++;
}
@@ -199,8 +186,6 @@ static int link_enter_set_routes(Link *link) {
}
static int link_enter_addresses_set(Link *link) {
- log_info("Addresses set for link '%s'", link->ifname);
-
link->state = LINK_STATE_ADDRESSES_SET;
return link_enter_set_routes(link);
@@ -223,8 +208,10 @@ static int address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
log_warning("Could not set address on interface '%s': %s",
link->ifname, strerror(-r));
- if (link->rtnl_messages == 0)
+ if (link->rtnl_messages == 0) {
+ log_info("Addresses set for link '%s'", link->ifname);
link_enter_addresses_set(link);
+ }
return 1;
}
@@ -244,8 +231,10 @@ static int link_enter_set_addresses(Link *link) {
LIST_FOREACH(addresses, address, link->network->addresses) {
r = address_configure(address, link, &address_handler);
- if (r < 0)
+ if (r < 0) {
+ log_warning("Could not set addresses for link '%s'", link->ifname);
return link_enter_failed(link);
+ }
link->rtnl_messages ++;
}
@@ -253,21 +242,53 @@ static int link_enter_set_addresses(Link *link) {
return 0;
}
-static int link_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int link_get_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
Link *link = userdata;
int r;
r = sd_rtnl_message_get_errno(m);
- if (r < 0)
+ if (r < 0) {
log_warning("Could not bring up interface '%s': %s",
link->ifname, strerror(-r));
+ link_enter_failed(link);
+ }
- link->flags |= IFF_UP;
+ return 1;
+}
- log_info("Link '%s' is up", link->ifname);
+static int link_get(Link *link) {
+ _cleanup_sd_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ int r;
- if (link->state == LINK_STATE_ROUTES_SET)
- return link_enter_configured(link);
+ assert(link);
+ assert(link->manager);
+ assert(link->manager->rtnl);
+
+ r = sd_rtnl_message_link_new(RTM_GETLINK, link->ifindex, 0, 0, &req);
+ if (r < 0) {
+ log_error("Could not allocate RTM_GETLINK message");
+ return r;
+ }
+
+ r = sd_rtnl_call_async(link->manager->rtnl, req, link_get_handler, link, 0, NULL);
+ if (r < 0) {
+ log_error("Could not send rtnetlink message: %s", strerror(-r));
+ return r;
+ }
+
+ return 0;
+}
+
+static int link_up_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+ Link *link = userdata;
+ int r;
+
+ r = sd_rtnl_message_get_errno(m);
+ if (r < 0) {
+ log_warning("Could not bring up interface '%s': %s",
+ link->ifname, strerror(-r));
+ link_enter_failed(link);
+ }
return 1;
}
@@ -286,7 +307,7 @@ static int link_up(Link *link) {
return r;
}
- r = sd_rtnl_call_async(link->manager->rtnl, req, link_handler, link, 0, NULL);
+ r = sd_rtnl_call_async(link->manager->rtnl, req, link_up_handler, link, 0, NULL);
if (r < 0) {
log_error("Could not send rtnetlink message: %s", strerror(-r));
return r;
@@ -298,12 +319,12 @@ static int link_up(Link *link) {
static int link_enter_bridge_joined(Link *link) {
int r;
+ link->state = LINK_STATE_BRIDGE_JOINED;
+
r = link_up(link);
if (r < 0)
return link_enter_failed(link);
- link->state = LINK_STATE_BRIDGE_JOINED;
-
return link_enter_set_addresses(link);
}
@@ -318,8 +339,11 @@ static int bridge_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
r = sd_rtnl_message_get_errno(m);
if (r < 0)
- log_warning("Could not join interface '%s' to bridge: %s",
- link->ifname, strerror(-r));
+ log_warning("Could not join interface '%s' to bridge '%s': %s",
+ link->ifname, link->network->bridge->name, strerror(-r));
+ else
+ log_info("Join interface '%s' to bridge: %s",
+ link->ifname, link->network->bridge->name);
link_enter_bridge_joined(link);
@@ -338,8 +362,11 @@ static int link_enter_join_bridge(Link *link) {
link->state = LINK_STATE_JOIN_BRIDGE;
r = bridge_join(link->network->bridge, link, &bridge_handler);
- if (r < 0)
+ if (r < 0) {
+ log_warning("Could not join link '%s' to bridge '%s'", link->ifname,
+ link->network->bridge->name);
return link_enter_failed(link);
+ }
return 0;
}
@@ -347,9 +374,31 @@ static int link_enter_join_bridge(Link *link) {
int link_configure(Link *link) {
int r;
+ r = link_get(link);
+ if (r < 0)
+ return link_enter_failed(link);
+
r = link_enter_join_bridge(link);
if (r < 0)
return link_enter_failed(link);
return 0;
}
+
+int link_update_flags(Link *link, unsigned flags) {
+ assert(link);
+
+ if (link->flags & IFF_UP && !(flags & IFF_UP))
+ log_info("Interface '%s' is down", link->ifname);
+ else if (!(link->flags & IFF_UP) && flags & IFF_UP)
+ log_info("Interface '%s' is up", link->ifname);
+
+ if (link->flags & IFF_LOWER_UP && !(flags & IFF_LOWER_UP))
+ log_info("Interface '%s' is disconnected", link->ifname);
+ else if (!(link->flags & IFF_LOWER_UP) && flags & IFF_LOWER_UP)
+ log_info("Interface '%s' is connected", link->ifname);
+
+ link->flags = flags;
+
+ return 0;
+}
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 1dc7e88..c8ec239 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -35,7 +35,7 @@ int manager_new(Manager **ret) {
if (r < 0)
return r;
- r = sd_rtnl_open(0, &m->rtnl);
+ r = sd_rtnl_open(RTMGRP_LINK | RTMGRP_IPV4_IFADDR, &m->rtnl);
if (r < 0)
return r;
@@ -243,6 +243,31 @@ int manager_udev_listen(Manager *m) {
return 0;
}
+static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, void *userdata) {
+ Manager *m = userdata;
+ Link *link;
+ unsigned flags;
+ int r, ifindex;
+
+ r = sd_rtnl_message_link_get_ifindex(message, &ifindex);
+ if (r < 0)
+ return 0;
+
+ link = hashmap_get(m->links, &ifindex);
+ if (!link)
+ return 0;
+
+ r = sd_rtnl_message_link_get_flags(message, &flags);
+ if (r < 0)
+ return 0;
+
+ r = link_update_flags(link, flags);
+ if (r < 0)
+ return 0;
+
+ return 1;
+}
+
int manager_rtnl_listen(Manager *m) {
int r;
@@ -250,5 +275,9 @@ int manager_rtnl_listen(Manager *m) {
if (r < 0)
return r;
+ r = sd_rtnl_add_match(m->rtnl, RTM_NEWLINK, &manager_rtnl_process_link, m);
+ if (r < 0)
+ return r;
+
return 0;
}
diff --git a/src/network/networkd.h b/src/network/networkd.h
index 1ab8a55..075cc12 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -138,7 +138,6 @@ typedef enum LinkState {
LINK_STATE_SET_ADDRESSES,
LINK_STATE_ADDRESSES_SET,
LINK_STATE_SET_ROUTES,
- LINK_STATE_ROUTES_SET,
LINK_STATE_CONFIGURED,
LINK_STATE_FAILED,
_LINK_STATE_MAX,
@@ -264,5 +263,7 @@ void link_free(Link *link);
int link_add(Manager *manager, struct udev_device *device);
int link_configure(Link *link);
+int link_update_flags(Link *link, unsigned flags);
+
DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);
#define _cleanup_link_free_ _cleanup_(link_freep)
commit 50b3c42f971f4c9c7791c3b2831f6146ebd15e06
Author: Tom Gundersen <teg at jklm.no>
Date: Wed Dec 4 00:34:58 2013 +0100
rtnl: add link_get_flags
diff --git a/src/libsystemd-rtnl/rtnl-message.c b/src/libsystemd-rtnl/rtnl-message.c
index 06c7622..8d62df9 100644
--- a/src/libsystemd-rtnl/rtnl-message.c
+++ b/src/libsystemd-rtnl/rtnl-message.c
@@ -127,7 +127,7 @@ int sd_rtnl_message_route_new(uint16_t nlmsg_type, unsigned char rtm_family,
return 0;
}
-int sd_rtnl_message_link_new(uint16_t nlmsg_type, int index, unsigned int type, unsigned int flags, sd_rtnl_message **ret) {
+int sd_rtnl_message_link_new(uint16_t nlmsg_type, int index, unsigned type, unsigned flags, sd_rtnl_message **ret) {
struct ifinfomsg *ifi;
int r;
@@ -222,6 +222,21 @@ int sd_rtnl_message_link_get_ifindex(sd_rtnl_message *m, int *ifindex) {
return 0;
}
+int sd_rtnl_message_link_get_flags(sd_rtnl_message *m, unsigned *flags) {
+ struct ifinfomsg *ifi;
+
+ assert_return(m, -EINVAL);
+ assert_return(flags, -EINVAL);
+ assert_return(m->hdr->nlmsg_type == RTM_NEWLINK || m->hdr->nlmsg_type == RTM_DELLINK ||
+ m->hdr->nlmsg_type == RTM_GETLINK || m->hdr->nlmsg_type == RTM_SETLINK, -EINVAL);
+
+ ifi = NLMSG_DATA(m->hdr);
+
+ *flags = ifi->ifi_flags;
+
+ return 0;
+}
+
/* If successful the updated message will be correctly aligned, if unsuccessful the old message is
untouched */
static int add_rtattr(sd_rtnl_message *m, unsigned short type, const void *data, size_t data_length) {
diff --git a/src/systemd/sd-rtnl.h b/src/systemd/sd-rtnl.h
index 6cd179a..0a63b28 100644
--- a/src/systemd/sd-rtnl.h
+++ b/src/systemd/sd-rtnl.h
@@ -81,6 +81,7 @@ 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_link_get_ifindex(sd_rtnl_message *m, int *ifindex);
+int sd_rtnl_message_link_get_flags(sd_rtnl_message *m, unsigned *flags);
int sd_rtnl_message_append(sd_rtnl_message *m, unsigned short type, const void *data);
int sd_rtnl_message_open_container(sd_rtnl_message *m, unsigned short type);
commit 8cec01b9e9b7264639fd1fc0fe373ef4d5baaf49
Author: Tom Gundersen <teg at jklm.no>
Date: Sat Nov 30 01:24:29 2013 +0100
rtnl: add callback support
sd_rtnl_add_match allows you to add a callback function for when given types of
messages are received.
diff --git a/src/libsystemd-rtnl/rtnl-internal.h b/src/libsystemd-rtnl/rtnl-internal.h
index a229ae7..dabf12d 100644
--- a/src/libsystemd-rtnl/rtnl-internal.h
+++ b/src/libsystemd-rtnl/rtnl-internal.h
@@ -25,6 +25,7 @@
#include "refcnt.h"
#include "prioq.h"
+#include "list.h"
#include "sd-rtnl.h"
@@ -36,6 +37,14 @@ struct reply_callback {
unsigned prioq_idx;
};
+struct match_callback {
+ sd_rtnl_message_handler_t callback;
+ uint16_t types;
+ void *userdata;
+
+ LIST_FIELDS(struct match_callback, match_callbacks);
+};
+
struct sd_rtnl {
RefCount n_ref;
@@ -59,6 +68,8 @@ struct sd_rtnl {
struct Prioq *reply_callbacks_prioq;
Hashmap *reply_callbacks;
+ LIST_HEAD(struct match_callback, match_callbacks);
+
pid_t original_pid;
sd_event_source *io_event_source;
diff --git a/src/libsystemd-rtnl/sd-rtnl.c b/src/libsystemd-rtnl/sd-rtnl.c
index 8631ff0..57d0b76 100644
--- a/src/libsystemd-rtnl/sd-rtnl.c
+++ b/src/libsystemd-rtnl/sd-rtnl.c
@@ -47,6 +47,8 @@ static int sd_rtnl_new(sd_rtnl **ret) {
rtnl->original_pid = getpid();
+ LIST_HEAD_INIT(rtnl->match_callbacks);
+
/* We guarantee that wqueue always has space for at least
* one entry */
rtnl->wqueue = new(sd_rtnl_message*, 1);
@@ -109,6 +111,7 @@ sd_rtnl *sd_rtnl_ref(sd_rtnl *rtnl) {
sd_rtnl *sd_rtnl_unref(sd_rtnl *rtnl) {
if (rtnl && REFCNT_DEC(rtnl->n_ref) <= 0) {
+ struct match_callback *f;
unsigned i;
for (i = 0; i < rtnl->rqueue_size; i++)
@@ -122,6 +125,11 @@ sd_rtnl *sd_rtnl_unref(sd_rtnl *rtnl) {
hashmap_free_free(rtnl->reply_callbacks);
prioq_free(rtnl->reply_callbacks_prioq);
+ while ((f = rtnl->match_callbacks)) {
+ LIST_REMOVE(match_callbacks, rtnl->match_callbacks, f);
+ free(f);
+ }
+
if (rtnl->fd >= 0)
close_nointr_nofail(rtnl->fd);
@@ -281,6 +289,29 @@ static int process_reply(sd_rtnl *rtnl, sd_rtnl_message *m) {
return r;
}
+static int process_match(sd_rtnl *rtnl, sd_rtnl_message *m) {
+ struct match_callback *c;
+ uint16_t type;
+ int r;
+
+ assert(rtnl);
+ assert(m);
+
+ r = sd_rtnl_message_get_type(m, &type);
+ if (r < 0)
+ return r;
+
+ LIST_FOREACH(match_callbacks, c, rtnl->match_callbacks) {
+ if (type & c->types) {
+ r = c->callback(rtnl, m, c->userdata);
+ if (r != 0)
+ return r;
+ }
+ }
+
+ return 0;
+}
+
static int process_running(sd_rtnl *rtnl, sd_rtnl_message **ret) {
_cleanup_sd_rtnl_message_unref_ sd_rtnl_message *m = NULL;
int r;
@@ -303,6 +334,10 @@ static int process_running(sd_rtnl *rtnl, sd_rtnl_message **ret) {
if (r != 0)
goto null_message;
+ r = process_match(rtnl, m);
+ if (r != 0)
+ goto null_message;
+
if (ret) {
*ret = m;
m = NULL;
@@ -784,3 +819,48 @@ int sd_rtnl_detach_event(sd_rtnl *rtnl) {
return 0;
}
+
+int sd_rtnl_add_match(sd_rtnl *rtnl,
+ uint16_t types,
+ sd_rtnl_message_handler_t callback,
+ void *userdata) {
+ struct match_callback *c;
+
+ assert_return(rtnl, -EINVAL);
+ assert_return(callback, -EINVAL);
+ assert_return(types, -EINVAL);
+ assert_return(!rtnl_pid_changed(rtnl), -ECHILD);
+
+ c = new0(struct match_callback, 1);
+ if (!c)
+ return -ENOMEM;
+
+ c->callback = callback;
+ c->types = types;
+ c->userdata = userdata;
+
+ LIST_PREPEND(match_callbacks, rtnl->match_callbacks, c);
+
+ return 0;
+}
+
+int sd_rtnl_remove_match(sd_rtnl *rtnl,
+ uint16_t types,
+ sd_rtnl_message_handler_t callback,
+ void *userdata) {
+ struct match_callback *c;
+
+ assert_return(rtnl, -EINVAL);
+ assert_return(callback, -EINVAL);
+ assert_return(!rtnl_pid_changed(rtnl), -ECHILD);
+
+ LIST_FOREACH(match_callbacks, c, rtnl->match_callbacks)
+ if (c->callback == callback && c->types == types && c->userdata == userdata) {
+ LIST_REMOVE(match_callbacks, rtnl->match_callbacks, c);
+ free(c);
+
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/src/libsystemd-rtnl/test-rtnl.c b/src/libsystemd-rtnl/test-rtnl.c
index 4b62c02..a512a7b 100644
--- a/src/libsystemd-rtnl/test-rtnl.c
+++ b/src/libsystemd-rtnl/test-rtnl.c
@@ -230,6 +230,21 @@ static void test_container(void) {
*/
}
+static void test_match(void) {
+ _cleanup_sd_rtnl_unref_ sd_rtnl *rtnl = NULL;
+
+ assert(sd_rtnl_open(0, &rtnl) >= 0);
+
+ assert(sd_rtnl_add_match(rtnl, 0, &link_handler, NULL) == -EINVAL);
+
+ assert(sd_rtnl_add_match(rtnl, RTMGRP_LINK, &link_handler, NULL) >= 0);
+ assert(sd_rtnl_add_match(rtnl, RTMGRP_LINK, &link_handler, NULL) >= 0);
+
+ assert(sd_rtnl_remove_match(rtnl, RTMGRP_LINK, &link_handler, NULL) == 1);
+ assert(sd_rtnl_remove_match(rtnl, RTMGRP_LINK, &link_handler, NULL) == 1);
+ assert(sd_rtnl_remove_match(rtnl, RTMGRP_LINK, &link_handler, NULL) == 0);
+}
+
int main(void) {
sd_rtnl *rtnl;
sd_rtnl_message *m;
@@ -240,6 +255,8 @@ int main(void) {
unsigned int mtu = 0;
unsigned int *mtu_reply;
+ test_match();
+
test_multiple();
test_route();
diff --git a/src/systemd/sd-rtnl.h b/src/systemd/sd-rtnl.h
index 6db5d8a..6cd179a 100644
--- a/src/systemd/sd-rtnl.h
+++ b/src/systemd/sd-rtnl.h
@@ -57,6 +57,9 @@ int sd_rtnl_process(sd_rtnl *nl, sd_rtnl_message **ret);
int sd_rtnl_wait(sd_rtnl *nl, uint64_t timeout);
int sd_rtnl_flush(sd_rtnl *nl);
+int sd_rtnl_add_match(sd_rtnl *nl, uint16_t match, sd_rtnl_message_handler_t c, void *userdata);
+int sd_rtnl_remove_match(sd_rtnl *nl, uint16_t match, sd_rtnl_message_handler_t c, void *userdata);
+
int sd_rtnl_attach_event(sd_rtnl *nl, sd_event *e, int priority);
int sd_rtnl_detach_event(sd_rtnl *nl);
commit a02113d2ea96467dc9f1ec196d5f62a34dd99314
Author: Tom Gundersen <teg at jklm.no>
Date: Tue Dec 3 23:55:45 2013 +0100
rtnl: don't ignore broadcast messages
diff --git a/src/libsystemd-rtnl/rtnl-message.c b/src/libsystemd-rtnl/rtnl-message.c
index b2b7feb..06c7622 100644
--- a/src/libsystemd-rtnl/rtnl-message.c
+++ b/src/libsystemd-rtnl/rtnl-message.c
@@ -615,8 +615,8 @@ int socket_read_message(sd_rtnl *nl, sd_rtnl_message **ret) {
else if ((size_t) k < sizeof(struct nlmsghdr) ||
(size_t) k < m->hdr->nlmsg_len)
k = -EIO; /* too small (we do accept too big though) */
- else if (m->hdr->nlmsg_pid != nl->sockaddr.nl.nl_pid)
- k = 0; /* not for us */
+ else if (m->hdr->nlmsg_pid && m->hdr->nlmsg_pid != nl->sockaddr.nl.nl_pid)
+ k = 0; /* not broadcast and not for us */
if (k > 0)
switch (m->hdr->nlmsg_type) {
More information about the systemd-commits
mailing list