summaryrefslogtreecommitdiffstats
path: root/examples/ipsec-secgw
diff options
context:
space:
mode:
authorRicardo Salveti <ricardo.salveti@linaro.org>2016-07-25 13:22:22 -0300
committerRicardo Salveti <ricardo.salveti@linaro.org>2016-07-25 13:23:50 -0300
commit7b53c036e6bf56623b8273018ff1c8cc62847857 (patch)
tree4af0da8c150bbebd7d1d252d6ac801a7efef0d23 /examples/ipsec-secgw
parent5d4e5dcd8a186778b3d78e27c81550d07a288fd2 (diff)
Imported Upstream version 16.07-rc4
Change-Id: Ic57f6a3726f2dbd1682223648d91310f45705327 Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Diffstat (limited to 'examples/ipsec-secgw')
-rw-r--r--examples/ipsec-secgw/ipip.h4
-rw-r--r--examples/ipsec-secgw/ipsec-secgw.c4
-rw-r--r--examples/ipsec-secgw/ipsec.h4
-rw-r--r--examples/ipsec-secgw/sa.c60
4 files changed, 38 insertions, 34 deletions
diff --git a/examples/ipsec-secgw/ipip.h b/examples/ipsec-secgw/ipip.h
index ce25a2e2..ff1dccdb 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-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 1ca144b8..5d04eb3f 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1273,6 +1273,10 @@ cryptodevs_init(void)
&qp_conf, dev_conf.socket_id))
rte_panic("Failed to setup queue %u for "
"cdev_id %u\n", 0, cdev_id);
+
+ if (rte_cryptodev_start(cdev_id))
+ rte_panic("Failed to start cryptodev %u\n",
+ cdev_id);
}
printf("\n");
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index 0d2ee254..a442a74a 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 ab18b811..4439e0f5 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: