git: 97340b68d18b - main - pf tests: extend SCTP tests to test state removal through ASCONF
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 07 Sep 2023 17:05:35 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=97340b68d18bbbdebf0f73ed900c5a33894061dd commit 97340b68d18bbbdebf0f73ed900c5a33894061dd Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2023-09-05 17:00:49 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2023-09-07 17:05:01 +0000 pf tests: extend SCTP tests to test state removal through ASCONF pf can now mark shut down multihomed connections shutting down. Verify that pf does the right thing. MFC after: 3 weeks Sponsored by: Orange Business Services --- tests/sys/netpfil/pf/sctp.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/sys/netpfil/pf/sctp.py b/tests/sys/netpfil/pf/sctp.py index b24d0c414ac8..5e6dca5dd64b 100644 --- a/tests/sys/netpfil/pf/sctp.py +++ b/tests/sys/netpfil/pf/sctp.py @@ -342,6 +342,24 @@ class TestSCTP(VnetTestTemplate): assert re.search(r"all sctp 192.0.2.1:.*192.0.2.3:1234", states) assert re.search(r"all sctp 192.0.2.10:.*192.0.2.3:1234", states) + # Now remove 192.0.2.1 as an address + client.bindx("192.0.2.1", False) + + # We can still communicate + try: + client.send(b"More data", 0) + rcvd = self.wait_object(srv_vnet.pipe, 5) + print(rcvd) + assert rcvd['ppid'] == 0 + assert rcvd['data'] =="More data" + finally: + # Debug output + ToolsHelper.print_output("/sbin/pfctl -ss -vv") + + # Verify that state is closing + states = ToolsHelper.get_output("/sbin/pfctl -ss") + assert re.search(r"all sctp 192.0.2.1:.*192.0.2.3:1234.*SHUTDOWN", states) + class TestSCTPv6(VnetTestTemplate): REQUIRED_MODULES = ["sctp", "pf"] TOPOLOGY = { @@ -440,3 +458,21 @@ class TestSCTPv6(VnetTestTemplate): states = ToolsHelper.get_output("/sbin/pfctl -ss") assert re.search(r"all sctp 2001:db8::1\[.*2001:db8::3\[1234\]", states) assert re.search(r"all sctp 2001:db8::10\[.*2001:db8::3\[1234\]", states) + + # Now remove 2001:db8::1 as an address + client.bindx("2001:db8::1", False) + + # Wecan still communicate + try: + client.send(b"More data", 0) + rcvd = self.wait_object(srv_vnet.pipe, 5) + print(rcvd) + assert rcvd['ppid'] == 0 + assert rcvd['data'] == "More data" + finally: + # Debug output + ToolsHelper.print_output("/sbin/pfctl -ss -vv") + + # Verify that the state is closing + states = ToolsHelper.get_output("/sbin/pfctl -ss") + assert re.search(r"all sctp 2001:db8::1\[.*2001:db8::3\[1234\].*SHUTDOWN", states)