Set the MTU of an path to an approriate value if the interface MTU
can't be determined. MFC after: 3 days.
This commit is contained in:
parent
1249ba5fc6
commit
a62e467ac3
@ -4064,13 +4064,8 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
|
||||
/* Now get the interface MTU */
|
||||
if (net->ro._s_addr && net->ro._s_addr->ifn_p) {
|
||||
net->mtu = SCTP_GATHER_MTU_FROM_INTFC(net->ro._s_addr->ifn_p);
|
||||
} else {
|
||||
net->mtu = 0;
|
||||
}
|
||||
if (net->mtu == 0) {
|
||||
/* Huh ?? */
|
||||
net->mtu = SCTP_DEFAULT_MTU;
|
||||
} else {
|
||||
if (net->mtu > 0) {
|
||||
uint32_t rmtu;
|
||||
|
||||
rmtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, net->ro.ro_rt);
|
||||
@ -4090,11 +4085,31 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
|
||||
net->mtu = rmtu;
|
||||
}
|
||||
}
|
||||
if (from == SCTP_ALLOC_ASOC) {
|
||||
stcb->asoc.smallest_mtu = net->mtu;
|
||||
}
|
||||
if (net->mtu == 0) {
|
||||
switch (newaddr->sa_family) {
|
||||
#ifdef INET
|
||||
case AF_INET:
|
||||
net->mtu = SCTP_DEFAULT_MTU;
|
||||
break;
|
||||
#endif
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
net->mtu = 1280;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
net->mtu = stcb->asoc.smallest_mtu;
|
||||
}
|
||||
if (net->port) {
|
||||
net->mtu -= (uint32_t) sizeof(struct udphdr);
|
||||
}
|
||||
if (from == SCTP_ALLOC_ASOC) {
|
||||
stcb->asoc.smallest_mtu = net->mtu;
|
||||
}
|
||||
if (stcb->asoc.smallest_mtu > net->mtu) {
|
||||
stcb->asoc.smallest_mtu = net->mtu;
|
||||
}
|
||||
#ifdef INET6
|
||||
if (newaddr->sa_family == AF_INET6) {
|
||||
@ -4104,12 +4119,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
|
||||
(void)sa6_recoverscope(sin6);
|
||||
}
|
||||
#endif
|
||||
if (net->port) {
|
||||
net->mtu -= sizeof(struct udphdr);
|
||||
}
|
||||
if (stcb->asoc.smallest_mtu > net->mtu) {
|
||||
stcb->asoc.smallest_mtu = net->mtu;
|
||||
}
|
||||
|
||||
/* JRS - Use the congestion control given in the CC module */
|
||||
if (stcb->asoc.cc_functions.sctp_set_initial_cc_param != NULL)
|
||||
(*stcb->asoc.cc_functions.sctp_set_initial_cc_param) (stcb, net);
|
||||
|
Loading…
x
Reference in New Issue
Block a user