From: Sabrina Dubroca <sd@queasysnail.net>
To: Antonio Quartulli <antonio@openvpn.net>
Cc: netdev@vger.kernel.org, Ralf Lici <ralf@mandelbit.com>,
Jakub Kicinski <kuba@kernel.org>,
linux-kselftest@vger.kernel.org, Shuah Khan <shuah@kernel.org>
Subject: Re: [RFC net-next 08/13] selftests: ovpn: add test for the FW mark feature
Date: Thu, 27 Nov 2025 12:09:27 +0100 [thread overview]
Message-ID: <aSgxZ0Z6eDWS0vva@krikkit> (raw)
In-Reply-To: <20251121002044.16071-9-antonio@openvpn.net>
2025-11-21, 01:20:39 +0100, Antonio Quartulli wrote:
> diff --git a/tools/testing/selftests/net/ovpn/ovpn-cli.c b/tools/testing/selftests/net/ovpn/ovpn-cli.c
> index baabb4c9120e..4df596d29b8c 100644
> --- a/tools/testing/selftests/net/ovpn/ovpn-cli.c
> +++ b/tools/testing/selftests/net/ovpn/ovpn-cli.c
> @@ -1693,12 +1705,13 @@ static void usage(const char *cmd)
> fprintf(stderr, "\tvpnaddr: peer VPN IP\n");
>
> fprintf(stderr,
> - "* new_multi_peer <iface> <lport> <peers_file>: add multiple peers as listed in the file\n");
> + "* new_multi_peer <iface> <lport> <peers_file> [mark]: add multiple peers as listed in the file\n");
> fprintf(stderr, "\tiface: ovpn interface name\n");
> fprintf(stderr, "\tlport: local UDP port to bind to\n");
> fprintf(stderr,
> "\tpeers_file: text file containing one peer per line. Line format:\n");
> - fprintf(stderr, "\t\t<peer_id> <tx_id> <raddr> <rport> <laddr> <lport> <vpnaddr>\n");
> + fprintf(stderr, "\t\t<peer_id> <tx_id> <raddr> <rport> <laddr> <lport> <vpnaddr> [mark]\n");
This line should be dropped, this patch doesn't have the corresponding
change to parse mark while we're looping over the lines of peers_file.
> diff --git a/tools/testing/selftests/net/ovpn/test-mark.sh b/tools/testing/selftests/net/ovpn/test-mark.sh
> new file mode 100755
> index 000000000000..a4bfe938118d
> --- /dev/null
> +++ b/tools/testing/selftests/net/ovpn/test-mark.sh
[...]
> +for p in $(seq 1 3); do
> + ip netns exec peer0 ${OVPN_CLI} set_peer tun0 ${p} 60 120
> + ip netns exec peer${p} ${OVPN_CLI} set_peer tun${p} $((${p} + 9)) 60 120
> +done
> +
> +sleep 1
> +
> +for p in $(seq 1 3); do
> + ip netns exec peer0 ping -qfc 500 -s 3000 -w 3 5.5.5.$((${p} + 1))
Any reason this ping (and the final one) uses -s 3000 while the one we
expect to fail doesn't?
> +done
> +
> +echo "Adding an nftables drop rule based on mark value ${MARK}"
> +ip netns exec peer0 nft flush ruleset
> +ip netns exec peer0 nft 'add table inet filter'
> +ip netns exec peer0 nft 'add chain inet filter output { type filter hook output priority 0; policy accept; }'
> +ip netns exec peer0 nft add rule inet filter output meta mark == ${MARK} counter drop
> +
> +DROP_COUNTER=$(ip netns exec peer0 nft list chain inet filter output | sed -n 's/.*packets \([0-9]*\).*/\1/p')
> +sleep 1
> +
> +# ping should fail
> +for p in $(seq 1 3); do
> + PING_OUTPUT=$(ip netns exec peer0 ping -qfc 500 -w 1 5.5.5.$((p+1)) 2>&1) && exit 1
nit: inconsistent syntax for p+1 compared to the other pings ($((p+1)) vs $((${p} + 1)))
> + echo "${PING_OUTPUT}"
> + LOST_PACKETS=$(echo "$PING_OUTPUT" | grep 'packets transmitted' | awk '{ print $1 }')
> + # increment the drop counter by the amount of lost packets
> + DROP_COUNTER=$(($DROP_COUNTER+$LOST_PACKETS))
> +done
> +
> +# check if the final nft counter matches our counter
> +TOTAL_COUNT=$(ip netns exec peer0 nft list chain inet filter output | sed -n 's/.*packets \([0-9]*\).*/\1/p')
> +[ ${DROP_COUNTER} -eq ${TOTAL_COUNT} ] || exit 1
Maybe add something like
echo "Expected ${TOTAL_COUNT} drops, got ${DROP_COUNTER}"
if we're failing at this stage?
> +
> +echo "Removing the drop rule"
> +ip netns exec peer0 nft flush ruleset
> +sleep 1
> +
> +for p in $(seq 1 3); do
> + ip netns exec peer0 ping -qfc 500 -s 3000 -w 3 5.5.5.$((${p} + 1))
> +done
> +
> +cleanup
> +
> +modprobe -r ovpn || true
--
Sabrina
next prev parent reply other threads:[~2025-11-27 11:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-21 0:20 [RFC net-next 00/13] ovpn: new features + kselftests Antonio Quartulli
2025-11-21 0:20 ` [RFC net-next 01/13] selftests: ovpn: allow compiling ovpn-cli.c with mbedtls3 Antonio Quartulli
2025-11-21 0:20 ` [RFC net-next 02/13] selftests: ovpn: add notification parsing and matching Antonio Quartulli
2025-11-21 10:56 ` Antonio Quartulli
2025-11-24 15:51 ` Sabrina Dubroca
2025-11-25 10:21 ` Ralf Lici
2025-11-21 0:20 ` [RFC net-next 03/13] ovpn: use correct array size to parse nested attributes in ovpn_nl_key_swap_doit Antonio Quartulli
2025-11-21 0:20 ` [RFC net-next 04/13] ovpn: pktid: use bitops.h API Antonio Quartulli
2025-11-21 0:20 ` [RFC net-next 05/13] ovpn: notify userspace on client float event Antonio Quartulli
2025-11-21 0:20 ` [RFC net-next 06/13] ovpn: add support for asymmetric peer IDs Antonio Quartulli
2025-11-21 0:20 ` [RFC net-next 07/13] selftests: ovpn: check asymmetric peer-id Antonio Quartulli
2025-11-27 0:13 ` Sabrina Dubroca
2025-12-02 16:11 ` Ralf Lici
2025-11-21 0:20 ` [RFC net-next 08/13] selftests: ovpn: add test for the FW mark feature Antonio Quartulli
2025-11-27 11:09 ` Sabrina Dubroca [this message]
2025-12-02 16:22 ` Ralf Lici
2025-11-21 0:20 ` [RFC net-next 09/13] ovpn: consolidate crypto allocations in one chunk Antonio Quartulli
2025-11-21 0:20 ` [RFC net-next 10/13] ovpn: use bound device in UDP when available Antonio Quartulli
2025-11-21 0:20 ` [RFC net-next 11/13] selftests: ovpn: add test for bound device Antonio Quartulli
2025-11-27 11:29 ` Sabrina Dubroca
2025-12-02 16:28 ` Ralf Lici
2025-11-21 0:20 ` [RFC net-next 12/13] ovpn: use bound address in UDP when available Antonio Quartulli
2025-11-21 0:20 ` [RFC net-next 13/13] selftests: ovpn: add test for bound address Antonio Quartulli
2025-11-27 14:34 ` Sabrina Dubroca
2025-12-02 16:34 ` Ralf Lici
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aSgxZ0Z6eDWS0vva@krikkit \
--to=sd@queasysnail.net \
--cc=antonio@openvpn.net \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ralf@mandelbit.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.