summaryrefslogtreecommitdiff
path: root/sys/netmpls
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2019-01-27 02:24:50 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2019-01-27 02:24:50 +0000
commite6f3d8be840f7a44dcd37cf7ec2c60cf4767e32e (patch)
tree4361cca9d67603feefef241db01ee2fbb749f5d1 /sys/netmpls
parentd01fd1e750a4ce94c8809b4537fb69835b0cc54a (diff)
split off "local" input handling
this means the current mpls header will be passed along with the mbuf for mpw to look at. right now this doesn't do anything, but it will allow for implementation of RFC 6391 (flow aware transport) and using the exp header for cos. when mpe gets moved to adding an RTF_LOCAL route, this will be used for cos and ttl handling.
Diffstat (limited to 'sys/netmpls')
-rw-r--r--sys/netmpls/mpls_input.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c
index a32e0e00e0a..f0b6ce11e09 100644
--- a/sys/netmpls/mpls_input.c
+++ b/sys/netmpls/mpls_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls_input.c,v 1.70 2019/01/27 01:39:05 dlg Exp $ */
+/* $OpenBSD: mpls_input.c,v 1.71 2019/01/27 02:24:49 dlg Exp $ */
/*
* Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org>
@@ -51,6 +51,7 @@ struct mbuf *mpls_ip6_adjttl(struct mbuf *, u_int8_t);
#endif
struct mbuf *mpls_do_error(struct mbuf *, int, int, int);
+void mpls_input_local(struct rtentry *, struct mbuf *);
void
mpls_input(struct ifnet *ifp, struct mbuf *m)
@@ -185,6 +186,11 @@ do_v6:
switch (rt_mpls->mpls_operation) {
case MPLS_OP_POP:
+ if (ISSET(rt->rt_flags, RTF_LOCAL)) {
+ mpls_input_local(rt, m);
+ goto done;
+ }
+
m = mpls_shim_pop(m);
if (m == NULL)
goto done;
@@ -279,6 +285,26 @@ done:
rtfree(rt);
}
+void
+mpls_input_local(struct rtentry *rt, struct mbuf *m)
+{
+ struct ifnet *ifp;
+
+ ifp = if_get(rt->rt_ifidx);
+ if (ifp == NULL) {
+ m_freem(m);
+ return;
+ }
+
+ /* shortcut sending out the packet */
+ if (!ISSET(ifp->if_xflags, IFXF_MPLS))
+ (*ifp->if_output)(ifp, m, rt->rt_gateway, rt);
+ else
+ (*ifp->if_ll_output)(ifp, m, rt->rt_gateway, rt);
+
+ if_put(ifp);
+}
+
struct mbuf *
mpls_ip_adjttl(struct mbuf *m, u_int8_t ttl)
{