Changeset View
Changeset View
Standalone View
Standalone View
sys/net/route/route_ctl.c
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | |||||
#else | #else | ||||
#define _MP_FLAGS CTLFLAG_RD | #define _MP_FLAGS CTLFLAG_RD | ||||
#endif | #endif | ||||
VNET_DEFINE(u_int, rib_route_multipath) = 1; | VNET_DEFINE(u_int, rib_route_multipath) = 1; | ||||
SYSCTL_UINT(_net_route, OID_AUTO, multipath, _MP_FLAGS | CTLFLAG_VNET, | SYSCTL_UINT(_net_route, OID_AUTO, multipath, _MP_FLAGS | CTLFLAG_VNET, | ||||
&VNET_NAME(rib_route_multipath), 0, "Enable route multipath"); | &VNET_NAME(rib_route_multipath), 0, "Enable route multipath"); | ||||
#undef _MP_FLAGS | #undef _MP_FLAGS | ||||
#if defined(INET) && defined(INET6) | |||||
/* | |||||
#define V_rib_route_ipv4_nexthop VNET(rib_route_ipv4_nexthop) | |||||
VNET_DEFINE(u_int, rib_route_ipv4_nexthop) = 1; | |||||
SYSCTL_UINT(_net_route, OID_AUTO, ipv4_nexthop, CTLFLAG_RW | CTLFLAG_VNET, | |||||
&VNET_NAME(rib_route_ipv4_nexthop), 0, "Enable IPv6 route via IPv4 Next Hop address"); | |||||
*/ | |||||
#define V_rib_route_ipv6_nexthop VNET(rib_route_ipv6_nexthop) | |||||
VNET_DEFINE(u_int, rib_route_ipv6_nexthop) = 1; | |||||
SYSCTL_UINT(_net_route, OID_AUTO, ipv6_nexthop, CTLFLAG_RW | CTLFLAG_VNET, | |||||
&VNET_NAME(rib_route_ipv6_nexthop), 0, "Enable IPv4 route via IPv6 Next Hop address"); | |||||
#endif | |||||
/* Routing table UMA zone */ | /* Routing table UMA zone */ | ||||
VNET_DEFINE_STATIC(uma_zone_t, rtzone); | VNET_DEFINE_STATIC(uma_zone_t, rtzone); | ||||
#define V_rtzone VNET(rtzone) | #define V_rtzone VNET(rtzone) | ||||
void | void | ||||
vnet_rtzone_init() | vnet_rtzone_init() | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | get_rnh(uint32_t fibnum, const struct rt_addrinfo *info) | ||||
KASSERT((fibnum < rt_numfibs), ("rib_add_route: bad fibnum")); | KASSERT((fibnum < rt_numfibs), ("rib_add_route: bad fibnum")); | ||||
dst = info->rti_info[RTAX_DST]; | dst = info->rti_info[RTAX_DST]; | ||||
rnh = rt_tables_get_rnh(fibnum, dst->sa_family); | rnh = rt_tables_get_rnh(fibnum, dst->sa_family); | ||||
return (rnh); | return (rnh); | ||||
} | } | ||||
#if defined(INET) && defined(INET6) | |||||
/* | |||||
static bool | |||||
rib_can_ipv4_nexthop_address(struct rib_head *rh) | |||||
{ | |||||
int result; | |||||
CURVNET_SET(rh->rib_vnet); | |||||
result = !!V_rib_route_ipv4_nexthop; | |||||
CURVNET_RESTORE(); | |||||
return (result); | |||||
} | |||||
*/ | |||||
static bool | |||||
rib_can_ipv6_nexthop_address(struct rib_head *rh) | |||||
{ | |||||
int result; | |||||
CURVNET_SET(rh->rib_vnet); | |||||
result = !!V_rib_route_ipv6_nexthop; | |||||
CURVNET_RESTORE(); | |||||
return (result); | |||||
} | |||||
#endif | |||||
#ifdef ROUTE_MPATH | #ifdef ROUTE_MPATH | ||||
static bool | static bool | ||||
rib_can_multipath(struct rib_head *rh) | rib_can_multipath(struct rib_head *rh) | ||||
{ | { | ||||
int result; | int result; | ||||
CURVNET_SET(rh->rib_vnet); | CURVNET_SET(rh->rib_vnet); | ||||
result = !!V_rib_route_multipath; | result = !!V_rib_route_multipath; | ||||
▲ Show 20 Lines • Show All 369 Lines • ▼ Show 20 Lines | check_gateway(struct rib_head *rnh, struct sockaddr *dst, | ||||
struct sockaddr *gateway) | struct sockaddr *gateway) | ||||
{ | { | ||||
if (dst->sa_family == gateway->sa_family) | if (dst->sa_family == gateway->sa_family) | ||||
return (true); | return (true); | ||||
else if (gateway->sa_family == AF_UNSPEC) | else if (gateway->sa_family == AF_UNSPEC) | ||||
return (true); | return (true); | ||||
else if (gateway->sa_family == AF_LINK) | else if (gateway->sa_family == AF_LINK) | ||||
return (true); | return (true); | ||||
#if defined(INET) && defined(INET6) | |||||
else if (dst->sa_family == AF_INET && gateway->sa_family == AF_INET6 && | |||||
rib_can_ipv6_nexthop_address(rnh)) | |||||
return (true); | |||||
#endif | |||||
return (false); | return (false); | ||||
} | } | ||||
/* | /* | ||||
* Creates rtentry and nexthop based on @info data. | * Creates rtentry and nexthop based on @info data. | ||||
* Return 0 and fills in rtentry into @prt on success, | * Return 0 and fills in rtentry into @prt on success, | ||||
* return errno otherwise. | * return errno otherwise. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 968 Lines • Show Last 20 Lines |