netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fan Du <fan.du@windriver.com>
To: <davem@davemloft.net>
Cc: <steffen.klassert@secunet.com>, <hadi@cyberus.ca>,
	<netdev@vger.kernel.org>
Subject: [PATCHv4 net-next 4/8] {pktgen, xfrm} Using "pgset spi xxx" to spedifiy SA for a given flow
Date: Fri, 20 Dec 2013 10:33:30 +0800	[thread overview]
Message-ID: <1387506814-4417-5-git-send-email-fan.du@windriver.com> (raw)
In-Reply-To: <1387506814-4417-1-git-send-email-fan.du@windriver.com>

User could set specific SPI value to arm pktgen flow with IPsec
transformation, instead of looking up SA by sadr/daddr. The reaseon
to do so is because current state lookup scheme is both slow and, most
important of all, in fact pktgen doesn't need to match any SA state
addresses information, all it needs is the SA transfromation shell to
do the encapuslation.

And this option also provide user an alternative to using pktgen
test existing SA without creating new ones.

Signed-off-by: Fan Du <fan.du@windriver.com>
---
 net/core/pktgen.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 156d57b..8bc4ddd 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -389,6 +389,7 @@ struct pktgen_dev {
 #ifdef CONFIG_XFRM
 	__u8	ipsmode;		/* IPSEC mode (config) */
 	__u8	ipsproto;		/* IPSEC type (config) */
+	__u32	spi;
 #endif
 	char result[512];
 };
@@ -1477,6 +1478,17 @@ static ssize_t pktgen_if_write(struct file *file,
 		return count;
 	}
 
+	if (!strcmp(name, "spi")) {
+		len = num_arg(&user_buffer[i], 10, &value);
+		if (len < 0)
+			return len;
+
+		i += len;
+		pkt_dev->spi = value;
+		sprintf(pg_result, "OK: spi=%u", pkt_dev->spi);
+		return count;
+	}
+
 	if (!strcmp(name, "flowlen")) {
 		len = num_arg(&user_buffer[i], 10, &value);
 		if (len < 0)
-- 
1.7.9.5

  parent reply	other threads:[~2013-12-20  2:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20  2:33 [PATCHv4 net-next 0/8] pktgen IPsec support Fan Du
2013-12-20  2:33 ` [PATCHv4 net-next 1/8] {pktgen, xfrm} Correct xfrm state lock usage when transforming Fan Du
2013-12-20  2:33 ` [PATCHv4 net-next 2/8] {pktgen, xfrm} Add statistics counting " Fan Du
2013-12-20  2:33 ` [PATCHv4 net-next 3/8] {pktgen, xfrm} Correct xfrm_state_lock usage in xfrm_stateonly_find Fan Du
2014-01-02  7:32   ` Steffen Klassert
2013-12-20  2:33 ` Fan Du [this message]
2013-12-20  2:33 ` [PATCHv4 net-next 5/8] {pktgen, xfrm} Construct skb dst for tunnel mode transformation Fan Du
2013-12-20  2:33 ` [PATCHv4 net-next 6/8] {pktgen, xfrm} Introduce xfrm_state_lookup_byspi for pktgen Fan Du
2013-12-20  2:33 ` [PATCHv4 net-next 7/8] {pktgen, xfrm} Show spi value properly when ipsec turned on Fan Du
2013-12-20  2:33 ` [PATCHv4 net-next 8/8] {pktgen, xfrm} Document IPsec usage in pktgen.txt Fan Du
  -- strict thread matches above, loose matches on Subject: below --
2014-01-03  3:18 [PATCHv5 net-next 0/8] pktgen IPsec support Fan Du
2014-01-03  3:18 ` [PATCHv4 net-next 4/8] {pktgen, xfrm} Using "pgset spi xxx" to spedifiy SA for a given flow Fan Du

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=1387506814-4417-5-git-send-email-fan.du@windriver.com \
    --to=fan.du@windriver.com \
    --cc=davem@davemloft.net \
    --cc=hadi@cyberus.ca \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.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).