[PATCH libnl 11/11] Add support for mpls encap to libnl commands
David Ahern
dsahern at gmail.com
Fri Jun 30 09:48:58 PDT 2017
Add support for MPLS lwtunnel encapsulation in nexthop specification.
Specifically, the mpls keyword is used to specify the label stack to
be applied to the route.
Signed-off-by: David Ahern <dsahern at gmail.com>
---
src/lib/route.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/lib/route.c b/src/lib/route.c
index 2eac0a05c97e..244848b80f85 100644
--- a/src/lib/route.c
+++ b/src/lib/route.c
@@ -142,12 +142,14 @@ void nl_cli_route_parse_nexthop(struct rtnl_route *route, char *subopts,
NH_VIA,
NH_WEIGHT,
NH_AS,
+ NH_MPLS,
};
static char *const tokens[] = {
"dev",
"via",
"weight",
"as",
+ "mpls",
NULL,
};
struct rtnl_nexthop *nh;
@@ -194,6 +196,12 @@ void nl_cli_route_parse_nexthop(struct rtnl_route *route, char *subopts,
nl_addr_put(addr);
break;
+ case NH_MPLS:
+ addr = nl_cli_addr_parse(arg, AF_MPLS);
+ rtnl_route_nh_encap_mpls(nh, addr, 0);
+ nl_addr_put(addr);
+ break;
+
case NH_WEIGHT:
lval = strtoul(arg, &endptr, 0);
if (endptr == arg)
--
2.11.0 (Apple Git-81)
More information about the libnl
mailing list