From patchwork Tue Jul 19 11:06:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Gonzalez Monroy X-Patchwork-Id: 14895 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id E9AE5F94; Tue, 19 Jul 2016 13:06:28 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 716FBDE3 for ; Tue, 19 Jul 2016 13:06:27 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP; 19 Jul 2016 04:06:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,389,1464678000"; d="scan'208";a="141800122" Received: from sie-lab-212-209.ir.intel.com (HELO silpixa00377983.ir.intel.com) ([10.237.212.209]) by fmsmga004.fm.intel.com with ESMTP; 19 Jul 2016 04:06:02 -0700 From: Sergio Gonzalez Monroy To: dev@dpdk.org Date: Tue, 19 Jul 2016 12:06:00 +0100 Message-Id: <1468926360-34989-1-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 2.4.11 Subject: [dpdk-dev] [PATCH] examples/ipsec-secgw: fix GCC 4.5.x build error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- examples/ipsec-secgw/ipip.h | 4 +-- examples/ipsec-secgw/ipsec.h | 4 +-- examples/ipsec-secgw/sa.c | 60 ++++++++++++++++++++++---------------------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/examples/ipsec-secgw/ipip.h b/examples/ipsec-secgw/ipip.h index ce25a2e..ff1dccd 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 0d2ee25..a442a74 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 ab18b81..4439e0f 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: