Deleted Added
full compact
route.c (200537) route.c (201282)
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 200537 2009-12-14 20:12:51Z luigi $
30 * $FreeBSD: head/sys/net/route.c 201282 2009-12-30 21:35:34Z qingli $
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"

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

93VNET_DEFINE(int, rttrash); /* routes not in table but not freed */
94VNET_DEFINE(struct rtstat, rtstat);
95
96#define V_rt_tables VNET(rt_tables)
97#define V_rtzone VNET(rtzone)
98#define V_rttrash VNET(rttrash)
99#define V_rtstat VNET(rtstat)
100
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"

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

93VNET_DEFINE(int, rttrash); /* routes not in table but not freed */
94VNET_DEFINE(struct rtstat, rtstat);
95
96#define V_rt_tables VNET(rt_tables)
97#define V_rtzone VNET(rtzone)
98#define V_rttrash VNET(rttrash)
99#define V_rtstat VNET(rtstat)
100
101static void rt_maskedcopy(struct sockaddr *,
102 struct sockaddr *, struct sockaddr *);
103
104/* compare two sockaddr structures */
105#define sa_equal(a1, a2) (bcmp((a1), (a2), (a1)->sa_len) == 0)
106
107/*
108 * Convert a 'struct radix_node *' to a 'struct rtentry *'.
109 * The operation can be done safely (in this code) because a
110 * 'struct rtentry' starts with two 'struct radix_node''s, the first

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

1317 /*
1318 * Copy the new gateway value into the memory chunk.
1319 */
1320 bcopy(gate, rt->rt_gateway, glen);
1321
1322 return (0);
1323}
1324
101
102/* compare two sockaddr structures */
103#define sa_equal(a1, a2) (bcmp((a1), (a2), (a1)->sa_len) == 0)
104
105/*
106 * Convert a 'struct radix_node *' to a 'struct rtentry *'.
107 * The operation can be done safely (in this code) because a
108 * 'struct rtentry' starts with two 'struct radix_node''s, the first

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

1315 /*
1316 * Copy the new gateway value into the memory chunk.
1317 */
1318 bcopy(gate, rt->rt_gateway, glen);
1319
1320 return (0);
1321}
1322
1325static void
1323void
1326rt_maskedcopy(struct sockaddr *src, struct sockaddr *dst, struct sockaddr *netmask)
1327{
1328 register u_char *cp1 = (u_char *)src;
1329 register u_char *cp2 = (u_char *)dst;
1330 register u_char *cp3 = (u_char *)netmask;
1331 u_char *cplim = cp2 + *cp3;
1332 u_char *cplim2 = cp2 + *cp1;
1333

--- 244 unchanged lines hidden ---
1324rt_maskedcopy(struct sockaddr *src, struct sockaddr *dst, struct sockaddr *netmask)
1325{
1326 register u_char *cp1 = (u_char *)src;
1327 register u_char *cp2 = (u_char *)dst;
1328 register u_char *cp3 = (u_char *)netmask;
1329 u_char *cplim = cp2 + *cp3;
1330 u_char *cplim2 = cp2 + *cp1;
1331

--- 244 unchanged lines hidden ---