MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_path_check_and_react

Function sctp_path_check_and_react

freebsd/netinet/sctp_asconf.c:1075–1169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1073}
1074
1075static void
1076sctp_path_check_and_react(struct sctp_tcb *stcb, struct sctp_ifa *newifa)
1077{
1078 struct sctp_nets *net;
1079 int addrnum, changed;
1080
1081 /*
1082 * If number of local valid addresses is 1, the valid address is
1083 * probably newly added address. Several valid addresses in this
1084 * association. A source address may not be changed. Additionally,
1085 * they can be configured on a same interface as "alias" addresses.
1086 * (by micchie)
1087 */
1088 addrnum = sctp_local_addr_count(stcb);
1089 SCTPDBG(SCTP_DEBUG_ASCONF1, "p_check_react(): %d local addresses\n",
1090 addrnum);
1091 if (addrnum == 1) {
1092 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
1093 /* clear any cached route and source address */
1094 RO_NHFREE(&net->ro);
1095 if (net->src_addr_selected) {
1096 sctp_free_ifa(net->ro._s_addr);
1097 net->ro._s_addr = NULL;
1098 net->src_addr_selected = 0;
1099 }
1100 /* Retransmit unacknowledged DATA chunks immediately */
1101 if (sctp_is_mobility_feature_on(stcb->sctp_ep,
1102 SCTP_MOBILITY_FASTHANDOFF)) {
1103 sctp_net_immediate_retrans(stcb, net);
1104 }
1105 /* also, SET PRIMARY is maybe already sent */
1106 }
1107 return;
1108 }
1109
1110 /* Multiple local addresses exsist in the association. */
1111 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
1112 /* clear any cached route and source address */
1113 RO_NHFREE(&net->ro);
1114 if (net->src_addr_selected) {
1115 sctp_free_ifa(net->ro._s_addr);
1116 net->ro._s_addr = NULL;
1117 net->src_addr_selected = 0;
1118 }
1119 /*
1120 * Check if the nexthop is corresponding to the new address.
1121 * If the new address is corresponding to the current
1122 * nexthop, the path will be changed. If the new address is
1123 * NOT corresponding to the current nexthop, the path will
1124 * not be changed.
1125 */
1126 SCTP_RTALLOC((sctp_route_t *)&net->ro,
1127 stcb->sctp_ep->def_vrf_id,
1128 stcb->sctp_ep->fibnum);
1129 if (net->ro.ro_nh == NULL)
1130 continue;
1131
1132 changed = 0;

Callers 1

Calls 6

sctp_local_addr_countFunction · 0.85
sctp_free_ifaFunction · 0.85
sctp_v4src_match_nexthopFunction · 0.85
sctp_v6src_match_nexthopFunction · 0.85
sctp_asconf_queue_mgmtFunction · 0.85

Tested by

no test coverage detected