continue;
if (dhcp_getoverride(ifo, opt->option))
continue;
- if ((p = get_option(dhcp, opt->option, &pl)))
+ if ((p = get_option(dhcp, opt->option, &pl))) {
ep += dhcp_envoption(ep, prefix, ifp->name,
opt, dhcp_getoption, p, pl);
- /* Grab the Vendor-Identifying Vendor Options, RFC 3925 */
- if (opt->option == DHO_VIVSO && pl > (int)sizeof(uint32_t)) {
- memcpy(&en, p, sizeof(en));
- en = ntohl(en);
- vo = vivso_find(en, ifp);
- if (vo) {
- /* Skip over en + total size */
- p += sizeof(en) + 1;
- pl -= sizeof(en) + 1;
- ep += dhcp_envoption(ep, prefix, ifp->name,
- vo, dhcp_getoption, p, pl);
- printf ("%p\n", ep);
+ if (opt->option == DHO_VIVSO &&
+ pl > (int)sizeof(uint32_t))
+ {
+ memcpy(&en, p, sizeof(en));
+ en = ntohl(en);
+ vo = vivso_find(en, ifp);
+ if (vo) {
+ /* Skip over en + total size */
+ p += sizeof(en) + 1;
+ pl -= sizeof(en) + 1;
+ ep += dhcp_envoption(ep, prefix,
+ ifp->name,
+ vo, dhcp_getoption, p, pl);
+ }
}
}
}
return -1;
}
}
- ndop = NULL;
if (opt != O_EMBED) {
- for (dl = 0; dl < *dop_len; dl++) {
- ndop = &(*dop)[dl];
+ for (dl = 0, ndop = *dop; dl < *dop_len; dl++, ndop++)
+ {
/* type 0 seems freshly malloced struct
* for us to use */
if (ndop->option == u || ndop->type == 0)
break;
}
- }
+ if (dl == *dop_len)
+ ndop = NULL;
+ } else
+ ndop = NULL;
if (ndop == NULL) {
if ((ndop = realloc(*dop,
- sizeof(**dop) * ((*dop_len) + 1))) == NULL) {
+ sizeof(**dop) * ((*dop_len) + 1))) == NULL)
+ {
syslog(LOG_ERR, "%s: %m", __func__);
return -1;
}