sd-dhcp-server: change the type of the client ID data

This commit is contained in:
Yu Watanabe
2022-01-24 04:18:20 +09:00
parent 255d493324
commit 2cb66bbdfb
2 changed files with 5 additions and 5 deletions
@@ -26,7 +26,7 @@ typedef enum DHCPRawOption {
typedef struct DHCPClientId {
size_t length;
void *data;
uint8_t *data;
} DHCPClientId;
typedef struct DHCPLease {
+4 -4
View File
@@ -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;