Deleted Added
full compact
ip_gre.c (107670) ip_gre.c (111888)
1/* $NetBSD: ip_gre.c,v 1.21 2002/08/14 00:23:30 itojun Exp $ */
1/* $NetBSD: ip_gre.c,v 1.21 2002/08/14 00:23:30 itojun Exp $ */
2/* $FreeBSD: head/sys/netinet/ip_gre.c 107670 2002-12-07 14:22:05Z sobomax $ */
2/* $FreeBSD: head/sys/netinet/ip_gre.c 111888 2003-03-04 23:19:55Z jlemon $ */
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 *

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

141 * proto is the protocol number of the "calling" foo_input()
142 * routine.
143 */
144
145static int
146gre_input2(struct mbuf *m ,int hlen, u_char proto)
147{
148 struct greip *gip = mtod(m, struct greip *);
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 *

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

141 * proto is the protocol number of the "calling" foo_input()
142 * routine.
143 */
144
145static int
146gre_input2(struct mbuf *m ,int hlen, u_char proto)
147{
148 struct greip *gip = mtod(m, struct greip *);
149 int s;
150 struct ifqueue *ifq;
149 int isr;
151 struct gre_softc *sc;
152 u_short flags;
153
154 if ((sc = gre_lookup(m, proto)) == NULL) {
155 /* No matching tunnel or tunnel is down. */
156 return (0);
157 }
158

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

175 if (flags & GRE_KP)
176 hlen += 4;
177 if (flags & GRE_SP)
178 hlen +=4;
179
180 switch (ntohs(gip->gi_ptype)) { /* ethertypes */
181 case ETHERTYPE_IP: /* shouldn't need a schednetisr(), as */
182 case WCCP_PROTOCOL_TYPE: /* we are in ip_input */
150 struct gre_softc *sc;
151 u_short flags;
152
153 if ((sc = gre_lookup(m, proto)) == NULL) {
154 /* No matching tunnel or tunnel is down. */
155 return (0);
156 }
157

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

174 if (flags & GRE_KP)
175 hlen += 4;
176 if (flags & GRE_SP)
177 hlen +=4;
178
179 switch (ntohs(gip->gi_ptype)) { /* ethertypes */
180 case ETHERTYPE_IP: /* shouldn't need a schednetisr(), as */
181 case WCCP_PROTOCOL_TYPE: /* we are in ip_input */
183 ifq = &ipintrq;
182 isr = NETISR_IP;
184 break;
185#ifdef NS
186 case ETHERTYPE_NS:
183 break;
184#ifdef NS
185 case ETHERTYPE_NS:
187 ifq = &nsintrq;
188 schednetisr(NETISR_NS);
186 isr = NETISR_NS;
189 break;
190#endif
191#ifdef NETATALK
192 case ETHERTYPE_ATALK:
187 break;
188#endif
189#ifdef NETATALK
190 case ETHERTYPE_ATALK:
193 ifq = &atintrq1;
194 schednetisr(NETISR_ATALK);
191 isr = NETISR_ATALK1;
195 break;
196#endif
197 case ETHERTYPE_IPV6:
198 /* FALLTHROUGH */
199 default: /* others not yet supported */
200 return(0);
201 }
202 break;

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

217 m0.m_len = 4;
218 m0.m_data = (char *)&af;
219
220 BPF_MTAP(&(sc->sc_if), &m0);
221 }
222
223 m->m_pkthdr.rcvif = &sc->sc_if;
224
192 break;
193#endif
194 case ETHERTYPE_IPV6:
195 /* FALLTHROUGH */
196 default: /* others not yet supported */
197 return(0);
198 }
199 break;

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

214 m0.m_len = 4;
215 m0.m_data = (char *)&af;
216
217 BPF_MTAP(&(sc->sc_if), &m0);
218 }
219
220 m->m_pkthdr.rcvif = &sc->sc_if;
221
225 s = splnet(); /* possible */
226 if (_IF_QFULL(ifq)) {
227 _IF_DROP(ifq);
228 m_freem(m);
229 } else {
230 IF_ENQUEUE(ifq,m);
231 }
232 splx(s);
222 netisr_dispatch(isr, m);
233
234 return(1); /* packet is done, no further processing needed */
235}
236
237/*
238 * input routine for IPPRPOTO_MOBILE
239 * This is a little bit diffrent from the other modes, as the
240 * encapsulating header was not prepended, but instead inserted

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

247#else
248gre_mobile_input(m, va_alist)
249 struct mbuf *m;
250 va_dcl
251#endif
252{
253 struct ip *ip = mtod(m, struct ip *);
254 struct mobip_h *mip = mtod(m, struct mobip_h *);
223
224 return(1); /* packet is done, no further processing needed */
225}
226
227/*
228 * input routine for IPPRPOTO_MOBILE
229 * This is a little bit diffrent from the other modes, as the
230 * encapsulating header was not prepended, but instead inserted

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

237#else
238gre_mobile_input(m, va_alist)
239 struct mbuf *m;
240 va_dcl
241#endif
242{
243 struct ip *ip = mtod(m, struct ip *);
244 struct mobip_h *mip = mtod(m, struct mobip_h *);
255 struct ifqueue *ifq;
256 struct gre_softc *sc;
245 struct gre_softc *sc;
257 int hlen,s;
246 int hlen;
258 va_list ap;
259 u_char osrc = 0;
260 int msiz;
261
262 va_start(ap,m);
263 hlen = va_arg(ap, int);
264 va_end(ap);
265

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

312 m0.m_len = 4;
313 m0.m_data = (char *)&af;
314
315 BPF_MTAP(&(sc->sc_if), &m0);
316 }
317
318 m->m_pkthdr.rcvif = &sc->sc_if;
319
247 va_list ap;
248 u_char osrc = 0;
249 int msiz;
250
251 va_start(ap,m);
252 hlen = va_arg(ap, int);
253 va_end(ap);
254

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

301 m0.m_len = 4;
302 m0.m_data = (char *)&af;
303
304 BPF_MTAP(&(sc->sc_if), &m0);
305 }
306
307 m->m_pkthdr.rcvif = &sc->sc_if;
308
320 ifq = &ipintrq;
321 s = splnet(); /* possible */
322 if (_IF_QFULL(ifq)) {
323 _IF_DROP(ifq);
324 m_freem(m);
325 } else {
326 IF_ENQUEUE(ifq,m);
327 }
328 splx(s);
309 netisr_dispatch(NETISR_IP, m);
329}
330
331/*
332 * Find the gre interface associated with our src/dst/proto set.
333 */
334static struct gre_softc *
335gre_lookup(m, proto)
336 struct mbuf *m;

--- 16 unchanged lines hidden ---
310}
311
312/*
313 * Find the gre interface associated with our src/dst/proto set.
314 */
315static struct gre_softc *
316gre_lookup(m, proto)
317 struct mbuf *m;

--- 16 unchanged lines hidden ---