| #
fba98755 |
| 10-Jan-2025 |
Andre Muezerie <andremue@linux.microsoft.com> |
lib: replace packed attributes
MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rt
lib: replace packed attributes
MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.
Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
show more ...
|
| #
3cd0547a |
| 10-Jan-2025 |
Andre Muezerie <andremue@linux.microsoft.com> |
net: remove packed attribute on IPv6 scope
This change affects the storage size of a variable of enum rte_ipv6_mc_scope (at least with gcc). It should be OK from an ABI POV though: there is one (inl
net: remove packed attribute on IPv6 scope
This change affects the storage size of a variable of enum rte_ipv6_mc_scope (at least with gcc). It should be OK from an ABI POV though: there is one (inline) helper using this type, and nothing else in DPDK takes a IPv6 multicast scope as input.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
show more ...
|
|
Revision tags: v24.11, v24.11-rc4, v24.11-rc3, v24.11-rc2 |
|
| #
365b7f34 |
| 05-Nov-2024 |
Robin Jarry <rjarry@redhat.com> |
net: improve IPv6 header types alignment
IPv6 headers are always aligned on a 2-bytes grid. Reflect this in the structure definition.
Signed-off-by: Robin Jarry <rjarry@redhat.com> Reviewed-by: Mor
net: improve IPv6 header types alignment
IPv6 headers are always aligned on a 2-bytes grid. Reflect this in the structure definition.
Signed-off-by: Robin Jarry <rjarry@redhat.com> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
show more ...
|
| #
1d9c6bbe |
| 24-Oct-2024 |
Robin Jarry <rjarry@redhat.com> |
net: fix out-of-bound access in IPv6 address mask
Fix the following out-of-bounds read in rte_ipv6_addr_mask() reported by Coverity:
83 static inline void 84 rte_ipv6_addr_mask(struct rte_ipv6_addr
net: fix out-of-bound access in IPv6 address mask
Fix the following out-of-bounds read in rte_ipv6_addr_mask() reported by Coverity:
83 static inline void 84 rte_ipv6_addr_mask(struct rte_ipv6_addr *ip, uint8_t depth) 85 { 1. Condition depth < 128 /* 16 * 8 */, taking true branch. 2. cond_at_most: Checking depth < 128 implies that depth may be up to 127 on the true branch. 86 if (depth < RTE_IPV6_MAX_DEPTH) { 3. assignment: Assigning: d = depth / 8. The value of d may now be up to 15. 87 uint8_t d = depth / 8; 88 uint8_t mask = ~(UINT8_MAX >> (depth % 8)); 89 ip->a[d] &= mask; 4. incr: Incrementing d. The value of d may now be up to 16. 90 d++; CID 446754: (#1 of 1): Out-of-bounds read (OVERRUN) 5. overrun-local: Overrunning array of 16 bytes at byte offset 16 by dereferencing pointer &ip->a[d]. 91 memset(&ip->a[d], 0, sizeof(*ip) - d); 92 } 93 }
Use a simple loop instead of memset.
Coverity issue: 446754 Fixes: ca786def84ca ("net: add IPv6 address structure and utils")
Signed-off-by: Robin Jarry <rjarry@redhat.com> Acked-by: Morten Brørup <mb@smartsharesystems.com>
show more ...
|
| #
b805c834 |
| 24-Oct-2024 |
Robin Jarry <rjarry@redhat.com> |
net: fix overflowed array index in IPv6 address utils
Fix the following overflowed array index reads reported by Coverity:
107 static inline bool 108 rte_ipv6_addr_eq_prefix(const struct rte_ipv6_a
net: fix overflowed array index in IPv6 address utils
Fix the following overflowed array index reads reported by Coverity:
107 static inline bool 108 rte_ipv6_addr_eq_prefix(const struct rte_ipv6_addr *a, const struct rte_ipv6_addr *b, uint8_t depth) 109 { 1. Condition depth < 128 /* 16 * 8 */, taking true branch. 110 if (depth < RTE_IPV6_MAX_DEPTH) { 2. cast_overflow: Truncation due to cast operation on depth / 8 from 32 to 8 bits. 3. overflow_assign: d is assigned from depth / 8. 111 uint8_t d = depth / 8; 112 uint8_t mask = ~(UINT8_MAX >> (depth % 8)); 113 CID 446756: (#1 of 1): Overflowed array index read 4. deref_overflow: d, which might have overflowed, is used in a pointer index in a->a[d]. 114 if ((a->a[d] ^ b->a[d]) & mask) 115 return false; 116 117 return memcmp(a, b, d) == 0; 118 } 119 return rte_ipv6_addr_eq(a, b); 120 }
The same issue has been reported both in rte_ipv6_addr_eq_prefix() and rte_ipv6_addr_mask(). All arithmetic operations are made using regular integers and then truncated on assign if necessary (or if explicitly down cast to a smaller type). In this case, the result of (depth / 8) is assumed to be on 32 bits and is implicitly down cast 8 bits. This is causing a warning because it may result in unexpected behaviour.
Change the type of the d variables to unsigned int (32bit by default) to avoid the overflow warning. Since depth is strictly lesser than RTE_IPV6_MAX_DEPTH, d will always be lesser than RTE_IPV6_ADDR_SIZE.
Replace the magic 8 literals with CHAR_BIT to be consistent with the definition of RTE_IPV6_MAX_DEPTH.
Coverity issue: 446756, 446758 Fixes: ca786def84ca ("net: add IPv6 address structure and utils")
Signed-off-by: Robin Jarry <rjarry@redhat.com> Acked-by: Morten Brørup <mb@smartsharesystems.com>
show more ...
|
|
Revision tags: v24.11-rc1, v24.07, v24.07-rc4, v24.07-rc3, v24.07-rc2, v24.07-rc1 |
|
| #
cba27998 |
| 18-Jun-2024 |
Gregory Etelson <getelson@nvidia.com> |
net: add IPv6 traffic class and flow label fields
DPDK IPv6 header definition combined the `version`, `traffic class` and `flow label` header fields into a single 32 bits structure member `vtc_flow`
net: add IPv6 traffic class and flow label fields
DPDK IPv6 header definition combined the `version`, `traffic class` and `flow label` header fields into a single 32 bits structure member `vtc_flow`.
The patch expands IPv6 header definition with dedicated structure members for the `version`, `traffic class` and `flow label` fields. The `traffic class` is also separated into DS and ECN fields.
The patch also preserves existing `vtc_flow` structure member for backward compatibility.
Signed-off-by: Gregory Etelson <getelson@nvidia.com> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
show more ...
|
| #
189fdd37 |
| 18-Oct-2024 |
Robin Jarry <rjarry@redhat.com> |
net: add function to check IPv6 version
Add a function to check the version in IPv6 headers.
Signed-off-by: Robin Jarry <rjarry@redhat.com>
|
| #
3d6d85f5 |
| 18-Oct-2024 |
Robin Jarry <rjarry@redhat.com> |
net: add utilities for well known IPv6 address types
Add more utilities to work with IPv6 addresses. These functions will be required in order to help building IPv6 routing applications.
Signed-off
net: add utilities for well known IPv6 address types
Add more utilities to work with IPv6 addresses. These functions will be required in order to help building IPv6 routing applications.
Signed-off-by: Robin Jarry <rjarry@redhat.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
show more ...
|
| #
89b5642d |
| 18-Oct-2024 |
Robin Jarry <rjarry@redhat.com> |
net: use IPv6 address structure for packet headers
The rte_ipv6_hdr uses ad-hoc uint8_t[16] arrays to represent addresses. Replace these arrays with the newly added rte_ipv6_addr structure. Adapt al
net: use IPv6 address structure for packet headers
The rte_ipv6_hdr uses ad-hoc uint8_t[16] arrays to represent addresses. Replace these arrays with the newly added rte_ipv6_addr structure. Adapt all code accordingly.
Signed-off-by: Robin Jarry <rjarry@redhat.com>
show more ...
|
| #
ca786def |
| 18-Oct-2024 |
Robin Jarry <rjarry@redhat.com> |
net: add IPv6 address structure and utils
There is currently no structure defined for IPv6 addresses. Introduce one that is simply a uint8_t array of 16 elements. The idea is to ensure this structur
net: add IPv6 address structure and utils
There is currently no structure defined for IPv6 addresses. Introduce one that is simply a uint8_t array of 16 elements. The idea is to ensure this structure alignment is 1 so that it can be mapped directly on unaligned packet memory.
Add utility functions and macros that use the newly added rte_ipv6_addr structure. Add basic unit tests to ensure everything works as expected.
These functions will be used in the next commits to replace private and/or duplicated functions.
Signed-off-by: Robin Jarry <rjarry@redhat.com>
show more ...
|
| #
1a2b549b |
| 18-Oct-2024 |
Robin Jarry <rjarry@redhat.com> |
net: split IPv4 and IPv6 symbols in separate headers
Split IPv4 and IPv6 symbols in two separate headers. rte_ip4.h and rte_ip6.h, respectively.
Update doxygen index accordingly.
Include rte_ip4.h
net: split IPv4 and IPv6 symbols in separate headers
Split IPv4 and IPv6 symbols in two separate headers. rte_ip4.h and rte_ip6.h, respectively.
Update doxygen index accordingly.
Include rte_ip4.h and rte_ip6.h in rte_ip.h for backward compatibility in applications.
Signed-off-by: Robin Jarry <rjarry@redhat.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
show more ...
|