ncoding:content-transfer-encoding; bh=1DL7F87O6QwKiXICxmC08slTx4uDKhybPzy+i+tmoD8=; b=ZMkEdeFoCRsQmdKjph2DJbDhZqbUoyDVg0BCbF2opUsVVARtmrNL7XRso+WFj2dcnAFciq ASiSwFqyGlnwfxUtkdKVLSpYDtdJvy/RzQQyrN6pNfhBlbSChN0jwtF055liEaqWO8qyIO 1GwzXwtJR9EpKN3YACoaCQlUm6RPc9JceLqGPl7wf2/cDdKmXbosyDIQl0zvXvgJslGqef H7GsjWruFzH8ujOVYsU2KGvf/9+HiekYIlMilop9JQw6oQtxgSTVcvgFNrRPAyD+HbXEsy 0jFOew7lzN6AGl7A2gWEX+QW4fddvJJvd6Cgb0wjxQ8Rld4RxL3P5xn+6bWNhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766420926; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1DL7F87O6QwKiXICxmC08slTx4uDKhybPzy+i+tmoD8=; b=IxKmjhhzsV0vBUZHXrMJ106rGs/BgCBCzVTHYnDt+OXXV+4yCJPWYk04OX8ql+05hfVFs+ 5UIn59vUfRvsOn9MrE/Gc3ZkyojHuEaiOr++HWtL6jhaSst8BJzURYxbIUHPzOJavvO213 WAavy+NP19fjBPYszCFrGf7vnleAW7ca6OfFMTYHXRK319hzDpebD4K4kRhHhvUVHQ0AGB wwjezVaXc4u5s/WemGVI84TJl/btiS8L7XX+lBsHKj27bXeSwPNxqfCxtyYQv/wmbvSHa+ mHkPnAhsVuJ0Q64khuq+ip0++Cqd0BoICRl66fDZs1zWoWhDoTtU7ZlJRPZP+g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1766420926; a=rsa-sha256; cv=none; b=MV1OJrCj1Qc0TZO7z5P/jXFj1TCcuXSAZ6nOng9p+bNsDDrOHstKBqWNQ+0nDtQfIAFVNG sPhsgGfJc9sObxevqireLm8TfGppBrmfVBuQ0QXLTEhp0a70f4VUn1Mix5+2rF6HV6q0Xz mDf8VySxTwg/0M06RhhUKyM3sxpLQX6K85V5pq9XZpMQQLOOztdC6kA0yHidddkxBlLY7u cN63nVD71beh5lXrDx+A4NpilbLIGIGaJx3eK5d/EjasgG0AwNkuOyj3aG8XdnGaI8D44l d3TQ3qg2UUgDiOVueoOMiPld6HaUaDBNAS94G8+wFwEux5UmgJtlrunrap9FXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dZk9B4SkwzZT6 for ; Mon, 22 Dec 2025 16:28:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 96b4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 22 Dec 2025 16:28:46 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 4f35a84b3241 - main - atf_python: support setting interface mtu List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f35a84b32412f5cf54e08cd97cd6eee407fb30e Auto-Submitted: auto-generated Date: Mon, 22 Dec 2025 16:28:46 +0000 Message-Id: <694971be.96b4.4ea2bfc7@gitrepo.freebsd.org> The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4f35a84b32412f5cf54e08cd97cd6eee407fb30e commit 4f35a84b32412f5cf54e08cd97cd6eee407fb30e Author: Kristof Provost AuthorDate: 2025-12-21 10:28:29 +0000 Commit: Kristof Provost CommitDate: 2025-12-22 16:28:33 +0000 atf_python: support setting interface mtu Teach the vnet support code to set interface MTU. Some tests make use of this, so have the framework handle it. Adapt a few pf tests to use this. Reviewed by: melifaro Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D54333 --- tests/atf_python/sys/net/vnet.py | 6 ++++++ tests/sys/netpfil/pf/frag6.py | 3 +-- tests/sys/netpfil/pf/icmp.py | 8 +------- tests/sys/netpfil/pf/nat66.py | 7 +------ 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/tests/atf_python/sys/net/vnet.py b/tests/atf_python/sys/net/vnet.py index f75a3eaa693e..93bfa4437940 100644 --- a/tests/atf_python/sys/net/vnet.py +++ b/tests/atf_python/sys/net/vnet.py @@ -109,6 +109,9 @@ class VnetInterface(object): ret.append(if2); return ret + def set_mtu(self, mtu): + run_cmd("/sbin/ifconfig {} mtu {}".format(self.name, mtu)) + def setup_addr(self, _addr: str): addr = ipaddress.ip_interface(_addr) if addr.version == 6: @@ -370,6 +373,7 @@ class VnetTestTemplate(BaseTest): idx = iface_map.vnet_aliases.index(vnet.alias) prefixes6 = topo[iface.alias].get("prefixes6", []) prefixes4 = topo[iface.alias].get("prefixes4", []) + mtu = topo[iface.alias].get("mtu", 0) if prefixes6 or prefixes4: ipv6_ifaces.append(iface) iface.turn_up() @@ -378,6 +382,8 @@ class VnetTestTemplate(BaseTest): for prefix in prefixes6 + prefixes4: if prefix[idx]: iface.setup_addr(prefix[idx]) + if mtu != 0: + iface.set_mtu(mtu) for iface in ipv6_ifaces: while iface.has_tentative(): time.sleep(0.1) diff --git a/tests/sys/netpfil/pf/frag6.py b/tests/sys/netpfil/pf/frag6.py index 26ae7af7c90c..ca2d231edccb 100644 --- a/tests/sys/netpfil/pf/frag6.py +++ b/tests/sys/netpfil/pf/frag6.py @@ -226,7 +226,7 @@ class TestFrag6_RouteTo(VnetTestTemplate): "vnet2": {"ifaces": ["if1", "if2"]}, "vnet3": {"ifaces": ["if2"]}, "if1": {"prefixes6": [("2001:db8::1/64", "2001:db8::2/64")]}, - "if2": {"prefixes6": [("2001:db8:1::1/64", "2001:db8:1::2/64")]}, + "if2": {"prefixes6": [("2001:db8:1::1/64", "2001:db8:1::2/64")], "mtu": 1300}, } def vnet2_handler(self, vnet): @@ -238,7 +238,6 @@ class TestFrag6_RouteTo(VnetTestTemplate): "pass in route-to (%s 2001:db8:1::2) from 2001:db8::1 to 2001:db8:666::1" % if2name, ]) - ToolsHelper.print_output("/sbin/ifconfig %s mtu 1300" % if2name) ToolsHelper.print_output("/sbin/sysctl net.inet6.ip6.forwarding=1") def vnet3_handler(self, vnet): diff --git a/tests/sys/netpfil/pf/icmp.py b/tests/sys/netpfil/pf/icmp.py index c5e945d60e99..93daf33e5201 100644 --- a/tests/sys/netpfil/pf/icmp.py +++ b/tests/sys/netpfil/pf/icmp.py @@ -43,13 +43,10 @@ class TestICMP(VnetTestTemplate): "vnet2": {"ifaces": ["if1", "if2"]}, "vnet3": {"ifaces": ["if2"]}, "if1": {"prefixes4": [("192.0.2.2/24", "192.0.2.1/24")]}, - "if2": {"prefixes4": [("198.51.100.1/24", "198.51.100.2/24")]}, + "if2": {"prefixes4": [("198.51.100.1/24", "198.51.100.2/24")], "mtu": 1492}, } def vnet2_handler(self, vnet): - ifname = vnet.iface_alias_map["if1"].name - if2name = vnet.iface_alias_map["if2"].name - ToolsHelper.print_output("/sbin/pfctl -e") ToolsHelper.pf_rules([ "set reassemble yes", @@ -61,8 +58,6 @@ class TestICMP(VnetTestTemplate): ToolsHelper.print_output("/sbin/sysctl net.inet.ip.forwarding=1") ToolsHelper.print_output("/sbin/pfctl -x loud") - ToolsHelper.print_output("/sbin/ifconfig %s mtu 1492" % if2name) - def vnet3_handler(self, vnet): # Import in the correct vnet, so at to not confuse Scapy import scapy.all as sp @@ -70,7 +65,6 @@ class TestICMP(VnetTestTemplate): ifname = vnet.iface_alias_map["if2"].name ToolsHelper.print_output("/sbin/route add default 198.51.100.1") ToolsHelper.print_output("/sbin/ifconfig %s inet alias 198.51.100.3/24" % ifname) - ToolsHelper.print_output("/sbin/ifconfig %s mtu 1492" % ifname) def checkfn(packet): icmp = packet.getlayer(sp.ICMP) diff --git a/tests/sys/netpfil/pf/nat66.py b/tests/sys/netpfil/pf/nat66.py index 16b4ef3dd02b..339895b253ae 100644 --- a/tests/sys/netpfil/pf/nat66.py +++ b/tests/sys/netpfil/pf/nat66.py @@ -39,13 +39,11 @@ class TestNAT66(VnetTestTemplate): "vnet1": {"ifaces": ["if1"]}, "vnet2": {"ifaces": ["if1", "if2"]}, "vnet3": {"ifaces": ["if2"]}, - "if1": {"prefixes6": [("2001:db8::2/64", "2001:db8::1/64")]}, + "if1": {"prefixes6": [("2001:db8::2/64", "2001:db8::1/64")], "mtu": 9000}, "if2": {"prefixes6": [("2001:db8:1::1/64", "2001:db8:1::2/64")]}, } def vnet2_handler(self, vnet): - ifname = vnet.iface_alias_map["if1"].name - ToolsHelper.print_output("/sbin/ifconfig %s mtu 9000" % ifname) outifname = vnet.iface_alias_map["if2"].name ToolsHelper.print_output("/sbin/pfctl -e") @@ -130,8 +128,6 @@ class TestNAT66(VnetTestTemplate): @pytest.mark.require_progs(["scapy"]) def test_npt_icmp(self): cl_vnet = self.vnet_map["vnet1"] - ifname = cl_vnet.iface_alias_map["if1"].name - ToolsHelper.print_output("/sbin/ifconfig %s mtu 9000" % ifname) ToolsHelper.print_output("/sbin/route add -6 2001:db8:1::/64 2001:db8::1") @@ -160,7 +156,6 @@ class TestNAT66(VnetTestTemplate): def test_npt_route_to_icmp(self): cl_vnet = self.vnet_map["vnet1"] ifname = cl_vnet.iface_alias_map["if1"].name - ToolsHelper.print_output("/sbin/ifconfig %s mtu 9000" % ifname) ToolsHelper.print_output("/sbin/ifconfig %s inet6 alias 2001:db8::3/64" % ifname) ToolsHelper.print_output("/sbin/route add -6 2001:db8:1::/64 2001:db8::1")