diff --git a/sys/netinet/ip6.h b/sys/netinet/ip6.h --- a/sys/netinet/ip6.h +++ b/sys/netinet/ip6.h @@ -106,9 +106,9 @@ #endif #define IPV6_FLOWLABEL_LEN 20 -#define IPV6_TRAFFIC_CLASS(ip6) ((ntohl((ip6)->ip6_flow) >> 20) & 0xff) -#define IPV6_DSCP(ip6) ((ntohl((ip6)->ip6_flow) >> 20) & 0xfc) -#define IPV6_ECN(ip6) ((ntohl((ip6)->ip6_flow) >> 20) & 0x03) +#define IPV6_TRAFFIC_CLASS(ip6) ((ntohl((ip6)->ip6_flow) >> IPV6_FLOWLABEL_LEN) & 0xff) +#define IPV6_DSCP(ip6) ((ntohl((ip6)->ip6_flow) >> IPV6_FLOWLABEL_LEN) & 0xfc) +#define IPV6_ECN(ip6) ((ntohl((ip6)->ip6_flow) >> IPV6_FLOWLABEL_LEN) & 0x03) /* * Extension Headers diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1204,8 +1204,8 @@ tp->t_flags2 &= ~TF2_ECN_SND_ECE; #ifdef INET6 if (isipv6) { - ip6->ip6_flow &= ~htonl(IPTOS_ECN_MASK << 20); - ip6->ip6_flow |= htonl(ect << 20); + ip6->ip6_flow &= ~htonl(IPTOS_ECN_MASK << IPV6_FLOWLABEL_LEN); + ip6->ip6_flow |= htonl(ect << IPV6_FLOWLABEL_LEN); } else #endif diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -2005,7 +2005,7 @@ ulen = tlen - sizeof(struct ip6_hdr); uh->uh_ulen = htons(ulen); } - ip6->ip6_flow = htonl(ect << 20); + ip6->ip6_flow = htonl(ect << IPV6_FLOWLABEL_LEN); ip6->ip6_vfc = IPV6_VERSION; if (port) ip6->ip6_nxt = IPPROTO_UDP; diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1866,7 +1866,7 @@ ip6->ip6_nxt = IPPROTO_TCP; th = (struct tcphdr *)(ip6 + 1); } - ip6->ip6_flow |= htonl(sc->sc_ip_tos << 20); + ip6->ip6_flow |= htonl(sc->sc_ip_tos << IPV6_FLOWLABEL_LEN); } #endif #if defined(INET6) && defined(INET)