diff --git a/share/man/man4/ip.4 b/share/man/man4/ip.4 --- a/share/man/man4/ip.4 +++ b/share/man/man4/ip.4 @@ -90,10 +90,13 @@ .Ed .Pp .Dv IP_TOS -and +may be used to set the differential service codepoint (DSCP) and the +explicit congestion notfication (ECN) codepoint. +Setting the ECN codepoint - the two least significant bits - on a +socket using a transport protocol implementing ECN has no effect. +.Pp .Dv IP_TTL -may be used to set the type-of-service and time-to-live -fields in the +configures the time-to-live (TTL) field in the .Tn IP header for .Dv SOCK_STREAM , SOCK_DGRAM , @@ -102,7 +105,7 @@ sockets. For example, .Bd -literal -int tos = IPTOS_LOWDELAY; /* see */ +int tos = IPTOS_DSCP_EF; /* see */ setsockopt(s, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); int ttl = 60; /* max = 255 */ diff --git a/sys/netinet/ip.h b/sys/netinet/ip.h --- a/sys/netinet/ip.h +++ b/sys/netinet/ip.h @@ -79,7 +79,7 @@ #define IPTOS_LOWDELAY 0x10 #define IPTOS_THROUGHPUT 0x08 #define IPTOS_RELIABILITY 0x04 -#define IPTOS_MINCOST 0x02 +#define IPTOS_MINCOST IPTOS_DSCP_CS0 /* * Definitions for IP precedence (also in ip_tos) (deprecated). diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -82,6 +82,7 @@ #include #include #include +#include #include #ifdef INET6 #include @@ -1759,6 +1760,8 @@ case IPPROTO_IP: switch (sopt->sopt_name) { case IP_TOS: + inp->inp_ip_tos &= ~IPTOS_ECN_MASK; + break; case IP_TTL: /* Notify tcp stacks that care (e.g. RACK). */ break;