1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * 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 --- 16 unchanged lines hidden (view full) --- 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 * $KAME: nd6_rtr.c,v 1.111 2001/04/27 01:37:15 jinmei Exp $ 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/netinet6/nd6_rtr.c 193232 2009-06-01 15:49:42Z bz $"); |
34 35#include "opt_inet.h" 36#include "opt_inet6.h" 37#include "opt_route.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/malloc.h> --- 1502 unchanged lines hidden (view full) --- 1544 } 1545 } 1546 } 1547} 1548 1549int 1550nd6_prefix_onlink(struct nd_prefix *pr) 1551{ |
1552 INIT_VNET_INET6(curvnet); 1553 struct ifaddr *ifa; 1554 struct ifnet *ifp = pr->ndpr_ifp; 1555 struct sockaddr_in6 mask6; 1556 struct nd_prefix *opr; 1557 u_long rtflags; 1558 int error = 0; 1559 struct radix_node_head *rnh; --- 66 unchanged lines hidden (view full) --- 1626 bzero(&mask6, sizeof(mask6)); 1627 mask6.sin6_len = sizeof(mask6); 1628 mask6.sin6_addr = pr->ndpr_mask; 1629 rtflags = ifa->ifa_flags | RTF_UP; 1630 error = rtrequest(RTM_ADD, (struct sockaddr *)&pr->ndpr_prefix, 1631 ifa->ifa_addr, (struct sockaddr *)&mask6, rtflags, &rt); 1632 if (error == 0) { 1633 if (rt != NULL) /* this should be non NULL, though */ { |
1634 rnh = rt_tables_get_rnh(rt->rt_fibnum, AF_INET6); 1635 /* XXX what if rhn == NULL? */ |
1636 RADIX_NODE_HEAD_LOCK(rnh); 1637 RT_LOCK(rt); 1638 if (!rt_setgate(rt, rt_key(rt), (struct sockaddr *)&null_sdl)) { 1639 ((struct sockaddr_dl *)rt->rt_gateway)->sdl_type = 1640 rt->rt_ifp->if_type; 1641 ((struct sockaddr_dl *)rt->rt_gateway)->sdl_index = 1642 rt->rt_ifp->if_index; 1643 } --- 409 unchanged lines hidden (view full) --- 2053/* 2054 * Delete all the routing table entries that use the specified gateway. 2055 * XXX: this function causes search through all entries of routing table, so 2056 * it shouldn't be called when acting as a router. 2057 */ 2058void 2059rt6_flush(struct in6_addr *gateway, struct ifnet *ifp) 2060{ |
2061 struct radix_node_head *rnh; |
2062 int s = splnet(); 2063 2064 /* We'll care only link-local addresses */ 2065 if (!IN6_IS_ADDR_LINKLOCAL(gateway)) { 2066 splx(s); 2067 return; 2068 } 2069 |
2070 rnh = rt_tables_get_rnh(0, AF_INET6); 2071 if (rnh == NULL) 2072 return; 2073 |
2074 RADIX_NODE_HEAD_LOCK(rnh); 2075 rnh->rnh_walktree(rnh, rt6_deleteroute, (void *)gateway); 2076 RADIX_NODE_HEAD_UNLOCK(rnh); 2077 splx(s); 2078} 2079 2080static int 2081rt6_deleteroute(struct radix_node *rn, void *arg) --- 61 unchanged lines hidden --- |