From: Sergio Gonzalez Monroy Date: Tue, 19 Jul 2016 11:06:00 +0000 (+0100) Subject: examples/ipsec-secgw: fix build with gcc 4.5 X-Git-Tag: spdx-start~6109 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=96362fadd149e5df347c02a9b227e7204487b1ad;p=dpdk.git examples/ipsec-secgw: fix build with gcc 4.5 GCC 4.5.x does not handle well initializing anonymous union and/or structs. To make the compiler happy we name those anonymous union/struct. Fixes: 906257e965b7 ("examples/ipsec-secgw: support IPv6") Signed-off-by: Sergio Gonzalez Monroy --- diff --git a/examples/ipsec-secgw/ipip.h b/examples/ipsec-secgw/ipip.h index ce25a2e20f..ff1dccdb8f 100644 --- a/examples/ipsec-secgw/ipip.h +++ b/examples/ipsec-secgw/ipip.h @@ -100,8 +100,8 @@ ipip_outbound(struct rte_mbuf *m, uint32_t offset, uint32_t is_ipv6, outip4->ip_ttl = IPDEFTTL; outip4->ip_p = IPPROTO_ESP; - outip4->ip_src.s_addr = src->ip4; - outip4->ip_dst.s_addr = dst->ip4; + outip4->ip_src.s_addr = src->ip.ip4; + outip4->ip_dst.s_addr = dst->ip.ip4; return outip4; } diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h index 0d2ee25481..a442a74a86 100644 --- a/examples/ipsec-secgw/ipsec.h +++ b/examples/ipsec-secgw/ipsec.h @@ -86,8 +86,8 @@ struct ip_addr { union { uint64_t ip6[2]; uint8_t ip6_b[16]; - }; - }; + } ip6; + } ip; }; struct ipsec_sa { diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index ab18b81103..4439e0f5a9 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -53,8 +53,8 @@ const struct ipsec_sa sa_out[] = { { .spi = 5, - .src.ip4 = IPv4(172, 16, 1, 5), - .dst.ip4 = IPv4(172, 16, 2, 5), + .src.ip.ip4 = IPv4(172, 16, 1, 5), + .dst.ip.ip4 = IPv4(172, 16, 2, 5), .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC, .digest_len = 12, @@ -64,8 +64,8 @@ const struct ipsec_sa sa_out[] = { }, { .spi = 6, - .src.ip4 = IPv4(172, 16, 1, 6), - .dst.ip4 = IPv4(172, 16, 2, 6), + .src.ip.ip4 = IPv4(172, 16, 1, 6), + .dst.ip.ip4 = IPv4(172, 16, 2, 6), .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC, .digest_len = 12, @@ -93,8 +93,8 @@ const struct ipsec_sa sa_out[] = { }, { .spi = 15, - .src.ip4 = IPv4(172, 16, 1, 5), - .dst.ip4 = IPv4(172, 16, 2, 5), + .src.ip.ip4 = IPv4(172, 16, 1, 5), + .dst.ip.ip4 = IPv4(172, 16, 2, 5), .cipher_algo = RTE_CRYPTO_CIPHER_NULL, .auth_algo = RTE_CRYPTO_AUTH_NULL, .digest_len = 0, @@ -104,8 +104,8 @@ const struct ipsec_sa sa_out[] = { }, { .spi = 16, - .src.ip4 = IPv4(172, 16, 1, 6), - .dst.ip4 = IPv4(172, 16, 2, 6), + .src.ip.ip4 = IPv4(172, 16, 1, 6), + .dst.ip.ip4 = IPv4(172, 16, 2, 6), .cipher_algo = RTE_CRYPTO_CIPHER_NULL, .auth_algo = RTE_CRYPTO_AUTH_NULL, .digest_len = 0, @@ -115,9 +115,9 @@ const struct ipsec_sa sa_out[] = { }, { .spi = 25, - .src.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + .src.ip.ip6.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x55, 0x55 }, - .dst.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + .dst.ip.ip6.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x55, 0x55 }, .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC, @@ -128,9 +128,9 @@ const struct ipsec_sa sa_out[] = { }, { .spi = 26, - .src.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + .src.ip.ip6.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x66, 0x66 }, - .dst.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + .dst.ip.ip6.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x66, 0x66 }, .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC, @@ -145,8 +145,8 @@ const struct ipsec_sa sa_out[] = { const struct ipsec_sa sa_in[] = { { .spi = 105, - .src.ip4 = IPv4(172, 16, 2, 5), - .dst.ip4 = IPv4(172, 16, 1, 5), + .src.ip.ip4 = IPv4(172, 16, 2, 5), + .dst.ip.ip4 = IPv4(172, 16, 1, 5), .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC, .digest_len = 12, @@ -156,8 +156,8 @@ const struct ipsec_sa sa_in[] = { }, { .spi = 106, - .src.ip4 = IPv4(172, 16, 2, 6), - .dst.ip4 = IPv4(172, 16, 1, 6), + .src.ip.ip4 = IPv4(172, 16, 2, 6), + .dst.ip.ip4 = IPv4(172, 16, 1, 6), .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC, .digest_len = 12, @@ -185,8 +185,8 @@ const struct ipsec_sa sa_in[] = { }, { .spi = 115, - .src.ip4 = IPv4(172, 16, 2, 5), - .dst.ip4 = IPv4(172, 16, 1, 5), + .src.ip.ip4 = IPv4(172, 16, 2, 5), + .dst.ip.ip4 = IPv4(172, 16, 1, 5), .cipher_algo = RTE_CRYPTO_CIPHER_NULL, .auth_algo = RTE_CRYPTO_AUTH_NULL, .digest_len = 0, @@ -196,8 +196,8 @@ const struct ipsec_sa sa_in[] = { }, { .spi = 116, - .src.ip4 = IPv4(172, 16, 2, 6), - .dst.ip4 = IPv4(172, 16, 1, 6), + .src.ip.ip4 = IPv4(172, 16, 2, 6), + .dst.ip.ip4 = IPv4(172, 16, 1, 6), .cipher_algo = RTE_CRYPTO_CIPHER_NULL, .auth_algo = RTE_CRYPTO_AUTH_NULL, .digest_len = 0, @@ -207,9 +207,9 @@ const struct ipsec_sa sa_in[] = { }, { .spi = 125, - .src.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + .src.ip.ip6.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x55, 0x55 }, - .dst.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + .dst.ip.ip6.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x55, 0x55 }, .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC, @@ -220,9 +220,9 @@ const struct ipsec_sa sa_in[] = { }, { .spi = 126, - .src.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + .src.ip.ip6.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x66, 0x66 }, - .dst.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + .dst.ip.ip6.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x66, 0x66 }, .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC, @@ -342,8 +342,8 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[], switch (sa->flags) { case IP4_TUNNEL: - sa->src.ip4 = rte_cpu_to_be_32(sa->src.ip4); - sa->dst.ip4 = rte_cpu_to_be_32(sa->dst.ip4); + sa->src.ip.ip4 = rte_cpu_to_be_32(sa->src.ip.ip4); + sa->dst.ip.ip4 = rte_cpu_to_be_32(sa->dst.ip.ip4); } if (inbound) { @@ -473,15 +473,15 @@ single_inbound_lookup(struct ipsec_sa *sadb, struct rte_mbuf *pkt, case IP4_TUNNEL: src4_addr = RTE_PTR_ADD(ip, offsetof(struct ip, ip_src)); if ((ip->ip_v == IPVERSION) && - (sa->src.ip4 == *src4_addr) && - (sa->dst.ip4 == *(src4_addr + 1))) + (sa->src.ip.ip4 == *src4_addr) && + (sa->dst.ip.ip4 == *(src4_addr + 1))) *sa_ret = sa; break; case IP6_TUNNEL: src6_addr = RTE_PTR_ADD(ip, offsetof(struct ip6_hdr, ip6_src)); if ((ip->ip_v == IP6_VERSION) && - !memcmp(&sa->src.ip6, src6_addr, 16) && - !memcmp(&sa->dst.ip6, src6_addr + 16, 16)) + !memcmp(&sa->src.ip.ip6.ip6, src6_addr, 16) && + !memcmp(&sa->dst.ip.ip6.ip6, src6_addr + 16, 16)) *sa_ret = sa; break; case TRANSPORT: