diff options
author | Mohammed Hawari <mohammed@hawari.fr> | 2021-03-31 17:26:19 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-04-12 16:00:25 +0000 |
commit | 4b1bacffe34e56775d6abb1541dfcca17bd4e8ee (patch) | |
tree | 53ca578abcff71239f53702bd121be34c08370e1 | |
parent | e263685ac82454c39eee6e2a2146dd1e02d61de8 (diff) |
geneve: fix options len parsing as 32-bits words
See https://tools.ietf.org/html/rfc8926 3.4. second paragraph Opt Len
Change-Id: I191d835651b2fa64eeb4ec4271497cf3342554be
Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
Type: fix
-rw-r--r-- | src/plugins/geneve/geneve_packet.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/geneve/geneve_packet.h b/src/plugins/geneve/geneve_packet.h index a0d0687434c..fb21a311f12 100644 --- a/src/plugins/geneve/geneve_packet.h +++ b/src/plugins/geneve/geneve_packet.h @@ -171,14 +171,15 @@ vnet_set_geneve_version (geneve_header_t * h, u8 version) static inline u8 vnet_get_geneve_options_len (geneve_header_t * h) { - return ((h->first_word & GENEVE_OPTLEN_MASK) >> GENEVE_OPTLEN_SHIFT); + return ((h->first_word & GENEVE_OPTLEN_MASK) >> GENEVE_OPTLEN_SHIFT) << 2; } static inline void vnet_set_geneve_options_len (geneve_header_t * h, u8 len) { + ASSERT ((len & 0x3) == 0); h->first_word &= ~(GENEVE_OPTLEN_MASK); - h->first_word |= ((len << GENEVE_OPTLEN_SHIFT) & GENEVE_OPTLEN_MASK); + h->first_word |= ((len << (GENEVE_OPTLEN_SHIFT - 2)) & GENEVE_OPTLEN_MASK); } static inline u8 |