diff options
author | Barry Spinney <spinney@mellanox.com> | 2016-04-28 22:35:39 -0500 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2016-04-29 11:47:42 +0300 |
commit | 1d70bc57f818794ae3db4a7279b45fa483aadc4f (patch) | |
tree | ad82ba77ccbc7dbe7cb4b53cdabf52d563919e00 /helper | |
parent | 5ae6f0af33ce8b0dde9dab15df564fce2765dbb8 (diff) |
linux-generic: packet: fix number of parsing bugs, some vlan_hdr_t related
This patch fixes a bug in parse_ipv6 caused because the IPv6 payload
length does not include the IPv6 header and a bug in parse_udp where
l4_offset was subtracted from l3_offset instead of the other way around.
Also fixed some bugs related to incorrect vlan_hdr_t. The corrected
vlan header then required some fixes to odp_classification.c and the
classifier validation test code. Also added ODPH_IPV6ADDR_LEN.
Finally made a number of cosmetic changes to satisfy checkpatch.
Signed-off-by: Barry Spinney <spinney@mellanox.com>
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'helper')
-rw-r--r-- | helper/include/odp/helper/eth.h | 12 | ||||
-rw-r--r-- | helper/include/odp/helper/ip.h | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/helper/include/odp/helper/eth.h b/helper/include/odp/helper/eth.h index 45970099b..9f47ddfaf 100644 --- a/helper/include/odp/helper/eth.h +++ b/helper/include/odp/helper/eth.h @@ -64,7 +64,7 @@ ODP_STATIC_ASSERT(sizeof(odph_ethaddr_t) == ODPH_ETHADDR_LEN, typedef struct ODP_PACKED { odph_ethaddr_t dst; /**< Destination address */ odph_ethaddr_t src; /**< Source address */ - odp_u16be_t type; /**< Type */ + odp_u16be_t type; /**< EtherType */ } odph_ethhdr_t; /** @internal Compile time assert */ @@ -72,13 +72,17 @@ ODP_STATIC_ASSERT(sizeof(odph_ethhdr_t) == ODPH_ETHHDR_LEN, "ODPH_ETHHDR_T__SIZE_ERROR"); /** - * VLAN header + * IEEE 802.1Q VLAN header * - * @todo Check usage of tpid vs ethertype. Check outer VLAN TPID. + * This field is present when the EtherType (the odph_ethhdr_t type field) of + * the preceding ethernet header is ODPH_ETHTYPE_VLAN. The inner EtherType + * (the odph_vlanhdr_t type field) then indicates what comes next. Note that + * the so called TPID field isn't here because it overlaps with the + * odph_ethhdr_t type field. */ typedef struct ODP_PACKED { - odp_u16be_t tpid; /**< Tag protocol ID (located after ethhdr.src) */ odp_u16be_t tci; /**< Priority / CFI / VLAN ID */ + odp_u16be_t type; /**< Inner EtherType */ } odph_vlanhdr_t; /** @internal Compile time assert */ diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h index f1f8cabf0..4cfc00f97 100644 --- a/helper/include/odp/helper/ip.h +++ b/helper/include/odp/helper/ip.h @@ -152,6 +152,9 @@ static inline odp_u16sum_t odph_ipv4_csum_update(odp_packet_t pkt) /** IPv6 header length */ #define ODPH_IPV6HDR_LEN 40 +/** IPv6 address length in bytes */ +#define ODPH_IPV6ADDR_LEN 16 + /** The following constants can be used to access the three subfields * of the 4 byte ver_tc_flow field - namely the four bit Version subfield, * the eight bit Traffic Class subfield (TC) and the twenty bit Flow Label |