From: Florian Obser Subject: dhcpleased(8): ignore wrong client id To: tech Date: Wed, 07 May 2025 20:27:37 +0200 Accept wrong client identifiers echoed back to us. Apparently there are broken CPEs out there that do not return the client identifier to us. Android and iPhone do not care, which pretty much means we cannot care either. RFC 6842 has this: If the 'client identifier' option is present in a message received from a client, the server MUST return the 'client identifier' option, unaltered, in its response message. Reported by mpi some time ago. I finally got around to setup a test environment, mpi no longer had access to the cpe in question. OK? diff --git engine.c engine.c index a2a5fdc859e..95121340c6c 100644 --- engine.c +++ engine.c @@ -1100,19 +1100,19 @@ parse_dhcp(struct dhcpleased_iface *iface, struct imsg_dhcp *dhcp) rem -= dho_len; break; case DHO_DHCP_CLIENT_IDENTIFIER: - /* the server is supposed to echo this back to us */ + /* + * The server is supposed to echo this back to us + * (RFC6841), but of course they don't. + */ #ifndef SMALL if (iface_conf != NULL && iface_conf->c_id_len > 0) { if (dho_len != iface_conf->c_id[1]) { log_warnx("wrong " "DHO_DHCP_CLIENT_IDENTIFIER"); - return; - } - if (memcmp(p, &iface_conf->c_id[2], dho_len) != - 0) { + } else if (memcmp(p, &iface_conf->c_id[2], + dho_len) != 0) { log_warnx("wrong " "DHO_DHCP_CLIENT_IDENTIFIER"); - return; } } else #endif /* SMALL */ @@ -1122,13 +1122,11 @@ parse_dhcp(struct dhcpleased_iface *iface, struct imsg_dhcp *dhcp) if (*p != HTYPE_ETHER) { log_warnx("DHO_DHCP_CLIENT_IDENTIFIER: " "wrong type"); - return; } if (memcmp(p + 1, &iface->hw_address, sizeof(iface->hw_address)) != 0) { log_warnx("wrong " "DHO_DHCP_CLIENT_IDENTIFIER"); - return; } } p += dho_len; -- In my defence, I have been left unsupervised.