From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
To: "Gonzalez Monroy, Sergio" <sergio.gonzalez.monroy@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "Mcnamara, John" <john.mcnamara@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2 7/9] examples/ipsec-secgw: ipv6 support
Date: Tue, 7 Jun 2016 16:10:03 +0000 [thread overview]
Message-ID: <E115CCD9D858EF4F90C690B0DCB4D8973C95B2F2@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <1463575330-8467-8-git-send-email-sergio.gonzalez.monroy@intel.com>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sergio Gonzalez
> Monroy
> Sent: Wednesday, May 18, 2016 1:42 PM
> To: dev@dpdk.org
> Cc: Mcnamara, John
> Subject: [dpdk-dev] [PATCH v2 7/9] examples/ipsec-secgw: ipv6 support
>
> Support IPSec IPv6 allowing IPv4/IPv6 traffic in IPv4 or IPv6 tunnel.
>
> We need separate Routing (LPM) and SP (ACL) tables for IPv4 and IPv6,
> but a common SA table.
>
> Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
...
> +static inline void
> +ip4_ecn_setup(struct ip *ip4)
> +{
> + if (ip4->ip_tos & IPTOS_ECN_MASK)
> + ip4->ip_tos |= IPTOS_ECN_CE;
> +}
> +
> +static inline void
> +ip6_ecn_setup(struct ip6_hdr *ip6)
> +{
> + if ((ntohl(ip6->ip6_flow) >> 20) & IPTOS_ECN_MASK)
> + ip6->ip6_flow = htonl(ntohl(ip6->ip6_flow) |
> + (IPTOS_ECN_CE << 20));
> }
>
> static inline int
> -ip4ip_inbound(struct rte_mbuf *m, uint32_t offset)
> +ipip_inbound(struct rte_mbuf *m, uint32_t offset)
This function should return void, since it is returning 0 always.
> {
> - struct ip *inip;
> - struct ip *outip;
> + struct ip *inip4, *outip4;
> + struct ip6_hdr *inip6, *outip6;
> + uint32_t ip_len, set_ecn;
>
> - outip = rte_pktmbuf_mtod(m, struct ip*);
> + outip4 = rte_pktmbuf_mtod(m, struct ip*);
>
> - RTE_ASSERT(outip->ip_v == IPVERSION);
> + RTE_ASSERT(outip4->ip_v == IPVERSION || outip4->ip_v ==
> IP6_VERSION);
>
> - offset += sizeof(struct ip);
> - inip = (struct ip *)rte_pktmbuf_adj(m, offset);
> - RTE_ASSERT(inip->ip_v == IPVERSION || inip->ip_v ==
> IPV6_VERSION);
> + if (outip4->ip_v == IPVERSION) {
> + ip_len = sizeof(struct ip);
> + set_ecn = ((outip4->ip_tos & IPTOS_ECN_CE) ==
> IPTOS_ECN_CE);
> + } else {
> + outip6 = (struct ip6_hdr *)outip4;
> + ip_len = sizeof(struct ip6_hdr);
> + set_ecn = ntohl(outip6->ip6_flow) >> 20;
> + set_ecn = ((set_ecn & IPTOS_ECN_CE) == IPTOS_ECN_CE);
> + }
> +
> + inip4 = (struct ip *)rte_pktmbuf_adj(m, offset + ip_len);
> + RTE_ASSERT(inip4->ip_v == IPVERSION || inip4->ip_v ==
> IP6_VERSION);
>
> /* Check packet is still bigger than IP header (inner) */
> - RTE_ASSERT(rte_pktmbuf_pkt_len(m) > sizeof(struct ip));
> + RTE_ASSERT(rte_pktmbuf_pkt_len(m) > ip_len);
>
> /* RFC4301 5.1.2.1 Note 6 */
> - if ((inip->ip_tos & htons(IPTOS_ECN_ECT0 | IPTOS_ECN_ECT1)) &&
> - ((outip->ip_tos & htons(IPTOS_ECN_CE)) ==
> IPTOS_ECN_CE))
> - inip->ip_tos |= htons(IPTOS_ECN_CE);
> + if (inip4->ip_v == IPVERSION) {
> + if (set_ecn)
> + ip4_ecn_setup(inip4);
> + /* XXX This should be done by the forwarding engine instead
> */
> + inip4->ip_ttl -= 1;
> + } else {
> + inip6 = (struct ip6_hdr *)inip4;
> + if (set_ecn)
> + ip6_ecn_setup(inip6);
> + /* XXX This should be done by the forwarding engine instead
> */
> + inip6->ip6_hops -= 1;
> + }
>
> return 0;
> }
next prev parent reply other threads:[~2016-06-07 16:10 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-06 16:31 [dpdk-dev] [PATCH 0/9] IPSec example enhancements Sergio Gonzalez Monroy
2016-05-06 16:31 ` [dpdk-dev] [PATCH 1/9] examples/ipsec-secgw: fix esp padding check Sergio Gonzalez Monroy
2016-05-06 16:31 ` [dpdk-dev] [PATCH 2/9] examples/ipsec-secgw: fix stack smashing error Sergio Gonzalez Monroy
2016-05-06 16:31 ` [dpdk-dev] [PATCH 3/9] examples/ipsec-secgw: add build option and cleanup Sergio Gonzalez Monroy
2016-05-06 16:31 ` [dpdk-dev] [PATCH 4/9] examples/ipsec-secgw: rework ipsec execution loop Sergio Gonzalez Monroy
2016-05-06 16:31 ` [dpdk-dev] [PATCH 5/9] examples/ipsec-secgw: fix no sa found case Sergio Gonzalez Monroy
2016-05-06 16:31 ` [dpdk-dev] [PATCH 6/9] examples/ipsec-secgw: consistent config variable names Sergio Gonzalez Monroy
2016-05-06 16:31 ` [dpdk-dev] [PATCH 7/9] examples/ipsec-secgw: ipv6 support Sergio Gonzalez Monroy
2016-05-06 16:31 ` [dpdk-dev] [PATCH 8/9] examples/ipsec-secgw: transport mode support Sergio Gonzalez Monroy
2016-05-06 16:31 ` [dpdk-dev] [PATCH 9/9] doc: update ipsec sample guide Sergio Gonzalez Monroy
2016-05-10 9:21 ` Mcnamara, John
2016-05-18 12:42 ` [dpdk-dev] [PATCH v2 0/9] IPSec enhancements Sergio Gonzalez Monroy
2016-05-18 12:42 ` [dpdk-dev] [PATCH v2 1/9] examples/ipsec-secgw: fix esp padding check Sergio Gonzalez Monroy
2016-05-18 12:42 ` [dpdk-dev] [PATCH v2 2/9] examples/ipsec-secgw: fix stack smashing error Sergio Gonzalez Monroy
2016-05-18 12:42 ` [dpdk-dev] [PATCH v2 3/9] examples/ipsec-secgw: add build option and cleanup Sergio Gonzalez Monroy
2016-05-18 12:42 ` [dpdk-dev] [PATCH v2 4/9] examples/ipsec-secgw: rework ipsec execution loop Sergio Gonzalez Monroy
2016-06-07 12:50 ` De Lara Guarch, Pablo
2016-05-18 12:42 ` [dpdk-dev] [PATCH v2 5/9] examples/ipsec-secgw: fix no sa found case Sergio Gonzalez Monroy
2016-06-07 13:17 ` De Lara Guarch, Pablo
2016-05-18 12:42 ` [dpdk-dev] [PATCH v2 6/9] examples/ipsec-secgw: consistent config variable names Sergio Gonzalez Monroy
2016-05-18 12:42 ` [dpdk-dev] [PATCH v2 7/9] examples/ipsec-secgw: ipv6 support Sergio Gonzalez Monroy
2016-06-07 16:10 ` De Lara Guarch, Pablo [this message]
2016-05-18 12:42 ` [dpdk-dev] [PATCH v2 8/9] examples/ipsec-secgw: transport mode support Sergio Gonzalez Monroy
2016-05-18 12:42 ` [dpdk-dev] [PATCH v2 9/9] doc: update ipsec sample guide Sergio Gonzalez Monroy
2016-05-18 13:43 ` Mcnamara, John
2016-06-09 8:42 ` [dpdk-dev] [PATCH v3 0/9] IPSec Enhancements Sergio Gonzalez Monroy
2016-06-09 8:42 ` [dpdk-dev] [PATCH v3 1/9] examples/ipsec-secgw: fix esp padding check Sergio Gonzalez Monroy
2016-06-09 8:42 ` [dpdk-dev] [PATCH v3 2/9] examples/ipsec-secgw: fix stack smashing error Sergio Gonzalez Monroy
2016-06-09 8:42 ` [dpdk-dev] [PATCH v3 3/9] examples/ipsec-secgw: add build option and cleanup Sergio Gonzalez Monroy
2016-06-09 8:42 ` [dpdk-dev] [PATCH v3 4/9] examples/ipsec-secgw: rework ipsec execution loop Sergio Gonzalez Monroy
2016-06-09 8:42 ` [dpdk-dev] [PATCH v3 5/9] examples/ipsec-secgw: fix no sa found case Sergio Gonzalez Monroy
2016-06-09 8:42 ` [dpdk-dev] [PATCH v3 6/9] examples/ipsec-secgw: consistent config variable names Sergio Gonzalez Monroy
2016-06-09 8:42 ` [dpdk-dev] [PATCH v3 7/9] examples/ipsec-secgw: ipv6 support Sergio Gonzalez Monroy
2016-06-09 8:42 ` [dpdk-dev] [PATCH v3 8/9] examples/ipsec-secgw: transport mode support Sergio Gonzalez Monroy
2016-06-09 8:42 ` [dpdk-dev] [PATCH v3 9/9] doc: update ipsec sample guide Sergio Gonzalez Monroy
2016-06-09 11:11 ` Mcnamara, John
2016-06-09 11:58 ` [dpdk-dev] [PATCH v3 0/9] IPSec Enhancements De Lara Guarch, Pablo
2016-06-21 10:14 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E115CCD9D858EF4F90C690B0DCB4D8973C95B2F2@IRSMSX108.ger.corp.intel.com \
--to=pablo.de.lara.guarch@intel.com \
--cc=dev@dpdk.org \
--cc=john.mcnamara@intel.com \
--cc=sergio.gonzalez.monroy@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).