Deleted Added
full compact
ip_encap.c (71999) ip_encap.c (78064)
1/* $FreeBSD: head/sys/netinet/ip_encap.c 71999 2001-02-04 13:13:25Z phk $ */
2/* $KAME: ip_encap.c,v 1.36 2000/06/17 20:34:24 itojun Exp $ */
1/* $FreeBSD: head/sys/netinet/ip_encap.c 78064 2001-06-11 12:39:29Z ume $ */
2/* $KAME: ip_encap.c,v 1.41 2001/03/15 08:35:08 itojun Exp $ */
3
4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:

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

62
63#include <sys/param.h>
64#include <sys/systm.h>
65#include <sys/socket.h>
66#include <sys/sockio.h>
67#include <sys/mbuf.h>
68#include <sys/errno.h>
69#include <sys/protosw.h>
3
4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:

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

62
63#include <sys/param.h>
64#include <sys/systm.h>
65#include <sys/socket.h>
66#include <sys/sockio.h>
67#include <sys/mbuf.h>
68#include <sys/errno.h>
69#include <sys/protosw.h>
70#include <sys/queue.h>
70
71#include <net/if.h>
72#include <net/route.h>
73
74#include <netinet/in.h>
75#include <netinet/in_systm.h>
76#include <netinet/ip.h>
77#include <netinet/ip_var.h>

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

95#include <sys/malloc.h>
96static MALLOC_DEFINE(M_NETADDR, "Export Host", "Export host address structure");
97
98static void encap_add __P((struct encaptab *));
99static int mask_match __P((const struct encaptab *, const struct sockaddr *,
100 const struct sockaddr *));
101static void encap_fillarg __P((struct mbuf *, const struct encaptab *));
102
71
72#include <net/if.h>
73#include <net/route.h>
74
75#include <netinet/in.h>
76#include <netinet/in_systm.h>
77#include <netinet/ip.h>
78#include <netinet/ip_var.h>

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

96#include <sys/malloc.h>
97static MALLOC_DEFINE(M_NETADDR, "Export Host", "Export host address structure");
98
99static void encap_add __P((struct encaptab *));
100static int mask_match __P((const struct encaptab *, const struct sockaddr *,
101 const struct sockaddr *));
102static void encap_fillarg __P((struct mbuf *, const struct encaptab *));
103
104#ifndef LIST_HEAD_INITIALIZER
103/* rely upon BSS initialization */
104LIST_HEAD(, encaptab) encaptab;
105/* rely upon BSS initialization */
106LIST_HEAD(, encaptab) encaptab;
107#else
108LIST_HEAD(, encaptab) encaptab = LIST_HEAD_INITIALIZER(&encaptab);
109#endif
105
106void
107encap_init()
108{
110
111void
112encap_init()
113{
114 static int initialized = 0;
115
116 if (initialized)
117 return;
118 initialized++;
109#if 0
110 /*
111 * we cannot use LIST_INIT() here, since drivers may want to call
112 * encap_attach(), on driver attach. encap_init() will be called
113 * on AF_INET{,6} initialization, which happens after driver
114 * initialization - using LIST_INIT() here can nuke encap_attach()
115 * from drivers.
116 */
117 LIST_INIT(&encaptab);
118#endif
119}
120
119#if 0
120 /*
121 * we cannot use LIST_INIT() here, since drivers may want to call
122 * encap_attach(), on driver attach. encap_init() will be called
123 * on AF_INET{,6} initialization, which happens after driver
124 * initialization - using LIST_INIT() here can nuke encap_attach()
125 * from drivers.
126 */
127 LIST_INIT(&encaptab);
128#endif
129}
130
131#ifdef INET
121void
122#if __STDC__
123encap4_input(struct mbuf *m, ...)
124#else
125encap4_input(m, va_alist)
126 struct mbuf *m;
127 va_dcl
128#endif

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

216 COMPATFUNC(m, off, proto);
217 return;
218 }
219#endif
220
221 /* last resort: inject to raw socket */
222 rip_input(m, off, proto);
223}
132void
133#if __STDC__
134encap4_input(struct mbuf *m, ...)
135#else
136encap4_input(m, va_alist)
137 struct mbuf *m;
138 va_dcl
139#endif

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

227 COMPATFUNC(m, off, proto);
228 return;
229 }
230#endif
231
232 /* last resort: inject to raw socket */
233 rip_input(m, off, proto);
234}
235#endif
224
225#ifdef INET6
226int
227encap6_input(mp, offp, proto)
228 struct mbuf **mp;
229 int *offp;
230 int proto;
231{

--- 303 unchanged lines hidden ---
236
237#ifdef INET6
238int
239encap6_input(mp, offp, proto)
240 struct mbuf **mp;
241 int *offp;
242 int proto;
243{

--- 303 unchanged lines hidden ---