route.c (286458) | route.c (286594) |
---|---|
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 286458 2015-08-08 18:14:59Z melifaro $ | 30 * $FreeBSD: head/sys/net/route.c 286594 2015-08-10 20:50:31Z melifaro $ |
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_inet6.h" --- 769 unchanged lines hidden (view full) --- 808 info.rti_flags = flags; 809 info.rti_info[RTAX_DST] = dst; 810 info.rti_info[RTAX_GATEWAY] = gateway; 811 info.rti_info[RTAX_NETMASK] = netmask; 812 return rtrequest1_fib(req, &info, ret_nrt, fibnum); 813} 814 815 | 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_inet6.h" --- 769 unchanged lines hidden (view full) --- 808 info.rti_flags = flags; 809 info.rti_info[RTAX_DST] = dst; 810 info.rti_info[RTAX_GATEWAY] = gateway; 811 info.rti_info[RTAX_NETMASK] = netmask; 812 return rtrequest1_fib(req, &info, ret_nrt, fibnum); 813} 814 815 |
816/* 817 * Iterates over all existing fibs in system calling 818 * @setwa_f function prior to traversing each fib. 819 * Calls @wa_f function for each element in current fib. 820 * If af is not AF_UNSPEC, iterates over fibs in particular 821 * address family. 822 */ |
|
816void | 823void |
817rt_foreach_fib(int af, rt_setwarg_t *setwa_f, rt_walktree_f_t *wa_f, void *arg) | 824rt_foreach_fib_walk(int af, rt_setwarg_t *setwa_f, rt_walktree_f_t *wa_f, 825 void *arg) |
818{ 819 struct radix_node_head *rnh; 820 uint32_t fibnum; 821 int i; 822 823 for (fibnum = 0; fibnum < rt_numfibs; fibnum++) { 824 /* Do we want some specific family? */ 825 if (af != AF_UNSPEC) { --- 68 unchanged lines hidden (view full) --- 894 * Unfortuneatly the only way to do this is to slog through 895 * the entire routing table looking for routes which point 896 * to this interface...oh well... 897 */ 898void 899rt_flushifroutes(struct ifnet *ifp) 900{ 901 | 826{ 827 struct radix_node_head *rnh; 828 uint32_t fibnum; 829 int i; 830 831 for (fibnum = 0; fibnum < rt_numfibs; fibnum++) { 832 /* Do we want some specific family? */ 833 if (af != AF_UNSPEC) { --- 68 unchanged lines hidden (view full) --- 902 * Unfortuneatly the only way to do this is to slog through 903 * the entire routing table looking for routes which point 904 * to this interface...oh well... 905 */ 906void 907rt_flushifroutes(struct ifnet *ifp) 908{ 909 |
902 rt_foreach_fib(AF_UNSPEC, NULL, rt_ifdelroute, ifp); | 910 rt_foreach_fib_walk(AF_UNSPEC, NULL, rt_ifdelroute, ifp); |
903} 904 905/* 906 * These (questionable) definitions of apparent local variables apply 907 * to the next two functions. XXXXXX!!! 908 */ 909#define dst info->rti_info[RTAX_DST] 910#define gateway info->rti_info[RTAX_GATEWAY] --- 1204 unchanged lines hidden --- | 911} 912 913/* 914 * These (questionable) definitions of apparent local variables apply 915 * to the next two functions. XXXXXX!!! 916 */ 917#define dst info->rti_info[RTAX_DST] 918#define gateway info->rti_info[RTAX_GATEWAY] --- 1204 unchanged lines hidden --- |