From nobody Tue Nov 28 21:53:25 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Sfx6G2vNdz52cZp; Tue, 28 Nov 2023 21:53:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sfx6G2TLYz3Kp7; Tue, 28 Nov 2023 21:53:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701208406; 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=VCdzYpsvKywECFUB8Q5acf11+rQl9+AA8FuSJmJxUNE=; b=o2cJZggKTB5zgXoL9F006cpRYoLK4c5tFFYMKHxIuPZeoLuv+0UVIAh1hErY/EXAXXx54k VvJnEhEz42nDXji8Yf3L7xVRqBC3cVTCw72fqx3ZKhwH2HtT8/SwmKHNiyHIowcyMxU6wh tnpgv7SywewD/AlUxTQOZCkhEJXe9g2R+eXQSTTH66pwUs7hIPgkDCl3ld7ieRqrnHfv8i VJImEvojNDzfxfAKbX6fi88Rigxx2np7EwZovx3uhrbCGTMt7vxFUgHb3wdLUYfNTrPtal wSJJiLx6Li2XTHeqRP/NrS3N4gTeniYuyXmWpBmD1xYSLp11udtRaYv82RzJDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701208406; 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=VCdzYpsvKywECFUB8Q5acf11+rQl9+AA8FuSJmJxUNE=; b=hEIkN7atOap65WL3oJUIVLXKR4A20yBFH8xKseHgmeTKz+ZblOHiuNxF5PId2G0Y2QTYEq yGS3eBVkER/DgksPTk3kjn7HQr5vUEgI07B5/O3KpXJZ0SAHvjgfd3LNfcsUy7C9jPJNpK F8dk2IesJLoxvHvpDpWMqZbxtmmdaSeTLnZ0s9ULTpfugJ3oZUd5E7gq14DtQRCzIXUt/7 iybdRM/KH+PBetXbHvi/yCdcpWypqHQzQQUc1P6KS2FH58nQZV/EcOy6sNq0SFpWQxAxVK fPTi1Isl5M8GZVxcsUGCaBAjZpGmihtvNaNAmUUgZ5FzDEd86rQyF2gGwqouHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701208406; a=rsa-sha256; cv=none; b=lQo3NmmUDZSATRCM84S97ARQJd+uGqVxmLVjpEy/VOmCORhLqyqGCCgs7TX3qHiDDZkXkM e0+PylNk7Hgxs40W0jaotFFNcCuDLk8gS8IlzJT1ge3WPcMMTO3l1mfQ3ExozH0zBp2M9l SwrnTbCBhLxf4fKXD6oL68xRBPOqTK6Vzu59URLFcKj5fyuIYv1wovQhW4ehURqkYw1zaU IJDQfccTNsQt8H6bajnai/zmCs1QKO3nEMMzt70RZi6VLoE2ygJGjl9UAzfj7IKFARAxI7 70d/APqKkmdx4d2gaSOo1pCukx5uhswJwAOhtnQaCZ2FPECkVgteArg+AzvlPw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Sfx6G1Ybdzfwl; Tue, 28 Nov 2023 21:53:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3ASLrPMo064877; Tue, 28 Nov 2023 21:53:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3ASLrP5I064874; Tue, 28 Nov 2023 21:53:25 GMT (envelope-from git) Date: Tue, 28 Nov 2023 21:53:25 GMT Message-Id: <202311282153.3ASLrP5I064874@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "R. Christian McDonald" Subject: git: 1db64f89363c - main - netlink: Add tests when adding an interface route 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rcm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1db64f89363c97858961c4df0b7d02f3223723cf Auto-Submitted: auto-generated The branch main has been updated by rcm: URL: https://cgit.FreeBSD.org/src/commit/?id=1db64f89363c97858961c4df0b7d02f3223723cf commit 1db64f89363c97858961c4df0b7d02f3223723cf Author: Jose Luis Duran AuthorDate: 2023-11-28 19:58:03 +0000 Commit: R. Christian McDonald CommitDate: 2023-11-28 21:53:00 +0000 netlink: Add tests when adding an interface route Add tests for adding a route using an interface only (without an IP address). Reviewed by: rcm Approved by: kp (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D41436 --- tests/sys/netlink/test_rtnl_route.py | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/sys/netlink/test_rtnl_route.py b/tests/sys/netlink/test_rtnl_route.py index e6bbe7656eb4..20f2c3ce3ee2 100644 --- a/tests/sys/netlink/test_rtnl_route.py +++ b/tests/sys/netlink/test_rtnl_route.py @@ -3,6 +3,7 @@ import socket import pytest from atf_python.sys.net.tools import ToolsHelper +from atf_python.sys.net.vnet import IfaceFactory from atf_python.sys.net.vnet import SingleVnetTestTemplate from atf_python.sys.netlink.attrs import NlAttrIp from atf_python.sys.netlink.attrs import NlAttrU32 @@ -45,6 +46,46 @@ class TestRtNlRoute(NetlinkTestTemplate, SingleVnetTestTemplate): ToolsHelper.print_net_debug() ToolsHelper.print_output("netstat -6onW") + @pytest.mark.timeout(5) + def test_add_route6_ll_if_gw(self): + tun_ifname = IfaceFactory().create_iface("", "tun")[0].name + tun_ifindex = socket.if_nametoindex(tun_ifname) + + msg = NetlinkRtMessage(self.helper, NlRtMsgType.RTM_NEWROUTE) + msg.set_request() + msg.add_nlflags([NlmNewFlags.NLM_F_CREATE]) + msg.base_hdr.rtm_family = socket.AF_INET6 + msg.base_hdr.rtm_dst_len = 64 + msg.add_nla(NlAttrIp(RtattrType.RTA_DST, "2001:db8:2::")) + msg.add_nla(NlAttrU32(RtattrType.RTA_OIF, tun_ifindex)) + + rx_msg = self.get_reply(msg) + assert rx_msg.is_type(NlMsgType.NLMSG_ERROR) + assert rx_msg.error_code == 0 + + ToolsHelper.print_net_debug() + ToolsHelper.print_output("netstat -6onW") + + @pytest.mark.timeout(5) + def test_add_route4_ll_if_gw(self): + tun_ifname = IfaceFactory().create_iface("", "tun")[0].name + tun_ifindex = socket.if_nametoindex(tun_ifname) + + msg = NetlinkRtMessage(self.helper, NlRtMsgType.RTM_NEWROUTE) + msg.set_request() + msg.add_nlflags([NlmNewFlags.NLM_F_CREATE]) + msg.base_hdr.rtm_family = socket.AF_INET + msg.base_hdr.rtm_dst_len = 32 + msg.add_nla(NlAttrIp(RtattrType.RTA_DST, "192.0.2.1")) + msg.add_nla(NlAttrU32(RtattrType.RTA_OIF, tun_ifindex)) + + rx_msg = self.get_reply(msg) + assert rx_msg.is_type(NlMsgType.NLMSG_ERROR) + assert rx_msg.error_code == 0 + + ToolsHelper.print_net_debug() + ToolsHelper.print_output("netstat -4onW") + @pytest.mark.timeout(20) def test_buffer_override(self): msg_flags = (