Skip to content

Commit 0de53b0

Browse files
sbrivio-rhummakynes
authored andcommitted
selftests: netfilter: Add correctness test for mac,net set type
The existing net,mac test didn't cover the issue recently reported by Nikita Yushchenko, where MAC addresses wouldn't match if given as first field of a concatenated set with AVX2 and 8-bit groups, because there's a different code path covering the lookup of six 8-bit groups (MAC addresses) if that's the first field. Add a similar mac,net test, with MAC address and IPv4 address swapped in the set specification. Signed-off-by: Stefano Brivio <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent b7e945e commit 0de53b0

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

tools/testing/selftests/netfilter/nft_concat_range.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ TESTS="reported_issues correctness concurrency timeout"
2323

2424
# Set types, defined by TYPE_ variables below
2525
TYPES="net_port port_net net6_port port_proto net6_port_mac net6_port_mac_proto
26-
net_port_net net_mac net_mac_icmp net6_mac_icmp net6_port_net6_port
27-
net_port_mac_proto_net"
26+
net_port_net net_mac mac_net net_mac_icmp net6_mac_icmp
27+
net6_port_net6_port net_port_mac_proto_net"
2828

2929
# Reported bugs, also described by TYPE_ variables below
3030
BUGS="flush_remove_add"
@@ -277,6 +277,23 @@ perf_entries 1000
277277
perf_proto ipv4
278278
"
279279

280+
TYPE_mac_net="
281+
display mac,net
282+
type_spec ether_addr . ipv4_addr
283+
chain_spec ether saddr . ip saddr
284+
dst
285+
src mac addr4
286+
start 1
287+
count 5
288+
src_delta 2000
289+
tools sendip nc bash
290+
proto udp
291+
292+
race_repeat 0
293+
294+
perf_duration 0
295+
"
296+
280297
TYPE_net_mac_icmp="
281298
display net,mac - ICMP
282299
type_spec ipv4_addr . ether_addr
@@ -984,7 +1001,8 @@ format() {
9841001
fi
9851002
done
9861003
for f in ${src}; do
987-
__expr="${__expr} . "
1004+
[ "${__expr}" != "{ " ] && __expr="${__expr} . "
1005+
9881006
__start="$(eval format_"${f}" "${srcstart}")"
9891007
__end="$(eval format_"${f}" "${srcend}")"
9901008

0 commit comments

Comments
 (0)