ip_gre.c (9e669156d49d639980264c8c064e9f95a4105cb6) ip_gre.c (3f2e28fe9ffbb70d26e5cc7abba248e981434853)
1/* $NetBSD: ip_gre.c,v 1.29 2003/09/05 23:02:43 itojun Exp $ */
2/* $FreeBSD$ */
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

--- 90 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
1/* $NetBSD: ip_gre.c,v 1.29 2003/09/05 23:02:43 itojun Exp $ */
2/* $FreeBSD$ */
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

--- 90 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
107gre_input(struct mbuf *m, int off)
114{
108{
115 int off, ret, proto;
116 va_list ap;
109 int ret, proto;
117
110
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
111 proto = (mtod(m, struct ip *))->ip_p;
112
113 ret = gre_input2(m, off, proto);
114 /*
115 * ret == 0 : packet not processed, meaning that
116 * no matching tunnel that is up is found.
117 * we inject it to raw ip socket to see if anyone picks it up.
118 */

--- 102 unchanged lines hidden (view full) ---

221/*
222 * input routine for IPPRPOTO_MOBILE
223 * This is a little bit diffrent from the other modes, as the
224 * encapsulating header was not prepended, but instead inserted
225 * between IP header and payload
226 */
227
228void
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
229gre_mobile_input(struct mbuf *m, int hlen)
246{
247 struct ip *ip;
248 struct mobip_h *mip;
249 struct gre_softc *sc;
230{
231 struct ip *ip;
232 struct mobip_h *mip;
233 struct gre_softc *sc;
250 int hlen;
251 va_list ap;
252 int msiz;
253
234 int msiz;
235
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 ---
236 if ((sc = gre_lookup(m, IPPROTO_MOBILE)) == NULL) {
237 /* No matching tunnel or tunnel is down. */
238 m_freem(m);
239 return;
240 }
241
242 if (m->m_len < sizeof(*mip)) {
243 m = m_pullup(m, sizeof(*mip));

--- 91 unchanged lines hidden ---