]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-dhcp-server: change the type of the client ID data
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 22 Jan 2022 17:47:32 +0000 (02:47 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 23 Jan 2022 19:18:20 +0000 (04:18 +0900)
src/libsystemd-network/dhcp-server-internal.h
src/libsystemd-network/sd-dhcp-server.c

index 13d8cd77b44ebd005c1d41859e0d31bb90ef5fcf..0193ab9503acfbb04fd60997ddd03b0cd3987a08 100644 (file)
@@ -26,7 +26,7 @@ typedef enum DHCPRawOption {
 
 typedef struct DHCPClientId {
         size_t length;
-        void *data;
+        uint8_t *data;
 } DHCPClientId;
 
 typedef struct DHCPLease {
index 45d5a9e59ca6a967e26b50ebbf780702f549787f..f00a1754e2baaaad95a220fb55e53dfbf0565653 100644 (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;