svn commit: r231478 - stable/8/sys/netinet
Michael Tuexen
tuexen at FreeBSD.org
Fri Feb 10 23:38:39 UTC 2012
Author: tuexen
Date: Fri Feb 10 23:38:38 2012
New Revision: 231478
URL: http://svn.freebsd.org/changeset/base/231478
Log:
MFC r227540:
Set the MTU of an path to an approriate value if the interface MTU
can't be determined.
Modified:
stable/8/sys/netinet/sctp_pcb.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/boot/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/e1000/ (props changed)
Modified: stable/8/sys/netinet/sctp_pcb.c
==============================================================================
--- stable/8/sys/netinet/sctp_pcb.c Fri Feb 10 23:36:33 2012 (r231477)
+++ stable/8/sys/netinet/sctp_pcb.c Fri Feb 10 23:38:38 2012 (r231478)
@@ -4064,13 +4064,8 @@ sctp_add_remote_addr(struct sctp_tcb *st
/* 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 *st
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 *st
(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);
More information about the svn-src-all
mailing list