diff options
author | claudio <claudio@openbsd.org> | 2017-02-27 19:16:56 +0000 |
---|---|---|
committer | claudio <claudio@openbsd.org> | 2017-02-27 19:16:56 +0000 |
commit | 2b751374e1d9fa84922032a6a734084162ee9656 (patch) | |
tree | 055f9f01646cf8154026b6b3bd2de11aa0cdcddc /sys/netmpls | |
parent | Add IPsec tests for ipip encapsulation. (diff) | |
download | wireguard-openbsd-2b751374e1d9fa84922032a6a734084162ee9656.tar.xz wireguard-openbsd-2b751374e1d9fa84922032a6a734084162ee9656.zip |
Retire the AF_MPLS protosw struct. Nothing is using it and the code was super
basic anyway. Simplifies the code a lot also by calling the mpls sysctl no
longer via the protosw but instead directly.
OK mpi@ on a previous diff. Also tested by renato@ who actually found a bug
which is now fixed.
Diffstat (limited to 'sys/netmpls')
-rw-r--r-- | sys/netmpls/mpls.h | 5 | ||||
-rw-r--r-- | sys/netmpls/mpls_input.c | 7 | ||||
-rw-r--r-- | sys/netmpls/mpls_proto.c | 29 | ||||
-rw-r--r-- | sys/netmpls/mpls_raw.c | 55 |
4 files changed, 8 insertions, 88 deletions
diff --git a/sys/netmpls/mpls.h b/sys/netmpls/mpls.h index cbdfc375f29..81e8b524e7c 100644 --- a/sys/netmpls/mpls.h +++ b/sys/netmpls/mpls.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls.h,v 1.35 2015/12/02 08:47:00 claudio Exp $ */ +/* $OpenBSD: mpls.h,v 1.36 2017/02/27 19:16:56 claudio Exp $ */ /* * Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project. @@ -182,13 +182,10 @@ extern int mpls_mapttl_ip6; extern int mpls_inkloop; -void mpls_init(void); - struct mbuf *mpls_shim_pop(struct mbuf *); struct mbuf *mpls_shim_swap(struct mbuf *, struct rt_mpls *); struct mbuf *mpls_shim_push(struct mbuf *, struct rt_mpls *); -int mpls_sysctl(int *, u_int, void *, size_t *, void *, size_t); int mpls_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); void mpls_input(struct mbuf *); diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c index 23cb330ad0c..140c4a9d33d 100644 --- a/sys/netmpls/mpls_input.c +++ b/sys/netmpls/mpls_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls_input.c,v 1.57 2016/08/22 15:37:23 mpi Exp $ */ +/* $OpenBSD: mpls_input.c,v 1.58 2017/02/27 19:16:56 claudio Exp $ */ /* * Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org> @@ -53,11 +53,6 @@ int mpls_ip6_adjttl(struct mbuf *, u_int8_t); struct mbuf *mpls_do_error(struct mbuf *, int, int, int); void -mpls_init(void) -{ -} - -void mpls_input(struct mbuf *m) { struct sockaddr_mpls *smpls; diff --git a/sys/netmpls/mpls_proto.c b/sys/netmpls/mpls_proto.c index b35e2b065a1..078ad2b42fe 100644 --- a/sys/netmpls/mpls_proto.c +++ b/sys/netmpls/mpls_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls_proto.c,v 1.14 2015/12/03 21:57:59 mpi Exp $ */ +/* $OpenBSD: mpls_proto.c,v 1.15 2017/02/27 19:16:56 claudio Exp $ */ /* * Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project. @@ -43,31 +43,12 @@ #include <netmpls/mpls.h> /* - * MPLS protocol family: + * MPLS address family: needed for the routing table */ -struct protosw mplssw[] = { -{ 0, &mplsdomain, 0, 0, - 0, 0, 0, 0, - 0, - mpls_init, 0, 0, 0, mpls_sysctl -}, -{ SOCK_DGRAM, &mplsdomain, 0, PR_ATOMIC|PR_ADDR, - 0, 0, 0, 0, - mpls_raw_usrreq, - 0, 0, 0, 0, mpls_sysctl, -}, -/* raw wildcard */ -{ SOCK_RAW, &mplsdomain, 0, PR_ATOMIC|PR_ADDR, - 0, 0, 0, 0, - mpls_raw_usrreq, - 0, 0, 0, 0, mpls_sysctl, -}, -}; - struct domain mplsdomain = { - AF_MPLS, "mpls", mpls_init, 0, 0, - mplssw, - &mplssw[nitems(mplssw)], + AF_MPLS, "mpls", NULL, 0, 0, + NULL, + 0, sizeof(struct sockaddr_mpls), offsetof(struct sockaddr_mpls, smpls_label), 32 }; diff --git a/sys/netmpls/mpls_raw.c b/sys/netmpls/mpls_raw.c index 1d740bff695..6d3a3fab105 100644 --- a/sys/netmpls/mpls_raw.c +++ b/sys/netmpls/mpls_raw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls_raw.c,v 1.14 2016/11/15 13:44:03 mpi Exp $ */ +/* $OpenBSD: mpls_raw.c,v 1.15 2017/02/27 19:16:56 claudio Exp $ */ /* * Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project. @@ -45,12 +45,6 @@ #include <netmpls/mpls.h> -#define MPLS_RAW_SNDQ 8192 -#define MPLS_RAW_RCVQ 8192 - -u_long mpls_raw_sendspace = MPLS_RAW_SNDQ; -u_long mpls_raw_recvspace = MPLS_RAW_RCVQ; - int mpls_defttl = 255; int mpls_inkloop = MPLS_INKERNEL_LOOP_MAX; int mpls_push_expnull_ip = 0; @@ -61,53 +55,6 @@ int mpls_mapttl_ip6 = 0; int *mplsctl_vars[MPLSCTL_MAXID] = MPLSCTL_VARS; int -mpls_raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, - struct mbuf *control, struct proc *p) -{ - int error = 0; - -#ifdef MPLS_DEBUG - printf("mpls_raw_usrreq: called! (reqid=%d).\n", req); -#endif /* MPLS_DEBUG */ - - if (req == PRU_CONTROL) - return (EOPNOTSUPP); - - switch (req) { - case PRU_ATTACH: - if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { - error = soreserve(so, mpls_raw_sendspace, - mpls_raw_recvspace); - if (error) - break; - } - break; - - case PRU_DETACH: - case PRU_BIND: - case PRU_LISTEN: - case PRU_CONNECT: - case PRU_CONNECT2: - case PRU_DISCONNECT: - case PRU_SHUTDOWN: - case PRU_RCVD: - case PRU_SEND: - case PRU_SENSE: - case PRU_RCVOOB: - case PRU_SENDOOB: - case PRU_SOCKADDR: - case PRU_PEERADDR: - error = EOPNOTSUPP; - break; - - default: - panic("mpls_raw_usrreq"); - } - - return (error); -} - -int mpls_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { |