1/* $NetBSD: ip_gre.c,v 1.29 2003/09/05 23:02:43 itojun Exp $ */
2/* $FreeBSD: head/sys/netinet/ip_gre.c 154625 2006-01-21 10:44:34Z 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
107gre_input(struct mbuf *m, int off)
108{
109 int ret, proto;
110
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
229gre_mobile_input(struct mbuf *m, int hlen)
230{
231 struct ip *ip;
232 struct mobip_h *mip;
233 struct gre_softc *sc;
234 int msiz;
235
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 ---
2/* $FreeBSD: head/sys/netinet/ip_gre.c 154625 2006-01-21 10:44:34Z 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
107gre_input(struct mbuf *m, int off)
108{
109 int ret, proto;
110
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
229gre_mobile_input(struct mbuf *m, int hlen)
230{
231 struct ip *ip;
232 struct mobip_h *mip;
233 struct gre_softc *sc;
234 int msiz;
235
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 ---