From patchwork Thu Mar 7 16:28:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Martins X-Patchwork-Id: 1053060 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44FbgC00LFz9s1B for ; Fri, 8 Mar 2019 03:29:10 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2EAE6C320; Thu, 7 Mar 2019 16:28:42 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 1AE42C30A for ; Thu, 7 Mar 2019 16:28:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 5FD04806 for ; Thu, 7 Mar 2019 16:28:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EABDE72D79; Thu, 7 Mar 2019 16:28:39 +0000 (UTC) Received: from lucas-t460s.redhat.com (ovpn-117-220.ams2.redhat.com [10.36.117.220]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39AAF5D9D4; Thu, 7 Mar 2019 16:28:39 +0000 (UTC) From: lmartins@redhat.com To: dev@openvswitch.org Date: Thu, 7 Mar 2019 16:28:35 +0000 Message-Id: <20190307162835.28751-2-lmartins@redhat.com> In-Reply-To: <20190307162835.28751-1-lmartins@redhat.com> References: <20190307162835.28751-1-lmartins@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 07 Mar 2019 16:28:39 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 2/2] OVN: Add support for DHCP option 150 - TFTP server address X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Lucas Alvares Gomes OpenStack Ironic relies on a few DHCP options [0] that were not supported in OVN yet. This patch is adding the last one which is the option 150 (TFTP server address, RFC5859 [1]). Note that this option is Cisco proprietary, the IEEE standard that matches with this requirement is Option 66. The difference is that 150 allows to multiple IPs to be specified and 66 only allows one. [0] https://github.com/openstack/ironic/blob/3f6d4c6a789b12512d6cc67cdbc93ba5fbf29848/ironic/common/pxe_utils.py#L44-L54 [1] https://tools.ietf.org/html/rfc5859 Signed-off-by: Lucas Alvares Gomes --- ovn/lib/ovn-l7.h | 2 ++ ovn/northd/ovn-northd.c | 1 + ovn/ovn-nb.xml | 9 +++++++++ tests/ovn.at | 6 +++--- tests/test-ovn.c | 1 + 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ovn/lib/ovn-l7.h b/ovn/lib/ovn-l7.h index a2224d019..fe3104e1f 100644 --- a/ovn/lib/ovn-l7.h +++ b/ovn/lib/ovn-l7.h @@ -73,6 +73,8 @@ struct gen_opts_map { #define DHCP_OPT_BOOTFILE DHCP_OPTION("bootfile_name", 67, "str") #define DHCP_OPT_WPAD DHCP_OPTION("wpad", 252, "str") #define DHCP_OPT_PATH_PREFIX DHCP_OPTION("path_prefix", 210, "str") +#define DHCP_OPT_TFTP_SERVER_ADDRESS \ + DHCP_OPTION("tftp_server_address", 150, "ipv4") static inline uint32_t gen_opt_hash(char *opt_name) diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 1a59c9fa9..2843969f4 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -7389,6 +7389,7 @@ static struct gen_opts_map supported_dhcp_opts[] = { DHCP_OPT_WPAD, DHCP_OPT_BOOTFILE, DHCP_OPT_PATH_PREFIX, + DHCP_OPT_TFTP_SERVER_ADDRESS, }; static struct gen_opts_map supported_dhcpv6_opts[] = { diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml index b084c821e..61a57110a 100644 --- a/ovn/ovn-nb.xml +++ b/ovn/ovn-nb.xml @@ -2178,6 +2178,15 @@ instead of deriving it from the bootfile name.

+ + +

+ The DHCPv4 option code for this option is 150. The option + contains one or more IPv4 addresses that the client MAY + use. This option is Cisco proprietary, the IEEE standard + that matches with this requirement is option 66 (tftp_server). +

+
diff --git a/tests/ovn.at b/tests/ovn.at index a5a6c6652..f2f2bc405 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -1107,9 +1107,9 @@ reg1[0] = put_dhcp_opts(offerip = 1.2.3.4, router = 10.0.0.1); reg2[5] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.254.0,mtu=1400,domain="ovn.org",wpad="https://example.org",bootfile_name="https://127.0.0.1/boot.ipxe",path_prefix="/tftpboot"); 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 = "ovn.org", wpad = "https://example.org", bootfile_name = "https://127.0.0.1/boot.ipxe", path_prefix = "/tftpboot"); encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.25.0a.00.00.04.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.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.d2.09.2f.74.66.74.70.62.6f.6f.74,pause) -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); - 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); - 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,pause) +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_address={10.0.0.4,10.0.0.5}); + 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_address = {10.0.0.4, 10.0.0.5}); + 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.96.08.0a.00.00.04.0a.00.00.05,pause) reg1[0..1] = put_dhcp_opts(offerip = 1.2.3.4, router = 10.0.0.1); Cannot use 2-bit field reg1[0..1] where 1-bit field is required. diff --git a/tests/test-ovn.c b/tests/test-ovn.c index 8e8c38a66..9e3112bf9 100644 --- a/tests/test-ovn.c +++ b/tests/test-ovn.c @@ -185,6 +185,7 @@ create_gen_opts(struct hmap *dhcp_opts, struct hmap *dhcpv6_opts, dhcp_opt_add(dhcp_opts, "wpad", 252, "str"); dhcp_opt_add(dhcp_opts, "bootfile_name", 67, "str"); dhcp_opt_add(dhcp_opts, "path_prefix", 210, "str"); + dhcp_opt_add(dhcp_opts, "tftp_server_address", 150, "ipv4"); /* DHCPv6 options. */ hmap_init(dhcpv6_opts);