]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: fix traffic engineering extended mask
authorLouis Scalbert <louis.scalbert@6wind.com>
Thu, 2 Feb 2023 14:44:31 +0000 (15:44 +0100)
committerLouis Scalbert <louis.scalbert@6wind.com>
Thu, 2 Feb 2023 15:20:01 +0000 (16:20 +0100)
RFC7471 and RFC8570 have defined the Extended Traffic Engineering
metrics that are carried within TLV of 32 bits data length. Extended
metrics, excepting bandwidth ones, use the following format:

>     0                   1                   2                   3
>     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
>    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>    |   Type        |     Length    |
>    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>    |A|  RESERVED   |                   Value                       |
>    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Data contains a flag/reserved of 8 bits and a 24 bits value.

The TE_EXT_MASK mask macro extracts a 28 bits value from a 32 bits
variable instead of 24 bits. It works in most of the case because
RESERVED bits are generally set to 0.

Fix the TE_EXT_MASK mask.

Fixes: 16f1b9ee29 ("Update Traffic Engineering Support for OSPFD")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
lib/if.h

index a653246ccb2ee61d1df3202c6eb5e2e40061ce76..acd60e9d062faad00d6a78099189df25078591cc 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -140,7 +140,7 @@ struct if_stats {
 #endif /* HAVE_PROC_NET_DEV */
 
 /* Here are "non-official" architectural constants. */
-#define TE_EXT_MASK             0x0FFFFFFF
+#define TE_EXT_MASK             0x00FFFFFF
 #define TE_EXT_ANORMAL          0x80000000
 #define LOSS_PRECISION          0.000003
 /* TE_MEGA_BIT and TE_BYTE are utilized to convert TE bandwidth */