Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/nd6_nbr.c
Show First 20 Lines • Show All 249 Lines • ▼ Show 20 Lines | nd6_ns_input(struct mbuf *m, int off, int icmp6len) | ||||
if (ifp->if_carp) | if (ifp->if_carp) | ||||
ifa = (*carp_iamatch6_p)(ifp, &taddr6); | ifa = (*carp_iamatch6_p)(ifp, &taddr6); | ||||
else | else | ||||
ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); | ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); | ||||
/* (2) check. */ | /* (2) check. */ | ||||
proxy = 0; | proxy = 0; | ||||
if (ifa == NULL) { | if (ifa == NULL) { | ||||
struct sockaddr_dl rt_gateway; | struct llentry *ln; | ||||
melifaro: Nit: worth considering moving it out as a separate function? like, `fill_proxyndp(struct infect… | |||||
takahiro.kurosawa_gmail.comAuthorUnsubmitted Done Inline ActionsApplied, readability gets improved indeed. takahiro.kurosawa_gmail.com: Applied, readability gets improved indeed. | |||||
struct rt_addrinfo info; | |||||
struct sockaddr_in6 dst6; | |||||
bzero(&dst6, sizeof(dst6)); | ln = nd6_lookup(&taddr6, LLE_SF(AF_INET6, 0), ifp); | ||||
dst6.sin6_len = sizeof(struct sockaddr_in6); | if (ln != NULL) { | ||||
dst6.sin6_family = AF_INET6; | if ((ln->la_flags & (LLE_PUB | LLE_VALID)) | ||||
dst6.sin6_addr = taddr6; | == (LLE_PUB | LLE_VALID)) { | ||||
link_init_sdl(ifp, (struct sockaddr *)&proxydl, | |||||
bzero(&rt_gateway, sizeof(rt_gateway)); | ifp->if_type); | ||||
rt_gateway.sdl_len = sizeof(rt_gateway); | proxydl.sdl_alen = ifp->if_addrlen; | ||||
bzero(&info, sizeof(info)); | bcopy(ln->ll_addr, &proxydl.sdl_data, | ||||
Not Done Inline ActionsNit: no need to check LLE_STATIC and LLE_IFADDR here. melifaro: Nit: no need to check `LLE_STATIC` and `LLE_IFADDR` here. | |||||
Done Inline ActionsFixed. Thanks! takahiro.kurosawa_gmail.com: Fixed. Thanks! | |||||
info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&rt_gateway; | ifp->if_addrlen); | ||||
if (rib_lookup_info(ifp->if_fib, (struct sockaddr *)&dst6, | |||||
0, 0, &info) == 0) { | |||||
if ((info.rti_flags & RTF_ANNOUNCE) != 0 && | |||||
rt_gateway.sdl_family == AF_LINK) { | |||||
/* | |||||
* proxy NDP for single entry | |||||
*/ | |||||
proxydl = *SDL(&rt_gateway); | |||||
ifa = (struct ifaddr *)in6ifa_ifpforlinklocal( | ifa = (struct ifaddr *)in6ifa_ifpforlinklocal( | ||||
ifp, IN6_IFF_NOTREADY|IN6_IFF_ANYCAST); | ifp, IN6_IFF_NOTREADY|IN6_IFF_ANYCAST); | ||||
if (ifa) | if (ifa) | ||||
proxy = 1; | proxy = 1; | ||||
} | } | ||||
LLE_RUNLOCK(ln); | |||||
} | } | ||||
} | } | ||||
if (ifa == NULL) { | if (ifa == NULL) { | ||||
/* | /* | ||||
* We've got an NS packet, and we don't have that adddress | * We've got an NS packet, and we don't have that adddress | ||||
* assigned for us. We MUST silently ignore it. | * assigned for us. We MUST silently ignore it. | ||||
* See RFC2461 7.2.3. | * See RFC2461 7.2.3. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 1,295 Lines • Show Last 20 Lines |
Nit: worth considering moving it out as a separate function? like, fill_proxyndp(struct infect *ifp, struct in6_addr *taddr, struct. sockaddr_dl *proxydl).
Should improve readability a bit.