diff options
author | Stephen Hemminger <stephen@networkplumber.org> | 2013-08-29 12:18:52 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2013-08-29 12:18:52 -0700 |
commit | 001856532f4983ae886052e88dc5c1d5a084bcd6 (patch) | |
tree | 9efd5e01f2d0d56136036d50d92aacc482375fcb | |
parent | e9e78b0db0e023035e346ba67de838be851eb665 (diff) |
add ability to filter neighbour discovery by protocol
Useful to be able to monitor arp and IPv6 nd seperately.
Default is both.
-rw-r--r-- | ip/ipmonitor.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c index 48953904..70f2a7ad 100644 --- a/ip/ipmonitor.c +++ b/ip/ipmonitor.c @@ -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); |