diff options
author | Kevin Lo <kevlo@FreeBSD.org> | 2014-08-08 01:57:15 +0000 |
---|---|---|
committer | Kevin Lo <kevlo@FreeBSD.org> | 2014-08-08 01:57:15 +0000 |
commit | 8f5a8818f57e31278b4bbd415c2cfa498306f91f (patch) | |
tree | b8a22569ba8e281cdf06effd47986cf8fb592118 /sys/netinet/ip_encap.c | |
parent | 9ce4512ccdfba4d81df33f159791681418c82b0a (diff) | |
download | src-8f5a8818f57e31278b4bbd415c2cfa498306f91f.tar.gz src-8f5a8818f57e31278b4bbd415c2cfa498306f91f.zip |
Merge 'struct ip6protosw' and 'struct protosw' into one. Now we have
only one protocol switch structure that is shared between ipv4 and ipv6.
Phabric: D476
Reviewed by: jhb
Notes
Notes:
svn path=/head/; revision=269699
Diffstat (limited to 'sys/netinet/ip_encap.c')
-rw-r--r-- | sys/netinet/ip_encap.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sys/netinet/ip_encap.c b/sys/netinet/ip_encap.c index ce1319d447ef..fcd048a90c94 100644 --- a/sys/netinet/ip_encap.c +++ b/sys/netinet/ip_encap.c @@ -84,7 +84,6 @@ __FBSDID("$FreeBSD$"); #ifdef INET6 #include <netinet/ip6.h> #include <netinet6/ip6_var.h> -#include <netinet6/ip6protosw.h> #endif #include <machine/stdarg.h> @@ -115,18 +114,20 @@ encap_init(void) } #ifdef INET -void -encap4_input(struct mbuf *m, int off) +int +encap4_input(struct mbuf **mp, int *offp, int proto) { struct ip *ip; - int proto; + struct mbuf *m; struct sockaddr_in s, d; const struct protosw *psw; struct encaptab *ep, *match; - int prio, matchprio; + int matchprio, off, prio; + m = *mp; + off = *offp; ip = mtod(m, struct ip *); - proto = ip->ip_p; + *mp = NULL; bzero(&s, sizeof(s)); s.sin_family = AF_INET; @@ -188,14 +189,16 @@ encap4_input(struct mbuf *m, int off) psw = match->psw; if (psw && psw->pr_input) { encap_fillarg(m, match); - (*psw->pr_input)(m, off); + *mp = m; + (*psw->pr_input)(mp, offp, proto); } else m_freem(m); - return; + return (IPPROTO_DONE); } /* last resort: inject to raw socket */ - rip_input(m, off); + *mp = m; + return (rip_input(mp, offp, proto)); } #endif @@ -206,7 +209,7 @@ encap6_input(struct mbuf **mp, int *offp, int proto) struct mbuf *m = *mp; struct ip6_hdr *ip6; struct sockaddr_in6 s, d; - const struct ip6protosw *psw; + const struct protosw *psw; struct encaptab *ep, *match; int prio, matchprio; @@ -252,7 +255,7 @@ encap6_input(struct mbuf **mp, int *offp, int proto) if (match) { /* found a match */ - psw = (const struct ip6protosw *)match->psw; + psw = match->psw; if (psw && psw->pr_input) { encap_fillarg(m, match); return (*psw->pr_input)(mp, offp, proto); |