git: 6913bf4c3d34 - main - tests/divert: fix after 2ce85919bbba (IP source address validation)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 12 Nov 2021 19:21:12 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=6913bf4c3d34c8caf2d3e72f9c44b345486b8ceb commit 6913bf4c3d34c8caf2d3e72f9c44b345486b8ceb Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2021-11-12 19:17:56 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2021-11-12 19:20:06 +0000 tests/divert: fix after 2ce85919bbba (IP source address validation) Just make the test packet more legitimate. Reviewed by: melifaro --- tests/sys/common/divert.py | 3 ++- tests/sys/netinet/divert.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/sys/common/divert.py b/tests/sys/common/divert.py index f23fbe857cbb..94e20a03571f 100755 --- a/tests/sys/common/divert.py +++ b/tests/sys/common/divert.py @@ -42,6 +42,7 @@ IPPROTO_DIVERT = 258 def parse_args(): parser = argparse.ArgumentParser(description='divert socket tester') parser.add_argument('--dip', type=str, help='destination packet IP') + parser.add_argument('--sip', type=str, help='source packet IP') parser.add_argument('--divert_port', type=int, default=6668, help='divert port to use') parser.add_argument('--test_name', type=str, required=True, @@ -65,7 +66,7 @@ def ipdivert_ip6_output_remote_success(args): def ipdivert_ip_input_local_success(args): """Sends IPv4 packet to OS stack as inbound local packet.""" - packet = sc.IP(dst=args.dip) / sc.ICMP(type='echo-request') + packet = sc.IP(dst=args.dip,src=args.sip) / sc.ICMP(type='echo-request') with socket.socket(socket.AF_INET, socket.SOCK_RAW, IPPROTO_DIVERT) as s: s.bind(('0.0.0.0', args.divert_port)) s.sendto(bytes(packet), (args.dip, 0)) diff --git a/tests/sys/netinet/divert.sh b/tests/sys/netinet/divert.sh index acd33742b791..3d064b9155b7 100755 --- a/tests/sys/netinet/divert.sh +++ b/tests/sys/netinet/divert.sh @@ -135,7 +135,8 @@ ipdivert_ip_input_local_success_body() { jexec ${jname} ifconfig ${epair}b inet ${ip4b}/30 atf_check -s exit:0 jexec ${jname} $(atf_get_srcdir)/${script_name} \ - --dip ${ip4b} --test_name ipdivert_ip_input_local_success + --sip ${ip4a} --dip ${ip4b} \ + --test_name ipdivert_ip_input_local_success count=`jexec ${jname} netstat -s -p icmp | grep 'Input histogram:' -A8 | grep -c 'echo: '` # Verify redirect got installed