Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/nd6.c
Show First 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
nd6_lle_event(void *arg __unused, struct llentry *lle, int evt) | nd6_lle_event(void *arg __unused, struct llentry *lle, int evt) | ||||
{ | { | ||||
struct rt_addrinfo rtinfo; | struct rt_addrinfo rtinfo; | ||||
struct sockaddr_in6 dst; | struct sockaddr_in6 dst; | ||||
struct sockaddr_dl gw; | struct sockaddr_dl gw; | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
int type; | int type; | ||||
int fibnum; | |||||
LLE_WLOCK_ASSERT(lle); | LLE_WLOCK_ASSERT(lle); | ||||
if (lltable_get_af(lle->lle_tbl) != AF_INET6) | if (lltable_get_af(lle->lle_tbl) != AF_INET6) | ||||
return; | return; | ||||
switch (evt) { | switch (evt) { | ||||
case LLENTRY_RESOLVED: | case LLENTRY_RESOLVED: | ||||
Show All 11 Lines | nd6_lle_event(void *arg __unused, struct llentry *lle, int evt) | ||||
ifp = lltable_get_ifp(lle->lle_tbl); | ifp = lltable_get_ifp(lle->lle_tbl); | ||||
bzero(&dst, sizeof(dst)); | bzero(&dst, sizeof(dst)); | ||||
bzero(&gw, sizeof(gw)); | bzero(&gw, sizeof(gw)); | ||||
bzero(&rtinfo, sizeof(rtinfo)); | bzero(&rtinfo, sizeof(rtinfo)); | ||||
lltable_fill_sa_entry(lle, (struct sockaddr *)&dst); | lltable_fill_sa_entry(lle, (struct sockaddr *)&dst); | ||||
dst.sin6_scope_id = in6_getscopezone(ifp, | dst.sin6_scope_id = in6_getscopezone(ifp, | ||||
in6_addrscope(&dst.sin6_addr)); | in6_addrscope(&dst.sin6_addr)); | ||||
gw.sdl_len = sizeof(struct sockaddr_dl); | gw = (struct sockaddr_dl){ | ||||
gw.sdl_family = AF_LINK; | .sdl_len = sizeof(gw), | ||||
gw.sdl_alen = ifp->if_addrlen; | .sdl_family = AF_LINK, | ||||
gw.sdl_index = ifp->if_index; | .sdl_alen = ifp->if_addrlen, | ||||
gw.sdl_type = ifp->if_type; | .sdl_index = ifp->if_index, | ||||
if (evt == LLENTRY_RESOLVED) | .sdl_type = ifp->if_type, | ||||
}; | |||||
bz: This is a style change and not necessarily needed (though I also prefer sizeof(gw) :-) ). | |||||
if (lle->ll_addr != NULL) | |||||
bcopy(lle->ll_addr, gw.sdl_data, ifp->if_addrlen); | bcopy(lle->ll_addr, gw.sdl_data, ifp->if_addrlen); | ||||
rtinfo.rti_info[RTAX_DST] = (struct sockaddr *)&dst; | rtinfo = (struct rt_addrinfo){ | ||||
rtinfo.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&gw; | .rti_info[RTAX_DST] = (struct sockaddr *)&dst, | ||||
rtinfo.rti_addrs = RTA_DST | RTA_GATEWAY; | .rti_info[RTAX_GATEWAY] = (struct sockaddr *)&gw, | ||||
fibnum = V_rt_add_addr_allfibs ? RT_ALL_FIBS : ifp->if_fib; | .rti_addrs = RTA_DST | RTA_GATEWAY, | ||||
}; | |||||
rt_missmsg_fib(type, &rtinfo, RTF_HOST | RTF_LLDATA | ( | rt_missmsg_fib(type, &rtinfo, RTF_HOST | RTF_LLDATA | ( | ||||
type == RTM_ADD ? RTF_UP: 0), 0, fibnum); | type == RTM_ADD ? RTF_UP: 0), 0, | ||||
(V_rt_add_addr_allfibs) ? RT_ALL_FIBS : ifp->if_fib); | |||||
} | } | ||||
bzUnsubmitted Done Inline ActionsThe entire rtinfo block again is a style change and no functional change, right? Maybe you can commit these upfront so they are not part of the functional changes? bz: The entire rtinfo block again is a style change and no functional change, right? Maybe you can… | |||||
/* | /* | ||||
* A handler for interface link layer address change event. | * A handler for interface link layer address change event. | ||||
*/ | */ | ||||
static void | static void | ||||
nd6_iflladdr(void *arg __unused, struct ifnet *ifp) | nd6_iflladdr(void *arg __unused, struct ifnet *ifp) | ||||
{ | { | ||||
Show All 31 Lines | |||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
void | void | ||||
nd6_destroy() | nd6_destroy() | ||||
{ | { | ||||
callout_drain(&V_nd6_slowtimo_ch); | callout_drain(&V_nd6_slowtimo_ch); | ||||
callout_drain(&V_nd6_timer_ch); | callout_drain(&V_nd6_timer_ch); | ||||
if (IS_DEFAULT_VNET(curvnet)) { | |||||
EVENTHANDLER_DEREGISTER(ifnet_link_event, ifnet_link_event_eh); | |||||
EVENTHANDLER_DEREGISTER(lle_event, lle_event_eh); | |||||
EVENTHANDLER_DEREGISTER(iflladdr_event, iflladdr_event_eh); | |||||
} | |||||
rw_destroy(&V_nd6_lock); | rw_destroy(&V_nd6_lock); | ||||
mtx_destroy(&V_nd6_onlink_mtx); | mtx_destroy(&V_nd6_onlink_mtx); | ||||
} | } | ||||
#endif | #endif | ||||
struct nd_ifinfo * | struct nd_ifinfo * | ||||
nd6_ifattach(struct ifnet *ifp) | nd6_ifattach(struct ifnet *ifp) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 2,489 Lines • Show Last 20 Lines |
This is a style change and not necessarily needed (though I also prefer sizeof(gw) :-) ).