Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet6/in6_fib.c
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
#ifdef INET6 | #ifdef INET6 | ||||
static void fib6_rte_to_nh_extended(struct rtentry *rte, | static void fib6_rte_to_nh_extended(struct rtentry *rte, | ||||
const struct in6_addr *dst, uint32_t flags, struct nhop6_extended *pnh6); | const struct in6_addr *dst, uint32_t flags, struct nhop6_extended *pnh6); | ||||
static void fib6_rte_to_nh_basic(struct rtentry *rte, const struct in6_addr *dst, | static void fib6_rte_to_nh_basic(struct rtentry *rte, const struct in6_addr *dst, | ||||
uint32_t flags, struct nhop6_basic *pnh6); | uint32_t flags, struct nhop6_basic *pnh6); | ||||
static struct ifnet *fib6_get_ifaifp(struct rtentry *rte); | static struct ifnet *fib6_get_ifaifp(struct rtentry *rte); | ||||
#define RNTORT(p) ((struct rtentry *)(p)) | #define RNTORT(p) ((struct rtentry *)(p)) | ||||
#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa)) | |||||
CHK_STRUCT_ROUTE_COMPAT(struct route_in6, ro_dst); | CHK_STRUCT_ROUTE_COMPAT(struct route_in6, ro_dst); | ||||
/* | /* | ||||
* Gets real interface for the @rte. | * Gets real interface for the @rte. | ||||
* Returns rt_ifp for !IFF_LOOPBACK routers. | * Returns rt_ifp for !IFF_LOOPBACK routers. | ||||
* Extracts "real" address interface from interface address | * Extracts "real" address interface from interface address | ||||
* loopback routes. | * loopback routes. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | if (rte->rt_flags & RTF_GATEWAY) { | ||||
pnh6->nh_addr = gw->sin6_addr; | pnh6->nh_addr = gw->sin6_addr; | ||||
} else | } else | ||||
pnh6->nh_addr = *dst; | pnh6->nh_addr = *dst; | ||||
/* Set flags */ | /* Set flags */ | ||||
pnh6->nh_flags = fib_rte_to_nh_flags(rte->rt_flags); | pnh6->nh_flags = fib_rte_to_nh_flags(rte->rt_flags); | ||||
gw = (struct sockaddr_in6 *)rt_key(rte); | gw = (struct sockaddr_in6 *)rt_key(rte); | ||||
if (IN6_IS_ADDR_UNSPECIFIED(&gw->sin6_addr)) | if (IN6_IS_ADDR_UNSPECIFIED(&gw->sin6_addr)) | ||||
pnh6->nh_flags |= NHF_DEFAULT; | pnh6->nh_flags |= NHF_DEFAULT; | ||||
pnh6->nh_ia = ifatoia6(rte->rt_ifa); | |||||
} | } | ||||
/* | /* | ||||
* Performs IPv6 route table lookup on @dst. Returns 0 on success. | * Performs IPv6 route table lookup on @dst. Returns 0 on success. | ||||
* Stores basic nexthop info into provided @pnh6 structure. | * Stores basic nexthop info into provided @pnh6 structure. | ||||
* Note that | * Note that | ||||
* - nh_ifp represents logical transmit interface (rt_ifp) by default | * - nh_ifp represents logical transmit interface (rt_ifp) by default | ||||
* - nh_ifp represents "address" interface if NHR_IFAIF flag is passed | * - nh_ifp represents "address" interface if NHR_IFAIF flag is passed | ||||
▲ Show 20 Lines • Show All 117 Lines • Show Last 20 Lines |