Skip to content

Commit 173b185

Browse files
committed
Merge: [RHEL9.5 P1] selftests: stable backport from upstream
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/3967 JIRA: https://issues.redhat.com/browse/RHEL-31077 v2: drop rtnetlink updates as I will backport them in a separate issue. Signed-off-by: Hangbin Liu <haliu@redhat.com> Approved-by: Sabrina Dubroca <sdubroca@redhat.com> Approved-by: Davide Caratti <dcaratti@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Scott Weaver <scweaver@redhat.com>
2 parents e8b367b + 4355a2f commit 173b185

23 files changed

+620
-68
lines changed

drivers/net/tap.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -717,10 +717,20 @@ static ssize_t tap_get_user(struct tap_queue *q, void *msg_control,
717717
skb_reset_mac_header(skb);
718718
skb->protocol = eth_hdr(skb)->h_proto;
719719

720+
rcu_read_lock();
721+
tap = rcu_dereference(q->tap);
722+
if (!tap) {
723+
kfree_skb(skb);
724+
rcu_read_unlock();
725+
return total_len;
726+
}
727+
skb->dev = tap->dev;
728+
720729
if (vnet_hdr_len) {
721730
err = virtio_net_hdr_to_skb(skb, &vnet_hdr,
722731
tap_is_little_endian(q));
723732
if (err) {
733+
rcu_read_unlock();
724734
drop_reason = SKB_DROP_REASON_DEV_HDR;
725735
goto err_kfree;
726736
}
@@ -733,8 +743,6 @@ static ssize_t tap_get_user(struct tap_queue *q, void *msg_control,
733743
vlan_get_protocol_and_depth(skb, skb->protocol, &depth) != 0)
734744
skb_set_network_header(skb, depth);
735745

736-
rcu_read_lock();
737-
tap = rcu_dereference(q->tap);
738746
/* copy skb_ubuf_info for callback when skb has no error */
739747
if (zerocopy) {
740748
skb_zcopy_init(skb, msg_control);
@@ -743,14 +751,8 @@ static ssize_t tap_get_user(struct tap_queue *q, void *msg_control,
743751
uarg->callback(NULL, uarg, false);
744752
}
745753

746-
if (tap) {
747-
skb->dev = tap->dev;
748-
dev_queue_xmit(skb);
749-
} else {
750-
kfree_skb(skb);
751-
}
754+
dev_queue_xmit(skb);
752755
rcu_read_unlock();
753-
754756
return total_len;
755757

756758
err_kfree:

tools/testing/selftests/drivers/net/bonding/lag_lib.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ test_LAG_cleanup()
4848
ip link add mv0 link "$name" up address "$ucaddr" type macvlan
4949
# Used to test dev->mc handling
5050
ip address add "$addr6" dev "$name"
51+
52+
# Check that addresses were added as expected
53+
(grep_bridge_fdb "$ucaddr" bridge fdb show dev dummy1 ||
54+
grep_bridge_fdb "$ucaddr" bridge fdb show dev dummy2) >/dev/null
55+
check_err $? "macvlan unicast address not found on a slave"
56+
57+
# mcaddr is added asynchronously by addrconf_dad_work(), use busywait
58+
(busywait 10000 grep_bridge_fdb "$mcaddr" bridge fdb show dev dummy1 ||
59+
grep_bridge_fdb "$mcaddr" bridge fdb show dev dummy2) >/dev/null
60+
check_err $? "IPv6 solicited-node multicast mac address not found on a slave"
61+
5162
ip link set dev "$name" down
5263
ip link del "$name"
5364

tools/testing/selftests/drivers/net/bonding/mode-1-recovery-updelay.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
# SPDX-License-Identifier: GPL-2.0
33

44
# Regression Test:

tools/testing/selftests/drivers/net/bonding/mode-2-recovery-updelay.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
# SPDX-License-Identifier: GPL-2.0
33

44
# Regression Test:

tools/testing/selftests/net/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ gro
3737
ioam6_parser
3838
toeplitz
3939
cmsg_so_mark
40+
tap

tools/testing/selftests/net/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ TEST_GEN_FILES += hwtstamp_config rxtimestamp timestamping txtimestamp
5353
TEST_GEN_FILES += ipsec
5454
TEST_GEN_FILES += gro
5555
TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
56-
TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls
56+
TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls tap
5757
TEST_GEN_FILES += cmsg_so_mark
5858
TEST_GEN_FILES += stress_reuseport_listen
5959
TEST_PROGS += test_vxlan_vnifiltering.sh

tools/testing/selftests/net/big_tcp.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ do_netperf() {
122122
local netns=$1
123123

124124
[ "$NF" = "6" ] && serip=$SERVER_IP6
125-
ip net exec $netns netperf -$NF -t TCP_STREAM -H $serip 2>&1 >/dev/null
125+
126+
# use large write to be sure to generate big tcp packets
127+
ip net exec $netns netperf -$NF -t TCP_STREAM -l 1 -H $serip -- -m 262144 2>&1 >/dev/null
126128
}
127129

128130
do_test() {

tools/testing/selftests/net/fcnal-test.sh

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ NSC_CMD="ip netns exec ${NSC}"
8484

8585
which ping6 > /dev/null 2>&1 && ping6=$(which ping6) || ping6=$(which ping)
8686

87+
# Check if FIPS mode is enabled
88+
if [ -f /proc/sys/crypto/fips_enabled ]; then
89+
fips_enabled=`cat /proc/sys/crypto/fips_enabled`
90+
else
91+
fips_enabled=0
92+
fi
93+
8794
################################################################################
8895
# utilities
8996

@@ -1196,7 +1203,7 @@ ipv4_tcp_novrf()
11961203
run_cmd nettest -d ${NSA_DEV} -r ${a}
11971204
log_test_addr ${a} $? 1 "No server, device client, local conn"
11981205

1199-
ipv4_tcp_md5_novrf
1206+
[ "$fips_enabled" = "1" ] || ipv4_tcp_md5_novrf
12001207
}
12011208

12021209
ipv4_tcp_vrf()
@@ -1250,9 +1257,11 @@ ipv4_tcp_vrf()
12501257
log_test_addr ${a} $? 1 "Global server, local connection"
12511258

12521259
# run MD5 tests
1253-
setup_vrf_dup
1254-
ipv4_tcp_md5
1255-
cleanup_vrf_dup
1260+
if [ "$fips_enabled" = "0" ]; then
1261+
setup_vrf_dup
1262+
ipv4_tcp_md5
1263+
cleanup_vrf_dup
1264+
fi
12561265

12571266
#
12581267
# enable VRF global server
@@ -2685,7 +2694,7 @@ ipv6_tcp_novrf()
26852694
log_test_addr ${a} $? 1 "No server, device client, local conn"
26862695
done
26872696

2688-
ipv6_tcp_md5_novrf
2697+
[ "$fips_enabled" = "1" ] || ipv6_tcp_md5_novrf
26892698
}
26902699

26912700
ipv6_tcp_vrf()
@@ -2755,9 +2764,11 @@ ipv6_tcp_vrf()
27552764
log_test_addr ${a} $? 1 "Global server, local connection"
27562765

27572766
# run MD5 tests
2758-
setup_vrf_dup
2759-
ipv6_tcp_md5
2760-
cleanup_vrf_dup
2767+
if [ "$fips_enabled" = "0" ]; then
2768+
setup_vrf_dup
2769+
ipv6_tcp_md5
2770+
cleanup_vrf_dup
2771+
fi
27612772

27622773
#
27632774
# enable VRF global server

tools/testing/selftests/net/fib_nexthop_multiprefix.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,12 @@ validate_v6_exception()
209209
echo "Route get"
210210
ip -netns h0 -6 ro get ${dst}
211211
echo "Searching for:"
212-
echo " ${dst} from :: via ${r1} dev eth0 src ${h0} .* mtu ${mtu}"
212+
echo " ${dst}.* via ${r1} dev eth0 src ${h0} .* mtu ${mtu}"
213213
echo
214214
fi
215215

216216
ip -netns h0 -6 ro get ${dst} | \
217-
grep -q "${dst} from :: via ${r1} dev eth0 src ${h0} .* mtu ${mtu}"
217+
grep -q "${dst}.* via ${r1} dev eth0 src ${h0} .* mtu ${mtu}"
218218
rc=$?
219219

220220
log_test $rc 0 "IPv6: host 0 to host ${i}, mtu ${mtu}"

tools/testing/selftests/net/forwarding/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ TEST_PROGS = bridge_igmp.sh \
109109
vxlan_symmetric_ipv6.sh \
110110
vxlan_symmetric.sh
111111

112-
TEST_PROGS_EXTENDED := devlink_lib.sh \
112+
TEST_FILES := devlink_lib.sh \
113113
ethtool_lib.sh \
114114
fib_offload_lib.sh \
115115
forwarding.config.sample \

0 commit comments

Comments
 (0)