Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/sctp_asconf.c
Show First 20 Lines • Show All 974 Lines • ▼ Show 20 Lines | TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { | ||||
* route's interface is NOT the same as the address change. | * route's interface is NOT the same as the address change. | ||||
* If it's the same interface, just clear the cached source | * If it's the same interface, just clear the cached source | ||||
* address. | * address. | ||||
*/ | */ | ||||
if (SCTP_ROUTE_HAS_VALID_IFN(&net->ro) && | if (SCTP_ROUTE_HAS_VALID_IFN(&net->ro) && | ||||
((ifn == NULL) || | ((ifn == NULL) || | ||||
(SCTP_GET_IF_INDEX_FROM_ROUTE(&net->ro) != ifn->ifn_index))) { | (SCTP_GET_IF_INDEX_FROM_ROUTE(&net->ro) != ifn->ifn_index))) { | ||||
/* clear any cached route */ | /* clear any cached route */ | ||||
RTFREE(net->ro.ro_rt); | RO_NHFREE(&net->ro); | ||||
net->ro.ro_rt = NULL; | |||||
} | } | ||||
/* clear any cached source address */ | /* clear any cached source address */ | ||||
if (net->src_addr_selected) { | if (net->src_addr_selected) { | ||||
sctp_free_ifa(net->ro._s_addr); | sctp_free_ifa(net->ro._s_addr); | ||||
net->ro._s_addr = NULL; | net->ro._s_addr = NULL; | ||||
net->src_addr_selected = 0; | net->src_addr_selected = 0; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | sctp_path_check_and_react(struct sctp_tcb *stcb, struct sctp_ifa *newifa) | ||||
* (by micchie) | * (by micchie) | ||||
*/ | */ | ||||
addrnum = sctp_local_addr_count(stcb); | addrnum = sctp_local_addr_count(stcb); | ||||
SCTPDBG(SCTP_DEBUG_ASCONF1, "p_check_react(): %d local addresses\n", | SCTPDBG(SCTP_DEBUG_ASCONF1, "p_check_react(): %d local addresses\n", | ||||
addrnum); | addrnum); | ||||
if (addrnum == 1) { | if (addrnum == 1) { | ||||
TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { | TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { | ||||
/* clear any cached route and source address */ | /* clear any cached route and source address */ | ||||
if (net->ro.ro_rt) { | RO_NHFREE(&net->ro); | ||||
RTFREE(net->ro.ro_rt); | |||||
net->ro.ro_rt = NULL; | |||||
} | |||||
if (net->src_addr_selected) { | if (net->src_addr_selected) { | ||||
sctp_free_ifa(net->ro._s_addr); | sctp_free_ifa(net->ro._s_addr); | ||||
net->ro._s_addr = NULL; | net->ro._s_addr = NULL; | ||||
net->src_addr_selected = 0; | net->src_addr_selected = 0; | ||||
} | } | ||||
/* Retransmit unacknowledged DATA chunks immediately */ | /* Retransmit unacknowledged DATA chunks immediately */ | ||||
if (sctp_is_mobility_feature_on(stcb->sctp_ep, | if (sctp_is_mobility_feature_on(stcb->sctp_ep, | ||||
SCTP_MOBILITY_FASTHANDOFF)) { | SCTP_MOBILITY_FASTHANDOFF)) { | ||||
sctp_net_immediate_retrans(stcb, net); | sctp_net_immediate_retrans(stcb, net); | ||||
} | } | ||||
/* also, SET PRIMARY is maybe already sent */ | /* also, SET PRIMARY is maybe already sent */ | ||||
} | } | ||||
return; | return; | ||||
} | } | ||||
/* Multiple local addresses exsist in the association. */ | /* Multiple local addresses exsist in the association. */ | ||||
TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { | TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { | ||||
/* clear any cached route and source address */ | /* clear any cached route and source address */ | ||||
if (net->ro.ro_rt) { | RO_NHFREE(&net->ro); | ||||
RTFREE(net->ro.ro_rt); | |||||
net->ro.ro_rt = NULL; | |||||
} | |||||
if (net->src_addr_selected) { | if (net->src_addr_selected) { | ||||
sctp_free_ifa(net->ro._s_addr); | sctp_free_ifa(net->ro._s_addr); | ||||
net->ro._s_addr = NULL; | net->ro._s_addr = NULL; | ||||
net->src_addr_selected = 0; | net->src_addr_selected = 0; | ||||
} | } | ||||
/* | /* | ||||
* Check if the nexthop is corresponding to the new address. | * Check if the nexthop is corresponding to the new address. | ||||
* If the new address is corresponding to the current | * If the new address is corresponding to the current | ||||
* nexthop, the path will be changed. If the new address is | * nexthop, the path will be changed. If the new address is | ||||
* NOT corresponding to the current nexthop, the path will | * NOT corresponding to the current nexthop, the path will | ||||
* not be changed. | * not be changed. | ||||
*/ | */ | ||||
SCTP_RTALLOC((sctp_route_t *)&net->ro, | SCTP_RTALLOC((sctp_route_t *)&net->ro, | ||||
stcb->sctp_ep->def_vrf_id, | stcb->sctp_ep->def_vrf_id, | ||||
stcb->sctp_ep->fibnum); | stcb->sctp_ep->fibnum); | ||||
if (net->ro.ro_rt == NULL) | if (net->ro.ro_nh == NULL) | ||||
continue; | continue; | ||||
changed = 0; | changed = 0; | ||||
switch (net->ro._l_addr.sa.sa_family) { | switch (net->ro._l_addr.sa.sa_family) { | ||||
#ifdef INET | #ifdef INET | ||||
case AF_INET: | case AF_INET: | ||||
if (sctp_v4src_match_nexthop(newifa, (sctp_route_t *)&net->ro)) { | if (sctp_v4src_match_nexthop(newifa, (sctp_route_t *)&net->ro)) { | ||||
changed = 1; | changed = 1; | ||||
▲ Show 20 Lines • Show All 1,066 Lines • ▼ Show 20 Lines | #endif | ||||
if (type == SCTP_ADD_IP_ADDRESS) { | if (type == SCTP_ADD_IP_ADDRESS) { | ||||
/* prevent this address from being used as a source */ | /* prevent this address from being used as a source */ | ||||
sctp_add_local_addr_restricted(stcb, ifa); | sctp_add_local_addr_restricted(stcb, ifa); | ||||
} else if (type == SCTP_DEL_IP_ADDRESS) { | } else if (type == SCTP_DEL_IP_ADDRESS) { | ||||
struct sctp_nets *net; | struct sctp_nets *net; | ||||
TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { | TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { | ||||
sctp_rtentry_t *rt; | |||||
/* delete this address if cached */ | /* delete this address if cached */ | ||||
if (net->ro._s_addr == ifa) { | if (net->ro._s_addr == ifa) { | ||||
sctp_free_ifa(net->ro._s_addr); | sctp_free_ifa(net->ro._s_addr); | ||||
net->ro._s_addr = NULL; | net->ro._s_addr = NULL; | ||||
net->src_addr_selected = 0; | net->src_addr_selected = 0; | ||||
rt = net->ro.ro_rt; | RO_NHFREE(&net->ro); | ||||
if (rt) { | |||||
RTFREE(rt); | |||||
net->ro.ro_rt = NULL; | |||||
} | |||||
/* | /* | ||||
* Now we deleted our src address, | * Now we deleted our src address, | ||||
* should we not also now reset the | * should we not also now reset the | ||||
* cwnd/rto to start as if its a new | * cwnd/rto to start as if its a new | ||||
* address? | * address? | ||||
*/ | */ | ||||
stcb->asoc.cc_functions.sctp_set_initial_cc_param(stcb, net); | stcb->asoc.cc_functions.sctp_set_initial_cc_param(stcb, net); | ||||
net->RTO = 0; | net->RTO = 0; | ||||
▲ Show 20 Lines • Show All 1,270 Lines • Show Last 20 Lines |