[v2,02/11] examples/ipsec-gw: fix build with pkg-config

Message ID 20201113122430.25354-3-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Examples compilation fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Nov. 13, 2020, 12:24 p.m. UTC
  flow.c: In function ‘parse_flow_tokens’:
flow.c:153:23: error: taking address of packed member of ‘struct
rte_ipv4_hdr’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  153 |     if (ipv4_addr_cpy(&rule->ipv4.spec.hdr.src_addr,
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flow.c:154:9: error: taking address of packed member of ‘struct
rte_ipv4_hdr’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  154 |         &rule->ipv4.mask.hdr.src_addr,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flow.c:170:23: error: taking address of packed member of ‘struct
rte_ipv4_hdr’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  170 |     if (ipv4_addr_cpy(&rule->ipv4.spec.hdr.dst_addr,
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flow.c:171:9: error: taking address of packed member of ‘struct
rte_ipv4_hdr’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  171 |         &rule->ipv4.mask.hdr.dst_addr,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Meson build is fine since we waive those warnings.
Replicate it for make.

Fixes: 8e693616fcb2 ("examples/ipsec-secgw: enable flow based distribution")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/ipsec-secgw/Makefile | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Anoob Joseph Nov. 16, 2020, 4:16 a.m. UTC | #1
> flow.c: In function ‘parse_flow_tokens’:
> flow.c:153:23: error: taking address of packed member of ‘struct
> rte_ipv4_hdr’ may result in an unaligned pointer value [-Werror=address-of-
> packed-member]
>   153 |     if (ipv4_addr_cpy(&rule->ipv4.spec.hdr.src_addr,
>       |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> flow.c:154:9: error: taking address of packed member of ‘struct rte_ipv4_hdr’
> may result in an unaligned pointer value [-Werror=address-of-packed-
> member]
>   154 |         &rule->ipv4.mask.hdr.src_addr,
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> flow.c:170:23: error: taking address of packed member of ‘struct
> rte_ipv4_hdr’ may result in an unaligned pointer value [-Werror=address-of-
> packed-member]
>   170 |     if (ipv4_addr_cpy(&rule->ipv4.spec.hdr.dst_addr,
>       |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> flow.c:171:9: error: taking address of packed member of ‘struct rte_ipv4_hdr’
> may result in an unaligned pointer value [-Werror=address-of-packed-
> member]
>   171 |         &rule->ipv4.mask.hdr.dst_addr,
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> Meson build is fine since we waive those warnings.
> Replicate it for make.
> 
> Fixes: 8e693616fcb2 ("examples/ipsec-secgw: enable flow based
> distribution")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Acked-by: Anoob Joseph <anoobj@marvell.com>
  

Patch

diff --git a/examples/ipsec-secgw/Makefile b/examples/ipsec-secgw/Makefile
index 5e6cb51eac..7670cc3684 100644
--- a/examples/ipsec-secgw/Makefile
+++ b/examples/ipsec-secgw/Makefile
@@ -42,6 +42,7 @@  LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -Wno-address-of-packed-member
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)