diff options
author | vadimk <vadim4j@gmail.com> | 2014-12-05 02:18:59 +0200 |
---|---|---|
committer | Stephen Hemminger <shemming@brocade.com> | 2014-12-09 20:17:29 -0800 |
commit | 6fcabac5e0f80cb7dac5ff805809fb1efcb12a10 (patch) | |
tree | c3f53769268878ea9d496b5bc44fcf28ec399ea6 /ip/ipmonitor.c | |
parent | 2ec28933b6cdeaf98ad8d3d6e9471b50bac91223 (diff) | |
download | platform_external_iproute2-6fcabac5e0f80cb7dac5ff805809fb1efcb12a10.tar.gz platform_external_iproute2-6fcabac5e0f80cb7dac5ff805809fb1efcb12a10.tar.bz2 platform_external_iproute2-6fcabac5e0f80cb7dac5ff805809fb1efcb12a10.zip |
ip monitor: Fix issue when timestamp is printed w/o msg
The issue was observed when IPv6 router broadcasted NDUSEROPT
messages which are not handled by monitor and caused printing
'Timestamps' w/o message because such kind of rtnl messages is not
handled by monitor.
As 'ip monitor' by default subscribes to the all mcast rtnl groups except
RTGRP_TC then all messages of these rtnl groups which are not handled by
monitor may cause such issues.
Fixed by subscribing by default to rtnl mcast groups which are
supported by 'ip monitor'.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Diffstat (limited to 'ip/ipmonitor.c')
-rw-r--r-- | ip/ipmonitor.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c index 4cc75f4c..4708e54d 100644 --- a/ip/ipmonitor.c +++ b/ip/ipmonitor.c @@ -134,14 +134,6 @@ static int accept_msg(const struct sockaddr_nl *who, fprintf(fp, "Timestamp: %s %lu us\n", tstr, usecs); return 0; } - if (n->nlmsg_type == RTM_NEWQDISC || - n->nlmsg_type == RTM_DELQDISC || - n->nlmsg_type == RTM_NEWTCLASS || - n->nlmsg_type == RTM_DELTCLASS || - n->nlmsg_type == RTM_NEWTFILTER || - n->nlmsg_type == RTM_DELTFILTER || - n->nlmsg_type == RTM_NEWNDUSEROPT) - return 0; if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP && n->nlmsg_type != NLMSG_DONE) { fprintf(fp, "Unknown message: type=0x%08x(%d) flags=0x%08x(%d)" @@ -155,7 +147,7 @@ static int accept_msg(const struct sockaddr_nl *who, int do_ipmonitor(int argc, char **argv) { char *file = NULL; - unsigned groups = ~RTMGRP_TC; + unsigned groups = 0; int llink=0; int laddr=0; int lroute=0; @@ -165,6 +157,18 @@ int do_ipmonitor(int argc, char **argv) int lnetconf=0; int ifindex=0; + groups |= nl_mgrp(RTNLGRP_LINK); + groups |= nl_mgrp(RTNLGRP_IPV4_IFADDR); + groups |= nl_mgrp(RTNLGRP_IPV6_IFADDR); + groups |= nl_mgrp(RTNLGRP_IPV4_ROUTE); + groups |= nl_mgrp(RTNLGRP_IPV6_ROUTE); + groups |= nl_mgrp(RTNLGRP_IPV4_MROUTE); + groups |= nl_mgrp(RTNLGRP_IPV6_MROUTE); + groups |= nl_mgrp(RTNLGRP_IPV6_PREFIX); + groups |= nl_mgrp(RTNLGRP_NEIGH); + groups |= nl_mgrp(RTNLGRP_IPV4_NETCONF); + groups |= nl_mgrp(RTNLGRP_IPV6_NETCONF); + rtnl_close(&rth); while (argc > 0) { @@ -195,7 +199,6 @@ int do_ipmonitor(int argc, char **argv) lnetconf = 1; groups = 0; } else if (strcmp(*argv, "all") == 0) { - groups = ~RTMGRP_TC; prefix_banner=1; } else if (matches(*argv, "help") == 0) { usage(); |