route.c (193232) | route.c (193731) |
---|---|
1/*- 2 * Copyright (c) 1980, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)route.c 8.3.1.1 (Berkeley) 2/23/95 | 1/*- 2 * Copyright (c) 1980, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)route.c 8.3.1.1 (Berkeley) 2/23/95 |
30 * $FreeBSD: head/sys/net/route.c 193232 2009-06-01 15:49:42Z bz $ | 30 * $FreeBSD: head/sys/net/route.c 193731 2009-06-08 17:15:40Z zec $ |
31 */ 32/************************************************************************ 33 * Note: In this file a 'fib' is a "forwarding information base" * 34 * Which is the new name for an in kernel routing (next hop) table. * 35 ***********************************************************************/ 36 37#include "opt_inet.h" 38#include "opt_route.h" --- 55 unchanged lines hidden (view full) --- 94struct radix_node_head *rt_tables; 95 96static int rttrash; /* routes not in table but not freed */ 97#endif 98 99static void rt_maskedcopy(struct sockaddr *, 100 struct sockaddr *, struct sockaddr *); 101static int vnet_route_iattach(const void *); | 31 */ 32/************************************************************************ 33 * Note: In this file a 'fib' is a "forwarding information base" * 34 * Which is the new name for an in kernel routing (next hop) table. * 35 ***********************************************************************/ 36 37#include "opt_inet.h" 38#include "opt_route.h" --- 55 unchanged lines hidden (view full) --- 94struct radix_node_head *rt_tables; 95 96static int rttrash; /* routes not in table but not freed */ 97#endif 98 99static void rt_maskedcopy(struct sockaddr *, 100 struct sockaddr *, struct sockaddr *); 101static int vnet_route_iattach(const void *); |
102#ifdef VIMAGE 103static int vnet_route_idetach(const void *); 104#endif |
|
102 103#ifndef VIMAGE_GLOBALS 104static const vnet_modinfo_t vnet_rtable_modinfo = { 105 .vmi_id = VNET_MOD_RTABLE, 106 .vmi_name = "rtable", | 105 106#ifndef VIMAGE_GLOBALS 107static const vnet_modinfo_t vnet_rtable_modinfo = { 108 .vmi_id = VNET_MOD_RTABLE, 109 .vmi_name = "rtable", |
107 .vmi_iattach = vnet_route_iattach | 110 .vmi_iattach = vnet_route_iattach, 111#ifdef VIMAGE 112 .vmi_idetach = vnet_route_idetach 113#endif |
108}; 109#endif /* !VIMAGE_GLOBALS */ 110 111/* compare two sockaddr structures */ 112#define sa_equal(a1, a2) (bcmp((a1), (a2), (a1)->sa_len) == 0) 113 114/* 115 * Convert a 'struct radix_node *' to a 'struct rtentry *'. --- 73 unchanged lines hidden (view full) --- 189 190#ifndef VIMAGE_GLOBALS 191 vnet_mod_register(&vnet_rtable_modinfo); 192#else 193 vnet_route_iattach(NULL); 194#endif 195} 196 | 114}; 115#endif /* !VIMAGE_GLOBALS */ 116 117/* compare two sockaddr structures */ 118#define sa_equal(a1, a2) (bcmp((a1), (a2), (a1)->sa_len) == 0) 119 120/* 121 * Convert a 'struct radix_node *' to a 'struct rtentry *'. --- 73 unchanged lines hidden (view full) --- 195 196#ifndef VIMAGE_GLOBALS 197 vnet_mod_register(&vnet_rtable_modinfo); 198#else 199 vnet_route_iattach(NULL); 200#endif 201} 202 |
197static int vnet_route_iattach(const void *unused __unused) | 203static int 204vnet_route_iattach(const void *unused __unused) |
198{ 199 INIT_VNET_NET(curvnet); 200 struct domain *dom; 201 struct radix_node_head **rnh; 202 int table; 203 int fam; 204 205 V_rt_tables = malloc(rt_numfibs * (AF_MAX+1) * --- 24 unchanged lines hidden (view full) --- 230 } 231 } 232 } 233 } 234 235 return (0); 236} 237 | 205{ 206 INIT_VNET_NET(curvnet); 207 struct domain *dom; 208 struct radix_node_head **rnh; 209 int table; 210 int fam; 211 212 V_rt_tables = malloc(rt_numfibs * (AF_MAX+1) * --- 24 unchanged lines hidden (view full) --- 237 } 238 } 239 } 240 } 241 242 return (0); 243} 244 |
245#ifdef VIMAGE 246static int 247vnet_route_idetach(const void *unused __unused) 248{ 249 int table; 250 int fam; 251 struct domain *dom; 252 struct radix_node_head **rnh; 253 254 for (dom = domains; dom; dom = dom->dom_next) { 255 if (dom->dom_rtdetach) { 256 for (table = 0; table < rt_numfibs; table++) { 257 if ( (fam = dom->dom_family) == AF_INET || 258 table == 0) { 259 /* For now only AF_INET has > 1 tbl. */ 260 rnh = rt_tables_get_rnh_ptr(table, fam); 261 if (rnh == NULL) 262 panic("%s: rnh NULL", __func__); 263 dom->dom_rtdetach((void **)rnh, 264 dom->dom_rtoffset); 265 } else { 266 break; 267 } 268 } 269 } 270 } 271 return (0); 272} 273#endif 274 |
|
238#ifndef _SYS_SYSPROTO_H_ 239struct setfib_args { 240 int fibnum; 241}; 242#endif 243int 244setfib(struct thread *td, struct setfib_args *uap) 245{ --- 1214 unchanged lines hidden --- | 275#ifndef _SYS_SYSPROTO_H_ 276struct setfib_args { 277 int fibnum; 278}; 279#endif 280int 281setfib(struct thread *td, struct setfib_args *uap) 282{ --- 1214 unchanged lines hidden --- |