summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/sd-dhcp-server.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-01-27 17:24:20 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-02-01 03:45:51 +0100
commit48be485b71a02066c0ee3665b98500563df4d0fd (patch)
tree23605e6f62c06efabd5b265aa8c9c5bc20d8b289 /src/libsystemd-network/sd-dhcp-server.c
parentsd-dhcp-server: do not use implicit cast to boolean from integer (diff)
downloadsystemd-48be485b71a02066c0ee3665b98500563df4d0fd.tar.xz
systemd-48be485b71a02066c0ee3665b98500563df4d0fd.zip
sd-dhcp-server: rename argument and add one missing assertion
Diffstat (limited to '')
-rw-r--r--src/libsystemd-network/sd-dhcp-server.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
index 7624e52858..cb1d06ce57 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -490,17 +490,22 @@ int dhcp_server_send_packet(sd_dhcp_server *server,
destination, destination_port, packet, optoffset, l2_broadcast);
}
-static int server_message_init(sd_dhcp_server *server, DHCPPacket **ret,
- uint8_t type, size_t *_optoffset,
- DHCPRequest *req) {
+static int server_message_init(
+ sd_dhcp_server *server,
+ DHCPPacket **ret,
+ uint8_t type,
+ size_t *ret_optoffset,
+ DHCPRequest *req) {
+
_cleanup_free_ DHCPPacket *packet = NULL;
size_t optoffset = 0;
int r;
assert(server);
assert(ret);
- assert(_optoffset);
+ assert(ret_optoffset);
assert(IN_SET(type, DHCP_OFFER, DHCP_ACK, DHCP_NAK));
+ assert(req);
packet = malloc0(sizeof(DHCPPacket) + req->max_optlen);
if (!packet)
@@ -516,7 +521,7 @@ static int server_message_init(sd_dhcp_server *server, DHCPPacket **ret,
packet->dhcp.flags = req->message->flags;
packet->dhcp.giaddr = req->message->giaddr;
- *_optoffset = optoffset;
+ *ret_optoffset = optoffset;
*ret = TAKE_PTR(packet);
return 0;