Skip to content

Commit

Permalink
{pktgen, xfrm} Using "pgset spi xxx" to spedifiy SA for a given flow
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Fan Du authored and Steffen Klassert committed Jan 3, 2014
1 parent 4ae770b commit de4aee7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
};
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit de4aee7

Please sign in to comment.