summaryrefslogtreecommitdiffstats
path: root/lib/route
diff options
context:
space:
mode:
authorAnn Pokora <apokora@juniper.net>2021-05-25 16:58:29 (GMT)
committerThomas Haller <thaller@redhat.com>2022-03-04 11:29:54 (GMT)
commitcc680d43fafc42c07df96401cfa0bf03b3c84e7c (patch)
treedb0ff6159a1827715c4a67d08d03253713ba611d /lib/route
parentefe8aad98ce341d98f0431b5bfb665e33593c299 (diff)
downloadlibnl-cc680d43fafc42c07df96401cfa0bf03b3c84e7c.zip
libnl-cc680d43fafc42c07df96401cfa0bf03b3c84e7c.tar.gz
libnl-cc680d43fafc42c07df96401cfa0bf03b3c84e7c.tar.bz2
route: add accessors for setting/getting ENCAP_MPLS attributes
[thaller@redhat.com: split original patch, reword commit message and fix symbols in "libnl-route-3.sym"]
Diffstat (limited to 'lib/route')
-rw-r--r--lib/route/nh_encap_mpls.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/route/nh_encap_mpls.c b/lib/route/nh_encap_mpls.c
index 65355a7..d30acc2 100644
--- a/lib/route/nh_encap_mpls.c
+++ b/lib/route/nh_encap_mpls.c
@@ -128,3 +128,31 @@ int rtnl_route_nh_encap_mpls(struct rtnl_nexthop *nh,
return 0;
}
+
+struct nl_addr *rtnl_route_nh_get_encap_mpls_dst(struct rtnl_nexthop *nh)
+{
+ struct mpls_iptunnel_encap *mpls_encap;
+
+ if (!nh->rtnh_encap || nh->rtnh_encap->ops->encap_type != LWTUNNEL_ENCAP_MPLS)
+ return NULL;
+
+ mpls_encap = (struct mpls_iptunnel_encap *)nh->rtnh_encap->priv;
+ if (!mpls_encap)
+ return NULL;
+
+ return mpls_encap->dst;
+}
+
+uint8_t rtnl_route_nh_get_encap_mpls_ttl(struct rtnl_nexthop *nh)
+{
+ struct mpls_iptunnel_encap *mpls_encap;
+
+ if (!nh->rtnh_encap || nh->rtnh_encap->ops->encap_type != LWTUNNEL_ENCAP_MPLS)
+ return 0;
+
+ mpls_encap = (struct mpls_iptunnel_encap *)nh->rtnh_encap->priv;
+ if (!mpls_encap)
+ return 0;
+
+ return mpls_encap->ttl;
+}