From nobody Thu Mar 14 08:29:44 2024 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 4TwLCX2g4Hz5FSF2; Thu, 14 Mar 2024 08:29:44 +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 4TwLCX1grgz437b; Thu, 14 Mar 2024 08:29:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710404984; 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=OHwzN5lg8+ERUzXWu2Y13ezi7gaa89zyYspAebusGVM=; b=HGlONhHvOKOvNhYwWwbF9Gukvm93OwFnkHZpqTbk3Sj/JKonWWqqZAEV73JpXTGggH+M7y 1ovVmP6N2AKlkd9HcacJZaS6PKqGI3V66NpOL+IMspvTAcAoS2JVNtaM8VyXRM2a40rj7l S1odTkhEcM50AtjGRulJgBwX9OGXfhqEDbpSwHS86hj3Kz7pO7P+aQThyOcqWedzeO2zXs TfYf2bMuxLUNv6XMPpsLaWlhl5AYxV04ZAf5XFsspWs6zOWLH1GYjuJgeQHGc9JzpgOBnV zX0C2mVJJ2msmxjp0aYgVyTqK2DfR5PwGWtTNR7e7DgowUo3FJcObFzrjQCrUQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710404984; a=rsa-sha256; cv=none; b=OW7QZihtTGSLffjlwtqLOI7uB3ET3trNDW4IAFk6B6tT3BYvYJou5Zm1GylPL7I7+mK9FL ZpGcmy2033e9swSQwQ7iX4KLrqrUqvjN6cyr2XqBGKSxn683EY1VzKMjd20moDXsrmhfGJ aT2lGcXkWl/RnBYY66QmJlRm5oSv+biGYAtRLbfTVxzh9uyBQV3hBO8kUp5Rv3JLGNTDL4 Xq+1xFZeIWgYijmfnARuLCfMv57Sc0eSSHlVQHiMMdGWkFXXBafjF4fyBH3GhGncwhCRfu QoyEQQrzmQbQBlvwT09p7/axGYkoOSRPRhEoJ9htBAjA1FyUCcQGfJj8AB5qxQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710404984; 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=OHwzN5lg8+ERUzXWu2Y13ezi7gaa89zyYspAebusGVM=; b=q8YG2LGWrnApp7Xz5EX8b6podrlqstSqMZyiobMODX4+z066Dy3eVWb4v0t6ReKBiu6vYD K+rHd40RQVwDWw2tgZOjh01tBj7GZMWiF+wBXZ6qjWWEzMe7ECV04TaNR/0NjxMWMjOPEq I0moc/vKVVHtwddTxNF2rem9tnJ+7SIXPN7IodPHTk6s1xTZV81s94Kgdw7sih8CVXl4fJ 613jneMKoyceCAIq8gT7X8qcqVEZuVCnLilosbuh9gn+PnS5pPdYnLkq50/nMJ81YsOzab RQD1KiqivYaEtOlPQw433WVbYpPBZnfp7mBy1dD4ypjUtajIVDG1soNphnKLNg== 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 4TwLCX1HCPzK5T; Thu, 14 Mar 2024 08:29:44 +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 42E8Tii1006417; Thu, 14 Mar 2024 08:29:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42E8Ti7q006414; Thu, 14 Mar 2024 08:29:44 GMT (envelope-from git) Date: Thu, 14 Mar 2024 08:29:44 GMT Message-Id: <202403140829.42E8Ti7q006414@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: b2cb054dac62 - stable/14 - 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b2cb054dac62b2f976677d140700f7aa5c228f5e Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=b2cb054dac62b2f976677d140700f7aa5c228f5e commit b2cb054dac62b2f976677d140700f7aa5c228f5e Author: Jose Luis Duran AuthorDate: 2023-11-28 19:58:03 +0000 Commit: Zhenlei Huang CommitDate: 2024-03-14 08:27:54 +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 (cherry picked from commit 1db64f89363c97858961c4df0b7d02f3223723cf) --- 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 = (