]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
add ability to filter neighbour discovery by protocol
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 29 Aug 2013 19:18:52 +0000 (12:18 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 29 Aug 2013 19:18:52 +0000 (12:18 -0700)
Useful to be able to monitor arp and IPv6 nd seperately.
Default is both.

ip/ipmonitor.c

index 489539044b6a112376ba61f6789ce8426dcc57ee..70f2a7adbae1f1c00ca1774919e3b250b44fe489 100644 (file)
@@ -36,7 +36,6 @@ static void usage(void)
        exit(-1);
 }
 
-
 static int accept_msg(const struct sockaddr_nl *who,
                      struct nlmsghdr *n, void *arg)
 {
@@ -88,6 +87,13 @@ static int accept_msg(const struct sockaddr_nl *who,
        }
        if (n->nlmsg_type == RTM_NEWNEIGH || n->nlmsg_type == RTM_DELNEIGH ||
            n->nlmsg_type == RTM_GETNEIGH) {
+               if (preferred_family) {
+                       struct ndmsg *r = NLMSG_DATA(n);
+
+                       if (r->ndm_family != preferred_family)
+                               return 0;
+               }
+
                if (prefix_banner)
                        fprintf(fp, "[NEIGH]");
                print_neigh(who, n, arg);