Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Sep 2024 12:34:31 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 85ea6992935c - main - pf tests: Make TCP port numbers configurable
Message-ID:  <202409251234.48PCYVt6071777@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=85ea6992935ced034dea1c88755542c1b4969368

commit 85ea6992935ced034dea1c88755542c1b4969368
Author:     Kajetan Staszkiewicz <vegeta@tuxpowered.net>
AuthorDate: 2024-09-25 10:46:37 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-09-25 10:46:48 +0000

    pf tests: Make TCP port numbers configurable
    
    This will be useful for state maximums testing.
    
    Reviewed by:    kp
    Differential Revision:  https://reviews.freebsd.org/D46773
---
 tests/sys/netpfil/common/pft_ping.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/sys/netpfil/common/pft_ping.py b/tests/sys/netpfil/common/pft_ping.py
index 21b08c75a7da..befe757406be 100644
--- a/tests/sys/netpfil/common/pft_ping.py
+++ b/tests/sys/netpfil/common/pft_ping.py
@@ -123,7 +123,10 @@ def send_tcp_syn(dst_address, sendif, send_params):
         ip = prepare_ipv6(dst_address, send_params)
     else:
         ip = prepare_ipv4(dst_address, send_params)
-    tcp = sp.TCP(dport=666, flags='S', options=opts, seq=seq)
+    tcp = sp.TCP(
+        sport=send_params.get('sport'), dport=send_params.get('dport'),
+        flags='S', options=opts, seq=seq,
+    )
     req = ether / ip / tcp
     sp.sendp(req, iface=sendif, verbose=False)
 
@@ -439,6 +442,10 @@ def parse_args():
         help='TCP Maximum Segment Size')
     parser_send.add_argument('--send-seq', type=int,
         help='TCP sequence number')
+    parser_send.add_argument('--send-sport', type=int,
+        help='TCP source port')
+    parser_send.add_argument('--send-dport', type=int, default=666,
+        help='TCP destination port')
     parser_send.add_argument('--send-length', type=int, default=len(PAYLOAD_MAGIC),
         help='ICMP Echo Request payload size')
     parser_send.add_argument('--send-tc', type=int,
@@ -480,7 +487,10 @@ def main():
     # missing from the command line, always fill the dictionaries with None.
     send_params = {}
     expect_params = {}
-    for param_name in ('flags', 'hlim', 'length', 'mss', 'seq', 'tc', 'frag_length'):
+    for param_name in (
+        'flags', 'hlim', 'length', 'mss', 'seq', 'tc', 'frag_length',
+        'sport', 'dport',
+    ):
         param_arg = vars(args).get(f'send_{param_name}')
         send_params[param_name] = param_arg if param_arg else None
         param_arg = vars(args).get(f'expect_{param_name}')



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202409251234.48PCYVt6071777>