Deleted Added
sdiff udiff text old ( 147256 ) new ( 148613 )
full compact
1/* $NetBSD: ip_gre.c,v 1.29 2003/09/05 23:02:43 itojun Exp $ */
2/* $FreeBSD: head/sys/netinet/ip_gre.c 147256 2005-06-10 16:49:24Z brooks $ */
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 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.

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

40/*
41 * deencapsulate tunneled packets and send them on
42 * output half is in net/if_gre.[ch]
43 * This currently handles IPPROTO_GRE, IPPROTO_MOBILE
44 */
45
46#include "opt_inet.h"
47#include "opt_atalk.h"
48
49#include <sys/param.h>
50#include <sys/systm.h>
51#include <sys/mbuf.h>
52#include <sys/socket.h>
53#include <sys/socketvar.h>
54#include <sys/protosw.h>
55#include <sys/errno.h>

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

137 */
138static int
139gre_input2(struct mbuf *m ,int hlen, u_char proto)
140{
141 struct greip *gip;
142 int isr;
143 struct gre_softc *sc;
144 u_int16_t flags;
145
146 if ((sc = gre_lookup(m, proto)) == NULL) {
147 /* No matching tunnel or tunnel is down. */
148 return (0);
149 }
150
151 if (m->m_len < sizeof(*gip)) {
152 m = m_pullup(m, sizeof(*gip));

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

178
179 switch (ntohs(gip->gi_ptype)) { /* ethertypes */
180 case WCCP_PROTOCOL_TYPE:
181 if (sc->wccp_ver == WCCP_V2)
182 hlen += 4;
183 /* FALLTHROUGH */
184 case ETHERTYPE_IP: /* shouldn't need a schednetisr(), */
185 isr = NETISR_IP;/* as we are in ip_input */
186 break;
187#ifdef NETATALK
188 case ETHERTYPE_ATALK:
189 isr = NETISR_ATALK1;
190 break;
191#endif
192 case ETHERTYPE_IPV6:
193 /* FALLTHROUGH */
194 default: /* others not yet supported */
195 return (0);
196 }
197 break;
198 default:
199 /* others not yet supported */
200 return (0);
201 }
202
203 if (hlen > m->m_pkthdr.len) {
204 m_freem(m);
205 return (EINVAL);
206 }
207 /* Unlike NetBSD, in FreeBSD m_adj() adjusts m->m_pkthdr.len as well */
208 m_adj(m, hlen);
209
210 if (GRE2IFP(sc)->if_bpf) {
211 u_int32_t af = AF_INET;
212 bpf_mtap2(GRE2IFP(sc)->if_bpf, &af, sizeof(af), m);
213 }
214
215 m->m_pkthdr.rcvif = GRE2IFP(sc);
216
217 netisr_dispatch(isr, m);
218
219 return (1); /* packet is done, no further processing needed */

--- 128 unchanged lines hidden ---