diff mbox series

[2/3] ip: Display ip rule protocol used

Message ID 20180217124753.2879-3-sharpd@cumulusnetworks.com
State Changes Requested, archived
Delegated to: David Ahern
Headers show
Series [1/3] ip: Use the `struct fib_rule_hdr` for rules | expand

Commit Message

Donald Sharp Feb. 17, 2018, 12:47 p.m. UTC
Newer kernels are now accepting a protocol from the installing
program for who installed the rule.  This change allows us
to see this change if it is being specified by the installing
program.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
---
 ip/iprule.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/ip/iprule.c b/ip/iprule.c
index 82e22fee..5703d6e4 100644
--- a/ip/iprule.c
+++ b/ip/iprule.c
@@ -213,6 +213,9 @@  int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 	else if (frh->action != RTN_UNICAST)
 		fprintf(fp, "%s", rtnl_rtntype_n2a(frh->action, b1, sizeof(b1)));
 
+	if (frh->proto != RTPROT_UNSPEC)
+		fprintf(fp, " proto %s ",
+			rtnl_rtprot_n2a(frh->proto, b1, sizeof(b1)));
 	fprintf(fp, "\n");
 	fflush(fp);
 	return 0;