summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_syncache.c
diff options
context:
space:
mode:
authorsilby <silby@FreeBSD.org>2002-06-14 03:08:05 +0000
committersilby <silby@FreeBSD.org>2002-06-14 03:08:05 +0000
commit86950bb1f4b520cb14150be632a047ba2d686a46 (patch)
treea4075c16821c9689076b925a0c7b200573f3ca7d /sys/netinet/tcp_syncache.c
parent0bbc7c9dc50832c581f689991f9b7d5fa84ba9f9 (diff)
downloadFreeBSD-src-86950bb1f4b520cb14150be632a047ba2d686a46.zip
FreeBSD-src-86950bb1f4b520cb14150be632a047ba2d686a46.tar.gz
Re-commit w/fix:
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 This time, make sure that ipv4 specific code (aka all of the above) is only run in the ipv4 case.
Diffstat (limited to 'sys/netinet/tcp_syncache.c')
-rw-r--r--sys/netinet/tcp_syncache.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 40defbe..0ef2f3d 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -1116,15 +1116,29 @@ syncache_respond(sc, m)
ip = mtod(m, struct ip *);
ip->ip_v = IPVERSION;
ip->ip_hl = sizeof(struct ip) >> 2;
- ip->ip_tos = 0;
ip->ip_len = tlen;
ip->ip_id = 0;
ip->ip_off = 0;
- ip->ip_ttl = ip_defttl;
ip->ip_sum = 0;
ip->ip_p = IPPROTO_TCP;
ip->ip_src = sc->sc_inc.inc_laddr;
ip->ip_dst = sc->sc_inc.inc_faddr;
+ 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 = (struct tcphdr *)(ip + 1);
}
OpenPOWER on IntegriCloud