Re: git: b0e13f785b33 - main - netinet: Define IPv6 ECN mask

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 15 Jan 2024 12:13:46 UTC
On Wed, 3 Jan 2024, Mark Johnston wrote:

> The branch main has been updated by markj:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=b0e13f785b336670bdf39b83a78435b00d00f43c
>
> commit b0e13f785b336670bdf39b83a78435b00d00f43c
> Author:     Jose Luis Duran <jlduran@gmail.com>
> AuthorDate: 2023-10-28 02:50:18 +0000
> Commit:     Mark Johnston <markj@FreeBSD.org>
> CommitDate: 2024-01-03 17:56:28 +0000
>
>    netinet: Define IPv6 ECN mask
>
>    Define a mask for the code point used for ECN in the Traffic Class field
>    (2 bits) of an IPv6 header.
>
>         BE:    0       0       3       0       0       0       0       0
>        Bit: 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>            +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>            |Version| Traffic Class |           Flow Label                  |
>            +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>            |                              ...                              |
>
>    For BE (Big Endian), or network-byte order, this corresponds to 0x00300000.
>    For Little Endian, it corresponds to 0x00003000.

I would really appreciate if these (supposedly excepts) came with a
reference to an RFC (ideally with section).


>    Reviewed by:    imp, markj
>    MFC after:      1 week
>    Pull Request:   https://github.com/freebsd/freebsd-src/pull/879
> ---
> sys/netinet/ip6.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/sys/netinet/ip6.h b/sys/netinet/ip6.h
> index 9807e6a1780a..2f61d594e59d 100644
> --- a/sys/netinet/ip6.h
> +++ b/sys/netinet/ip6.h
> @@ -95,10 +95,12 @@ struct ip6_hdr {
> #if BYTE_ORDER == BIG_ENDIAN
> #define IPV6_FLOWINFO_MASK	0x0fffffff	/* flow info (28 bits) */
> #define IPV6_FLOWLABEL_MASK	0x000fffff	/* flow label (20 bits) */
> +#define IPV6_ECN_MASK		0x00300000	/* ECN code point (2 bits) */
> #else
> #if BYTE_ORDER == LITTLE_ENDIAN
> #define IPV6_FLOWINFO_MASK	0xffffff0f	/* flow info (28 bits) */
> #define IPV6_FLOWLABEL_MASK	0xffff0f00	/* flow label (20 bits) */
> +#define IPV6_ECN_MASK		0x00003000	/* ECN code point (2 bits) */
> #endif /* LITTLE_ENDIAN */
> #endif
> #define IPV6_FLOWLABEL_LEN	20
>

-- 
Bjoern A. Zeeb                                                     r15:7