Module Name: src
Committed By: knakahara
Date: Tue Jan 26 05:58:06 UTC 2016
Modified Files:
src/sys/net: if_stf.c if_stf.h
src/sys/netinet: in_gif.c ip_encap.c ip_encap.h ip_mroute.c
src/sys/netinet6: in6_gif.c
src/sys/netipsec: xform_ipip.c
Log Message:
implement encapsw instead of protosw and uniform prototype.
suggested and advised by [email protected], thanks.
BTW, It seems in_stf_input() had bugs...
To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/net/if_stf.c
cvs rdiff -u -r1.4 -r1.5 src/sys/net/if_stf.h
cvs rdiff -u -r1.73 -r1.74 src/sys/netinet/in_gif.c
cvs rdiff -u -r1.50 -r1.51 src/sys/netinet/ip_encap.c
cvs rdiff -u -r1.15 -r1.16 src/sys/netinet/ip_encap.h
cvs rdiff -u -r1.136 -r1.137 src/sys/netinet/ip_mroute.c
cvs rdiff -u -r1.70 -r1.71 src/sys/netinet6/in6_gif.c
cvs rdiff -u -r1.35 -r1.36 src/sys/netipsec/xform_ipip.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/if_stf.c
diff -u src/sys/net/if_stf.c:1.85 src/sys/net/if_stf.c:1.86
--- src/sys/net/if_stf.c:1.85 Fri Jan 22 23:27:12 2016
+++ src/sys/net/if_stf.c Tue Jan 26 05:58:05 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: if_stf.c,v 1.85 2016/01/22 23:27:12 riastradh Exp $ */
+/* $NetBSD: if_stf.c,v 1.86 2016/01/26 05:58:05 knakahara Exp $ */
/* $KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */
/*
@@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.85 2016/01/22 23:27:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.86 2016/01/26 05:58:05 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -93,7 +93,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/proc.h>
-#include <sys/protosw.h>
#include <sys/queue.h>
#include <sys/syslog.h>
@@ -158,16 +157,12 @@ static int ip_gif_ttl = 40; /*XXX*/
extern struct domain inetdomain;
-static const struct protosw in_stf_protosw =
+static const struct encapsw in_stf_encapsw =
{
- .pr_type = SOCK_RAW,
- .pr_domain = &inetdomain,
- .pr_protocol = IPPROTO_IPV6,
- .pr_flags = PR_ATOMIC|PR_ADDR,
- .pr_input = in_stf_input,
- .pr_ctlinput = NULL,
- .pr_ctloutput = rip_ctloutput,
- .pr_usrreqs = &rip_usrreqs,
+ .encapsw6 = {
+ .pr_input = in_stf_input,
+ .pr_ctlinput = NULL,
+ }
};
static int stf_encapcheck(struct mbuf *, int, int, void *);
@@ -206,7 +201,7 @@ stf_clone_create(struct if_clone *ifc, i
if_initname(&sc->sc_if, ifc->ifc_name, unit);
sc->encap_cookie = encap_attach_func(AF_INET, IPPROTO_IPV6,
- stf_encapcheck, &in_stf_protosw, sc);
+ stf_encapcheck, &in_stf_encapsw, sc);
if (sc->encap_cookie == NULL) {
printf("%s: unable to attach encap\n", if_name(&sc->sc_if));
free(sc, M_DEVBUF);
@@ -557,26 +552,22 @@ stf_checkaddr6(struct stf_softc *sc, con
return 0;
}
-void
-in_stf_input(struct mbuf *m, ...)
+int
+in_stf_input(struct mbuf **mp, int *offp, int proto)
{
- int s, off, proto;
+ int s;
struct stf_softc *sc;
struct ip *ip;
struct ip6_hdr *ip6;
uint8_t otos, itos;
struct ifnet *ifp;
size_t pktlen;
- va_list ap;
-
- va_start(ap, m);
- off = va_arg(ap, int);
- proto = va_arg(ap, int);
- va_end(ap);
+ int off = *offp;
+ struct mbuf *m = *mp;
if (proto != IPPROTO_IPV6) {
m_freem(m);
- return;
+ return IPPROTO_DONE;
}
ip = mtod(m, struct ip *);
@@ -585,7 +576,7 @@ in_stf_input(struct mbuf *m, ...)
if (sc == NULL || (sc->sc_if.if_flags & IFF_UP) == 0) {
m_freem(m);
- return;
+ return IPPROTO_DONE;
}
ifp = &sc->sc_if;
@@ -597,7 +588,7 @@ in_stf_input(struct mbuf *m, ...)
if (stf_checkaddr4(sc, &ip->ip_dst, NULL) < 0 ||
stf_checkaddr4(sc, &ip->ip_src, m->m_pkthdr.rcvif) < 0) {
m_freem(m);
- return;
+ return IPPROTO_DONE;
}
otos = ip->ip_tos;
@@ -606,7 +597,7 @@ in_stf_input(struct mbuf *m, ...)
if (m->m_len < sizeof(*ip6)) {
m = m_pullup(m, sizeof(*ip6));
if (!m)
- return;
+ return IPPROTO_DONE;
}
ip6 = mtod(m, struct ip6_hdr *);
@@ -617,7 +608,7 @@ in_stf_input(struct mbuf *m, ...)
if (stf_checkaddr6(sc, &ip6->ip6_dst, NULL) < 0 ||
stf_checkaddr6(sc, &ip6->ip6_src, m->m_pkthdr.rcvif) < 0) {
m_freem(m);
- return;
+ return IPPROTO_DONE;
}
itos = (ntohl(ip6->ip6_flow) >> 20) & 0xff;
@@ -648,6 +639,8 @@ in_stf_input(struct mbuf *m, ...)
m_freem(m);
}
splx(s);
+
+ return IPPROTO_DONE;
}
/* ARGSUSED */
Index: src/sys/net/if_stf.h
diff -u src/sys/net/if_stf.h:1.4 src/sys/net/if_stf.h:1.5
--- src/sys/net/if_stf.h:1.4 Sun Dec 11 23:05:25 2005
+++ src/sys/net/if_stf.h Tue Jan 26 05:58:05 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: if_stf.h,v 1.4 2005/12/11 23:05:25 thorpej Exp $ */
+/* $NetBSD: if_stf.h,v 1.5 2016/01/26 05:58:05 knakahara Exp $ */
/* $KAME: if_stf.h,v 1.3 2000/03/25 07:23:33 sumikawa Exp $ */
/*
@@ -37,6 +37,6 @@
#define STF_MTU_MIN (1280) /* Minimum MTU */
#define STF_MTU_MAX (8192) /* Maximum MTU */
-void in_stf_input(struct mbuf *, ...);
+int in_stf_input(struct mbuf **, int *, int);
#endif /* !_NET_IF_STF_H_ */
Index: src/sys/netinet/in_gif.c
diff -u src/sys/netinet/in_gif.c:1.73 src/sys/netinet/in_gif.c:1.74
--- src/sys/netinet/in_gif.c:1.73 Sat Jan 23 14:48:55 2016
+++ src/sys/netinet/in_gif.c Tue Jan 26 05:58:05 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: in_gif.c,v 1.73 2016/01/23 14:48:55 riastradh Exp $ */
+/* $NetBSD: in_gif.c,v 1.74 2016/01/26 05:58:05 knakahara Exp $ */
/* $KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.73 2016/01/23 14:48:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.74 2016/01/26 05:58:05 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -45,7 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/syslog.h>
-#include <sys/protosw.h>
#include <sys/kernel.h>
#include <net/if.h>
@@ -79,15 +78,11 @@ int ip_gif_ttl = GIF_TTL;
int ip_gif_ttl = 0;
#endif
-static const struct protosw in_gif_protosw = {
- .pr_type = SOCK_RAW,
- .pr_domain = &inetdomain,
- .pr_protocol = 0 /* IPPROTO_IPV[46] */,
- .pr_flags = PR_ATOMIC|PR_ADDR,
- .pr_input = in_gif_input,
- .pr_ctlinput = NULL,
- .pr_ctloutput = rip_ctloutput,
- .pr_usrreqs = &rip_usrreqs,
+static const struct encapsw in_gif_encapsw = {
+ .encapsw4 = {
+ .pr_input = in_gif_input,
+ .pr_ctlinput = NULL,
+ }
};
int
@@ -381,10 +376,10 @@ in_gif_attach(struct gif_softc *sc)
return EINVAL;
sc->encap_cookie4 = encap_attach(AF_INET, -1, sc->gif_psrc,
(struct sockaddr *)&mask4, sc->gif_pdst, (struct sockaddr *)&mask4,
- (const struct protosw *)&in_gif_protosw, sc);
+ &in_gif_encapsw, sc);
#else
sc->encap_cookie4 = encap_attach_func(AF_INET, -1, gif_encapcheck,
- &in_gif_protosw, sc);
+ &in_gif_encapsw, sc);
#endif
if (sc->encap_cookie4 == NULL)
return EEXIST;
Index: src/sys/netinet/ip_encap.c
diff -u src/sys/netinet/ip_encap.c:1.50 src/sys/netinet/ip_encap.c:1.51
--- src/sys/netinet/ip_encap.c:1.50 Fri Jan 22 23:27:12 2016
+++ src/sys/netinet/ip_encap.c Tue Jan 26 05:58:05 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_encap.c,v 1.50 2016/01/22 23:27:12 riastradh Exp $ */
+/* $NetBSD: ip_encap.c,v 1.51 2016/01/26 05:58:05 knakahara Exp $ */
/* $KAME: ip_encap.c,v 1.73 2001/10/02 08:30:58 itojun Exp $ */
/*
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.50 2016/01/22 23:27:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.51 2016/01/26 05:58:05 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_mrouting.h"
@@ -80,7 +80,6 @@ __KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v
#include <sys/sockio.h>
#include <sys/mbuf.h>
#include <sys/errno.h>
-#include <sys/protosw.h>
#include <sys/queue.h>
#include <sys/kmem.h>
@@ -99,7 +98,7 @@ __KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v
#ifdef INET6
#include <netinet/ip6.h>
#include <netinet6/ip6_var.h>
-#include <netinet6/ip6protosw.h>
+#include <netinet6/ip6protosw.h> /* for struct ip6ctlparam */
#include <netinet6/in6_var.h>
#include <netinet6/in6_pcb.h>
#include <netinet/icmp6.h>
@@ -240,7 +239,7 @@ encap4_input(struct mbuf *m, ...)
{
int off, proto;
va_list ap;
- const struct protosw *psw;
+ const struct encapsw *esw;
struct encaptab *match;
va_start(ap, m);
@@ -252,10 +251,10 @@ encap4_input(struct mbuf *m, ...)
if (match) {
/* found a match, "match" has the best one */
- psw = match->psw;
- if (psw && psw->pr_input) {
+ esw = match->esw;
+ if (esw && esw->encapsw4.pr_input) {
encap_fillarg(m, match);
- (*psw->pr_input)(m, off, proto);
+ (*esw->encapsw4.pr_input)(m, off, proto);
} else
m_freem(m);
return;
@@ -329,17 +328,17 @@ int
encap6_input(struct mbuf **mp, int *offp, int proto)
{
struct mbuf *m = *mp;
- const struct ip6protosw *psw;
+ const struct encapsw *esw;
struct encaptab *match;
match = encap6_lookup(m, *offp, proto, INBOUND);
if (match) {
/* found a match */
- psw = (const struct ip6protosw *)match->psw;
- if (psw && psw->pr_input) {
+ esw = match->esw;
+ if (esw && esw->encapsw6.pr_input) {
encap_fillarg(m, match);
- return (*psw->pr_input)(mp, offp, proto);
+ return (*esw->encapsw6.pr_input)(mp, offp, proto);
} else {
m_freem(m);
return IPPROTO_DONE;
@@ -431,7 +430,7 @@ const struct encaptab *
encap_attach(int af, int proto,
const struct sockaddr *sp, const struct sockaddr *sm,
const struct sockaddr *dp, const struct sockaddr *dm,
- const struct protosw *psw, void *arg)
+ const struct encapsw *esw, void *arg)
{
struct encaptab *ep;
int error;
@@ -534,7 +533,7 @@ encap_attach(int af, int proto,
memcpy(ep->srcmask, sm, sp->sa_len);
memcpy(ep->dst, dp, dp->sa_len);
memcpy(ep->dstmask, dm, dp->sa_len);
- ep->psw = psw;
+ ep->esw = esw;
ep->arg = arg;
error = encap_add(ep);
@@ -560,7 +559,7 @@ fail:
const struct encaptab *
encap_attach_func(int af, int proto,
int (*func)(struct mbuf *, int, int, void *),
- const struct protosw *psw, void *arg)
+ const struct encapsw *esw, void *arg)
{
struct encaptab *ep;
int error;
@@ -587,7 +586,7 @@ encap_attach_func(int af, int proto,
ep->af = af;
ep->proto = proto;
ep->func = func;
- ep->psw = psw;
+ ep->esw = esw;
ep->arg = arg;
error = encap_add(ep);
@@ -616,7 +615,7 @@ encap6_ctlinput(int cmd, const struct so
struct ip6ctlparam *ip6cp = NULL;
int nxt;
struct encaptab *ep;
- const struct ip6protosw *psw;
+ const struct encapsw *esw;
if (sa->sa_family != AF_INET6 ||
sa->sa_len != sizeof(struct sockaddr_in6))
@@ -675,9 +674,10 @@ encap6_ctlinput(int cmd, const struct so
/* should optimize by looking at address pairs */
/* XXX need to pass ep->arg or ep itself to listeners */
- psw = (const struct ip6protosw *)ep->psw;
- if (psw && psw->pr_ctlinput)
- (*psw->pr_ctlinput)(cmd, sa, d);
+ esw = ep->esw;
+ if (esw && esw->encapsw6.pr_ctlinput) {
+ (*esw->encapsw6.pr_ctlinput)(cmd, sa, d);
+ }
}
rip6_ctlinput(cmd, sa, d0);
Index: src/sys/netinet/ip_encap.h
diff -u src/sys/netinet/ip_encap.h:1.15 src/sys/netinet/ip_encap.h:1.16
--- src/sys/netinet/ip_encap.h:1.15 Fri Jan 22 23:27:12 2016
+++ src/sys/netinet/ip_encap.h Tue Jan 26 05:58:05 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_encap.h,v 1.15 2016/01/22 23:27:12 riastradh Exp $ */
+/* $NetBSD: ip_encap.h,v 1.16 2016/01/26 05:58:05 knakahara Exp $ */
/* $KAME: ip_encap.h,v 1.7 2000/03/25 07:23:37 sumikawa Exp $ */
/*
@@ -39,6 +39,26 @@
#include <net/radix.h>
#endif
+struct encapsw {
+ union {
+ struct encapsw4 {
+ void (*pr_input) /* input to protocol (from below) */
+ (struct mbuf *, ...);
+ void *(*pr_ctlinput) /* control input (from below) */
+ (int, const struct sockaddr *, void *);
+ } _encapsw4;
+ struct encapsw6 {
+ int (*pr_input) /* input to protocol (from below) */
+ (struct mbuf **, int *, int);
+ void *(*pr_ctlinput) /* control input (from below) */
+ (int, const struct sockaddr *, void *);
+ } _encapsw6;
+ } encapsw46;
+};
+
+#define encapsw4 encapsw46._encapsw4
+#define encapsw6 encapsw46._encapsw6
+
struct encaptab {
struct radix_node nodes[2];
LIST_ENTRY(encaptab) chain;
@@ -51,7 +71,7 @@ struct encaptab {
struct sockaddr *dst; /* remote addr */
struct sockaddr *dstmask;
int (*func) (struct mbuf *, int, int, void *);
- const struct protosw *psw; /* only pr_input will be used */
+ const struct encapsw *esw;
void *arg; /* passed via PACKET_TAG_ENCAP */
};
@@ -78,10 +98,10 @@ void encap4_input(struct mbuf *, ...);
int encap6_input(struct mbuf **, int *, int);
const struct encaptab *encap_attach(int, int, const struct sockaddr *,
const struct sockaddr *, const struct sockaddr *,
- const struct sockaddr *, const struct protosw *, void *);
+ const struct sockaddr *, const struct encapsw *, void *);
const struct encaptab *encap_attach_func(int, int,
int (*)(struct mbuf *, int, int, void *),
- const struct protosw *, void *);
+ const struct encapsw *, void *);
void *encap6_ctlinput(int, const struct sockaddr *, void *);
int encap_detach(const struct encaptab *);
void *encap_getarg(struct mbuf *);
Index: src/sys/netinet/ip_mroute.c
diff -u src/sys/netinet/ip_mroute.c:1.136 src/sys/netinet/ip_mroute.c:1.137
--- src/sys/netinet/ip_mroute.c:1.136 Fri Jan 22 23:27:12 2016
+++ src/sys/netinet/ip_mroute.c Tue Jan 26 05:58:05 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_mroute.c,v 1.136 2016/01/22 23:27:12 riastradh Exp $ */
+/* $NetBSD: ip_mroute.c,v 1.137 2016/01/26 05:58:05 knakahara Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -93,7 +93,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.136 2016/01/22 23:27:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.137 2016/01/26 05:58:05 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -193,14 +193,11 @@ extern int rsvp_on;
static void vif_input(struct mbuf *, ...);
static int vif_encapcheck(struct mbuf *, int, int, void *);
-static const struct protosw vif_protosw = {
- .pr_type = SOCK_RAW,
- .pr_domain = &inetdomain,
- .pr_protocol = IPPROTO_IPV4,
- .pr_flags = PR_ATOMIC|PR_ADDR,
- .pr_input = vif_input,
- .pr_ctloutput = rip_ctloutput,
- .pr_usrreqs = &rip_usrreqs,
+static const struct encapsw vif_encapsw = {
+ .encapsw4 = {
+ .pr_input = vif_input,
+ .pr_ctlinput = NULL,
+ }
};
#define EXPIRE_TIMEOUT (hz / 4) /* 4x / second */
@@ -837,7 +834,7 @@ add_vif(struct vifctl *vifcp)
* function to check, and this is not supported yet.
*/
vifp->v_encap_cookie = encap_attach_func(AF_INET, IPPROTO_IPV4,
- vif_encapcheck, &vif_protosw, vifp);
+ vif_encapcheck, &vif_encapsw, vifp);
if (!vifp->v_encap_cookie)
return (EINVAL);
Index: src/sys/netinet6/in6_gif.c
diff -u src/sys/netinet6/in6_gif.c:1.70 src/sys/netinet6/in6_gif.c:1.71
--- src/sys/netinet6/in6_gif.c:1.70 Sat Jan 23 14:48:55 2016
+++ src/sys/netinet6/in6_gif.c Tue Jan 26 05:58:05 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_gif.c,v 1.70 2016/01/23 14:48:55 riastradh Exp $ */
+/* $NetBSD: in6_gif.c,v 1.71 2016/01/26 05:58:05 knakahara Exp $ */
/* $KAME: in6_gif.c,v 1.62 2001/07/29 04:27:25 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.70 2016/01/23 14:48:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.71 2016/01/26 05:58:05 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -46,7 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v
#include <sys/ioctl.h>
#include <sys/queue.h>
#include <sys/syslog.h>
-#include <sys/protosw.h>
#include <sys/kernel.h>
#include <net/if.h>
@@ -65,7 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v
#include <netinet6/in6_gif.h>
#include <netinet6/in6_var.h>
#endif
-#include <netinet6/ip6protosw.h>
+#include <netinet6/ip6protosw.h> /* for struct ip6ctlparam */
#include <netinet/ip_ecn.h>
#include <net/if_gif.h>
@@ -79,7 +78,7 @@ int ip6_gif_hlim = GIF_HLIM;
extern LIST_HEAD(, gif_softc) gif_softc_list;
-static const struct ip6protosw in6_gif_protosw;
+static const struct encapsw in6_gif_encapsw;
/*
* family - family of the packet to be encapsulate.
@@ -374,10 +373,10 @@ in6_gif_attach(struct gif_softc *sc)
return EINVAL;
sc->encap_cookie6 = encap_attach(AF_INET6, -1, sc->gif_psrc,
(struct sockaddr *)&mask6, sc->gif_pdst, (struct sockaddr *)&mask6,
- (const void *)&in6_gif_protosw, sc);
+ (const void *)&in6_gif_encapsw, sc);
#else
sc->encap_cookie6 = encap_attach_func(AF_INET6, -1, gif_encapcheck,
- (struct protosw *)&in6_gif_protosw, sc);
+ &in6_gif_encapsw, sc);
#endif
if (sc->encap_cookie6 == NULL)
return EEXIST;
@@ -451,20 +450,11 @@ in6_gif_ctlinput(int cmd, const struct s
}
PR_WRAP_CTLINPUT(in6_gif_ctlinput)
-PR_WRAP_CTLOUTPUT(rip6_ctloutput)
-
#define in6_gif_ctlinput in6_gif_ctlinput_wrapper
-#define rip6_ctloutput rip6_ctloutput_wrapper
-
-extern struct domain inet6domain;
-static const struct ip6protosw in6_gif_protosw = {
- .pr_type = SOCK_RAW,
- .pr_domain = &inet6domain,
- .pr_protocol = 0 /* IPPROTO_IPV[46] */,
- .pr_flags = PR_ATOMIC | PR_ADDR,
- .pr_input = in6_gif_input,
- .pr_ctlinput = in6_gif_ctlinput,
- .pr_ctloutput = rip6_ctloutput,
- .pr_usrreqs = &rip6_usrreqs,
+static const struct encapsw in6_gif_encapsw = {
+ .encapsw6 = {
+ .pr_input = in6_gif_input,
+ .pr_ctlinput = in6_gif_ctlinput,
+ }
};
Index: src/sys/netipsec/xform_ipip.c
diff -u src/sys/netipsec/xform_ipip.c:1.35 src/sys/netipsec/xform_ipip.c:1.36
--- src/sys/netipsec/xform_ipip.c:1.35 Fri Jan 22 23:27:12 2016
+++ src/sys/netipsec/xform_ipip.c Tue Jan 26 05:58:06 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: xform_ipip.c,v 1.35 2016/01/22 23:27:12 riastradh Exp $ */
+/* $NetBSD: xform_ipip.c,v 1.36 2016/01/26 05:58:06 knakahara Exp $ */
/* $FreeBSD: src/sys/netipsec/xform_ipip.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */
/* $OpenBSD: ip_ipip.c,v 1.25 2002/06/10 18:04:55 itojun Exp $ */
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.35 2016/01/22 23:27:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.36 2016/01/26 05:58:06 knakahara Exp $");
/*
* IP-inside-IP processing
@@ -682,43 +682,19 @@ static struct xformsw ipe4_xformsw = {
};
#ifdef INET
-PR_WRAP_CTLOUTPUT(rip_ctloutput)
-#define rip_ctloutput rip_ctloutput_wrapper
-
-extern struct domain inetdomain;
-static struct ipprotosw ipe4_protosw = {
- .pr_type = SOCK_RAW,
- .pr_domain = &inetdomain,
- .pr_protocol = IPPROTO_IPV4,
- .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
- .pr_input = ip4_input,
- .pr_ctlinput = 0,
- .pr_ctloutput = rip_ctloutput,
- .pr_usrreqs = &rip_usrreqs,
- .pr_init = 0,
- .pr_fasttimo = 0,
- .pr_slowtimo = 0,
- .pr_drain = 0,
+static struct encapsw ipe4_encapsw = {
+ .encapsw4 = {
+ .pr_input = ip4_input,
+ .pr_ctlinput = NULL,
+ }
};
#endif
#ifdef INET6
-PR_WRAP_CTLOUTPUT(rip6_ctloutput)
-#define rip6_ctloutput rip6_ctloutput_wrapper
-
-extern struct domain inet6domain;
-static struct ip6protosw ipe4_protosw6 = {
- .pr_type = SOCK_RAW,
- .pr_domain = &inet6domain,
- .pr_protocol = IPPROTO_IPV6,
- .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
- .pr_input = ip4_input6,
- .pr_ctlinput = 0,
- .pr_ctloutput = rip6_ctloutput,
- .pr_usrreqs = &rip6_usrreqs,
- .pr_init = 0,
- .pr_fasttimo = 0,
- .pr_slowtimo = 0,
- .pr_drain = 0,
+static struct encapsw ipe4_encapsw6 = {
+ .encapsw6 = {
+ .pr_input = ip4_input6,
+ .pr_ctlinput = NULL,
+ }
};
#endif
@@ -752,11 +728,11 @@ ipe4_attach(void)
/* XXX save return cookie for detach on module remove */
#ifdef INET
(void) encap_attach_func(AF_INET, -1,
- ipe4_encapcheck, (struct protosw*) &ipe4_protosw, NULL);
+ ipe4_encapcheck, &ipe4_encapsw, NULL);
#endif
#ifdef INET6
(void) encap_attach_func(AF_INET6, -1,
- ipe4_encapcheck, (struct protosw*) &ipe4_protosw6, NULL);
+ ipe4_encapcheck, &ipe4_encapsw6, NULL);
#endif
}