diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/tcp_output.c | 2 | ||||
-rw-r--r-- | sys/netinet/tcp_syncache.c | 18 | ||||
-rw-r--r-- | sys/netinet/tcp_var.h | 1 |
3 files changed, 18 insertions, 3 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 40ed7ee41141..8a55d28e38c5 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 40defbe8b4e2..0ef2f3dc4033 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); } diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index e8eb361506e9..bce5d29637d8 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; |