From: Antonio Ojea <aojea@google.com>
To: netfilter-devel@vger.kernel.org
Cc: fw@strlen.de, pablo@netfilter.org, willemb@google.com,
edumazet@google.com, Antonio Ojea <aojea@google.com>
Subject: [PATCH net-next 2/2] selftests: net: netfilter: nft_queue.sh: sctp checksum
Date: Fri, 3 May 2024 11:34:55 +0000 [thread overview]
Message-ID: <20240503113456.864063-3-aojea@google.com> (raw)
In-Reply-To: <20240503113456.864063-1-aojea@google.com>
Test that nfqueue, when using GSO, process SCTP packets
correctly.
Regression test for https://bugzilla.netfilter.org/show_bug.cgi?id=1742
Signed-off-by: Antonio Ojea <aojea@google.com>
---
.../selftests/net/netfilter/nft_queue.sh | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/tools/testing/selftests/net/netfilter/nft_queue.sh b/tools/testing/selftests/net/netfilter/nft_queue.sh
index 8538f08c64c2..5e075c7e0350 100755
--- a/tools/testing/selftests/net/netfilter/nft_queue.sh
+++ b/tools/testing/selftests/net/netfilter/nft_queue.sh
@@ -25,6 +25,9 @@ cleanup()
}
checktool "nft --version" "test without nft tool"
+checktool "socat -h" "run test without socat"
+
+modprobe -q sctp
trap cleanup EXIT
@@ -375,6 +378,40 @@ EOF
wait 2>/dev/null
}
+test_sctp_forward()
+{
+ ip netns exec "$nsrouter" nft -f /dev/stdin <<EOF
+table inet sctpq {
+ chain forward {
+ type filter hook forward priority 0; policy accept;
+ sctp dport 12345 queue num 10
+ }
+}
+EOF
+ ip netns exec "$nsrouter" ./nf_queue -q 10 -G -t "$timeout" &
+ local nfqpid=$!
+
+ timeout 5 ip netns exec "$ns2" socat -u SCTP-LISTEN:12345 STDOUT > "$TMPFILE1" &
+ local rpid=$!
+
+ # ss does not show the sctp socket?
+ busywait "$BUSYWAIT_TIMEOUT" sh -c "ps axf | grep -q SCTP-LISTEN" "$ns2"
+
+ ip netns exec "$ns1" socat -u STDIN SCTP:10.0.2.99:12345 <"$TMPINPUT" >/dev/null
+
+ if ! ip netns exec "$nsrouter" nft delete table inet sctpq; then
+ echo "FAIL: Could not delete sctpq table"
+ exit 1
+ fi
+
+ if ! diff -u "$TMPINPUT" "$TMPFILE1" ; then
+ echo "FAIL: lost packets?!" 1>&2
+ return
+ fi
+
+ wait "$rpid" && echo "PASS: sctp and nfqueue in forward chain with GSO"
+}
+
ip netns exec "$nsrouter" sysctl net.ipv6.conf.all.forwarding=1 > /dev/null
ip netns exec "$nsrouter" sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null
ip netns exec "$nsrouter" sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null
@@ -413,5 +450,6 @@ test_tcp_localhost
test_tcp_localhost_connectclose
test_tcp_localhost_requeue
test_icmp_vrf
+test_sctp_forward
exit $ret
--
2.45.0.rc1.225.g2a3ae87e7f-goog
prev parent reply other threads:[~2024-05-03 11:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 11:34 [PATCH net-next 0/2] netfilter: nfqueue: incorrect sctp checksum Antonio Ojea
2024-05-03 11:34 ` [PATCH net-next 1/2] netfilter: nft_queue: compute SCTP checksum Antonio Ojea
2024-05-03 12:46 ` Antonio Ojea
2024-05-03 13:09 ` Antonio Ojea
2024-05-06 22:30 ` Pablo Neira Ayuso
2024-05-04 1:51 ` kernel test robot
2024-05-03 11:34 ` Antonio Ojea [this message]
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=20240503113456.864063-3-aojea@google.com \
--to=aojea@google.com \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=willemb@google.com \
/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.