Module Name: src Committed By: riz Date: Sun Apr 3 15:06:14 UTC 2011
Modified Files: src/sys/netinet [netbsd-4-0]: tcp_output.c Log Message: Pull up following revision(s) (requested by spz in ticket #1424): sys/netinet/tcp_output.c: revision 1.170 Clean up setting ECN bit in TOS. Fixes PR 44742 To generate a diff of this commit: cvs rdiff -u -r1.153.2.1 -r1.153.2.1.4.1 src/sys/netinet/tcp_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet/tcp_output.c diff -u src/sys/netinet/tcp_output.c:1.153.2.1 src/sys/netinet/tcp_output.c:1.153.2.1.4.1 --- src/sys/netinet/tcp_output.c:1.153.2.1 Thu May 24 19:13:14 2007 +++ src/sys/netinet/tcp_output.c Sun Apr 3 15:06:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_output.c,v 1.153.2.1 2007/05/24 19:13:14 pavel Exp $ */ +/* $NetBSD: tcp_output.c,v 1.153.2.1.4.1 2011/04/03 15:06:14 riz Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -142,7 +142,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.153.2.1 2007/05/24 19:13:14 pavel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.153.2.1.4.1 2011/04/03 15:06:14 riz Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -571,6 +571,7 @@ boolean_t alwaysfrag; int sack_rxmit; int sack_bytes_rxmt; + int ecn_tos; struct sackhole *p; #ifdef TCP_SIGNATURE int sigoff = 0; @@ -697,6 +698,7 @@ txsegsize_nosack = txsegsize; again: + ecn_tos = 0; use_tso = has_tso; if ((tp->t_flags & (TF_ECN_SND_CWR|TF_ECN_SND_ECE)) != 0) { /* don't duplicate CWR/ECE. */ @@ -1294,18 +1296,7 @@ */ if (len > 0 && SEQ_GEQ(tp->snd_nxt, tp->snd_max) && !(tp->t_force && len == 1)) { - switch (af) { -#ifdef INET - case AF_INET: - tp->t_inpcb->inp_ip.ip_tos |= IPTOS_ECN_ECT0; - break; -#endif -#ifdef INET6 - case AF_INET6: - ip6->ip6_flow |= htonl(IPTOS_ECN_ECT0 << 20); - break; -#endif - } + ecn_tos = IPTOS_ECN_ECT0; tcpstat.tcps_ecn_ect++; } @@ -1519,12 +1510,12 @@ packetlen = m->m_pkthdr.len; if (tp->t_inpcb) { ip->ip_ttl = tp->t_inpcb->inp_ip.ip_ttl; - ip->ip_tos = tp->t_inpcb->inp_ip.ip_tos; + ip->ip_tos = tp->t_inpcb->inp_ip.ip_tos | ecn_tos; } #ifdef INET6 else if (tp->t_in6pcb) { ip->ip_ttl = in6_selecthlim(tp->t_in6pcb, NULL); /*XXX*/ - ip->ip_tos = 0; /*XXX*/ + ip->ip_tos = ecn_tos; /*XXX*/ } #endif break; @@ -1543,7 +1534,8 @@ ip6->ip6_hlim = in6_selecthlim(tp->t_in6pcb, ro->ro_rt ? ro->ro_rt->rt_ifp : NULL); } - /* ip6->ip6_flow = ??? */ + ip6->ip6_flow |= htonl(ecn_tos << 20); + /* ip6->ip6_flow = ??? (from template) */ /* ip6_plen will be filled in ip6_output(). */ break; #endif