From patchwork Mon Dec 21 12:18:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1419001 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Czz5Y4Wh3z9sTg for ; Mon, 21 Dec 2020 23:18:24 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 27AD3207A9; Mon, 21 Dec 2020 12:18:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 41T5Y0IW2jOj; Mon, 21 Dec 2020 12:18:19 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id E82D820010; Mon, 21 Dec 2020 12:18:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CF1C4C1787; Mon, 21 Dec 2020 12:18:18 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 609DBC0893 for ; Mon, 21 Dec 2020 12:18:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5B53387C6B for ; Mon, 21 Dec 2020 12:18:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AE3nzASoW9fH for ; Mon, 21 Dec 2020 12:18:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by hemlock.osuosl.org (Postfix) with ESMTPS id 9BAB387C69 for ; Mon, 21 Dec 2020 12:18:15 +0000 (UTC) X-Originating-IP: 60.243.250.219 Received: from nusiddiq.home.org.com (unknown [60.243.250.219]) (Authenticated sender: numans@ovn.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 8DF59C0003; Mon, 21 Dec 2020 12:18:11 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Mon, 21 Dec 2020 17:48:07 +0530 Message-Id: <20201221121807.110437-1-numans@ovn.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn] Add support for DHCP Options 44, 46 (NB Name Server, NB Node Type) X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Vladislav Odintsov Submitted-at: https://github.com/ovn-org/ovn/pull/66 Signed-off-by: Vladislav Odintsov --- lib/ovn-l7.h | 5 +++++ northd/ovn-northd.c | 2 ++ ovn-nb.xml | 13 +++++++++++++ tests/ovn.at | 6 +++--- tests/test-ovn.c | 2 ++ 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/ovn-l7.h b/lib/ovn-l7.h index c84a0e7a99..cdcb8d7544 100644 --- a/lib/ovn-l7.h +++ b/lib/ovn-l7.h @@ -96,6 +96,11 @@ struct gen_opts_map { #define DHCP_OPT_BROADCAST_ADDRESS \ DHCP_OPTION("broadcast_address", 28, "ipv4") +#define DHCP_OPT_NETBIOS_NAME_SERVER \ + DHCP_OPTION("netbios_name_server", 44, "ipv4") +#define DHCP_OPT_NETBIOS_NODE_TYPE \ + DHCP_OPTION("netbios_node_type", 46, "uint8") + #define DHCP_OPT_BOOTFILE_CODE 67 /* Use unused 254 option for iPXE bootfile_name_alt userdata DHCP option. diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index b377dffa1d..f6acdc1087 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -12727,6 +12727,8 @@ static struct gen_opts_map supported_dhcp_opts[] = { DHCP_OPT_DOMAIN_SEARCH_LIST, DHCP_OPT_BOOTFILE_ALT, DHCP_OPT_BROADCAST_ADDRESS, + DHCP_OPT_NETBIOS_NAME_SERVER, + DHCP_OPT_NETBIOS_NODE_TYPE, }; static struct gen_opts_map supported_dhcpv6_opts[] = { diff --git a/ovn-nb.xml b/ovn-nb.xml index 0cf043790e..ec6405ff5e 100644 --- a/ovn-nb.xml +++ b/ovn-nb.xml @@ -3057,6 +3057,12 @@

+ +

+ The DHCPv4 option code for this option is 44. +

+
+

The DHCPv4 option code for this option is 121. @@ -3158,6 +3164,13 @@ specifies the interval that the client TCP should wait before sending a keepalive message on a TCP connection. + + +

+ The DHCPv4 option code for this option is 46. +

+
diff --git a/tests/ovn.at b/tests/ovn.at index 66088a7f55..66b1d734d6 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -1334,9 +1334,9 @@ reg0[15] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.255.0, reg0[15] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.255.0,mtu=1400,ip_forward_enable=1,default_ttl=121,dns_server={8.8.8.8,7.7.7.7},classless_static_route={30.0.0.0/24,10.0.0.4,40.0.0.0/16,10.0.0.6,0.0.0.0/0,10.0.0.1},ethernet_encap=1,router_discovery=0,tftp_server="tftp_server_test"); formats as reg0[15] = put_dhcp_opts(offerip = 10.0.0.4, router = 10.0.0.1, netmask = 255.255.255.0, mtu = 1400, ip_forward_enable = 1, default_ttl = 121, dns_server = {8.8.8.8, 7.7.7.7}, classless_static_route = {30.0.0.0/24, 10.0.0.4, 40.0.0.0/16, 10.0.0.6, 0.0.0.0/0, 10.0.0.1}, ethernet_encap = 1, router_discovery = 0, tftp_server = "tftp_server_test"); encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.6f.0a.00.00.04.03.04.0a.00.00.01.01.04.ff.ff.ff.00.1a.02.05.78.13.01.01.17.01.79.06.08.08.08.08.08.07.07.07.07.79.14.18.1e.00.00.0a.00.00.04.10.28.00.0a.00.00.06.00.0a.00.00.01.24.01.01.1f.01.00.42.10.74.66.74.70.5f.73.65.72.76.65.72.5f.74.65.73.74,pause) -reg2[5] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.254.0,mtu=1400,domain_name="ovn.org",wpad="https://example.org",bootfile_name="https://127.0.0.1/boot.ipxe",path_prefix="/tftpboot",domain_search_list="ovn.org,abc.ovn.org"); - formats as reg2[5] = put_dhcp_opts(offerip = 10.0.0.4, router = 10.0.0.1, netmask = 255.255.254.0, mtu = 1400, domain_name = "ovn.org", wpad = "https://example.org", bootfile_name = "https://127.0.0.1/boot.ipxe", path_prefix = "/tftpboot", domain_search_list = "ovn.org,abc.ovn.org"); - encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.25.0a.00.00.04.43.1b.68.74.74.70.73.3a.2f.2f.31.32.37.2e.30.2e.30.2e.31.2f.62.6f.6f.74.2e.69.70.78.65.03.04.0a.00.00.01.01.04.ff.ff.fe.00.1a.02.05.78.0f.07.6f.76.6e.2e.6f.72.67.fc.13.68.74.74.70.73.3a.2f.2f.65.78.61.6d.70.6c.65.2e.6f.72.67.d2.09.2f.74.66.74.70.62.6f.6f.74.77.0f.03.6f.76.6e.03.6f.72.67.00.03.61.62.63.c0.00,pause) +reg2[5] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.254.0,mtu=1400,domain_name="ovn.org",wpad="https://example.org",bootfile_name="https://127.0.0.1/boot.ipxe",path_prefix="/tftpboot",domain_search_list="ovn.org,abc.ovn.org",netbios_name_server={10.0.0.7,10.0.0.8},netbios_node_type=2); + formats as reg2[5] = put_dhcp_opts(offerip = 10.0.0.4, router = 10.0.0.1, netmask = 255.255.254.0, mtu = 1400, domain_name = "ovn.org", wpad = "https://example.org", bootfile_name = "https://127.0.0.1/boot.ipxe", path_prefix = "/tftpboot", domain_search_list = "ovn.org,abc.ovn.org", netbios_name_server = {10.0.0.7, 10.0.0.8}, netbios_node_type = 2); + encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.25.0a.00.00.04.43.1b.68.74.74.70.73.3a.2f.2f.31.32.37.2e.30.2e.30.2e.31.2f.62.6f.6f.74.2e.69.70.78.65.03.04.0a.00.00.01.01.04.ff.ff.fe.00.1a.02.05.78.0f.07.6f.76.6e.2e.6f.72.67.fc.13.68.74.74.70.73.3a.2f.2f.65.78.61.6d.70.6c.65.2e.6f.72.67.d2.09.2f.74.66.74.70.62.6f.6f.74.77.0f.03.6f.76.6e.03.6f.72.67.00.03.61.62.63.c0.00.2c.08.0a.00.00.07.0a.00.00.08.2e.01.02,pause) reg2[5] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.254.0,mtu=1400,domain_name="ovn.org",wpad="https://example.org",bootfile_name="https://127.0.0.1/boot.ipxe",path_prefix="/tftpboot",domain_search_list="ovn.org,abc.ovn.org,def.ovn.org,ovn.test,def.ovn.test,test.org,abc.com"); formats as reg2[5] = put_dhcp_opts(offerip = 10.0.0.4, router = 10.0.0.1, netmask = 255.255.254.0, mtu = 1400, domain_name = "ovn.org", wpad = "https://example.org", bootfile_name = "https://127.0.0.1/boot.ipxe", path_prefix = "/tftpboot", domain_search_list = "ovn.org,abc.ovn.org,def.ovn.org,ovn.test,def.ovn.test,test.org,abc.com"); encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.25.0a.00.00.04.43.1b.68.74.74.70.73.3a.2f.2f.31.32.37.2e.30.2e.30.2e.31.2f.62.6f.6f.74.2e.69.70.78.65.03.04.0a.00.00.01.01.04.ff.ff.fe.00.1a.02.05.78.0f.07.6f.76.6e.2e.6f.72.67.fc.13.68.74.74.70.73.3a.2f.2f.65.78.61.6d.70.6c.65.2e.6f.72.67.d2.09.2f.74.66.74.70.62.6f.6f.74.77.35.03.6f.76.6e.03.6f.72.67.00.03.61.62.63.c0.00.03.64.65.66.c0.00.03.6f.76.6e.04.74.65.73.74.00.03.64.65.66.c0.15.04.74.65.73.74.c0.04.03.61.62.63.03.63.6f.6d.00,pause) diff --git a/tests/test-ovn.c b/tests/test-ovn.c index 49a1947f6c..9bd13a037f 100644 --- a/tests/test-ovn.c +++ b/tests/test-ovn.c @@ -193,6 +193,8 @@ create_gen_opts(struct hmap *dhcp_opts, struct hmap *dhcpv6_opts, dhcp_opt_add(dhcp_opts, "domain_search_list", 119, "domains"); dhcp_opt_add(dhcp_opts, "bootfile_name_alt", 254, "str"); dhcp_opt_add(dhcp_opts, "broadcast_address", 28, "ipv4"); + dhcp_opt_add(dhcp_opts, "netbios_name_server", 44, "ipv4"); + dhcp_opt_add(dhcp_opts, "netbios_node_type", 46, "uint8"); /* DHCPv6 options. */ hmap_init(dhcpv6_opts);