mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 17:57:38 -04:00
Merge tag 'asoc-v6.18-2' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: Updates for v6.18 round 2 Some more updates for v6.18, mostly fixes for the earlier pull request with some cleanups and more minor fixes for older code. We do have one new driver, the TI TAS2783A, and some quirks for new platforms.
This commit is contained in:
@@ -7,6 +7,8 @@ ALL_TESTS="
|
||||
prio
|
||||
arp_validate
|
||||
num_grat_arp
|
||||
fail_over_mac
|
||||
vlan_over_bond
|
||||
"
|
||||
|
||||
lib_dir=$(dirname "$0")
|
||||
@@ -352,8 +354,8 @@ garp_test()
|
||||
|
||||
exp_num=$(echo "${param}" | cut -f6 -d ' ')
|
||||
active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" ".[].linkinfo.info_data.active_slave")
|
||||
slowwait_for_counter $((exp_num + 5)) $exp_num \
|
||||
tc_rule_handle_stats_get "dev s${active_slave#eth} ingress" 101 ".packets" "-n ${g_ns}"
|
||||
slowwait_for_counter $((exp_num + 5)) $exp_num tc_rule_handle_stats_get \
|
||||
"dev s${active_slave#eth} ingress" 101 ".packets" "-n ${g_ns}" &> /dev/null
|
||||
|
||||
# check result
|
||||
real_num=$(tc_rule_handle_stats_get "dev s${active_slave#eth} ingress" 101 ".packets" "-n ${g_ns}")
|
||||
@@ -376,6 +378,197 @@ num_grat_arp()
|
||||
done
|
||||
}
|
||||
|
||||
check_all_mac_same()
|
||||
{
|
||||
RET=0
|
||||
# all slaves should have same mac address (with the first port's mac)
|
||||
local bond_mac=$(ip -n "$s_ns" -j link show bond0 | jq -r '.[]["address"]')
|
||||
local eth0_mac=$(ip -n "$s_ns" -j link show eth0 | jq -r '.[]["address"]')
|
||||
local eth1_mac=$(ip -n "$s_ns" -j link show eth1 | jq -r '.[]["address"]')
|
||||
local eth2_mac=$(ip -n "$s_ns" -j link show eth2 | jq -r '.[]["address"]')
|
||||
if [ "$bond_mac" != "${mac[0]}" ] || [ "$eth0_mac" != "$bond_mac" ] || \
|
||||
[ "$eth1_mac" != "$bond_mac" ] || [ "$eth2_mac" != "$bond_mac" ]; then
|
||||
RET=1
|
||||
fi
|
||||
}
|
||||
|
||||
check_bond_mac_same_with_first()
|
||||
{
|
||||
RET=0
|
||||
# bond mac address should be same with the first added slave
|
||||
local bond_mac=$(ip -n "$s_ns" -j link show bond0 | jq -r '.[]["address"]')
|
||||
if [ "$bond_mac" != "${mac[0]}" ]; then
|
||||
RET=1
|
||||
fi
|
||||
}
|
||||
|
||||
check_bond_mac_same_with_active()
|
||||
{
|
||||
RET=0
|
||||
# bond mac address should be same with active slave
|
||||
local bond_mac=$(ip -n "$s_ns" -j link show bond0 | jq -r '.[]["address"]')
|
||||
local active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" ".[].linkinfo.info_data.active_slave")
|
||||
local active_slave_mac=$(ip -n "$s_ns" -j link show "$active_slave" | jq -r '.[]["address"]')
|
||||
if [ "$bond_mac" != "$active_slave_mac" ]; then
|
||||
RET=1
|
||||
fi
|
||||
}
|
||||
|
||||
check_backup_slave_mac_not_change()
|
||||
{
|
||||
RET=0
|
||||
# backup slave's mac address is not changed
|
||||
if ip -n "$s_ns" -d -j link show type bond_slave | jq -e '.[]
|
||||
| select(.linkinfo.info_slave_data.state=="BACKUP")
|
||||
| select(.address != .linkinfo.info_slave_data.perm_hwaddr)' &> /dev/null; then
|
||||
RET=1
|
||||
fi
|
||||
}
|
||||
|
||||
check_backup_slave_mac_inherit()
|
||||
{
|
||||
local backup_mac
|
||||
RET=0
|
||||
|
||||
# backup slaves should use mac[1] or mac[2]
|
||||
local backup_macs=$(ip -n "$s_ns" -d -j link show type bond_slave | \
|
||||
jq -r '.[] | select(.linkinfo.info_slave_data.state=="BACKUP") | .address')
|
||||
for backup_mac in $backup_macs; do
|
||||
if [ "$backup_mac" != "${mac[1]}" ] && [ "$backup_mac" != "${mac[2]}" ]; then
|
||||
RET=1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
check_first_slave_random_mac()
|
||||
{
|
||||
RET=0
|
||||
# remove the first added slave and added it back
|
||||
ip -n "$s_ns" link set eth0 nomaster
|
||||
ip -n "$s_ns" link set eth0 master bond0
|
||||
|
||||
# the first slave should use random mac address
|
||||
eth0_mac=$(ip -n "$s_ns" -j link show eth0 | jq -r '.[]["address"]')
|
||||
[ "$eth0_mac" = "${mac[0]}" ] && RET=1
|
||||
log_test "bond fail_over_mac follow" "random first slave mac"
|
||||
|
||||
# remove the first slave, the permanent MAC address should be restored back
|
||||
ip -n "$s_ns" link set eth0 nomaster
|
||||
eth0_mac=$(ip -n "$s_ns" -j link show eth0 | jq -r '.[]["address"]')
|
||||
[ "$eth0_mac" != "${mac[0]}" ] && RET=1
|
||||
}
|
||||
|
||||
do_active_backup_failover()
|
||||
{
|
||||
local active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" ".[].linkinfo.info_data.active_slave")
|
||||
ip -n ${s_ns} link set ${active_slave} down
|
||||
slowwait 2 active_slave_changed $active_slave
|
||||
ip -n ${s_ns} link set ${active_slave} up
|
||||
}
|
||||
|
||||
fail_over_mac()
|
||||
{
|
||||
# Bring down the first interface on the switch to force the bond to
|
||||
# select another active interface instead of the first one that joined.
|
||||
ip -n "$g_ns" link set s0 down
|
||||
|
||||
# fail_over_mac none
|
||||
bond_reset "mode active-backup miimon 100 fail_over_mac 0"
|
||||
check_all_mac_same
|
||||
log_test "fail_over_mac 0" "all slaves have same mac"
|
||||
do_active_backup_failover
|
||||
check_all_mac_same
|
||||
log_test "fail_over_mac 0" "failover: all slaves have same mac"
|
||||
|
||||
# fail_over_mac active
|
||||
bond_reset "mode active-backup miimon 100 fail_over_mac 1"
|
||||
check_bond_mac_same_with_active
|
||||
log_test "fail_over_mac 1" "bond mac is same with active slave mac"
|
||||
check_backup_slave_mac_not_change
|
||||
log_test "fail_over_mac 1" "backup slave mac is not changed"
|
||||
do_active_backup_failover
|
||||
check_bond_mac_same_with_active
|
||||
log_test "fail_over_mac 1" "failover: bond mac is same with active slave mac"
|
||||
check_backup_slave_mac_not_change
|
||||
log_test "fail_over_mac 1" "failover: backup slave mac is not changed"
|
||||
|
||||
# fail_over_mac follow
|
||||
bond_reset "mode active-backup miimon 100 fail_over_mac 2"
|
||||
check_bond_mac_same_with_first
|
||||
log_test "fail_over_mac 2" "bond mac is same with first slave mac"
|
||||
check_bond_mac_same_with_active
|
||||
log_test "fail_over_mac 2" "bond mac is same with active slave mac"
|
||||
check_backup_slave_mac_inherit
|
||||
log_test "fail_over_mac 2" "backup slave mac inherit"
|
||||
do_active_backup_failover
|
||||
check_bond_mac_same_with_first
|
||||
log_test "fail_over_mac 2" "failover: bond mac is same with first slave mac"
|
||||
check_bond_mac_same_with_active
|
||||
log_test "fail_over_mac 2" "failover: bond mac is same with active slave mac"
|
||||
check_backup_slave_mac_inherit
|
||||
log_test "fail_over_mac 2" "failover: backup slave mac inherit"
|
||||
check_first_slave_random_mac
|
||||
log_test "fail_over_mac 2" "first slave mac random"
|
||||
}
|
||||
|
||||
vlan_over_bond_arp()
|
||||
{
|
||||
local mode="$1"
|
||||
RET=0
|
||||
|
||||
bond_reset "mode $mode arp_interval 100 arp_ip_target 192.0.3.10"
|
||||
ip -n "${s_ns}" link add bond0.3 link bond0 type vlan id 3
|
||||
ip -n "${s_ns}" link set bond0.3 up
|
||||
ip -n "${s_ns}" addr add 192.0.3.1/24 dev bond0.3
|
||||
ip -n "${s_ns}" addr add 2001:db8::3:1/64 dev bond0.3
|
||||
|
||||
slowwait_for_counter 5 5 tc_rule_handle_stats_get \
|
||||
"dev eth0.3 ingress" 101 ".packets" "-n ${c_ns}" &> /dev/null || RET=1
|
||||
log_test "vlan over bond arp" "$mode"
|
||||
}
|
||||
|
||||
vlan_over_bond_ns()
|
||||
{
|
||||
local mode="$1"
|
||||
RET=0
|
||||
|
||||
if skip_ns; then
|
||||
log_test_skip "vlan_over_bond ns" "$mode"
|
||||
return 0
|
||||
fi
|
||||
|
||||
bond_reset "mode $mode arp_interval 100 ns_ip6_target 2001:db8::3:10"
|
||||
ip -n "${s_ns}" link add bond0.3 link bond0 type vlan id 3
|
||||
ip -n "${s_ns}" link set bond0.3 up
|
||||
ip -n "${s_ns}" addr add 192.0.3.1/24 dev bond0.3
|
||||
ip -n "${s_ns}" addr add 2001:db8::3:1/64 dev bond0.3
|
||||
|
||||
slowwait_for_counter 5 5 tc_rule_handle_stats_get \
|
||||
"dev eth0.3 ingress" 102 ".packets" "-n ${c_ns}" &> /dev/null || RET=1
|
||||
log_test "vlan over bond ns" "$mode"
|
||||
}
|
||||
|
||||
vlan_over_bond()
|
||||
{
|
||||
# add vlan 3 for client
|
||||
ip -n "${c_ns}" link add eth0.3 link eth0 type vlan id 3
|
||||
ip -n "${c_ns}" link set eth0.3 up
|
||||
ip -n "${c_ns}" addr add 192.0.3.10/24 dev eth0.3
|
||||
ip -n "${c_ns}" addr add 2001:db8::3:10/64 dev eth0.3
|
||||
|
||||
# Add tc rule to check the vlan pkts
|
||||
tc -n "${c_ns}" qdisc add dev eth0.3 clsact
|
||||
tc -n "${c_ns}" filter add dev eth0.3 ingress protocol arp \
|
||||
handle 101 flower skip_hw arp_op request \
|
||||
arp_sip 192.0.3.1 arp_tip 192.0.3.10 action pass
|
||||
tc -n "${c_ns}" filter add dev eth0.3 ingress protocol ipv6 \
|
||||
handle 102 flower skip_hw ip_proto icmpv6 \
|
||||
type 135 src_ip 2001:db8::3:1 action pass
|
||||
|
||||
vlan_over_bond_arp "active-backup"
|
||||
vlan_over_bond_ns "active-backup"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
|
||||
@@ -39,6 +39,8 @@ g_ip4="192.0.2.254"
|
||||
s_ip6="2001:db8::1"
|
||||
c_ip6="2001:db8::10"
|
||||
g_ip6="2001:db8::254"
|
||||
mac[0]="00:0a:0b:0c:0d:01"
|
||||
mac[1]="00:0a:0b:0c:0d:02"
|
||||
|
||||
gateway_create()
|
||||
{
|
||||
@@ -62,6 +64,7 @@ server_create()
|
||||
|
||||
for i in $(seq 0 1); do
|
||||
ip -n ${s_ns} link add eth${i} type veth peer name s${i} netns ${g_ns}
|
||||
ip -n "${s_ns}" link set "eth${i}" addr "${mac[$i]}"
|
||||
|
||||
ip -n ${g_ns} link set s${i} up
|
||||
ip -n ${g_ns} link set s${i} master br0
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
# +-------------------------------------+
|
||||
|
||||
source bond_topo_2d1c.sh
|
||||
mac[2]="00:0a:0b:0c:0d:03"
|
||||
|
||||
setup_prepare()
|
||||
{
|
||||
@@ -36,6 +37,7 @@ setup_prepare()
|
||||
# Add the extra device as we use 3 down links for bond0
|
||||
local i=2
|
||||
ip -n ${s_ns} link add eth${i} type veth peer name s${i} netns ${g_ns}
|
||||
ip -n "${s_ns}" link set "eth${i}" addr "${mac[$i]}"
|
||||
ip -n ${g_ns} link set s${i} up
|
||||
ip -n ${g_ns} link set s${i} master br0
|
||||
ip -n ${s_ns} link set eth${i} master bond0
|
||||
|
||||
@@ -10,3 +10,4 @@ CONFIG_NET_CLS_MATCHALL=m
|
||||
CONFIG_NET_SCH_INGRESS=y
|
||||
CONFIG_NLMON=y
|
||||
CONFIG_VETH=y
|
||||
CONFIG_VLAN_8021Q=m
|
||||
|
||||
@@ -1093,6 +1093,7 @@ int main_loop_s(int listensock)
|
||||
struct pollfd polls;
|
||||
socklen_t salen;
|
||||
int remotesock;
|
||||
int err = 0;
|
||||
int fd = 0;
|
||||
|
||||
again:
|
||||
@@ -1125,7 +1126,7 @@ int main_loop_s(int listensock)
|
||||
SOCK_TEST_TCPULP(remotesock, 0);
|
||||
|
||||
memset(&winfo, 0, sizeof(winfo));
|
||||
copyfd_io(fd, remotesock, 1, true, &winfo);
|
||||
err = copyfd_io(fd, remotesock, 1, true, &winfo);
|
||||
} else {
|
||||
perror("accept");
|
||||
return 1;
|
||||
@@ -1134,10 +1135,10 @@ int main_loop_s(int listensock)
|
||||
if (cfg_input)
|
||||
close(fd);
|
||||
|
||||
if (--cfg_repeat > 0)
|
||||
if (!err && --cfg_repeat > 0)
|
||||
goto again;
|
||||
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
static void init_rng(void)
|
||||
@@ -1247,7 +1248,7 @@ void xdisconnect(int fd)
|
||||
else
|
||||
xerror("bad family");
|
||||
|
||||
strcpy(cmd, "ss -M | grep -q ");
|
||||
strcpy(cmd, "ss -Mnt | grep -q ");
|
||||
cmdlen = strlen(cmd);
|
||||
if (!inet_ntop(addr.ss_family, raw_addr, &cmd[cmdlen],
|
||||
sizeof(cmd) - cmdlen))
|
||||
@@ -1257,7 +1258,7 @@ void xdisconnect(int fd)
|
||||
|
||||
/*
|
||||
* wait until the pending data is completely flushed and all
|
||||
* the MPTCP sockets reached the closed status.
|
||||
* the sockets reached the closed status.
|
||||
* disconnect will bypass/ignore/drop any pending data.
|
||||
*/
|
||||
for (i = 0; ; i += msec_sleep) {
|
||||
|
||||
@@ -211,6 +211,11 @@ if $checksum; then
|
||||
done
|
||||
fi
|
||||
|
||||
if $capture; then
|
||||
rndh="${ns1:4}"
|
||||
mptcp_lib_pr_info "Packet capture files will have this prefix: ${rndh}-"
|
||||
fi
|
||||
|
||||
set_ethtool_flags() {
|
||||
local ns="$1"
|
||||
local dev="$2"
|
||||
@@ -361,7 +366,6 @@ do_transfer()
|
||||
|
||||
if $capture; then
|
||||
local capuser
|
||||
local rndh="${connector_ns:4}"
|
||||
if [ -z $SUDO_USER ] ; then
|
||||
capuser=""
|
||||
else
|
||||
|
||||
@@ -384,7 +384,7 @@ mptcp_lib_make_file() {
|
||||
mptcp_lib_print_file_err() {
|
||||
ls -l "${1}" 1>&2
|
||||
echo "Trailing bytes are: "
|
||||
tail -c 27 "${1}"
|
||||
tail -c 32 "${1}" | od -x | head -n2
|
||||
}
|
||||
|
||||
# $1: input file ; $2: output file ; $3: what kind of file
|
||||
|
||||
@@ -667,22 +667,26 @@ static void process_one_client(int fd, int pipefd)
|
||||
|
||||
do_getsockopts(&s, fd, ret, ret2);
|
||||
if (s.mptcpi_rcv_delta != (uint64_t)ret + 1)
|
||||
xerror("mptcpi_rcv_delta %" PRIu64 ", expect %" PRIu64, s.mptcpi_rcv_delta, ret + 1, s.mptcpi_rcv_delta - ret);
|
||||
xerror("mptcpi_rcv_delta %" PRIu64 ", expect %" PRIu64 ", diff %" PRId64,
|
||||
s.mptcpi_rcv_delta, ret + 1, s.mptcpi_rcv_delta - (ret + 1));
|
||||
|
||||
/* be nice when running on top of older kernel */
|
||||
if (s.pkt_stats_avail) {
|
||||
if (s.last_sample.mptcpi_bytes_sent != ret2)
|
||||
xerror("mptcpi_bytes_sent %" PRIu64 ", expect %" PRIu64,
|
||||
xerror("mptcpi_bytes_sent %" PRIu64 ", expect %" PRIu64
|
||||
", diff %" PRId64,
|
||||
s.last_sample.mptcpi_bytes_sent, ret2,
|
||||
s.last_sample.mptcpi_bytes_sent - ret2);
|
||||
if (s.last_sample.mptcpi_bytes_received != ret)
|
||||
xerror("mptcpi_bytes_received %" PRIu64 ", expect %" PRIu64,
|
||||
xerror("mptcpi_bytes_received %" PRIu64 ", expect %" PRIu64
|
||||
", diff %" PRId64,
|
||||
s.last_sample.mptcpi_bytes_received, ret,
|
||||
s.last_sample.mptcpi_bytes_received - ret);
|
||||
if (s.last_sample.mptcpi_bytes_acked != ret)
|
||||
xerror("mptcpi_bytes_acked %" PRIu64 ", expect %" PRIu64,
|
||||
s.last_sample.mptcpi_bytes_acked, ret2,
|
||||
s.last_sample.mptcpi_bytes_acked - ret2);
|
||||
xerror("mptcpi_bytes_acked %" PRIu64 ", expect %" PRIu64
|
||||
", diff %" PRId64,
|
||||
s.last_sample.mptcpi_bytes_acked, ret,
|
||||
s.last_sample.mptcpi_bytes_acked - ret);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
@@ -188,6 +188,13 @@ static int capture_events(int fd, int event_group)
|
||||
fprintf(stderr, ",error:%u", *(__u8 *)RTA_DATA(attrs));
|
||||
else if (attrs->rta_type == MPTCP_ATTR_SERVER_SIDE)
|
||||
fprintf(stderr, ",server_side:%u", *(__u8 *)RTA_DATA(attrs));
|
||||
else if (attrs->rta_type == MPTCP_ATTR_FLAGS) {
|
||||
__u16 flags = *(__u16 *)RTA_DATA(attrs);
|
||||
|
||||
/* only print when present, easier */
|
||||
if (flags & MPTCP_PM_EV_FLAG_DENY_JOIN_ID0)
|
||||
fprintf(stderr, ",deny_join_id0:1");
|
||||
}
|
||||
|
||||
attrs = RTA_NEXT(attrs, msg_len);
|
||||
}
|
||||
|
||||
@@ -201,6 +201,9 @@ make_connection()
|
||||
is_v6="v4"
|
||||
fi
|
||||
|
||||
# set this on the client side only: will not affect the rest
|
||||
ip netns exec "$ns2" sysctl -q net.mptcp.allow_join_initial_addr_port=0
|
||||
|
||||
:>"$client_evts"
|
||||
:>"$server_evts"
|
||||
|
||||
@@ -223,23 +226,28 @@ make_connection()
|
||||
local client_token
|
||||
local client_port
|
||||
local client_serverside
|
||||
local client_nojoin
|
||||
local server_token
|
||||
local server_serverside
|
||||
local server_nojoin
|
||||
|
||||
client_token=$(mptcp_lib_evts_get_info token "$client_evts")
|
||||
client_port=$(mptcp_lib_evts_get_info sport "$client_evts")
|
||||
client_serverside=$(mptcp_lib_evts_get_info server_side "$client_evts")
|
||||
client_nojoin=$(mptcp_lib_evts_get_info deny_join_id0 "$client_evts")
|
||||
server_token=$(mptcp_lib_evts_get_info token "$server_evts")
|
||||
server_serverside=$(mptcp_lib_evts_get_info server_side "$server_evts")
|
||||
server_nojoin=$(mptcp_lib_evts_get_info deny_join_id0 "$server_evts")
|
||||
|
||||
print_test "Established IP${is_v6} MPTCP Connection ns2 => ns1"
|
||||
if [ "$client_token" != "" ] && [ "$server_token" != "" ] && [ "$client_serverside" = 0 ] &&
|
||||
[ "$server_serverside" = 1 ]
|
||||
if [ "${client_token}" != "" ] && [ "${server_token}" != "" ] &&
|
||||
[ "${client_serverside}" = 0 ] && [ "${server_serverside}" = 1 ] &&
|
||||
[ "${client_nojoin:-0}" = 0 ] && [ "${server_nojoin:-0}" = 1 ]
|
||||
then
|
||||
test_pass
|
||||
print_title "Connection info: ${client_addr}:${client_port} -> ${connect_addr}:${app_port}"
|
||||
else
|
||||
test_fail "Expected tokens (c:${client_token} - s:${server_token}) and server (c:${client_serverside} - s:${server_serverside})"
|
||||
test_fail "Expected tokens (c:${client_token} - s:${server_token}), server (c:${client_serverside} - s:${server_serverside}), nojoin (c:${client_nojoin} - s:${server_nojoin})"
|
||||
mptcp_lib_result_print_all_tap
|
||||
exit ${KSFT_FAIL}
|
||||
fi
|
||||
|
||||
@@ -25,6 +25,7 @@ tests="
|
||||
nat_related_v4 ip4-nat-related: ICMP related matches work with SNAT
|
||||
netlink_checks ovsnl: validate netlink attrs and settings
|
||||
upcall_interfaces ovs: test the upcall interfaces
|
||||
tunnel_metadata ovs: test extraction of tunnel metadata
|
||||
drop_reason drop: test drop reasons are emitted
|
||||
psample psample: Sampling packets with psample"
|
||||
|
||||
@@ -113,13 +114,13 @@ ovs_add_dp () {
|
||||
}
|
||||
|
||||
ovs_add_if () {
|
||||
info "Adding IF to DP: br:$2 if:$3"
|
||||
if [ "$4" != "-u" ]; then
|
||||
ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py add-if "$2" "$3" \
|
||||
|| return 1
|
||||
info "Adding IF to DP: br:$3 if:$4 ($2)"
|
||||
if [ "$5" != "-u" ]; then
|
||||
ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py add-if \
|
||||
-t "$2" "$3" "$4" || return 1
|
||||
else
|
||||
python3 $ovs_base/ovs-dpctl.py add-if \
|
||||
-u "$2" "$3" >$ovs_dir/$3.out 2>$ovs_dir/$3.err &
|
||||
-u -t "$2" "$3" "$4" >$ovs_dir/$4.out 2>$ovs_dir/$4.err &
|
||||
pid=$!
|
||||
on_exit "ovs_sbx $1 kill -TERM $pid 2>/dev/null"
|
||||
fi
|
||||
@@ -166,9 +167,9 @@ ovs_add_netns_and_veths () {
|
||||
fi
|
||||
|
||||
if [ "$7" != "-u" ]; then
|
||||
ovs_add_if "$1" "$2" "$4" || return 1
|
||||
ovs_add_if "$1" "netdev" "$2" "$4" || return 1
|
||||
else
|
||||
ovs_add_if "$1" "$2" "$4" -u || return 1
|
||||
ovs_add_if "$1" "netdev" "$2" "$4" -u || return 1
|
||||
fi
|
||||
|
||||
if [ $TRACING -eq 1 ]; then
|
||||
@@ -756,6 +757,79 @@ test_upcall_interfaces() {
|
||||
return 0
|
||||
}
|
||||
|
||||
ovs_add_kernel_tunnel() {
|
||||
local sbxname=$1; shift
|
||||
local ns=$1; shift
|
||||
local tnl_type=$1; shift
|
||||
local name=$1; shift
|
||||
local addr=$1; shift
|
||||
|
||||
info "setting up kernel ${tnl_type} tunnel ${name}"
|
||||
ovs_sbx "${sbxname}" ip -netns ${ns} link add dev ${name} type ${tnl_type} $* || return 1
|
||||
on_exit "ovs_sbx ${sbxname} ip -netns ${ns} link del ${name} >/dev/null 2>&1"
|
||||
ovs_sbx "${sbxname}" ip -netns ${ns} addr add dev ${name} ${addr} || return 1
|
||||
ovs_sbx "${sbxname}" ip -netns ${ns} link set dev ${name} mtu 1450 up || return 1
|
||||
}
|
||||
|
||||
test_tunnel_metadata() {
|
||||
which arping >/dev/null 2>&1 || return $ksft_skip
|
||||
|
||||
sbxname="test_tunnel_metadata"
|
||||
sbx_add "${sbxname}" || return 1
|
||||
|
||||
info "setting up new DP"
|
||||
ovs_add_dp "${sbxname}" tdp0 -V 2:1 || return 1
|
||||
|
||||
ovs_add_netns_and_veths "${sbxname}" tdp0 tns left0 l0 \
|
||||
172.31.110.1/24 || return 1
|
||||
|
||||
info "removing veth interface from openvswitch and setting IP"
|
||||
ovs_del_if "${sbxname}" tdp0 left0 || return 1
|
||||
ovs_sbx "${sbxname}" ip addr add 172.31.110.2/24 dev left0 || return 1
|
||||
ovs_sbx "${sbxname}" ip link set left0 up || return 1
|
||||
|
||||
info "setting up tunnel port in openvswitch"
|
||||
ovs_add_if "${sbxname}" "vxlan" tdp0 ovs-vxlan0 -u || return 1
|
||||
on_exit "ovs_sbx ${sbxname} ip link del ovs-vxlan0"
|
||||
ovs_wait ip link show ovs-vxlan0 &>/dev/null || return 1
|
||||
ovs_sbx "${sbxname}" ip link set ovs-vxlan0 up || return 1
|
||||
|
||||
configs=$(echo '
|
||||
1 172.31.221.1/24 1155332 32 set udpcsum flags\(df\|csum\)
|
||||
2 172.31.222.1/24 1234567 45 set noudpcsum flags\(df\)
|
||||
3 172.31.223.1/24 1020304 23 unset udpcsum flags\(csum\)
|
||||
4 172.31.224.1/24 1357986 15 unset noudpcsum' | sed '/^$/d')
|
||||
|
||||
while read -r i addr id ttl df csum flags; do
|
||||
ovs_add_kernel_tunnel "${sbxname}" tns vxlan vxlan${i} ${addr} \
|
||||
remote 172.31.110.2 id ${id} dstport 4789 \
|
||||
ttl ${ttl} df ${df} ${csum} || return 1
|
||||
done <<< "${configs}"
|
||||
|
||||
ovs_wait grep -q 'listening on upcall packet handler' \
|
||||
${ovs_dir}/ovs-vxlan0.out || return 1
|
||||
|
||||
info "sending arping"
|
||||
for i in 1 2 3 4; do
|
||||
ovs_sbx "${sbxname}" ip netns exec tns \
|
||||
arping -I vxlan${i} 172.31.22${i}.2 -c 1 \
|
||||
>${ovs_dir}/arping.stdout 2>${ovs_dir}/arping.stderr
|
||||
done
|
||||
|
||||
info "checking that received decapsulated packets carry correct metadata"
|
||||
while read -r i addr id ttl df csum flags; do
|
||||
arp_hdr="arp\\(sip=172.31.22${i}.1,tip=172.31.22${i}.2,op=1,sha="
|
||||
addrs="src=172.31.110.1,dst=172.31.110.2"
|
||||
ports="tp_src=[0-9]*,tp_dst=4789"
|
||||
tnl_md="tunnel\\(tun_id=${id},${addrs},ttl=${ttl},${ports},${flags}\\)"
|
||||
|
||||
ovs_sbx "${sbxname}" grep -qE "MISS upcall.*${tnl_md}.*${arp_hdr}" \
|
||||
${ovs_dir}/ovs-vxlan0.out || return 1
|
||||
done <<< "${configs}"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
run_test() {
|
||||
(
|
||||
tname="$1"
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
`./defaults.sh
|
||||
./set_sysctls.py /proc/sys/net/ipv4/tcp_fastopen=0x602 /proc/sys/net/ipv4/tcp_timestamps=0`
|
||||
|
||||
0 socket(..., SOCK_STREAM|SOCK_NONBLOCK, IPPROTO_TCP) = 3
|
||||
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
|
||||
+0 bind(3, ..., ...) = 0
|
||||
+0 listen(3, 1) = 0
|
||||
|
||||
+0 < S 0:10(10) win 32792 <mss 1460,nop,nop,sackOK>
|
||||
+0 > S. 0:0(0) ack 11 win 65535 <mss 1460,nop,nop,sackOK>
|
||||
|
||||
// sk->sk_state is TCP_SYN_RECV
|
||||
+.1 accept(3, ..., ...) = 4
|
||||
|
||||
// tcp_disconnect() sets sk->sk_state to TCP_CLOSE
|
||||
+0 connect(4, AF_UNSPEC, ...) = 0
|
||||
+0 > R. 1:1(0) ack 11 win 65535
|
||||
|
||||
// connect() sets sk->sk_state to TCP_SYN_SENT
|
||||
+0 fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
|
||||
+0 connect(4, ..., ...) = -1 EINPROGRESS (Operation is now in progress)
|
||||
+0 > S 0:0(0) win 65535 <mss 1460,nop,nop,sackOK,nop,wscale 8>
|
||||
|
||||
// tp->fastopen_rsk must be NULL
|
||||
+1 > S 0:0(0) win 65535 <mss 1460,nop,nop,sackOK,nop,wscale 8>
|
||||
@@ -2770,6 +2770,22 @@ TEST_F(tls_err, poll_partial_rec_async)
|
||||
}
|
||||
}
|
||||
|
||||
/* Use OOB+large send to trigger copy mode due to memory pressure.
|
||||
* OOB causes a short read.
|
||||
*/
|
||||
TEST_F(tls_err, oob_pressure)
|
||||
{
|
||||
char buf[1<<16];
|
||||
int i;
|
||||
|
||||
memrnd(buf, sizeof(buf));
|
||||
|
||||
EXPECT_EQ(send(self->fd2, buf, 5, MSG_OOB), 5);
|
||||
EXPECT_EQ(send(self->fd2, buf, sizeof(buf), 0), sizeof(buf));
|
||||
for (i = 0; i < 64; i++)
|
||||
EXPECT_EQ(send(self->fd2, buf, 5, MSG_OOB), 5);
|
||||
}
|
||||
|
||||
TEST(non_established) {
|
||||
struct tls12_crypto_info_aes_gcm_256 tls12;
|
||||
struct sockaddr_in addr;
|
||||
|
||||
Reference in New Issue
Block a user