Skip to content

Commit 62515f9

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next
Minor conflict in ip_output.c, overlapping changes to the body of an if() statement. Signed-off-by: David S. Miller <[email protected]>
2 parents 9d4927f + 565f0fa commit 62515f9

File tree

5 files changed

+114
-8
lines changed

5 files changed

+114
-8
lines changed

net/ipv4/ip_output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ static int __ip_append_data(struct sock *sk,
910910
length + fragheaderlen <= mtu &&
911911
rt->dst.dev->features & (NETIF_F_HW_CSUM | NETIF_F_IP_CSUM) &&
912912
(!(flags & MSG_MORE) || cork->gso_size) &&
913-
!exthdrlen)
913+
(!exthdrlen || (rt->dst.dev->features & NETIF_F_HW_ESP_TX_CSUM)))
914914
csummode = CHECKSUM_PARTIAL;
915915

916916
cork->length += length;

net/ipv6/ip6_vti.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ vti6_parm_to_user(struct ip6_tnl_parm2 *u, const struct __ip6_tnl_parm *p)
743743
}
744744

745745
/**
746-
* vti6_tnl_ioctl - configure vti6 tunnels from userspace
746+
* vti6_ioctl - configure vti6 tunnels from userspace
747747
* @dev: virtual device associated with tunnel
748748
* @ifr: parameters passed from userspace
749749
* @cmd: command to be performed

net/ipv6/xfrm6_state.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,9 @@ xfrm6_init_temprop(struct xfrm_state *x, const struct xfrm_tmpl *tmpl,
6060
static int
6161
__xfrm6_sort(void **dst, void **src, int n, int (*cmp)(void *p), int maxclass)
6262
{
63-
int i;
63+
int count[XFRM_MAX_DEPTH] = { };
6464
int class[XFRM_MAX_DEPTH];
65-
int count[maxclass];
66-
67-
memset(count, 0, sizeof(count));
65+
int i;
6866

6967
for (i = 0; i < n; i++) {
7068
int c;

net/xfrm/xfrm_state.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ static void xfrm_state_gc_task(struct work_struct *work);
4242

4343
static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024;
4444
static __read_mostly seqcount_t xfrm_state_hash_generation = SEQCNT_ZERO(xfrm_state_hash_generation);
45+
static struct kmem_cache *xfrm_state_cache __ro_after_init;
4546

4647
static DECLARE_WORK(xfrm_state_gc_work, xfrm_state_gc_task);
4748
static HLIST_HEAD(xfrm_state_gc_list);
@@ -451,7 +452,7 @@ static void xfrm_state_gc_destroy(struct xfrm_state *x)
451452
}
452453
xfrm_dev_state_free(x);
453454
security_xfrm_state_free(x);
454-
kfree(x);
455+
kmem_cache_free(xfrm_state_cache, x);
455456
}
456457

457458
static void xfrm_state_gc_task(struct work_struct *work)
@@ -563,7 +564,7 @@ struct xfrm_state *xfrm_state_alloc(struct net *net)
563564
{
564565
struct xfrm_state *x;
565566

566-
x = kzalloc(sizeof(struct xfrm_state), GFP_ATOMIC);
567+
x = kmem_cache_alloc(xfrm_state_cache, GFP_ATOMIC | __GFP_ZERO);
567568

568569
if (x) {
569570
write_pnet(&x->xs_net, net);
@@ -2307,6 +2308,10 @@ int __net_init xfrm_state_init(struct net *net)
23072308
{
23082309
unsigned int sz;
23092310

2311+
if (net_eq(net, &init_net))
2312+
xfrm_state_cache = KMEM_CACHE(xfrm_state,
2313+
SLAB_HWCACHE_ALIGN | SLAB_PANIC);
2314+
23102315
INIT_LIST_HEAD(&net->xfrm.state_all);
23112316

23122317
sz = sizeof(struct hlist_head) * 8;

tools/testing/selftests/net/rtnetlink.sh

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,108 @@ kci_test_macsec()
502502
echo "PASS: macsec"
503503
}
504504

505+
#-------------------------------------------------------------------
506+
# Example commands
507+
# ip x s add proto esp src 14.0.0.52 dst 14.0.0.70 \
508+
# spi 0x07 mode transport reqid 0x07 replay-window 32 \
509+
# aead 'rfc4106(gcm(aes))' 1234567890123456dcba 128 \
510+
# sel src 14.0.0.52/24 dst 14.0.0.70/24
511+
# ip x p add dir out src 14.0.0.52/24 dst 14.0.0.70/24 \
512+
# tmpl proto esp src 14.0.0.52 dst 14.0.0.70 \
513+
# spi 0x07 mode transport reqid 0x07
514+
#
515+
# Subcommands not tested
516+
# ip x s update
517+
# ip x s allocspi
518+
# ip x s deleteall
519+
# ip x p update
520+
# ip x p deleteall
521+
# ip x p set
522+
#-------------------------------------------------------------------
523+
kci_test_ipsec()
524+
{
525+
srcip="14.0.0.52"
526+
dstip="14.0.0.70"
527+
algo="aead rfc4106(gcm(aes)) 0x3132333435363738393031323334353664636261 128"
528+
529+
# flush to be sure there's nothing configured
530+
ip x s flush ; ip x p flush
531+
check_err $?
532+
533+
# start the monitor in the background
534+
tmpfile=`mktemp ipsectestXXX`
535+
ip x m > $tmpfile &
536+
mpid=$!
537+
sleep 0.2
538+
539+
ipsecid="proto esp src $srcip dst $dstip spi 0x07"
540+
ip x s add $ipsecid \
541+
mode transport reqid 0x07 replay-window 32 \
542+
$algo sel src $srcip/24 dst $dstip/24
543+
check_err $?
544+
545+
lines=`ip x s list | grep $srcip | grep $dstip | wc -l`
546+
test $lines -eq 2
547+
check_err $?
548+
549+
ip x s count | grep -q "SAD count 1"
550+
check_err $?
551+
552+
lines=`ip x s get $ipsecid | grep $srcip | grep $dstip | wc -l`
553+
test $lines -eq 2
554+
check_err $?
555+
556+
ip x s delete $ipsecid
557+
check_err $?
558+
559+
lines=`ip x s list | wc -l`
560+
test $lines -eq 0
561+
check_err $?
562+
563+
ipsecsel="dir out src $srcip/24 dst $dstip/24"
564+
ip x p add $ipsecsel \
565+
tmpl proto esp src $srcip dst $dstip \
566+
spi 0x07 mode transport reqid 0x07
567+
check_err $?
568+
569+
lines=`ip x p list | grep $srcip | grep $dstip | wc -l`
570+
test $lines -eq 2
571+
check_err $?
572+
573+
ip x p count | grep -q "SPD IN 0 OUT 1 FWD 0"
574+
check_err $?
575+
576+
lines=`ip x p get $ipsecsel | grep $srcip | grep $dstip | wc -l`
577+
test $lines -eq 2
578+
check_err $?
579+
580+
ip x p delete $ipsecsel
581+
check_err $?
582+
583+
lines=`ip x p list | wc -l`
584+
test $lines -eq 0
585+
check_err $?
586+
587+
# check the monitor results
588+
kill $mpid
589+
lines=`wc -l $tmpfile | cut "-d " -f1`
590+
test $lines -eq 20
591+
check_err $?
592+
rm -rf $tmpfile
593+
594+
# clean up any leftovers
595+
ip x s flush
596+
check_err $?
597+
ip x p flush
598+
check_err $?
599+
600+
if [ $ret -ne 0 ]; then
601+
echo "FAIL: ipsec"
602+
return 1
603+
fi
604+
echo "PASS: ipsec"
605+
}
606+
505607
kci_test_gretap()
506608
{
507609
testns="testns"
@@ -755,6 +857,7 @@ kci_test_rtnl()
755857
kci_test_vrf
756858
kci_test_encap
757859
kci_test_macsec
860+
kci_test_ipsec
758861

759862
kci_del_dummy
760863
}

0 commit comments

Comments
 (0)