Skip to content

Commit 21705c7

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf
Pable Neira Ayuso says: ==================== The following patchset contains Netfilter fixes for net: 1) Increase timeout to 120 seconds for netfilter selftests to fix nftables transaction tests, from Florian Westphal. 2) Fix overflow in bitmap_ip_create() due to integer arithmetics in a 64-bit bitmask, from Gavrilov Ilia. 3) Fix incorrect arithmetics in nft_payload with double-tagged vlan matching. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents c296c77 + 696e1a4 commit 21705c7

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

net/netfilter/ipset/ip_set_bitmap_ip.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ bitmap_ip_create(struct net *net, struct ip_set *set, struct nlattr *tb[],
308308
return -IPSET_ERR_BITMAP_RANGE;
309309

310310
pr_debug("mask_bits %u, netmask %u\n", mask_bits, netmask);
311-
hosts = 2 << (32 - netmask - 1);
312-
elements = 2 << (netmask - mask_bits - 1);
311+
hosts = 2U << (32 - netmask - 1);
312+
elements = 2UL << (netmask - mask_bits - 1);
313313
}
314314
if (elements > IPSET_BITMAP_MAX_RANGE + 1)
315315
return -IPSET_ERR_BITMAP_RANGE_SIZE;

net/netfilter/nft_payload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ nft_payload_copy_vlan(u32 *d, const struct sk_buff *skb, u8 offset, u8 len)
6363
return false;
6464

6565
if (offset + len > VLAN_ETH_HLEN + vlan_hlen)
66-
ethlen -= offset + len - VLAN_ETH_HLEN + vlan_hlen;
66+
ethlen -= offset + len - VLAN_ETH_HLEN - vlan_hlen;
6767

6868
memcpy(dst_u8, vlanh + offset - vlan_hlen, ethlen);
6969

tools/testing/selftests/netfilter/nft_trans_stress.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@
1010
ksft_skip=4
1111

1212
testns=testns-$(mktemp -u "XXXXXXXX")
13+
tmp=""
1314

1415
tables="foo bar baz quux"
1516
global_ret=0
1617
eret=0
1718
lret=0
1819

20+
cleanup() {
21+
ip netns pids "$testns" | xargs kill 2>/dev/null
22+
ip netns del "$testns"
23+
24+
rm -f "$tmp"
25+
}
26+
1927
check_result()
2028
{
2129
local r=$1
@@ -43,6 +51,7 @@ if [ $? -ne 0 ];then
4351
exit $ksft_skip
4452
fi
4553

54+
trap cleanup EXIT
4655
tmp=$(mktemp)
4756

4857
for table in $tables; do
@@ -139,11 +148,4 @@ done
139148

140149
check_result $lret "add/delete with nftrace enabled"
141150

142-
pkill -9 ping
143-
144-
wait
145-
146-
rm -f "$tmp"
147-
ip netns del "$testns"
148-
149151
exit $global_ret
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
timeout=120

0 commit comments

Comments
 (0)