aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJieqiang Wang <jieqiang.wang@arm.com>2020-08-07 14:18:04 +0000
committerDamjan Marion <dmarion@me.com>2020-08-31 18:15:51 +0000
commitc8833b21919090cfde400c5fe7a14ccc38949764 (patch)
tree961d87e1c8e1904df4656e10f67a59a6d02f0498
parent4a76d6f6da035220917097bc047b08bc58254803 (diff)
ip: fix compiling error with gcc-10
Building VPP using gcc-10 fails because of the array bounds check error for function ip4_header_checksum(), with option field in IPv4 header exceeding the ip4_header_t bound. Fix this error by turning off the array bounds check option for function ip4_header_checksum(). Change-Id: I68cc241ae9e403d35ac2e320549506dc6565a0b6 Type: fix Signed-off-by: Jieqiang Wang <jieqiang.wang@arm.com>
-rw-r--r--src/vnet/ip/ip4_packet.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/vnet/ip/ip4_packet.h b/src/vnet/ip/ip4_packet.h
index fee0c8cbcd7..6abb6a9ebf0 100644
--- a/src/vnet/ip/ip4_packet.h
+++ b/src/vnet/ip/ip4_packet.h
@@ -43,6 +43,7 @@
#include <vnet/ip/ip_packet.h> /* for ip_csum_t */
#include <vnet/tcp/tcp_packet.h> /* for tcp_header_t */
#include <vppinfra/byte_order.h> /* for clib_net_to_host_u16 */
+#include <vppinfra/warnings.h> /* for WARN_OFF/WARN_ON macro */
/* IP4 address which can be accessed either as 4 bytes
or as a 32-bit number. */
@@ -197,6 +198,13 @@ ip4_next_header (ip4_header_t * i)
return (void *) i + ip4_header_bytes (i);
}
+/* Turn off array bounds check due to ip4_header_t
+ option field operations. */
+
+/* *INDENT-OFF* */
+WARN_OFF(array-bounds)
+/* *INDENT-ON* */
+
always_inline u16
ip4_header_checksum (ip4_header_t * i)
{
@@ -297,6 +305,10 @@ ip4_header_checksum (ip4_header_t * i)
return ~((u16) sum);
}
+/* *INDENT-OFF* */
+WARN_ON(array-bounds)
+/* *INDENT-ON* */
+
always_inline void
ip4_header_set_dscp (ip4_header_t * ip4, ip_dscp_t dscp)
{