From patchwork Thu Jun 25 02:02:57 2020
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Ankur Sharma
X-Patchwork-Id: 1316683
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.138; helo=whitealder.osuosl.org;
envelope-from=ovs-dev-bounces@openvswitch.org; receiver=)
Authentication-Results: ozlabs.org;
dmarc=fail (p=none dis=none) header.from=nutanix.com
Authentication-Results: ozlabs.org;
dkim=fail reason="signature verification failed" (2048-bit key;
unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256
header.s=proofpoint20171006 header.b=PL7+EX5b;
dkim-atps=neutral
Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by ozlabs.org (Postfix) with ESMTPS id 49sjwf6WyWz9s6w
for ; Thu, 25 Jun 2020 12:03:28 +1000 (AEST)
Received: from localhost (localhost [127.0.0.1])
by whitealder.osuosl.org (Postfix) with ESMTP id CF85C87E81;
Thu, 25 Jun 2020 02:03:25 +0000 (UTC)
X-Virus-Scanned: amavisd-new at osuosl.org
Received: from whitealder.osuosl.org ([127.0.0.1])
by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id gjkko5L64pey; Thu, 25 Jun 2020 02:03:21 +0000 (UTC)
Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])
by whitealder.osuosl.org (Postfix) with ESMTP id B3FE287E75;
Thu, 25 Jun 2020 02:03:21 +0000 (UTC)
Received: from lf-lists.osuosl.org (localhost [127.0.0.1])
by lists.linuxfoundation.org (Postfix) with ESMTP id 8F769C0888;
Thu, 25 Jun 2020 02:03:21 +0000 (UTC)
X-Original-To: ovs-dev@openvswitch.org
Delivered-To: ovs-dev@lists.linuxfoundation.org
Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])
by lists.linuxfoundation.org (Postfix) with ESMTP id 01A19C016F
for ; Thu, 25 Jun 2020 02:03:20 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
by silver.osuosl.org (Postfix) with ESMTP id A78DC20115
for ; Thu, 25 Jun 2020 02:03:19 +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 6f6AB8W1dQo1 for ;
Thu, 25 Jun 2020 02:03:17 +0000 (UTC)
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6
Received: from mx0b-002c1b01.pphosted.com (mx0b-002c1b01.pphosted.com
[148.163.155.12])
by silver.osuosl.org (Postfix) with ESMTPS id D26A220034
for ; Thu, 25 Jun 2020 02:03:16 +0000 (UTC)
Received: from pps.filterd (m0127843.ppops.net [127.0.0.1])
by mx0b-002c1b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id
05P21sx4008550
for ; Wed, 24 Jun 2020 19:03:15 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com;
h=from : to : cc :
subject : date : message-id : content-type : mime-version;
s=proofpoint20171006; bh=+GnfClnlf5EZ3ufvAhJpap2TvszF0YPPPdJTq3kyugk=;
b=PL7+EX5bTLKPEOoisthVgT3SRhcz4S+SMzAZdzcKENrJBqTwCxL6Iaug57+OHUuADjfJ
Rv08VyZHukYAnvgc8BIwuTu27nSpu1LgJbk9XZbhQAEz1pt6FTmKEuNRD0ekFj6U0iCp
JLr7gnMaNK8Avnw6WIpHsRuFYAJX18OmJ8dnK/ZgcAzwzsCrOpkwfq9sDzGAkIO+i6CA
kCSs3mEoF2c6NHH0D+dc1Ks1SL2dZRnSgPRen4S/+Ycbwy+DCBNeRpQAoGukbzysFSKH
jD0GuNvOO8tZsGpidrOo4sgCXSluvbdKwIYSWpsY6kkoEuUiK8BeWzLjLjO/U3w9kniG 0Q==
Received: from nam11-co1-obe.outbound.protection.outlook.com
(mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173])
by mx0b-002c1b01.pphosted.com with ESMTP id 31uusq2rs2-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
for ; Wed, 24 Jun 2020 19:03:15 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=ktaA/Kn2+H0y5jdfQawbWWNtZznWRnq/xSz6pMTaWvP66X2A66oUG9l8s4S9UPGIzr1weF+I2G2e4QVVfUXRxpB/7uuj3ZogrwsByfCx+q3ptW8McsBeQlTuH7k28NG6lGhcJkzWFPm29yneO/mpAu1jhh5YdlHDvgKCzD54XSOaoyQQVwrrKuYYlhl3RsFh5ijOAELMJU4Xs0jRSMIkaq0++4b3dBm73IL4uVuqnU6O1kYfF9Qd9Xqi8Cr7JKI3LHp9vbHkYVGAtb/hkxS+vOhP7F27I6e1XcAWOVRRJ8y60IpwJv5cG8YAPCiuLn3kHou6jtQ+5fDBTb+24wjQow==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector9901;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=+GnfClnlf5EZ3ufvAhJpap2TvszF0YPPPdJTq3kyugk=;
b=WMJaFaGhj8lJf+KXj9tJ6+0y3ahl+D3yeNAjeTYoajTCtkvBij4L+LQXK5OHxlZyjyicpctG7mR66vCFX7r6ISpfrU/q3o9lpcwWYNzYPrqAnp5lh5fOVIASzhLkrFYSTtf4LFPg6LW0QZhyTPARJo96i08HykfuJ+Cc/PNVeLS50Z/4dt2B43aH1lznqJJBEDJuY2B/y2jhmd8+BLaDO1ScZUWZGmTO372Y86cdCrtBARSG8Noc5SPuI5ul8SPOfwT290couXNaQfyYZCIs3P5JiNY9dUaxA+rb78jtSTLZJD89Pcql19RxMfn69J7Jt0sl7vumejWEDj/DIBKsNQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com;
dkim=pass header.d=nutanix.com; arc=none
Authentication-Results: openvswitch.org; dkim=none (message not signed)
header.d=none;openvswitch.org; dmarc=none action=none
header.from=nutanix.com;
Received: from BL0PR02MB3714.namprd02.prod.outlook.com (2603:10b6:207:44::16)
by MN2PR02MB6750.namprd02.prod.outlook.com (2603:10b6:208:1d7::17)
with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21; Thu, 25 Jun
2020 02:03:12 +0000
Received: from BL0PR02MB3714.namprd02.prod.outlook.com
([fe80::445e:7f74:952e:2ccb]) by BL0PR02MB3714.namprd02.prod.outlook.com
([fe80::445e:7f74:952e:2ccb%5]) with mapi id 15.20.3109.027; Thu, 25 Jun 2020
02:03:12 +0000
From: Ankur Sharma
To: ovs-dev@openvswitch.org
Date: Wed, 24 Jun 2020 19:02:57 -0700
Message-Id: <1593050577-12688-1-git-send-email-svc.mail.git@nutanix.com>
X-Mailer: git-send-email 1.8.3.1
X-ClientProxiedBy: BYAPR07CA0064.namprd07.prod.outlook.com
(2603:10b6:a03:60::41) To BL0PR02MB3714.namprd02.prod.outlook.com
(2603:10b6:207:44::16)
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
Received: from northd.localdomain (192.146.154.98) by
BYAPR07CA0064.namprd07.prod.outlook.com (2603:10b6:a03:60::41) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.20.3131.21 via Frontend Transport; Thu, 25 Jun 2020 02:03:11 +0000
X-Mailer: git-send-email 1.8.3.1
X-Originating-IP: [192.146.154.98]
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: b7e1f539-98cc-4ec1-06c4-08d818abea34
X-MS-TrafficTypeDiagnostic: MN2PR02MB6750:
X-MS-Exchange-Transport-Forked: True
X-Microsoft-Antispam-PRVS:
x-proofpoint-crosstenant: true
X-MS-Oob-TLC-OOBClassifiers: OLM:1923;
X-Forefront-PRVS: 0445A82F82
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info:
u1ph7IrEH0m4QPMgQ2jkJsSr3wG5dQ2QRrx6/9R2fUufcNXod7f3Jy3Vbxy0abo/CvG1fvuCwUfmjM58FU8Jx64MDkwvc0V+oOFwwh8fYeTBZtoV821xkknFggH7NWBlftA8I4yLxjZtvig4WoSuN5LF1ZxvPC3mHxadDU2jkT8vxVgrcOPFplvOa3EURMC1yrvA8CvxUEmYRKJaK31HiOwTEddya/MwFrxn6PhyzgZqfI/ePu5tG0Pp2T7QXpdMkWwJ8Fkvth5WHJyPP9QaV7B43728wdSVE/PUePYHITV+XVGIRRn34wvM1+qIlrsrQA3I7Yh3uuZxIazbnOzmOKqMyFRGmthjPyj38zP6yOubMp5ysvc98lkyAApgdigK69efCfeENS7XYyxCLVvzXw==
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
IPV:NLI; SFV:NSPM; H:BL0PR02MB3714.namprd02.prod.outlook.com; PTR:; CAT:NONE;
SFTY:;
SFS:(6019001)(136003)(396003)(39860400002)(366004)(346002)(376002)(5660300002)(86362001)(26005)(16526019)(66556008)(30864003)(186003)(6512007)(66476007)(66946007)(8936002)(2906002)(6506007)(83380400001)(2616005)(956004)(8676002)(36756003)(6916009)(52116002)(66574015)(107886003)(54906003)(83080400001)(4326008)(478600001)(6666004)(316002)(6486002);
DIR:OUT; SFP:1102;
X-MS-Exchange-AntiSpam-MessageData:
MfW1D4wvPAAC/YNS8qFuA1IE4COuPWuXMkdE2+Ldkmy1Y3OsAGq5Nbqd1Ef6nT++xRfNBwI6cQHMgbLq7778vf6XWnKdYYSd3AIM5SC4DM6p0+qnNTB4R27s1jfR3wx/DY2QQPqXeuLOHqhfFrli2sP6k0vNdzK7woXnOKkFpBeoaviHiCNvir8IzNTrMBqBdmpZa8U6/uZ1RxewY8fN6eIOA8+0JL3lk6SDJmL+gg5Q0KeOYvQQumYygEACRsd3PnFkyJIFQUvRAJV/n4Y0OqF4F8evUdibvH8Ch/Ve9DQiNa/97mF0tLv8sv8Dyfp3pATIpObLjxQ58Lssz6o3aFRyG0ZY/3YwKxON57V0ZpTNsmv7IGsMYLOLIwJ4zv82pluAe5Oyzk3ZD4nVBY9dXav2FM4E/noA4Hm8IjooNMntL/3N4S7xFBwOOAOmuToLutOi/bGjxHFz+A/RfUrFSeHvczKFdBHdNCQJotCX70Q=
X-OriginatorOrg: nutanix.com
X-MS-Exchange-CrossTenant-Network-Message-Id:
b7e1f539-98cc-4ec1-06c4-08d818abea34
X-MS-Exchange-CrossTenant-AuthSource: BL0PR02MB3714.namprd02.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2020 02:03:12.4924 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName:
KWaTSnaNS/KUfYepttvpEY2ks6UEgmyhnRBaOvtYXwIcEX/jeLghqCYENngAzOvjfSVN85Ywi1LM3609RoUJFiUvFpzlAZqyeQY1qAa1Rm0=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB6750
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687
definitions=2020-06-24_19:2020-06-24,
2020-06-24 signatures=0
X-Proofpoint-Spam-Reason: safe
Cc: Dhathri Purohith
Subject: [ovs-dev] [PATCH v9 ovn] Add support for DHCP domain search option
(119)
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: Dhathri Purohith
From: Dhathri Purohith
Domain search list is encoded according to the specifications in RFC 1035,
section 4.1.4.
Signed-off-by: Dhathri Purohith
Signed-off-by: Ankur Sharma
---
v8 -> v9
---
* Add Signed-off-by: Ankur Sharma
---
---
v7 -> v8
---
* Use SHASH_INITIALIZER to initialize shash.
* Use ovs_strlcpy() instead of strcpy().
* Use shash_destroy_free_data() for cleanup.
* Test: Add more examples in the domain_search_list.
---
lib/actions.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
lib/ovn-l7.h | 3 ++
northd/ovn-northd.c | 1 +
ovn-nb.xml | 13 ++++++++
ovn-sb.ovsschema | 6 ++--
ovn-sb.xml | 11 +++++++
tests/ovn.at | 39 ++++++++++++++++++++++++
tests/test-ovn.c | 1 +
8 files changed, 155 insertions(+), 4 deletions(-)
diff --git a/lib/actions.c b/lib/actions.c
index 9baa90f..ee7c825 100644
--- a/lib/actions.c
+++ b/lib/actions.c
@@ -1982,7 +1982,8 @@ parse_gen_opt(struct action_context *ctx, struct ovnact_gen_option *o,
return;
}
- if (!strcmp(o->option->type, "str")) {
+ if (!strcmp(o->option->type, "str") ||
+ !strcmp(o->option->type, "domains")) {
if (o->value.type != EXPR_C_STRING) {
lexer_error(ctx->lexer, "%s option %s requires string value.",
opts_type, o->option->name);
@@ -2317,6 +2318,88 @@ encode_put_dhcpv4_option(const struct ovnact_gen_option *o,
opt_header[1] = sizeof(ovs_be32);
ofpbuf_put(ofpacts, &c->value.ipv4, sizeof(ovs_be32));
}
+ } else if (!strcmp(o->option->type, "domains")) {
+ /* Please refer to RFC 1035, section 4.1.4 for the format of encoding
+ * domain names. Below is an example for encoding a search list
+ * consisting of the "abc.com" and "xyz.abc.com".
+ *
+ * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+ * |119|14 | 3 |'a'|'b'|'c'| 3 |'c'|'o'|'m'| 0 |'x'|'y'|'z'|xC0|x00|
+ * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+ *
+ * The encoding of "abc.com" ends with 0 to mark the end of the
+ * domain name as required by RFC 1035.
+ *
+ * The encoding of "xyz" (for "xyz.abc.com") ends with the two-octet
+ * compression pointer C000 (hex), which points to offset 0 where
+ * another validly encoded domain name can be found to complete
+ * the name ("abc.com").
+ *
+ * Encoding adds 2 bytes (one for length and one for delimiter) for
+ * every domain name that is unique. If all the domain names are unique
+ * (which probably never happens in real world), then encoded string
+ * could be longer than the original string. Just to be on the safer
+ * side, allocate the (approx.) worst case length here.
+ */
+ uint8_t *dns_encoded = xzalloc(2 * strlen(c->string));
+ uint16_t encode_offset = 0;
+ struct shash label_offset_map = SHASH_INITIALIZER(&label_offset_map);
+ char *domain_list = xstrdup(c->string), *dom_ptr = NULL;
+ char *suffix = xzalloc(strlen(domain_list));
+ for (char *domain = strtok_r(domain_list, ",", &dom_ptr);
+ domain != NULL;
+ domain = strtok_r(NULL, ",", &dom_ptr)) {
+ if (strlen(domain) > DOMAIN_NAME_MAX_LEN) {
+ VLOG_WARN("Domain names longer than 255 characters are not"
+ "supported");
+ goto out;
+ }
+ ovs_strlcpy(suffix, domain, strlen(domain));
+ char *label;
+ for (label = strtok_r(domain, ".", &domain);
+ label != NULL;
+ label = strtok_r(NULL, ".", &domain)) {
+ /* Check if we have already encoded this suffix.
+ * If yes, fill in the reference and break. */
+ uint16_t *get_offset;
+ get_offset = shash_find_data(&label_offset_map, suffix);
+ if (get_offset != NULL) {
+ ovs_be16 temp = htons(0xc000) | htons(*get_offset);
+ memcpy(dns_encoded + encode_offset, &temp,
+ sizeof(temp));
+ encode_offset += sizeof(temp);
+ break;
+ } else {
+ /* The suffix was not encoded before, encode it now
+ * and add the offset to the label_offset_map. */
+ uint16_t *set_offset = xzalloc(sizeof(uint16_t));
+ *set_offset = encode_offset;
+ shash_add_once(&label_offset_map, suffix, set_offset);
+
+ uint8_t len = strlen(label);
+ memcpy(dns_encoded + encode_offset, &len, sizeof(uint8_t));
+ encode_offset += sizeof(uint8_t);
+ memcpy(dns_encoded + encode_offset, label, len);
+ encode_offset += len;
+ }
+ ovs_strlcpy(suffix, domain, strlen(domain));
+ }
+ /* Add the end marker (0 byte) to determine the end of the
+ * domain. */
+ if (label == NULL) {
+ uint8_t end = 0;
+ memcpy(dns_encoded + encode_offset, &end, sizeof(uint8_t));
+ encode_offset += sizeof(uint8_t);
+ }
+ }
+ opt_header[1] = encode_offset;
+ ofpbuf_put(ofpacts, dns_encoded, encode_offset);
+
+ out:
+ free(suffix);
+ free(domain_list);
+ free(dns_encoded);
+ shash_destroy_free_data(&label_offset_map);
}
}
diff --git a/lib/ovn-l7.h b/lib/ovn-l7.h
index 4bfa902..9acfbe0 100644
--- a/lib/ovn-l7.h
+++ b/lib/ovn-l7.h
@@ -34,6 +34,7 @@ struct gen_opts_map {
size_t code;
};
+#define DOMAIN_NAME_MAX_LEN 255
#define DHCP_BROADCAST_FLAG 0x8000
/* These are not defined in ovs/lib/dhcp.h and hence defined here with
@@ -89,6 +90,8 @@ struct gen_opts_map {
#define DHCP_OPT_PATH_PREFIX DHCP_OPTION("path_prefix", 210, "str")
#define DHCP_OPT_TFTP_SERVER_ADDRESS \
DHCP_OPTION("tftp_server_address", 150, "ipv4")
+#define DHCP_OPT_DOMAIN_SEARCH_LIST \
+ DHCP_OPTION("domain_search_list", 119, "domains")
#define DHCP_OPT_ARP_CACHE_TIMEOUT \
DHCP_OPTION("arp_cache_timeout", 35, "uint32")
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index d02447c..6983038 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -11352,6 +11352,7 @@ static struct gen_opts_map supported_dhcp_opts[] = {
DHCP_OPT_DOMAIN_NAME,
DHCP_OPT_ARP_CACHE_TIMEOUT,
DHCP_OPT_TCP_KEEPALIVE_INTERVAL,
+ DHCP_OPT_DOMAIN_SEARCH_LIST,
};
static struct gen_opts_map supported_dhcpv6_opts[] = {
diff --git a/ovn-nb.xml b/ovn-nb.xml
index 2f610ee..6ac178b 100644
--- a/ovn-nb.xml
+++ b/ovn-nb.xml
@@ -2960,6 +2960,19 @@
+
+
+
+ These options accept string value which is a comma separated
+ list of domain names. The domain names are encoded based on RFC 1035.
+
+
+
+
+ The DHCPv4 option code for this option is 119.
+
+
+
diff --git a/ovn-sb.ovsschema b/ovn-sb.ovsschema
index 2ec729b..99c5de8 100644
--- a/ovn-sb.ovsschema
+++ b/ovn-sb.ovsschema
@@ -1,7 +1,7 @@
{
"name": "OVN_Southbound",
- "version": "2.8.1",
- "cksum": "236203406 21905",
+ "version": "2.8.2",
+ "cksum": "464326363 21916",
"tables": {
"SB_Global": {
"columns": {
@@ -218,7 +218,7 @@
"type": "string",
"enum": ["set", ["bool", "uint8", "uint16", "uint32",
"ipv4", "static_routes", "str",
- "host_id"]]}}}},
+ "host_id", "domains"]]}}}},
"isRoot": true},
"DHCPv6_Options": {
"columns": {
diff --git a/ovn-sb.xml b/ovn-sb.xml
index 00e7e7f..cf95a7c 100644
--- a/ovn-sb.xml
+++ b/ovn-sb.xml
@@ -3233,6 +3233,17 @@ tcp.flags = RST;
+ value: domains
+
+
+ This indicates that the value of the DHCP option is a domain name
+ or a comma separated list of domain names.
+
+
+
+ Example. "name=domain_search_list", "code=119", "type=domains".
+
+
diff --git a/tests/ovn.at b/tests/ovn.at
index 195f7c1..3c757df 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -1235,6 +1235,12 @@ 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.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.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,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.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.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)
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.
@@ -1252,6 +1258,8 @@ reg1[0] = put_dhcp_opts(offerip="xyzzy");
DHCPv4 option offerip requires numeric value.
reg1[0] = put_dhcp_opts(offerip=1.2.3.4, domain_name=1.2.3.4);
DHCPv4 option domain_name requires string value.
+reg1[0] = put_dhcp_opts(offerip=1.2.3.4, domain_search_list=1.2.3.4);
+ DHCPv4 option domain_search_list requires string value.
# nd_ns
nd_ns { nd.target = xxreg0; output; };
@@ -5744,6 +5752,37 @@ AT_CHECK([cat 2.packets | cut -c -48], [0], [expout])
cat 2.expected | cut -c 53- > expout
AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout])
+reset_pcap_file hv1-vif1 hv1/vif1
+reset_pcap_file hv1-vif2 hv1/vif2
+rm -f 1.expected
+rm -f 2.expected
+
+# Set domain search list option for ls1
+echo "------ Set domain search list --------"
+ovn-nbctl dhcp-options-set-options $d1 server_id=10.0.0.1 \
+server_mac=ff:10:00:00:00:01 lease_time=3600 router=10.0.0.1 \
+domain_search_list=\"test1.com,test2.com\"
+echo "------------------------------------------"
+
+# Send DHCPREQUEST in the SELECTING/INIT-REBOOT state with the offered IP
+# address in the Requested IP Address option.
+offer_ip=`ip_to_hex 10 0 0 6`
+server_ip=`ip_to_hex 10 0 0 1`
+ciaddr=`ip_to_hex 0 0 0 0`
+request_ip=$offer_ip
+expected_dhcp_opts=771305746573743103636f6d00057465737432c006330400000e100104ffffff0003040a00000136040a000001
+test_dhcp 2 f00000000002 03 0 $ciaddr $offer_ip $request_ip 0 ff1000000001 $server_ip 05 $expected_dhcp_opts
+
+# NXT_RESUMEs should be 16.
+OVS_WAIT_UNTIL([test 16 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
+
+$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
+cat 2.expected | cut -c -48 > expout
+AT_CHECK([cat 2.packets | cut -c -48], [0], [expout])
+# Skipping the IPv4 checksum.
+cat 2.expected | cut -c 53- > expout
+AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout])
+
OVN_CLEANUP([hv1])
AT_CLEANUP
diff --git a/tests/test-ovn.c b/tests/test-ovn.c
index 4391694..b43f67f 100644
--- a/tests/test-ovn.c
+++ b/tests/test-ovn.c
@@ -189,6 +189,7 @@ create_gen_opts(struct hmap *dhcp_opts, struct hmap *dhcpv6_opts,
dhcp_opt_add(dhcp_opts, "tftp_server_address", 150, "ipv4");
dhcp_opt_add(dhcp_opts, "arp_cache_timeout", 35, "uint32");
dhcp_opt_add(dhcp_opts, "tcp_keepalive_interval", 38, "uint32");
+ dhcp_opt_add(dhcp_opts, "domain_search_list", 119, "domains");
/* DHCPv6 options. */
hmap_init(dhcpv6_opts);