From: Yu Watanabe Date: Sat, 22 Jan 2022 17:47:32 +0000 (+0900) Subject: sd-dhcp-server: change the type of the client ID data X-Git-Tag: v251-rc1~471^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2cb66bbdfb30d58e9b0c960db0b714960685c774;p=thirdparty%2Fsystemd.git sd-dhcp-server: change the type of the client ID data --- diff --git a/src/libsystemd-network/dhcp-server-internal.h b/src/libsystemd-network/dhcp-server-internal.h index 13d8cd77b44..0193ab9503a 100644 --- a/src/libsystemd-network/dhcp-server-internal.h +++ b/src/libsystemd-network/dhcp-server-internal.h @@ -26,7 +26,7 @@ typedef enum DHCPRawOption { typedef struct DHCPClientId { size_t length; - void *data; + uint8_t *data; } DHCPClientId; typedef struct DHCPLease { diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index 45d5a9e59ca..f00a1754e2b 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -706,14 +706,14 @@ static int ensure_sane_request(sd_dhcp_server *server, DHCPRequest *req, DHCPMes /* set client id based on MAC address if client did not send an explicit one */ if (!req->client_id.data) { - void *data; + uint8_t *data; - data = malloc0(ETH_ALEN + 1); + data = new0(uint8_t, ETH_ALEN + 1); if (!data) return -ENOMEM; - ((uint8_t*) data)[0] = 0x01; - memcpy((uint8_t*) data + 1, &message->chaddr, ETH_ALEN); + data[0] = 0x01; + memcpy(data + 1, message->chaddr, ETH_ALEN); req->client_id.length = ETH_ALEN + 1; req->client_id.data = data;