From: David Ahern <dsahern@kernel.org>
To: stephen@networkplumber.org
Cc: netdev@vger.kernel.org, David Ahern <dsa@cumulusnetworks.com>
Subject: [PATCH iproute2-next 9/9] ipmonitor: Add nexthop option to monitor
Date: Wed, 29 May 2019 20:17:46 -0700 [thread overview]
Message-ID: <20190530031746.2040-10-dsahern@kernel.org> (raw)
In-Reply-To: <20190530031746.2040-1-dsahern@kernel.org>
From: David Ahern <dsa@cumulusnetworks.com>
Add capability to ip-monitor to listen and dump nexthop messages
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
ip/ipmonitor.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index 9ecc7fd2011a..5da1256450b3 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -84,6 +84,12 @@ static int accept_msg(struct rtnl_ctrl_data *ctrl,
}
}
+ case RTM_NEWNEXTHOP:
+ case RTM_DELNEXTHOP:
+ print_headers(fp, "[NEXTHOP]", ctrl);
+ print_nexthop(n, arg);
+ return 0;
+
case RTM_NEWLINK:
case RTM_DELLINK:
ll_remember_index(n, NULL);
@@ -173,6 +179,7 @@ int do_ipmonitor(int argc, char **argv)
int lrule = 0;
int lnsid = 0;
int ifindex = 0;
+ int lnexthop = 1;
groups |= nl_mgrp(RTNLGRP_LINK);
groups |= nl_mgrp(RTNLGRP_IPV4_IFADDR);
@@ -202,30 +209,42 @@ int do_ipmonitor(int argc, char **argv)
} else if (matches(*argv, "link") == 0) {
llink = 1;
groups = 0;
+ lnexthop = 0;
} else if (matches(*argv, "address") == 0) {
laddr = 1;
groups = 0;
+ lnexthop = 0;
} else if (matches(*argv, "route") == 0) {
lroute = 1;
groups = 0;
+ lnexthop = 0;
} else if (matches(*argv, "mroute") == 0) {
lmroute = 1;
groups = 0;
+ lnexthop = 0;
} else if (matches(*argv, "prefix") == 0) {
lprefix = 1;
groups = 0;
+ lnexthop = 0;
} else if (matches(*argv, "neigh") == 0) {
lneigh = 1;
groups = 0;
+ lnexthop = 0;
} else if (matches(*argv, "netconf") == 0) {
lnetconf = 1;
groups = 0;
+ lnexthop = 0;
} else if (matches(*argv, "rule") == 0) {
lrule = 1;
groups = 0;
+ lnexthop = 0;
} else if (matches(*argv, "nsid") == 0) {
lnsid = 1;
groups = 0;
+ lnexthop = 0;
+ } else if (matches(*argv, "nexthop") == 0) {
+ groups = 0;
+ lnexthop = 1;
} else if (strcmp(*argv, "all") == 0) {
prefix_banner = 1;
} else if (matches(*argv, "all-nsid") == 0) {
@@ -313,6 +332,11 @@ int do_ipmonitor(int argc, char **argv)
if (rtnl_open(&rth, groups) < 0)
exit(1);
+ if (lnexthop && rtnl_add_nl_group(&rth, RTNLGRP_NEXTHOP) < 0) {
+ fprintf(stderr, "Failed to add nexthop group to list\n");
+ exit(1);
+ }
+
if (listen_all_nsid && rtnl_listen_all_nsid(&rth) < 0)
exit(1);
--
2.11.0
prev parent reply other threads:[~2019-05-30 4:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-30 3:17 [PATCH iproute2-next 0/9] ip: Add support for nexthop objects David Ahern
2019-05-30 3:17 ` [PATCH iproute2-next 1/9] libnetlink: Set NLA_F_NESTED in rta_nest David Ahern
2019-05-30 17:43 ` Stephen Hemminger
2019-05-30 17:50 ` David Ahern
2019-05-31 6:35 ` Michal Kubecek
2019-05-30 3:17 ` [PATCH iproute2-next 2/9] lwtunnel: Pass encap and encap_type attributes to lwt_parse_encap David Ahern
2019-05-30 3:17 ` [PATCH iproute2-next 3/9] libnetlink: Add helper to add a group via setsockopt David Ahern
2019-05-30 3:17 ` [PATCH iproute2-next 4/9] uapi: Import nexthop object API David Ahern
2019-05-30 3:17 ` [PATCH iproute2-next 5/9] libnetlink: Add helper to create nexthop dump request David Ahern
2019-05-30 19:56 ` Roopa Prabhu
2019-05-30 19:59 ` David Ahern
2019-05-30 3:17 ` [PATCH iproute2-next 6/9] ip route: Export print_rt_flags and print_rta_if David Ahern
2019-05-30 3:17 ` [PATCH iproute2-next 7/9] Add support for nexthop objects David Ahern
2019-05-30 17:45 ` Stephen Hemminger
2019-05-30 17:52 ` David Ahern
2019-05-30 17:45 ` Stephen Hemminger
2019-05-30 17:52 ` David Ahern
2019-05-30 17:52 ` Stephen Hemminger
2019-05-30 17:55 ` David Ahern
2019-05-30 20:01 ` Roopa Prabhu
2019-05-30 3:17 ` [PATCH iproute2-next 8/9] ip route: Add option to use " David Ahern
2019-05-30 19:59 ` Roopa Prabhu
2019-05-30 3:17 ` David Ahern [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190530031746.2040-10-dsahern@kernel.org \
--to=dsahern@kernel.org \
--cc=dsa@cumulusnetworks.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).