aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/ip_gre.c
diff options
context:
space:
mode:
authorKevin Lo <kevlo@FreeBSD.org>2014-08-08 01:57:15 +0000
committerKevin Lo <kevlo@FreeBSD.org>2014-08-08 01:57:15 +0000
commit8f5a8818f57e31278b4bbd415c2cfa498306f91f (patch)
treeb8a22569ba8e281cdf06effd47986cf8fb592118 /sys/netinet/ip_gre.c
parent9ce4512ccdfba4d81df33f159791681418c82b0a (diff)
downloadsrc-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_gre.c')
-rw-r--r--sys/netinet/ip_gre.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c
index 10fcbce2868d..21a665a99e22 100644
--- a/sys/netinet/ip_gre.c
+++ b/sys/netinet/ip_gre.c
@@ -92,12 +92,15 @@ static struct mbuf *gre_input2(struct mbuf *, int, u_char);
* IPPROTO_GRE and a local destination address).
* This really is simple
*/
-void
-gre_input(struct mbuf *m, int off)
+int
+gre_input(struct mbuf **mp, int *offp, int proto)
{
- int proto;
+ struct mbuf *m;
+ int off;
- proto = (mtod(m, struct ip *))->ip_p;
+ m = *mp;
+ off = *offp;
+ *mp = NULL;
m = gre_input2(m, off, proto);
@@ -105,8 +108,11 @@ gre_input(struct mbuf *m, int off)
* If no matching tunnel that is up is found. We inject
* the mbuf to raw ip socket to see if anyone picks it up.
*/
- if (m != NULL)
- rip_input(m, off);
+ if (m != NULL) {
+ *mp = m;
+ rip_input(mp, offp, proto);
+ }
+ return (IPPROTO_DONE);
}
/*
@@ -213,24 +219,26 @@ gre_input2(struct mbuf *m ,int hlen, u_char proto)
* between IP header and payload
*/
-void
-gre_mobile_input(struct mbuf *m, int hlen)
+int
+gre_mobile_input(struct mbuf **mp, int *offp, int proto)
{
struct ip *ip;
struct mobip_h *mip;
+ struct mbuf *m;
struct gre_softc *sc;
int msiz;
+ m = *mp;
if ((sc = gre_lookup(m, IPPROTO_MOBILE)) == NULL) {
/* No matching tunnel or tunnel is down. */
m_freem(m);
- return;
+ return (IPPROTO_DONE);
}
if (m->m_len < sizeof(*mip)) {
m = m_pullup(m, sizeof(*mip));
if (m == NULL)
- return;
+ return (IPPROTO_DONE);
}
ip = mtod(m, struct ip *);
mip = mtod(m, struct mobip_h *);
@@ -247,7 +255,7 @@ gre_mobile_input(struct mbuf *m, int hlen)
if (m->m_len < (ip->ip_hl << 2) + msiz) {
m = m_pullup(m, (ip->ip_hl << 2) + msiz);
if (m == NULL)
- return;
+ return (IPPROTO_DONE);
ip = mtod(m, struct ip *);
mip = mtod(m, struct mobip_h *);
}
@@ -257,7 +265,7 @@ gre_mobile_input(struct mbuf *m, int hlen)
if (gre_in_cksum((u_int16_t *)&mip->mh, msiz) != 0) {
m_freem(m);
- return;
+ return (IPPROTO_DONE);
}
bcopy((caddr_t)(ip) + (ip->ip_hl << 2) + msiz, (caddr_t)(ip) +
@@ -282,12 +290,13 @@ gre_mobile_input(struct mbuf *m, int hlen)
if ((GRE2IFP(sc)->if_flags & IFF_MONITOR) != 0) {
m_freem(m);
- return;
+ return (IPPROTO_DONE);
}
m->m_pkthdr.rcvif = GRE2IFP(sc);
netisr_queue(NETISR_IP, m);
+ return (IPPROTO_DONE);
}
/*