Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/nd6_rtr.c
Show First 20 Lines • Show All 2,159 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
int | int | ||||
nd6_prefix_offlink(struct nd_prefix *pr) | nd6_prefix_offlink(struct nd_prefix *pr) | ||||
{ | { | ||||
int error = 0; | int error = 0; | ||||
struct ifnet *ifp = pr->ndpr_ifp; | struct ifnet *ifp = pr->ndpr_ifp; | ||||
struct nd_prefix *opr; | struct nd_prefix *opr; | ||||
struct sockaddr_in6 sa6; | |||||
char ip6buf[INET6_ADDRSTRLEN]; | char ip6buf[INET6_ADDRSTRLEN]; | ||||
uint64_t genid; | uint64_t genid; | ||||
int a_failure; | int a_failure; | ||||
ND6_ONLINK_LOCK_ASSERT(); | ND6_ONLINK_LOCK_ASSERT(); | ||||
ND6_UNLOCK_ASSERT(); | ND6_UNLOCK_ASSERT(); | ||||
if ((pr->ndpr_stateflags & NDPRF_ONLINK) == 0) | if ((pr->ndpr_stateflags & NDPRF_ONLINK) == 0) | ||||
return (EEXIST); | return (EEXIST); | ||||
struct sockaddr_in6 mask6 = { | struct sockaddr_in6 mask6 = { | ||||
.sin6_family = AF_INET6, | .sin6_family = AF_INET6, | ||||
.sin6_len = sizeof(struct sockaddr_in6), | .sin6_len = sizeof(struct sockaddr_in6), | ||||
.sin6_addr = pr->ndpr_mask, | .sin6_addr = pr->ndpr_mask, | ||||
}; | }; | ||||
struct sockaddr_in6 *pmask6 = (pr->ndpr_plen != 128) ? &mask6 : NULL; | struct sockaddr_in6 *pmask6 = (pr->ndpr_plen != 128) ? &mask6 : NULL; | ||||
error = nd6_prefix_rtrequest(ifp->if_fib, RTM_DELETE, | error = nd6_prefix_rtrequest(ifp->if_fib, RTM_DELETE, | ||||
&pr->ndpr_prefix, pmask6, ifp, NULL); | &pr->ndpr_prefix, pmask6, ifp, NULL); | ||||
a_failure = 1; | a_failure = 1; | ||||
if (error == 0) { | if (error == 0) { | ||||
donner: If an error occured, a_failure is 1 and will never be reset. | |||||
Done Inline ActionsAre you saying that we should not call lltable_prefix_free() in that case? markj: Are you saying that we should not call lltable_prefix_free() in that case? | |||||
pr->ndpr_stateflags &= ~NDPRF_ONLINK; | pr->ndpr_stateflags &= ~NDPRF_ONLINK; | ||||
/* | /* | ||||
* There might be the same prefix on another interface, | * There might be the same prefix on another interface, | ||||
* the prefix which could not be on-link just because we have | * the prefix which could not be on-link just because we have | ||||
* the interface route (see comments in nd6_prefix_onlink). | * the interface route (see comments in nd6_prefix_onlink). | ||||
* If there's one, try to make the prefix on-link on the | * If there's one, try to make the prefix on-link on the | ||||
* interface. | * interface. | ||||
Show All 36 Lines | restart: | ||||
/* XXX: can we still set the NDPRF_ONLINK flag? */ | /* XXX: can we still set the NDPRF_ONLINK flag? */ | ||||
nd6log((LOG_ERR, | nd6log((LOG_ERR, | ||||
"%s: failed to delete route: %s/%d on %s (errno=%d)\n", | "%s: failed to delete route: %s/%d on %s (errno=%d)\n", | ||||
__func__, ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr), | __func__, ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr), | ||||
pr->ndpr_plen, if_name(ifp), error)); | pr->ndpr_plen, if_name(ifp), error)); | ||||
} | } | ||||
if (a_failure) | if (a_failure) | ||||
lltable_prefix_free(AF_INET6, (struct sockaddr *)&sa6, | lltable_prefix_free(AF_INET6, | ||||
(struct sockaddr *)&pr->ndpr_prefix, | |||||
(struct sockaddr *)&mask6, LLE_STATIC); | (struct sockaddr *)&mask6, LLE_STATIC); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* ia0 - corresponding public address | * ia0 - corresponding public address | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 327 Lines • Show Last 20 Lines |
If an error occured, a_failure is 1 and will never be reset.