From patchwork Fri Jun 7 12:14:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maciej Jozefczyk X-Patchwork-Id: 1111813 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 45L1hW4Mhlz9sNT for ; Fri, 7 Jun 2019 22:15:54 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 39C79113A; Fri, 7 Jun 2019 12:15:49 +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 122E11124 for ; Fri, 7 Jun 2019 12:14:51 +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 32A7887D for ; Fri, 7 Jun 2019 12:14:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8A2D42F8BF5 for ; Fri, 7 Jun 2019 12:14:49 +0000 (UTC) Received: from zyleta.redhat.com (ovpn-200-30.brq.redhat.com [10.40.200.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51F5D82A11; Fri, 7 Jun 2019 12:14:48 +0000 (UTC) From: mjozefcz@redhat.com To: dev@openvswitch.org Date: Fri, 7 Jun 2019 14:14:28 +0200 Message-Id: <20190607121428.17737-1-mjozefcz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 07 Jun 2019 12:14:49 +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 v2] Add support for DHCP option 15 - domain name 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: Maciej Józefczyk For Openstack Internal DNS functionality we need to provide support for domain_name option. DHCP option 15 was previously used only in parser tests and according to RFC it should be renamed to domain_name [1]. This patch modifies its name in the tests from 'domain' to 'domain_name' and adds its support to the code. [1] https://tools.ietf.org/html/rfc2132#section-3.17 Signed-off-by: Maciej Józefczyk --- ovn/lib/ovn-l7.h | 1 + ovn/northd/ovn-northd.c | 1 + ovn/ovn-nb.xml | 8 ++++++++ tests/oss-fuzz/expr_parse_target.c | 2 +- tests/ovn.at | 8 ++++---- tests/test-ovn.c | 2 +- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ovn/lib/ovn-l7.h b/ovn/lib/ovn-l7.h index c24201ef0..362f537da 100644 --- a/ovn/lib/ovn-l7.h +++ b/ovn/lib/ovn-l7.h @@ -40,6 +40,7 @@ struct gen_opts_map { #define DHCP_OPT_DNS_SERVER DHCP_OPTION("dns_server", 6, "ipv4") #define DHCP_OPT_LOG_SERVER DHCP_OPTION("log_server", 7, "ipv4") #define DHCP_OPT_LPR_SERVER DHCP_OPTION("lpr_server", 9, "ipv4") +#define DHCP_OPT_DOMAIN_NAME DHCP_OPTION("domain_name", 15, "str") #define DHCP_OPT_SWAP_SERVER DHCP_OPTION("swap_server", 16, "ipv4") #define DHCP_OPT_POLICY_FILTER \ diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index de0c06d4b..0b0a96a3a 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -8226,6 +8226,7 @@ static struct gen_opts_map supported_dhcp_opts[] = { DHCP_OPT_BOOTFILE, DHCP_OPT_PATH_PREFIX, DHCP_OPT_TFTP_SERVER_ADDRESS, + DHCP_OPT_DOMAIN_NAME, }; static struct gen_opts_map supported_dhcpv6_opts[] = { diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml index cbaa9495f..318379c1f 100644 --- a/ovn/ovn-nb.xml +++ b/ovn/ovn-nb.xml @@ -2355,6 +2355,14 @@ that matches with this requirement is option 66 (tftp_server).

+ + +

+ The DHCPv4 option code for this option is 15. This option + specifies the domain name that client should use when + resolving hostnames via the Domain Name System. +

+
diff --git a/tests/oss-fuzz/expr_parse_target.c b/tests/oss-fuzz/expr_parse_target.c index 7416421b8..170186d9d 100644 --- a/tests/oss-fuzz/expr_parse_target.c +++ b/tests/oss-fuzz/expr_parse_target.c @@ -122,7 +122,7 @@ create_gen_opts(struct hmap *dhcp_opts, struct hmap *dhcpv6_opts, dhcp_opt_add(dhcp_opts, "dns_server", 6, "ipv4"); dhcp_opt_add(dhcp_opts, "log_server", 7, "ipv4"); dhcp_opt_add(dhcp_opts, "lpr_server", 9, "ipv4"); - dhcp_opt_add(dhcp_opts, "domain", 15, "str"); + dhcp_opt_add(dhcp_opts, "domain_name", 15, "str"); dhcp_opt_add(dhcp_opts, "swap_server", 16, "ipv4"); dhcp_opt_add(dhcp_opts, "policy_filter", 21, "ipv4"); dhcp_opt_add(dhcp_opts, "router_solicitation", 32, "ipv4"); diff --git a/tests/ovn.at b/tests/ovn.at index 1231f4106..daf85a55d 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -1104,8 +1104,8 @@ put_arp(inport, arp.spa, arp.sha); # put_dhcp_opts reg1[0] = put_dhcp_opts(offerip = 1.2.3.4, router = 10.0.0.1); encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.40.01.02.03.04.03.04.0a.00.00.01,pause) -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"); +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"); + 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"); 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,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}); @@ -1125,8 +1125,8 @@ reg1[0] = put_dhcp_opts(offerip=1.2.3.4, xyzzy); Syntax error at `xyzzy' expecting DHCPv4 option name. reg1[0] = put_dhcp_opts(offerip="xyzzy"); DHCPv4 option offerip requires numeric value. -reg1[0] = put_dhcp_opts(offerip=1.2.3.4, domain=1.2.3.4); - DHCPv4 option domain requires string value. +reg1[0] = put_dhcp_opts(offerip=1.2.3.4, domain_name=1.2.3.4); + DHCPv4 option domain_name requires string value. # nd_ns nd_ns { nd.target = xxreg0; output; }; diff --git a/tests/test-ovn.c b/tests/test-ovn.c index 450cb9db5..27e65266d 100644 --- a/tests/test-ovn.c +++ b/tests/test-ovn.c @@ -166,7 +166,7 @@ create_gen_opts(struct hmap *dhcp_opts, struct hmap *dhcpv6_opts, dhcp_opt_add(dhcp_opts, "dns_server", 6, "ipv4"); dhcp_opt_add(dhcp_opts, "log_server", 7, "ipv4"); dhcp_opt_add(dhcp_opts, "lpr_server", 9, "ipv4"); - dhcp_opt_add(dhcp_opts, "domain", 15, "str"); + dhcp_opt_add(dhcp_opts, "domain_name", 15, "str"); dhcp_opt_add(dhcp_opts, "swap_server", 16, "ipv4"); dhcp_opt_add(dhcp_opts, "policy_filter", 21, "ipv4"); dhcp_opt_add(dhcp_opts, "router_solicitation", 32, "ipv4");