1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

Added net.inet.tcp.path_mtu_discovery variable which when set to 0

(default 1) disables PMTUD globally. Although PMTUD can be disabled in
the standard case by locking the MTU on a static route (including the
default route), this method doesn't work in the face of dynamic routing
protocols like gated.
This commit is contained in:
David Greenman 1999-05-27 12:24:21 +00:00
parent afed137543
commit 9a039a5fec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=47547

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_output.c 8.4 (Berkeley) 5/24/95
* $Id: tcp_output.c,v 1.32 1999/01/20 17:31:59 fenner Exp $
* $Id: tcp_output.c,v 1.33 1999/04/07 22:22:06 julian Exp $
*/
#include "opt_tcpdebug.h"
@ -40,6 +40,8 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
#include <sys/mbuf.h>
#include <sys/protosw.h>
#include <sys/socket.h>
@ -67,6 +69,10 @@
extern struct mbuf *m_copypack();
#endif
static int path_mtu_discovery = 1;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, path_mtu_discovery, CTLFLAG_RW,
&path_mtu_discovery, 1, "Enable Path MTU Discovery");
/*
* Tcp output routine: figure out what should be sent and send it.
@ -673,13 +679,10 @@ tcp_output(tp)
*/
m->m_pkthdr.len = hdrlen + len;
{
#if 1
struct rtentry *rt;
#endif
((struct ip *)ti)->ip_len = m->m_pkthdr.len;
((struct ip *)ti)->ip_ttl = tp->t_inpcb->inp_ip_ttl; /* XXX */
((struct ip *)ti)->ip_tos = tp->t_inpcb->inp_ip_tos; /* XXX */
#if 1
/*
* See if we should do MTU discovery. We do it only if the following
* are true:
@ -687,12 +690,12 @@ tcp_output(tp)
* 2) the MTU is not locked (if it is, then discovery has been
* disabled)
*/
if ((rt = tp->t_inpcb->inp_route.ro_rt)
if (path_mtu_discovery
&& (rt = tp->t_inpcb->inp_route.ro_rt)
&& rt->rt_flags & RTF_UP
&& !(rt->rt_rmx.rmx_locks & RTV_MTU)) {
((struct ip *)ti)->ip_off |= IP_DF;
}
#endif
error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route,
so->so_options & SO_DONTROUTE, 0);
}
@ -702,7 +705,6 @@ tcp_output(tp)
tcp_quench(tp->t_inpcb, 0);
return (0);
}
#if 1
if (error == EMSGSIZE) {
/*
* ip_output() will have already fixed the route
@ -713,7 +715,6 @@ tcp_output(tp)
tcp_mtudisc(tp->t_inpcb, 0);
return 0;
}
#endif
if ((error == EHOSTUNREACH || error == ENETDOWN)
&& TCPS_HAVERCVDSYN(tp->t_state)) {
tp->t_softerror = error;