netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsa@cumulusnetworks.com>
To: netdev@vger.kernel.org, stephen@networkplumber.org
Cc: nicolas.dichtel@6wind.com, David Ahern <dsa@cumulusnetworks.com>
Subject: [PATCH iproute2] ip: Add support for MPLS netconf
Date: Tue, 21 Feb 2017 09:23:31 -0800	[thread overview]
Message-ID: <1487697811-28638-1-git-send-email-dsa@cumulusnetworks.com> (raw)

Add support for MPLS netconf to ip monitor and ip netconf commands.
Changes to header files not included as those are typically pulled
in my a header sync with the kernel.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
 ip/ipmonitor.c | 3 +++
 ip/ipnetconf.c | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index c892b8f1c224..3171d4712887 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -176,6 +176,7 @@ int do_ipmonitor(int argc, char **argv)
 	groups |= nl_mgrp(RTNLGRP_IPV4_RULE);
 	groups |= nl_mgrp(RTNLGRP_IPV6_RULE);
 	groups |= nl_mgrp(RTNLGRP_NSID);
+	groups |= nl_mgrp(RTNLGRP_MPLS_NETCONF);
 
 	rtnl_close(&rth);
 
@@ -271,6 +272,8 @@ int do_ipmonitor(int argc, char **argv)
 			groups |= nl_mgrp(RTNLGRP_IPV4_NETCONF);
 		if (!preferred_family || preferred_family == AF_INET6)
 			groups |= nl_mgrp(RTNLGRP_IPV6_NETCONF);
+		if (!preferred_family || preferred_family == AF_MPLS)
+			groups |= nl_mgrp(RTNLGRP_MPLS_NETCONF);
 	}
 	if (lrule) {
 		if (!preferred_family || preferred_family == AF_INET)
diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c
index 50c4e33cfe93..af539f5e945c 100644
--- a/ip/ipnetconf.c
+++ b/ip/ipnetconf.c
@@ -83,6 +83,9 @@ int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
 	case AF_INET6:
 		fprintf(fp, "ipv6 ");
 		break;
+	case AF_MPLS:
+		fprintf(fp, "mpls ");
+		break;
 	default:
 		fprintf(fp, "unknown ");
 		break;
@@ -131,6 +134,9 @@ int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
 		print_onoff(fp, "ignore_routes_with_linkdown",
 		     rta_getattr_u32(tb[NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN]));
 
+	if (tb[NETCONFA_INPUT])
+		print_onoff(fp, "input", rta_getattr_u32(tb[NETCONFA_INPUT]));
+
 	fprintf(fp, "\n");
 	fflush(fp);
 	return 0;
-- 
2.1.4

             reply	other threads:[~2017-02-21 17:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 17:23 David Ahern [this message]
2017-02-23 17:00 ` [PATCH iproute2] ip: Add support for MPLS netconf Stephen Hemminger

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=1487697811-28638-1-git-send-email-dsa@cumulusnetworks.com \
    --to=dsa@cumulusnetworks.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --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).