opt_hdr
visbuf = calloc(4, opt_hdr.len - 2 + 1);
strvisx(visbuf, p + 2, opt_hdr.len - 2, VIS_SAFE);
log_debug("unhandled option: %u", opt_hdr.code);
p += opt_hdr.len;
len -= opt_hdr.len;
struct dhcp_option_hdr opt_hdr;
memcpy(&opt_hdr, p, sizeof(struct dhcp_option_hdr));
opt_hdr.code = ntohs(opt_hdr.code);
opt_hdr.len = ntohs(opt_hdr.len);
dhcp_option_type2str(opt_hdr.code), opt_hdr.len);
if (rem < opt_hdr.len) {
switch (opt_hdr.code) {
if (opt_hdr.len != sizeof(struct dhcp_duid) ||
if (opt_hdr.len < 2 + 1) {
if (opt_hdr.len > SERVERID_SIZE) {
dhcp_duid2str(opt_hdr.len, p));
serverid_len = opt_hdr.len;
if (opt_hdr.len < sizeof(struct dhcp_iapd)) {
sizeof(struct dhcp_iapd), opt_hdr.len -
if (opt_hdr.len != 0) {
log_debug("unhandled option: %u", opt_hdr.code);
p += opt_hdr.len;
rem -= opt_hdr.len;
struct dhcp_option_hdr opt_hdr;
memcpy(&opt_hdr, p, sizeof(struct dhcp_option_hdr));
opt_hdr.code = ntohs(opt_hdr.code);
opt_hdr.len = ntohs(opt_hdr.len);
dhcp_option_type2str(opt_hdr.code), opt_hdr.len);
if (len < opt_hdr.len) {
switch (opt_hdr.code) {
struct dhcp_option_hdr opt_hdr;
opt_hdr.code = htons(DHO_CLIENTID);
opt_hdr.len = htons(sizeof(struct dhcp_duid));
memcpy(p, &opt_hdr, sizeof(struct dhcp_option_hdr));
opt_hdr.code = htons(DHO_SERVERID);
opt_hdr.len = htons(iface->serverid_len);
memcpy(p, &opt_hdr, sizeof(struct dhcp_option_hdr));
opt_hdr.code = htons(DHO_IA_PD);
opt_hdr.len = htons(sizeof(struct dhcp_iapd) +
memcpy(p, &opt_hdr, sizeof(struct dhcp_option_hdr));
opt_hdr.code = htons(DHO_IA_PREFIX);
opt_hdr.len = htons(sizeof(struct dhcp_iaprefix));
memcpy(p, &opt_hdr, sizeof(struct dhcp_option_hdr));
opt_hdr.code = htons(DHO_ORO);
opt_hdr.len = htons(sizeof(request_option_code) * nitems(options));
memcpy(p, &opt_hdr, sizeof(struct dhcp_option_hdr));
opt_hdr.code = htons(DHO_ELAPSED_TIME);
opt_hdr.len = htons(2);
memcpy(p, &opt_hdr, sizeof(struct dhcp_option_hdr));
opt_hdr.code = htons(DHO_RAPID_COMMIT);
opt_hdr.len = htons(0);
memcpy(p, &opt_hdr, sizeof(struct dhcp_option_hdr));
opt_hdr.code = htons(DHO_VENDOR_CLASS);
opt_hdr.len = htons(sizeof(struct dhcp_vendor_class) +
memcpy(p, &opt_hdr, sizeof(struct dhcp_option_hdr));
if (!opt_hdr(optarg, &hdr))