summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorFan Du <fan.du@windriver.com>2014-01-03 11:18:30 +0800
committerSteffen Klassert <steffen.klassert@secunet.com>2014-01-03 07:29:11 +0100
commitde4aee7d69f2957c808572f2d5b5fc808ebe212a (patch)
treed7f5e9395d4b8cff2a202d86e11cbb5bb2247486 /net
parent4ae770bf58ce6315e0f4a1bd4b7e574bdfa59ca9 (diff)
{pktgen, xfrm} Using "pgset spi xxx" to spedifiy SA for a given flow
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> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net')
-rw-r--r--net/core/pktgen.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 156d57b616ac..8bc4ddd375a9 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)