summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorsilby <silby@FreeBSD.org>2002-06-14 02:36:34 +0000
committersilby <silby@FreeBSD.org>2002-06-14 02:36:34 +0000
commitacb0745bfa68988b8d0cde904671fa3ec632f361 (patch)
tree81478ca710ba7576d2156faab17630cfd30302b1 /sys/netinet
parentb7f83f53f9f626f04e3bc752801604713555442e (diff)
downloadFreeBSD-src-acb0745bfa68988b8d0cde904671fa3ec632f361.zip
FreeBSD-src-acb0745bfa68988b8d0cde904671fa3ec632f361.tar.gz
Ensure that the syn cache's syn-ack packets contain the same
ip_tos, ip_ttl, and DF bits as all other tcp packets. PR: 39141 MFC after: 2 weeks
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/tcp_output.c2
-rw-r--r--sys/netinet/tcp_syncache.c18
-rw-r--r--sys/netinet/tcp_var.h1
3 files changed, 20 insertions, 1 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 40ed7ee..8a55d28 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -83,7 +83,7 @@
extern struct mbuf *m_copypack();
#endif
-static int path_mtu_discovery = 1;
+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");
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 40defbe..e4c467e 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -1128,6 +1128,24 @@ syncache_respond(sc, m)
th = (struct tcphdr *)(ip + 1);
}
+
+ ip->ip_ttl = sc->sc_tp->t_inpcb->inp_ip_ttl; /* XXX */
+ ip->ip_tos = sc->sc_tp->t_inpcb->inp_ip_tos; /* XXX */
+
+ /*
+ * See if we should do MTU discovery. We do it only if the following
+ * are true:
+ * 1) we have a valid route to the destination
+ * 2) the MTU is not locked (if it is, then discovery has been
+ * disabled)
+ */
+ if (path_mtu_discovery
+ && (rt != NULL)
+ && rt->rt_flags & RTF_UP
+ && !(rt->rt_rmx.rmx_locks & RTV_MTU)) {
+ ip->ip_off |= IP_DF;
+ }
+
th->th_sport = sc->sc_inc.inc_lport;
th->th_dport = sc->sc_inc.inc_fport;
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index e8eb361..bce5d29 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -432,6 +432,7 @@ extern struct tcpstat tcpstat; /* tcp statistics */
extern int tcp_mssdflt; /* XXX */
extern int tcp_delack_enabled;
extern int tcp_do_newreno;
+extern int path_mtu_discovery;
extern int ss_fltsz;
extern int ss_fltsz_local;
OpenPOWER on IntegriCloud