]> git.proxmox.com Git - ovs.git/commit
lib/tc: make pedit mask calculations byte order agnostic
authorPieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Mon, 28 Jan 2019 12:29:07 +0000 (12:29 +0000)
committerSimon Horman <simon.horman@netronome.com>
Thu, 31 Jan 2019 09:53:10 +0000 (10:53 +0100)
commitf8b63e59301fda6211e8ab69bd2e32c3f98325c9
treee980c9969b3c169ff8f1d6aef9462ad18e53060d
parent68c00e3eed72a58e4b9e29a0fd1cafbcf6fff3a8
lib/tc: make pedit mask calculations byte order agnostic

pedit allows setting entire words with an optional mask and OVS
makes use of such masks to allow setting fields that do not span
entire words.

The struct tc_pedit_key structure, which is part of the kernel
ABI, uses host byte order fields to store the mask and value for
a pedit action, however, these fields contain values in network
byte order.

In order to allow static analysis tools to check for endianness
problems this patch adds a local version of struct tc_pedit_key
which uses big endian types and refactors the relevant code as
appropriate.

In the course of making this change it became apparent that the
calculation of masks was occurring using host byte order although
the values are in network byte order. This patch also fixes that
problem by shifting values in host byte order and then converting
them to network byte order. It is believe this fixes a bug on big
endian systems although we are not in a position to test that.

Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
include/sparse/automake.mk
include/sparse/linux/tc_act/tc_pedit.h [new file with mode: 0644]
lib/tc.c