]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Move where we check for non-kernel netlink messages
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 23 May 2018 13:24:12 +0000 (09:24 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 24 May 2018 13:14:43 +0000 (09:14 -0400)
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 <sharpd@cumulusnetworks.com>
zebra/kernel_netlink.c

index b26f6f83a928efb9c0d75a5d9e5cd3186a8311c6..f6be2236001b79e323d0455938bcae23a6cd98e7 100644 (file)
@@ -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);