Changeset View
Standalone View
sys/netinet6/nd6_nbr.c
Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | if (ifa == NULL) { | ||||
dst6.sin6_family = AF_INET6; | dst6.sin6_family = AF_INET6; | ||||
dst6.sin6_addr = taddr6; | dst6.sin6_addr = taddr6; | ||||
bzero(&rt_gateway, sizeof(rt_gateway)); | bzero(&rt_gateway, sizeof(rt_gateway)); | ||||
rt_gateway.sdl_len = sizeof(rt_gateway); | rt_gateway.sdl_len = sizeof(rt_gateway); | ||||
bzero(&info, sizeof(info)); | bzero(&info, sizeof(info)); | ||||
info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&rt_gateway; | info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&rt_gateway; | ||||
/* Always use the default FIB. */ | if (rib_lookup_info(ifp->if_fib, (struct sockaddr *)&dst6, | ||||
asomers: As with `nd6_is_new_addr_neighbor`, we should get @bz's review here. | |||||
jhujhiti_adjectivism.orgAuthorUnsubmitted Not Done Inline ActionsI think this is the only thing left to consider for this patch, but it seems to me that using the receiving interface's FIB is the most correct thing to do here. Checking other FIBs seems incorrect since that would cause the proxy to "leak" across FIB boundaries. jhujhiti_adjectivism.org: I think this is the only thing left to consider for this patch, but it seems to me that using… | |||||
asomersUnsubmitted Not Done Inline ActionsAt this point, dst6 is the destination address of the received ns packet. ns packets are sent either to unicast or multicast addresses. In the former case, we should never receive a ns packet except to an address we already use, and it should only arrive at the interface that's using that address (unless your interface fib is different than fib the address was configured with, but I would call that a configuration error). If it's a multicast packet, the same logic applies, except that there's a small chance for us to receive a multicast ns packet for an address that's not ours. But even in that case, the packet should arrive at the interface that's a member of that multicast group, unless the group's unicast address is configured for a different fib than the interface. In summary, I think it's ok to use the receiving interface's fib here. asomers: At this point, `dst6` is the destination address of the received ns packet. ns packets are… | |||||
if (rib_lookup_info(RT_DEFAULT_FIB, (struct sockaddr *)&dst6, | |||||
0, 0, &info) == 0) { | 0, 0, &info) == 0) { | ||||
if ((info.rti_flags & RTF_ANNOUNCE) != 0 && | if ((info.rti_flags & RTF_ANNOUNCE) != 0 && | ||||
rt_gateway.sdl_family == AF_LINK) { | rt_gateway.sdl_family == AF_LINK) { | ||||
/* | /* | ||||
* proxy NDP for single entry | * proxy NDP for single entry | ||||
*/ | */ | ||||
proxydl = *SDL(&rt_gateway); | proxydl = *SDL(&rt_gateway); | ||||
▲ Show 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | if (ifa != NULL) { | ||||
ip6->ip6_src = *saddr6; | ip6->ip6_src = *saddr6; | ||||
ifa_free(ifa); | ifa_free(ifa); | ||||
} else { | } else { | ||||
int error; | int error; | ||||
struct in6_addr dst6, src6; | struct in6_addr dst6, src6; | ||||
uint32_t scopeid; | uint32_t scopeid; | ||||
in6_splitscope(&ip6->ip6_dst, &dst6, &scopeid); | in6_splitscope(&ip6->ip6_dst, &dst6, &scopeid); | ||||
error = in6_selectsrc_addr(RT_DEFAULT_FIB, &dst6, | error = in6_selectsrc_addr(fibnum, &dst6, | ||||
scopeid, ifp, &src6, NULL); | scopeid, ifp, &src6, NULL); | ||||
if (error) { | if (error) { | ||||
char ip6buf[INET6_ADDRSTRLEN]; | char ip6buf[INET6_ADDRSTRLEN]; | ||||
nd6log((LOG_DEBUG, "%s: source can't be " | nd6log((LOG_DEBUG, "%s: source can't be " | ||||
"determined: dst=%s, error=%d\n", __func__, | "determined: dst=%s, error=%d\n", __func__, | ||||
ip6_sprintf(ip6buf, &dst6), | ip6_sprintf(ip6buf, &dst6), | ||||
error)); | error)); | ||||
goto bad; | goto bad; | ||||
▲ Show 20 Lines • Show All 480 Lines • ▼ Show 20 Lines | if (IN6_IS_ADDR_UNSPECIFIED(&daddr6)) { | ||||
flags &= ~ND_NA_FLAG_SOLICITED; | flags &= ~ND_NA_FLAG_SOLICITED; | ||||
} | } | ||||
ip6->ip6_dst = daddr6; | ip6->ip6_dst = daddr6; | ||||
/* | /* | ||||
* Select a source whose scope is the same as that of the dest. | * Select a source whose scope is the same as that of the dest. | ||||
*/ | */ | ||||
in6_splitscope(&daddr6, &dst6, &scopeid); | in6_splitscope(&daddr6, &dst6, &scopeid); | ||||
error = in6_selectsrc_addr(RT_DEFAULT_FIB, &dst6, | error = in6_selectsrc_addr(fibnum, &dst6, | ||||
scopeid, ifp, &src6, NULL); | scopeid, ifp, &src6, NULL); | ||||
if (error) { | if (error) { | ||||
char ip6buf[INET6_ADDRSTRLEN]; | char ip6buf[INET6_ADDRSTRLEN]; | ||||
nd6log((LOG_DEBUG, "nd6_na_output: source can't be " | nd6log((LOG_DEBUG, "nd6_na_output: source can't be " | ||||
"determined: dst=%s, error=%d\n", | "determined: dst=%s, error=%d\n", | ||||
ip6_sprintf(ip6buf, &daddr6), error)); | ip6_sprintf(ip6buf, &daddr6), error)); | ||||
goto bad; | goto bad; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 552 Lines • Show Last 20 Lines |
As with nd6_is_new_addr_neighbor, we should get @bz's review here.