Deleted Added
full compact
ip_gre.c (271863) ip_gre.c (271918)
1/* $NetBSD: ip_gre.c,v 1.29 2003/09/05 23:02:43 itojun Exp $ */
2
3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Heiko W.Rupp <hwr@pilhuhn.de>

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

33
34/*
35 * deencapsulate tunneled packets and send them on
36 * output half is in net/if_gre.[ch]
37 * This currently handles IPPROTO_GRE, IPPROTO_MOBILE
38 */
39
40#include <sys/cdefs.h>
1/* $NetBSD: ip_gre.c,v 1.29 2003/09/05 23:02:43 itojun Exp $ */
2
3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Heiko W.Rupp <hwr@pilhuhn.de>

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

33
34/*
35 * deencapsulate tunneled packets and send them on
36 * output half is in net/if_gre.[ch]
37 * This currently handles IPPROTO_GRE, IPPROTO_MOBILE
38 */
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/sys/netinet/ip_gre.c 271863 2014-09-19 10:19:51Z glebius $");
41__FBSDID("$FreeBSD: head/sys/netinet/ip_gre.c 271918 2014-09-21 03:56:06Z hrs $");
42
43#include "opt_inet.h"
44#include "opt_inet6.h"
45
46#include <sys/param.h>
47#include <sys/systm.h>
48#include <sys/mbuf.h>
49#include <sys/socket.h>

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

310 * in_gre.c during destroy.
311 */
312static struct gre_softc *
313gre_lookup(struct mbuf *m, u_int8_t proto)
314{
315 struct ip *ip = mtod(m, struct ip *);
316 struct gre_softc *sc;
317
42
43#include "opt_inet.h"
44#include "opt_inet6.h"
45
46#include <sys/param.h>
47#include <sys/systm.h>
48#include <sys/mbuf.h>
49#include <sys/socket.h>

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

310 * in_gre.c during destroy.
311 */
312static struct gre_softc *
313gre_lookup(struct mbuf *m, u_int8_t proto)
314{
315 struct ip *ip = mtod(m, struct ip *);
316 struct gre_softc *sc;
317
318 mtx_lock(&gre_mtx);
319 for (sc = LIST_FIRST(&gre_softc_list); sc != NULL;
318 GRE_LIST_LOCK();
319 for (sc = LIST_FIRST(&V_gre_softc_list); sc != NULL;
320 sc = LIST_NEXT(sc, sc_list)) {
321 if ((sc->g_dst.s_addr == ip->ip_src.s_addr) &&
322 (sc->g_src.s_addr == ip->ip_dst.s_addr) &&
323 (sc->g_proto == proto) &&
324 ((GRE2IFP(sc)->if_flags & IFF_UP) != 0)) {
320 sc = LIST_NEXT(sc, sc_list)) {
321 if ((sc->g_dst.s_addr == ip->ip_src.s_addr) &&
322 (sc->g_src.s_addr == ip->ip_dst.s_addr) &&
323 (sc->g_proto == proto) &&
324 ((GRE2IFP(sc)->if_flags & IFF_UP) != 0)) {
325 mtx_unlock(&gre_mtx);
325 GRE_LIST_UNLOCK();
326 return (sc);
327 }
328 }
326 return (sc);
327 }
328 }
329 mtx_unlock(&gre_mtx);
329 GRE_LIST_UNLOCK();
330
331 return (NULL);
332}
330
331 return (NULL);
332}