1/* $NetBSD: ip_gre.c,v 1.29 2003/09/05 23:02:43 itojun Exp $ */
2/* $FreeBSD: head/sys/netinet/ip_gre.c 148613 2005-08-01 08:14:21Z bz $ */
3
4/*-
5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Heiko W.Rupp <hwr@pilhuhn.de>
10 *
--- 88 unchanged lines hidden (view full) ---
99
100/*
101 * De-encapsulate a packet and feed it back through ip input (this
102 * routine is called whenever IP gets a packet with proto type
103 * IPPROTO_GRE and a local destination address).
104 * This really is simple
105 */
106void
107#if __STDC__
108gre_input(struct mbuf *m, ...)
109#else
110gre_input(m, va_alist)
111 struct mbuf *m;
112 va_dcl
113#endif
114{
115 int off, ret, proto;
116 va_list ap;
117
118 va_start(ap, m);
119 off = va_arg(ap, int);
120 va_end(ap);
121 proto = (mtod(m, struct ip *))->ip_p;
122
123 ret = gre_input2(m, off, proto);
124 /*
125 * ret == 0 : packet not processed, meaning that
126 * no matching tunnel that is up is found.
127 * we inject it to raw ip socket to see if anyone picks it up.
128 */
--- 102 unchanged lines hidden (view full) ---
231/*
232 * input routine for IPPRPOTO_MOBILE
233 * This is a little bit diffrent from the other modes, as the
234 * encapsulating header was not prepended, but instead inserted
235 * between IP header and payload
236 */
237
238void
239#if __STDC__
240gre_mobile_input(struct mbuf *m, ...)
241#else
242gre_mobile_input(m, va_alist)
243 struct mbuf *m;
244 va_dcl
245#endif
246{
247 struct ip *ip;
248 struct mobip_h *mip;
249 struct gre_softc *sc;
250 int hlen;
251 va_list ap;
252 int msiz;
253
254 va_start(ap, m);
255 hlen = va_arg(ap, int);
256 va_end(ap);
257
258 if ((sc = gre_lookup(m, IPPROTO_MOBILE)) == NULL) {
259 /* No matching tunnel or tunnel is down. */
260 m_freem(m);
261 return;
262 }
263
264 if (m->m_len < sizeof(*mip)) {
265 m = m_pullup(m, sizeof(*mip));
--- 91 unchanged lines hidden ---
2/* $FreeBSD: head/sys/netinet/ip_gre.c 148613 2005-08-01 08:14:21Z bz $ */
3
4/*-
5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Heiko W.Rupp <hwr@pilhuhn.de>
10 *
--- 88 unchanged lines hidden (view full) ---
99
100/*
101 * De-encapsulate a packet and feed it back through ip input (this
102 * routine is called whenever IP gets a packet with proto type
103 * IPPROTO_GRE and a local destination address).
104 * This really is simple
105 */
106void
107#if __STDC__
108gre_input(struct mbuf *m, ...)
109#else
110gre_input(m, va_alist)
111 struct mbuf *m;
112 va_dcl
113#endif
114{
115 int off, ret, proto;
116 va_list ap;
117
118 va_start(ap, m);
119 off = va_arg(ap, int);
120 va_end(ap);
121 proto = (mtod(m, struct ip *))->ip_p;
122
123 ret = gre_input2(m, off, proto);
124 /*
125 * ret == 0 : packet not processed, meaning that
126 * no matching tunnel that is up is found.
127 * we inject it to raw ip socket to see if anyone picks it up.
128 */
--- 102 unchanged lines hidden (view full) ---
231/*
232 * input routine for IPPRPOTO_MOBILE
233 * This is a little bit diffrent from the other modes, as the
234 * encapsulating header was not prepended, but instead inserted
235 * between IP header and payload
236 */
237
238void
239#if __STDC__
240gre_mobile_input(struct mbuf *m, ...)
241#else
242gre_mobile_input(m, va_alist)
243 struct mbuf *m;
244 va_dcl
245#endif
246{
247 struct ip *ip;
248 struct mobip_h *mip;
249 struct gre_softc *sc;
250 int hlen;
251 va_list ap;
252 int msiz;
253
254 va_start(ap, m);
255 hlen = va_arg(ap, int);
256 va_end(ap);
257
258 if ((sc = gre_lookup(m, IPPROTO_MOBILE)) == NULL) {
259 /* No matching tunnel or tunnel is down. */
260 m_freem(m);
261 return;
262 }
263
264 if (m->m_len < sizeof(*mip)) {
265 m = m_pullup(m, sizeof(*mip));
--- 91 unchanged lines hidden ---