[ovs-dev] [PATCH ovn] Add support for DHCP Options 44, 46 (NB Name Server, NB Node Type)

numans at ovn.org numans at ovn.org
Mon Dec 21 12:18:07 UTC 2020


From: Vladislav Odintsov <odivlad at gmail.com>

Submitted-at: https://github.com/ovn-org/ovn/pull/66
Signed-off-by: Vladislav Odintsov <odivlad at gmail.com>
---
 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 @@
           </p>
         </column>
 
+        <column name="options" key="netbios_name_server">
+          <p>
+            The DHCPv4 option code for this option is 44.
+          </p>
+        </column>
+
         <column name="options" key="classless_static_route">
           <p>
             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.
         </column>
+
+        <column name="options" key="netbios_node_type"
+                type='{"type": "integer", "minInteger": 0, "maxInteger": 255}'>
+          <p>
+            The DHCPv4 option code for this option is 46.
+          </p>
+        </column>
       </group>
 
       <group title="String DHCP Options">
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);
-- 
2.28.0



More information about the dev mailing list