From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=EAjSC66c; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 36C665A004E for ; Fri, 15 Nov 2024 10:25:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731662748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xHVSYQZ4BuxUyBbl7H26X98frntfVsTuiEY0wiL+2tw=; b=EAjSC66c+0snibPDjzJs3J3rhWdyVFFaLkhv339dCLdbnHqb6HpgL92CmhAmcP2VDbMkoo coEvNhRyVM/F+fs1ki8zsKY8u+ZNXS4B2AdlOI48xR3yOKbkfQl+SsJAgqK00++rf7Q+kc dhOK1My2Ye9tQ6kM//Dm36/8DRJDD+o= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-139-riGP3GGqMiODUS422FRjkg-1; Fri, 15 Nov 2024 04:25:46 -0500 X-MC-Unique: riGP3GGqMiODUS422FRjkg-1 X-Mimecast-MFC-AGG-ID: riGP3GGqMiODUS422FRjkg Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a9a2a81ab82so133164266b.1 for ; Fri, 15 Nov 2024 01:25:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731662745; x=1732267545; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xHVSYQZ4BuxUyBbl7H26X98frntfVsTuiEY0wiL+2tw=; b=pLPuHUzL/4qM67rNSipbhWWazeZO5LUSLB6lUqPN16r8R5DIoWNVK9N27nqOVnoHm3 pyZG49kcXUGRsCp2cp89ynhlQQAF6FC2XE4AI62DNWM7SXwKD/yQK3iHYT8tTmHxi44W wgEbcnxUqZipLKWnCZIvpq85YnmIvtnApCYMD4d2suwBKsovS1BnBFEZXDUsJOL1iKTe 3Dh2tijMUvX54y6cVzI2aBcTteNOOu4M3LPs/kwD3vBOqaSAYW1xmDvqabe3H5FD4NC+ ZX7SJTnve5dThL+K1XOT6nscDwTdr/0A8Wvq6h+o0YS9d3vGgexHwg7zNXgPKuL4LAqF gxBA== X-Gm-Message-State: AOJu0YwpuPY9T2i3hKwb5PnOlLONYo4oUs1tgcpdDLSHxlTBCvkc9hFn l0a2QKg5yRMnzUoT0eTHaQdr42oi+TQzNf12sf1NqiJNxKuLd5ewojI1sHev0zusia2rlT1z86t XozPkclpYK2yUTeqxJgyCXaUUANvFNnAsD/el1LqMM1iEHEMBkRS+Nk3fV0wySWFq4oC+sq/EMu NMMcLISe/0Asvzp/aNSfV+C4rb X-Received: by 2002:a17:907:3f98:b0:a9a:26a1:1963 with SMTP id a640c23a62f3a-aa4833f66c5mr172399866b.7.1731662744643; Fri, 15 Nov 2024 01:25:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIeKao++i0wSulz3kguESFPhHp9Osc9V3V5G/jcrmJJau+hjR8EbvzDraS7t2vJoUcZ73VchcIjpLB/CGXCWw= X-Received: by 2002:a17:907:3f98:b0:a9a:26a1:1963 with SMTP id a640c23a62f3a-aa4833f66c5mr172396866b.7.1731662744046; Fri, 15 Nov 2024 01:25:44 -0800 (PST) MIME-Version: 1.0 References: <20241114084727.37263-1-ellorent@redhat.com> <20241114181323.14fd3d36@elisabeth> In-Reply-To: <20241114181323.14fd3d36@elisabeth> From: Enrique Llorente Pastora Date: Fri, 15 Nov 2024 10:25:33 +0100 Message-ID: Subject: Re: [PATCH v2] dhcp, dhcpv6: Add hostname and client fqdn ops To: Stefano Brivio X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 4tg4q9azBZQ70l9iTjQogZJMyyHaLQ8shoXp7sg7ido_1731662745 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GWQIOXQIKWUOWMVZ3QULVZRGXXXRUUIC X-Message-ID-Hash: GWQIOXQIKWUOWMVZ3QULVZRGXXXRUUIC X-MailFrom: ellorent@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, Nov 14, 2024 at 6:13=E2=80=AFPM Stefano Brivio = wrote: > > On Thu, 14 Nov 2024 09:47:27 +0100 > Enrique Llorente wrote: > > > Both DHCPv4 and DHCPv6 has the capability to pass the hostname to > > clients, the DHCPv4 uses option 12 (hostname) while the DHCPv6 uses opt= ion 39 > > (client fqdn), for some virt deployments like kubevirt is expected to > > have the VirtualMachine name as the guest hostname. > > > > This change add the -H --hostname to configure the DHCPv4 and DHCPv6 > > options to will send hostname to clients. > > > > Signed-off-by: Enrique Llorente > > --- > > conf.c | 13 ++++++++++--- > > dhcp.c | 8 +++++++- > > dhcpv6.c | 44 +++++++++++++++++++++++++++++++++++++++++++- > > passt.h | 2 ++ > > test/lib/setup | 10 +++++----- > > test/passt.mbuto | 1 + > > test/passt/dhcp | 11 ++++++++++- > > 7 files changed, 78 insertions(+), 11 deletions(-) > > > > diff --git a/conf.c b/conf.c > > index 14411b4..ddb585c 100644 > > --- a/conf.c > > +++ b/conf.c > > @@ -847,7 +847,8 @@ static void usage(const char *name, FILE *f, int st= atus) > > " --freebind Bind to any address for forwardin= g\n" > > " --no-map-gw Don't map gateway address to host= \n" > > " -4, --ipv4-only Enable IPv4 operation only\n" > > - " -6, --ipv6-only Enable IPv6 operation only\n"); > > + " -6, --ipv6-only Enable IPv6 operation only\n" > > + " -H, --hostname NAME Hostname to configure client with\= n"); > > Use one tab instead of one space between "NAME" and "Hostname" so that > the output (and the code itself) is aligned. > > > > > if (strstr(name, "pasta")) > > goto pasta_opts; > > @@ -1303,6 +1304,7 @@ void conf(struct ctx *c, int argc, char **argv) > > {"map-guest-addr", required_argument, NULL, 2= 2 }, > > {"host-lo-to-ns-lo", no_argument, NULL, 2= 3 }, > > {"dns-host", required_argument, NULL, 2= 4 }, > > + {"hostname", required_argument, NULL, '= H' }, > > Maybe this could go a bit more up, just after the "dns" and "search" > options. Two reasons: we have all the options without a short version > at the end, and this logically belongs together with other name-related > stuff we send to the guest. > > > { 0 }, > > }; > > const char *logname =3D (c->mode =3D=3D MODE_PASTA) ? "pasta" : "= passt"; > > @@ -1325,9 +1327,9 @@ void conf(struct ctx *c, int argc, char **argv) > > if (c->mode =3D=3D MODE_PASTA) { > > c->no_dhcp_dns =3D c->no_dhcp_dns_search =3D 1; > > fwd_default =3D FWD_AUTO; > > - optstring =3D "+dqfel:hF:I:p:P:m:a:n:M:g:i:o:D:S:46t:u:T:= U:"; > > + optstring =3D "+dqfel:hF:I:p:P:m:a:n:M:g:i:o:D:S:46t:u:T:= U:H:"; > > Same here: maybe after S: it makes more sense. > > > } else { > > - optstring =3D "+dqfel:hs:F:p:P:m:a:n:M:g:i:o:D:S:461t:u:"= ; > > + optstring =3D "+dqfel:hs:F:p:P:m:a:n:M:g:i:o:D:S:461t:u:H= :"; > > } > > > > c->tcp.fwd_in.mode =3D c->tcp.fwd_out.mode =3D FWD_UNSET; > > @@ -1680,6 +1682,11 @@ void conf(struct ctx *c, int argc, char **argv) > > > > c->one_off =3D true; > > break; > > + case 'H': > > + ret =3D snprintf(c->hostname.n, sizeof(c->hostnam= e.n), "%s", optarg); > > We (generally) wrap lines at 80 columns where doable: > > ret =3D snprintf(c->hostname.n, sizeof(c->hostnam= e.n), > "%s", optarg); > > > + if (ret <=3D 0 || ret >=3D (int)sizeof(c->hostnam= e.n)) > > + die("Invalid hostname: %s", optarg); > > + break; > > case 't': > > case 'u': > > case 'T': > > diff --git a/dhcp.c b/dhcp.c > > index a06f143..ec7e78a 100644 > > --- a/dhcp.c > > +++ b/dhcp.c > > @@ -275,7 +275,7 @@ static void opt_set_dns_search(const struct ctx *c,= size_t max_len) > > */ > > int dhcp(const struct ctx *c, const struct pool *p) > > { > > - size_t mlen, dlen, offset =3D 0, opt_len, opt_off =3D 0; > > + size_t mlen, dlen, offset =3D 0, opt_len, opt_off =3D 0, hostname= _len; > > char macstr[ETH_ADDRSTRLEN]; > > const struct ethhdr *eh; > > const struct iphdr *iph; > > @@ -375,6 +375,12 @@ int dhcp(const struct ctx *c, const struct pool *p= ) > > opts[6].slen +=3D sizeof(uint32_t); > > } > > > > + hostname_len =3D strlen(c->hostname.n); > > + if ( hostname_len > 0 ) { > > No space around parentheses in expressions: > > if (hostname_len > 0) { > > > + opts[12].slen =3D hostname_len; > > + memcpy(opts[12].s, &c->hostname.n, hostname_len); > > + } > > + > > if (!c->no_dhcp_dns_search) > > opt_set_dns_search(c, sizeof(m->o)); > > > > diff --git a/dhcpv6.c b/dhcpv6.c > > index 14a5c7e..190dc0e 100644 > > --- a/dhcpv6.c > > +++ b/dhcpv6.c > > @@ -48,6 +48,7 @@ struct opt_hdr { > > # define STATUS_NOTONLINK htons_constant(4) > > # define OPT_DNS_SERVERS htons_constant(23) > > # define OPT_DNS_SEARCH htons_constant(24) > > +# define OPT_CLIENT_FQDN htons_constant(39) > > One tab instead of spaces. > > > #define STR_NOTONLINK "Prefix not appropriate for link.= " > > > > uint16_t l; > > @@ -163,6 +164,18 @@ struct opt_dns_search { > > char list[MAXDNSRCH * NS_MAXDNAME]; > > } __attribute__((packed)); > > > > +/** > > + * struct opt_client_fqdn - Client FQDN option (RFC 4704) > > + * @hdr: Option header > > + * @flags: Flags as stated at RFC 4704 > > s/stated at/described by/ > > Maybe mention that we don't really use those ("always zero for us"). > > > + * @hostname: Client fqdn > > A hostname is not necessarily a fully-qualified domain name. The RFC > calls this "domain name", so we could at least call this 'domain' in > the struct to make it clear we're referring to that. > > As to what it should contain: RFC 4702 defines option 81 (FQDN) for > DHCP, which is equivalent to DHCPv6's option 39 (RFC 4704). Should we > just call this whole thing "FQDN" and switch to option 81 for DHCP > instead? Would this work for KubeVirt? > > Or introduce two options: -H / --hostname (option 12, DHCP only), and > --fqdn (setting both DHCP option 81 and DHCPv6 option 39)? Let me experiment with DHCPv4 option 81 with kubevirt machines, if it's eno= ugh we use 81 instead of 12 and call it --fqdn. If not we go with --fqdn and --hostname, but in this case it's not clear to me what kubevirt/libvirt has to pass though, also is this going to be expose at the domain xml or libvirt will directly pass always the vm name as one of them ? (for dual stack or single stack ipv4 hostname is enough, problem is single stack ipv6) > > > + */ > > +struct opt_client_fqdn{ > > + struct opt_hdr hdr; > > + uint8_t flags; > > + uint8_t hostname[NS_MAXDNAME]; > > NS_MAXDNAME is typically 1025, I don't remember why it's defined > that way, but we shouldn't accept domain names that are longer than 255 > bytes (or maybe even 253 bytes, RFC 1035), because otherwise they will > be different when sent over DHCP (where we have a 255 bytes limit). > > Right now we only send domain names as part of the DNS search option, > and there we also use NS_MAXDNAME as limit, but for DHCP, we apply > message compression (RFC 1035 4.1.4). In that case, we might be able to > send domain names that are longer than 255 bytes (because of the > compression). > > For simplicity, perhaps we should just stick to 253 bytes for any kind > of domain name. doesn't really help us: > > #define NS_MAXDNAME 1025 /*%< maximum domain name */ > > #define NS_MAXCDNAME 255 /*%< maximum compressed domain name */ > > ...so maybe we could define our own MAXDNAME as 253 and be done with it. Make sense, did use the limit found around. > > > +} __attribute__((packed)); > > + > > /** > > * struct msg_hdr - DHCPv6 client/server message header > > * @type: DHCP message type > > @@ -191,6 +204,7 @@ struct msg_hdr { > > * @ia_na: Non-temporary Address option > > * @ia_addr: Address for IA_NA > > * @client_id: Client Identifier, variable length > > + * @client_fqdn: Client FQDN, variable length > > * @dns_servers: DNS Recursive Name Server, here just for storage = size > > * @dns_search: Domain Search List, here just for storage= size > > */ > > @@ -203,10 +217,10 @@ static struct resp_t { > > struct opt_client_id client_id; > > struct opt_dns_servers dns_servers; > > struct opt_dns_search dns_search; > > + struct opt_client_fqdn client_fqdn; > > This should also appear in the description of struct resp_t. > > > } __attribute__((__packed__)) resp =3D { > > { 0 }, > > SERVER_ID, > > - > > Unrelated change. > > > { { OPT_IA_NA, OPT_SIZE_CONV(sizeof(struct opt_ia_na) + > > sizeof(struct opt_ia_addr) = - > > sizeof(struct opt_hdr)) }, > > @@ -228,6 +242,10 @@ static struct resp_t { > > { { OPT_DNS_SEARCH, 0, }, > > { 0 }, > > }, > > + > > + { { OPT_CLIENT_FQDN, 0, }, > > + (uint8_t)~0U, { 0 }, > > No need to initialise fields here as this member is here just to > calculate the storage size for 'resp_t': 'flags' can be all zeroes. > > > + }, > > }; > > > > static const struct opt_status_code sc_not_on_link =3D { > > @@ -416,6 +434,29 @@ search: > > return offset; > > } > > > > +/** > > + * dhcpv6_client_fqdn_fill() - Fill in client FQDN option > > + * @c: Execution context > > + * @buf: Response message buffer where options will be appended > > + * @offset: Offset in message buffer for new options > > + * > > + * Return: updated length of response message buffer. > > + */ > > +static size_t dhcpv6_client_fqdn_fill(const struct ctx *c, char *buf, = int offset) > > This whole function mixes up spaces and tabs. > > > +{ > > + uint16_t hostname_len =3D strlen(c->hostname.n); > > + if (hostname_len > 0) { > > + struct opt_client_fqdn *o =3D (struct opt_client_fqdn*)(buf + off= set); > > Space before * (struct opt_client_fqdn *). > > > + o->hdr.t =3D OPT_CLIENT_FQDN; > > + o->hdr.l =3D htons(hostname_len+2); > > Spaces around operands (hostname_len + 2). > > > + o->flags =3D 0x00; > > + *o->hostname =3D hostname_len; > > + memcpy(o->hostname+1, c->hostname.n, hostname_len); > > Same here (o->hostname + 1). > > > + offset +=3D sizeof(struct opt_hdr) + hostname_len+2; > > And here. > > > + } > > + return offset; > > +} > > + > > /** > > * dhcpv6() - Check if this is a DHCPv6 message, reply as needed > > * @c: Execution context > > @@ -549,6 +590,7 @@ int dhcpv6(struct ctx *c, const struct pool *p, > > n =3D offsetof(struct resp_t, client_id) + > > sizeof(struct opt_hdr) + ntohs(client_id->l); > > n =3D dhcpv6_dns_fill(c, (char *)&resp, n); > > + n =3D dhcpv6_client_fqdn_fill(c, (char*)&resp, n); > > > > resp.hdr.xid =3D mh->xid; > > > > diff --git a/passt.h b/passt.h > > index 72c7f72..d9864e6 100644 > > --- a/passt.h > > +++ b/passt.h > > @@ -205,6 +205,7 @@ struct ip6_ctx { > > * @ifi4: Index of template interface for IPv4, 0 if IPv4 d= isabled > > * @ip: IPv4 configuration > > * @dns_search: DNS search list > > + * @hostname: Client hostname > > * @ifi6: Index of template interface for IPv6, 0 if IPv6 d= isabled > > * @ip6: IPv6 configuration > > * @pasta_ifn: Name of namespace interface for pasta > > @@ -262,6 +263,7 @@ struct ctx { > > struct ip4_ctx ip4; > > > > struct fqdn dns_search[MAXDNSRCH]; > > + struct fqdn hostname; > > Same here: FQDN and hostname aren't necessarily the same thing. We > should pick one, or add two separate options. Or even just --fqdn if > it's what KubeVirt needs. > > > > > unsigned int ifi6; > > struct ip6_ctx ip6; > > diff --git a/test/lib/setup b/test/lib/setup > > index 5338393..9c7aac9 100755 > > --- a/test/lib/setup > > +++ b/test/lib/setup > > @@ -49,7 +49,7 @@ setup_passt() { > > > > context_run passt "make clean" > > context_run passt "make valgrind" > > - context_run_bg passt "valgrind --max-stackframe=3D$((4 * 1024 * 1= 024)) --trace-children=3Dyes --vgdb=3Dno --error-exitcode=3D1 --suppression= s=3Dtest/valgrind.supp ./passt ${__opts} -s ${STATESETUP}/passt.socket -f -= t 10001 -u 10001 -P ${STATESETUP}/passt.pid" > > + context_run_bg passt "valgrind --max-stackframe=3D$((4 * 1024 * 1= 024)) --trace-children=3Dyes --vgdb=3Dno --error-exitcode=3D1 --suppression= s=3Dtest/valgrind.supp ./passt ${__opts} -s ${STATESETUP}/passt.socket -f -= t 10001 -u 10001 -H passt1 -P ${STATESETUP}/passt.pid" > > > > # pidfile isn't created until passt is listening > > wait_for [ -f "${STATESETUP}/passt.pid" ] > > @@ -146,11 +146,11 @@ setup_passt_in_ns() { > > if [ ${VALGRIND} -eq 1 ]; then > > context_run passt "make clean" > > context_run passt "make valgrind" > > - context_run_bg passt "valgrind --max-stackframe=3D$((4 * = 1024 * 1024)) --trace-children=3Dyes --vgdb=3Dno --error-exitcode=3D1 --sup= pressions=3Dtest/valgrind.supp ./passt -f ${__opts} -s ${STATESETUP}/passt.= socket -t 10001,10011,10021,10031 -u 10001,10011,10021,10031 -P ${STATESETU= P}/passt.pid --map-host-loopback ${__map_ns4} --map-host-loopback ${__map_n= s6}" > > + context_run_bg passt "valgrind --max-stackframe=3D$((4 * = 1024 * 1024)) --trace-children=3Dyes --vgdb=3Dno --error-exitcode=3D1 --sup= pressions=3Dtest/valgrind.supp ./passt -f ${__opts} -s ${STATESETUP}/passt.= socket -H passt1 -t 10001,10011,10021,10031 -u 10001,10011,10021,10031 -P $= {STATESETUP}/passt.pid --map-host-loopback ${__map_ns4} --map-host-loopback= ${__map_ns6}" > > else > > context_run passt "make clean" > > context_run passt "make" > > - context_run_bg passt "./passt -f ${__opts} -s ${STATESETU= P}/passt.socket -t 10001,10011,10021,10031 -u 10001,10011,10021,10031 -P ${= STATESETUP}/passt.pid --map-host-loopback ${__map_ns4} --map-host-loopback = ${__map_ns6}" > > + context_run_bg passt "./passt -f ${__opts} -s ${STATESETU= P}/passt.socket -H passt1 -t 10001,10011,10021,10031 -u 10001,10011,10021,1= 0031 -P ${STATESETUP}/passt.pid --map-host-loopback ${__map_ns4} --map-host= -loopback ${__map_ns6}" > > fi > > wait_for [ -f "${STATESETUP}/passt.pid" ] > > > > @@ -215,7 +215,7 @@ setup_two_guests() { > > [ ${DEBUG} -eq 1 ] && __opts=3D"${__opts} -d" > > [ ${TRACE} -eq 1 ] && __opts=3D"${__opts} --trace" > > > > - context_run_bg passt_1 "./passt -s ${STATESETUP}/passt_1.socket -= P ${STATESETUP}/passt_1.pid -f ${__opts} -t 10001 -u 10001" > > + context_run_bg passt_1 "./passt -s ${STATESETUP}/passt_1.socket -= P ${STATESETUP}/passt_1.pid -f ${__opts} -H passt1 -t 10001 -u 10001" > > wait_for [ -f "${STATESETUP}/passt_1.pid" ] > > > > __opts=3D > > @@ -223,7 +223,7 @@ setup_two_guests() { > > [ ${DEBUG} -eq 1 ] && __opts=3D"${__opts} -d" > > [ ${TRACE} -eq 1 ] && __opts=3D"${__opts} --trace" > > > > - context_run_bg passt_2 "./passt -s ${STATESETUP}/passt_2.socket -= P ${STATESETUP}/passt_2.pid -f ${__opts} -t 10004 -u 10004" > > + context_run_bg passt_2 "./passt -s ${STATESETUP}/passt_2.socket -= P ${STATESETUP}/passt_2.pid -f ${__opts} --hostname passt2 -t 10004 -u 1000= 4" > > wait_for [ -f "${STATESETUP}/passt_2.pid" ] > > > > GUEST_1_CID=3D94557 > > diff --git a/test/passt.mbuto b/test/passt.mbuto > > index 138d365..bcd9041 100755 > > --- a/test/passt.mbuto > > +++ b/test/passt.mbuto > > @@ -55,6 +55,7 @@ set >> \$LOG > > [ -n "\${new_dhcp6_name_servers}" ] && for d in \${new_dhcp6_name_ser= vers}; do echo "nameserver \${d}%\${interface}" >> /etc/resolv.conf; done > > [ -n "\${new_dhcp6_domain_search}" ] && (printf "search"; for d in \${= new_dhcp6_domain_search}; do printf " %s" "\${d}"; done; printf "\n") >> /e= tc/resolv.conf > > [ -n "\${new_host_name}" ] && hostname "\${new_host_name}" > > +[ -n "\${new_fqdn_hostname}" ] && hostname "\${new_fqdn_hostname= }" > > exit 0 > > EOF > > chmod 755 /sbin/dhclient-script > > diff --git a/test/passt/dhcp b/test/passt/dhcp > > index 9925ab9..36535f2 100644 > > --- a/test/passt/dhcp > > +++ b/test/passt/dhcp > > @@ -11,7 +11,7 @@ > > # Copyright (c) 2021 Red Hat GmbH > > # Author: Stefano Brivio > > > > -gtools ip jq dhclient sed tr > > +gtools ip jq dhclient sed tr hostname > > htools ip jq sed tr head > > > > test Interface name > > @@ -47,7 +47,12 @@ gout SEARCH sed 's/\. / /g' /etc/resolv.conf |= sed 's/\.$//g' | sed -n 's/^searc > > hout HOST_SEARCH sed 's/\. / /g' /etc/resolv.conf | sed 's/\.$//g' | s= ed -n 's/^search \(.*\)/\1/p' | tr ' \n' ',' | sed 's/,$//;s/$/\n/' > > check [ "__SEARCH__" =3D "__HOST_SEARCH__" ] > > > > +test DHCP: Hostname > > +gout HOSTNAME hostname > > +check [ "__HOSTNAME__" =3D "passt1" ] > > + > > test DHCPv6: address > > +guest hostname none > > guest /sbin/dhclient -6 __IFNAME__ > > # Wait for DAD to complete > > guest while ip -j -6 addr show tentative | jq -e '.[].addr_info= '; do sleep 0.1; done > > @@ -70,3 +75,7 @@ test DHCPv6: search list > > gout SEARCH6 sed 's/\. / /g' /etc/resolv.conf | sed 's/\.$//g' | sed -= n 's/^search \(.*\)/\1/p' | tr ' \n' ',' | sed 's/,$//;s/$/\n/' > > hout HOST_SEARCH6 sed 's/\. / /g' /etc/resolv.conf | sed 's/\.$//g' | = sed -n 's/^search \(.*\)/\1/p' | tr ' \n' ',' | sed 's/,$//;s/$/\n/' > > check [ "__SEARCH6__" =3D "__HOST_SEARCH6__" ] > > + > > +test DHCPv6: Hostname > > +gout HOSTNAME hostname > > +check [ "__HOSTNAME__" =3D "passt1" ] > > The rest looks good to me. > > -- > Stefano > --=20 Quique Llorente CNV networking Senior Software Engineer Red Hat EMEA ellorent@redhat.com @RedHat Red Hat Red Hat