add ability to filter neighbour discovery by protocol
Useful to be able to monitor arp and IPv6 nd seperately. Default is both.
This commit is contained in:
parent
e9e78b0db0
commit
001856532f
|
|
@ -36,7 +36,6 @@ static void usage(void)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int accept_msg(const struct sockaddr_nl *who,
|
static int accept_msg(const struct sockaddr_nl *who,
|
||||||
struct nlmsghdr *n, void *arg)
|
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 ||
|
if (n->nlmsg_type == RTM_NEWNEIGH || n->nlmsg_type == RTM_DELNEIGH ||
|
||||||
n->nlmsg_type == RTM_GETNEIGH) {
|
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)
|
if (prefix_banner)
|
||||||
fprintf(fp, "[NEIGH]");
|
fprintf(fp, "[NEIGH]");
|
||||||
print_neigh(who, n, arg);
|
print_neigh(who, n, arg);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue