static int test_advertise_option(sd_event *e) {
_cleanup_dhcp6_lease_free_ sd_dhcp6_lease *lease = NULL;
DHCP6Message *advertise = (DHCP6Message *)msg_advertise;
- uint8_t *optval, *opt = &msg_advertise[sizeof(DHCP6Message)];
+ uint8_t *optval, *opt = msg_advertise + sizeof(DHCP6Message);
uint16_t optcode;
size_t optlen, len = sizeof(msg_advertise) - sizeof(DHCP6Message);
be32_t val;
*optval) >= 0);
break;
+ case DHCP6_OPTION_ELAPSED_TIME:
+ assert_se(optlen == 2);
+
+ break;
+
default:
break;
}
uint8_t *optval;
uint16_t optcode;
size_t optlen;
- bool found_clientid = false, found_iana = false, found_serverid = false;
+ bool found_clientid = false, found_iana = false, found_serverid = false,
+ found_elapsed_time = false;
int r;
struct in6_addr addr;
be32_t val;
assert_se(optlen == 14);
assert_se(!memcmp(&msg_advertise[179], optval, optlen));
+ break;
+
+ case DHCP6_OPTION_ELAPSED_TIME:
+ assert_se(!found_elapsed_time);
+ found_elapsed_time = true;
+
+ assert_se(optlen == 2);
+
break;
}
}
assert_se(r == -ENOMSG);
- assert_se(found_clientid && found_iana && found_serverid);
+ assert_se(found_clientid && found_iana && found_serverid &&
+ found_elapsed_time);
assert_se(sd_dhcp6_lease_get_first_address(lease, &addr, <_pref,
<_valid) >= 0);
uint8_t *optval;
uint16_t optcode;
size_t optlen;
- bool found_clientid = false, found_iana = false;
+ bool found_clientid = false, found_iana = false,
+ found_elapsed_time = false;
int r;
assert_se(solicit->type == DHCP6_SOLICIT);
memcpy(&test_iaid, optval, sizeof(test_iaid));
+ break;
+
+ case DHCP6_OPTION_ELAPSED_TIME:
+ assert_se(!found_elapsed_time);
+ found_elapsed_time = true;
+
+ assert_se(optlen == 2);
+
break;
}
}
assert_se(r == -ENOMSG);
- assert_se(found_clientid && found_iana);
+ assert_se(found_clientid && found_iana && found_elapsed_time);
return 0;
}