sd-dhcp6: coding style cleanups

This commit is contained in:
Yu Watanabe
2018-10-19 06:11:58 +09:00
parent 91c43f3978
commit da07cf3582
+10 -7
View File
@@ -829,10 +829,11 @@ static int client_parse_message(
DHCP6Message *message,
size_t len,
sd_dhcp6_lease *lease) {
uint32_t lt_t1 = ~0, lt_t2 = ~0;
bool clientid = false;
size_t pos = 0;
int r;
bool clientid = false;
uint32_t lt_t1 = ~0, lt_t2 = ~0;
assert(client);
assert(message);
@@ -842,20 +843,22 @@ static int client_parse_message(
len -= sizeof(DHCP6Message);
while (pos < len) {
DHCP6Option *option = (DHCP6Option *)&message->options[pos];
DHCP6Option *option = (DHCP6Option *) &message->options[pos];
uint16_t optcode, optlen;
int status;
uint8_t *optval;
be32_t iaid_lease;
uint8_t *optval;
int status;
if (len < pos + offsetof(DHCP6Option, data) ||
len < pos + offsetof(DHCP6Option, data) + be16toh(option->len))
if (len < pos + offsetof(DHCP6Option, data))
return -ENOBUFS;
optcode = be16toh(option->code);
optlen = be16toh(option->len);
optval = option->data;
if (len < pos + offsetof(DHCP6Option, data) + optlen)
return -ENOBUFS;
switch (optcode) {
case SD_DHCP6_OPTION_CLIENTID:
if (clientid) {