-.\" $OpenBSD: dhcpleased.conf.5,v 1.5 2021/08/12 12:41:08 florian Exp $
+.\" $OpenBSD: dhcpleased.conf.5,v 1.6 2021/09/20 11:46:22 florian Exp $
.\"
.\" Copyright (c) 2018, 2021 Florian Obser <florian@openbsd.org>
.\" Copyright (c) 2005 Esben Norby <norby@openbsd.org>
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: August 12 2021 $
+.Dd $Mdocdate: September 20 2021 $
.Dt DHCPLEASED.CONF 5
.Os
.Sh NAME
.Pp
Otherwise the string
.Ar client-id
-is sent verbatim with type zero.
+is sent verbatim.
The default is to send the interface's MAC address as client identifier.
.It Ic send vendor class id Ar vendor-class-id
Send the dhcp vendor class identifier option with a value of
-/* $OpenBSD: parse.y,v 1.3 2021/08/12 12:41:08 florian Exp $ */
+/* $OpenBSD: parse.y,v 1.4 2021/09/20 11:46:22 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
yyerror("client-id too long");
YYERROR;
}
- iface_conf->c_id_len = 3 + strlen(buf);
+ iface_conf->c_id_len = 2 + len;
iface_conf->c_id = malloc(iface_conf->c_id_len);
if (iface_conf->c_id == NULL) {
yyerror("malloc");
YYERROR;
}
- iface_conf->c_id[2] = HTYPE_NONE;
- memcpy(&iface_conf->c_id[3], buf,
- iface_conf->c_id_len - 3);
+ memcpy(&iface_conf->c_id[2], buf,
+ iface_conf->c_id_len - 2);
} else {
free($4);
iface_conf->c_id_len = 2 + i;
-/* $OpenBSD: printconf.c,v 1.2 2021/08/12 12:41:08 florian Exp $ */
+/* $OpenBSD: printconf.c,v 1.3 2021/09/20 11:46:22 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
{
static char buf[4 * 1500 + 1];
int rem, i;
- uint8_t dho, dho_len, type;
+ uint8_t dho, dho_len;
rem = len;
case DHO_DHCP_CLIENT_IDENTIFIER:
if (dho_len < 1)
fatal("dhcp option too short");
- type = *p;
- p += 1;
- rem -= 1;
- switch (type) {
- case HTYPE_NONE:
- strvisx(buf, p, dho_len - 1, VIS_DQ |
- VIS_CSTYLE);
- printf("%ssend client id \"%s\"\n",
- indent, buf);
+ switch (*p) {
+ case HTYPE_ETHER:
+ printf("%ssend client id \"", indent);
+ for (i = 0; i < dho_len; i++)
+ printf("%s%02x", i != 0? ":" : "",
+ *(p + i));
+ printf("\"\n");
break;
default:
- printf("%ssend client id \"%02x",
- indent, type);
-
- for (i = 0; i < dho_len - 1; i++) {
- printf(":%02x", *(p + i));
- }
- printf("\"\n");
+ strvisx(buf, p, dho_len, VIS_DQ | VIS_CSTYLE);
+ printf("%ssend client id \"%s\"\n",
+ indent, buf);
break;
}
- p += dho_len - 1;
- rem -= dho_len - 1;
+ p += dho_len;
+ rem -= dho_len;
break;
default:
fatal("unknown dhcp option: %d [%d]", *p, rem);