Deleted Added
full compact
ip_gre.c (103026) ip_gre.c (103032)
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 103026 2002-09-06 17:12:50Z sobomax $ */
2/* $FreeBSD: head/sys/netinet/ip_gre.c 103032 2002-09-06 18:16:03Z sobomax $ */
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 *

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

39
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 <sys/cdefs.h>
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 *

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

39
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 <sys/cdefs.h>
47__RCSID("@(#) $FreeBSD: head/sys/netinet/ip_gre.c 103026 2002-09-06 17:12:50Z sobomax $");
47__RCSID("@(#) $FreeBSD: head/sys/netinet/ip_gre.c 103032 2002-09-06 18:16:03Z sobomax $");
48
49#include "opt_inet.h"
50#include "opt_ns.h"
51#include "opt_atalk.h"
52#include "bpf.h"
53
54#include <sys/param.h>
55#include <sys/systm.h>

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

95#include <net/if_gre.h>
96
97#include <machine/stdarg.h>
98
99#if 1
100void gre_inet_ntoa(struct in_addr in); /* XXX */
101#endif
102
48
49#include "opt_inet.h"
50#include "opt_ns.h"
51#include "opt_atalk.h"
52#include "bpf.h"
53
54#include <sys/param.h>
55#include <sys/systm.h>

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

95#include <net/if_gre.h>
96
97#include <machine/stdarg.h>
98
99#if 1
100void gre_inet_ntoa(struct in_addr in); /* XXX */
101#endif
102
103struct gre_softc *gre_lookup __P((struct mbuf *, u_int8_t));
103static struct gre_softc *gre_lookup __P((struct mbuf *, u_int8_t));
104
104
105int gre_input2 __P((struct mbuf *, int, u_char));
105static int gre_input2 __P((struct mbuf *, int, u_char));
106
107/*
108 * De-encapsulate a packet and feed it back through ip input (this
109 * routine is called whenever IP gets a packet with proto type
110 * IPPROTO_GRE and a local destination address).
111 * This really is simple
112 */
113void

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

141 * decapsulate.
142 * Does the real work and is called from gre_input() (above)
143 * returns 0 if packet is not yet processed
144 * and 1 if it needs no further processing
145 * proto is the protocol number of the "calling" foo_input()
146 * routine.
147 */
148
106
107/*
108 * De-encapsulate a packet and feed it back through ip input (this
109 * routine is called whenever IP gets a packet with proto type
110 * IPPROTO_GRE and a local destination address).
111 * This really is simple
112 */
113void

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

141 * decapsulate.
142 * Does the real work and is called from gre_input() (above)
143 * returns 0 if packet is not yet processed
144 * and 1 if it needs no further processing
145 * proto is the protocol number of the "calling" foo_input()
146 * routine.
147 */
148
149int
149static int
150gre_input2(struct mbuf *m ,int hlen, u_char proto)
151{
152 struct greip *gip = mtod(m, struct greip *);
153 int s;
154 struct ifqueue *ifq;
155 struct gre_softc *sc;
156 u_short flags;
157

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

334 IF_ENQUEUE(ifq,m);
335 }
336 splx(s);
337}
338
339/*
340 * Find the gre interface associated with our src/dst/proto set.
341 */
150gre_input2(struct mbuf *m ,int hlen, u_char proto)
151{
152 struct greip *gip = mtod(m, struct greip *);
153 int s;
154 struct ifqueue *ifq;
155 struct gre_softc *sc;
156 u_short flags;
157

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

334 IF_ENQUEUE(ifq,m);
335 }
336 splx(s);
337}
338
339/*
340 * Find the gre interface associated with our src/dst/proto set.
341 */
342struct gre_softc *
342static struct gre_softc *
343gre_lookup(m, proto)
344 struct mbuf *m;
345 u_int8_t proto;
346{
347 struct ip *ip = mtod(m, struct ip *);
348 struct gre_softc *sc;
349
350 for (sc = LIST_FIRST(&gre_softc_list); sc != NULL;
351 sc = LIST_NEXT(sc, sc_list)) {
352 if ((sc->g_dst.s_addr == ip->ip_src.s_addr) &&
353 (sc->g_src.s_addr == ip->ip_dst.s_addr) &&
354 (sc->g_proto == proto) &&
355 ((sc->sc_if.if_flags & IFF_UP) != 0))
356 return (sc);
357 }
358
359 return (NULL);
360}
343gre_lookup(m, proto)
344 struct mbuf *m;
345 u_int8_t proto;
346{
347 struct ip *ip = mtod(m, struct ip *);
348 struct gre_softc *sc;
349
350 for (sc = LIST_FIRST(&gre_softc_list); sc != NULL;
351 sc = LIST_NEXT(sc, sc_list)) {
352 if ((sc->g_dst.s_addr == ip->ip_src.s_addr) &&
353 (sc->g_src.s_addr == ip->ip_dst.s_addr) &&
354 (sc->g_proto == proto) &&
355 ((sc->sc_if.if_flags & IFF_UP) != 0))
356 return (sc);
357 }
358
359 return (NULL);
360}