From 783827ae61899ace7bde73863891f12cd2b35641 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 23 May 2018 09:24:12 -0400 Subject: [PATCH] zebra: Move where we check for non-kernel netlink messages Move where we check for non-kernel netlink messages to a slightly earlier spot. This will allow in subsuquent commits the removal of an extra parameter that needs to be passed around. Signed-off-by: Donald Sharp --- zebra/kernel_netlink.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index b26f6f83a9..f6be223600 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -248,12 +248,6 @@ static int netlink_information_fetch(struct sockaddr_nl *snl, struct nlmsghdr *h, ns_id_t ns_id, int startup) { - /* JF: Ignore messages that aren't from the kernel */ - if (snl->nl_pid != 0) { - zlog_err("Ignoring message from pid %u", snl->nl_pid); - return 0; - } - /* * When we handle new message types here * because we are starting to install them @@ -686,6 +680,17 @@ int netlink_parse_info(int (*filter)(struct sockaddr_nl *, struct nlmsghdr *, h->nlmsg_type, h->nlmsg_len, h->nlmsg_seq, h->nlmsg_pid); + + /* + * Ignore messages that maybe sent from + * other actors besides the kernel + */ + if (snl.nl_pid != 0) { + zlog_err("Ignoring message from pid %u", + snl.nl_pid); + continue; + } + error = (*filter)(&snl, h, zns->ns_id, startup); if (error < 0) { zlog_err("%s filter function error", nl->name); -- 2.39.5