diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2016-06-02 08:28:15 -0300 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-09-23 09:31:15 -0400 |
| commit | d3e2c74adaa2564775f2c60320213e28e329be50 (patch) | |
| tree | ef609154588b3a799911e990774f47975bf83f7d /zebra/rt_socket.c | |
| parent | be0dba358f7cd40ae27f012409734786a13d5ce4 (diff) | |
mpls: add support to the OpenBSD kernel
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'zebra/rt_socket.c')
| -rw-r--r-- | zebra/rt_socket.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c index 24671829f0..a6a1978065 100644 --- a/zebra/rt_socket.c +++ b/zebra/rt_socket.c @@ -21,6 +21,9 @@ */ #include <zebra.h> +#if defined HAVE_MPLS && defined __OpenBSD__ +#include <netmpls/mpls.h> +#endif #include "if.h" #include "prefix.h" @@ -33,13 +36,15 @@ #include "zebra/rib.h" #include "zebra/rt.h" #include "zebra/kernel_socket.h" +#include "zebra/zebra_mpls.h" extern struct zebra_privs_t zserv_privs; /* kernel socket export */ extern int rtm_write (int message, union sockunion *dest, union sockunion *mask, union sockunion *gate, - unsigned int index, int zebra_flags, int metric); + union sockunion *mpls, unsigned int index, + int zebra_flags, int metric); #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN /* Adjust netmask socket length. Return value is a adjusted sin_len @@ -73,6 +78,10 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib, int family) { struct sockaddr_in *mask = NULL; struct sockaddr_in sin_dest, sin_mask, sin_gate; +#if defined HAVE_MPLS && defined __OpenBSD__ + struct sockaddr_mpls smpls; +#endif + union sockunion *smplsp = NULL; struct nexthop *nexthop, *tnexthop; int recursing; int nexthop_num = 0; @@ -147,10 +156,23 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib, int family) mask = &sin_mask; } +#if defined HAVE_MPLS && defined __OpenBSD__ + if (nexthop->nh_label) + { + memset (&smpls, 0, sizeof (smpls)); + smpls.smpls_len = sizeof (smpls); + smpls.smpls_family = AF_MPLS; + smpls.smpls_label = + htonl (nexthop->nh_label->label[0] << MPLS_LABEL_OFFSET); + smplsp = (union sockunion *)&smpls; + } +#endif + error = rtm_write (cmd, (union sockunion *)&sin_dest, (union sockunion *)mask, gate ? (union sockunion *)&sin_gate : NULL, + smplsp, ifindex, rib->flags, rib->metric); @@ -365,6 +387,7 @@ kernel_rtm_ipv6_multipath (int cmd, struct prefix *p, struct rib *rib, (union sockunion *) &sin_dest, (union sockunion *) mask, gate ? (union sockunion *)&sin_gate : NULL, + NULL, ifindex, rib->flags, rib->metric); |
