29 #define DHCP_OPTION_DATA 36 static int pretty_text(
char **,
char *,
const unsigned char **,
37 const unsigned char *,
int);
38 static int pretty_domain(
char **,
char *,
const unsigned char **,
39 const unsigned char *);
41 unsigned char *
buffer,
unsigned length,
42 unsigned code,
int terminatep,
54 packet -> options_valid = 0;
61 &packet -> raw -> options [4],
62 (packet -> packet_length -
96 (
unsigned char *)packet -> raw ->
file,
97 sizeof packet -> raw ->
file,
104 (
unsigned char *)packet -> raw -> sname,
105 sizeof packet -> raw -> sname,
110 packet -> options_valid = 1;
119 const
unsigned char *
buffer;
123 unsigned len, offset;
126 struct buffer *bp = (
struct buffer *)0;
128 char *reason =
"general failure";
131 log_error (
"no memory for option buffer.");
134 memcpy (bp -> data, buffer, length);
137 (offset + universe->
tag_size) <= length &&
138 (code = universe->
get_tag(buffer + offset)) != universe->
end; ) {
147 reason =
"code tag at end of buffer - missing " 164 log_fatal(
"Improperly configured option space(%s): " 165 "may not have a nonzero length size " 166 "AND a NULL get_length function.",
175 option_code_hash_lookup(&option, universe->
code_hash, &code,
179 if (offset + len > length) {
180 reason =
"option length exceeds option buffer length";
182 log_error(
"parse_option_buffer: malformed option " 183 "%s.%s (code %u): %s.", universe->
name,
184 option ? option->
name :
"<unknown>",
195 (option->
format[0] ==
'e' ||
196 option->
format[0] ==
'E') &&
198 bp->
data + offset, len,
204 memset(&
new, 0,
sizeof new);
214 memcpy(
new.buffer->data, op->
data.
data,
217 memcpy(
new.buffer->data + op->
data.
len,
218 bp->
data + offset, len);
220 new.data =
new.buffer->data;
225 }
else if (op != NULL) {
229 while (op->
next != NULL)
241 nop->data.buffer = NULL;
243 nop->data.data = bp->
data + offset;
250 bp->
data + offset, len,
253 "save_option_buffer failed");
278 s = strchr (eopt -> format,
'E');
280 log_error (
"internal encapsulation format error 1.");
284 t = strchr (++s,
'.');
288 log_error (
"internal encapsulation format error 2.");
291 if (t == s && uname) {
302 s, (
unsigned)(t - s))) {
318 const unsigned char *
buffer,
336 i = (*universe ->
decode) (options, buffer, len, universe);
339 if (eopt -> format [0] !=
'E')
346 const unsigned char *
buffer,
347 unsigned length,
struct universe *u)
349 struct buffer *bp = (
struct buffer *)0;
357 log_error (
"no memory for option buffer.");
360 memcpy (&bp ->
data [3], buffer + 1, length - 1);
389 if (!bp ->
data [0]) {
393 if (buffer [length - 1] == 0) {
401 for (i = 3; i < length && buffer [i] !=
'.'; i++);
412 if (length > 4 + i &&
414 &bp ->
data[6 + i], length - 4 - i,
420 &bp ->
data [5], length - 3,
426 unsigned total_len = 0;
427 unsigned first_len = 0;
433 while (s < &bp ->
data[0] + length + 2) {
436 log_info (
"fancy bits in fqdn option");
443 if (s + len > &bp ->
data [0] + length + 3) {
444 log_info (
"fqdn tag longer than buffer");
448 if (first_len == 0) {
454 total_len += len + 1;
465 first_len = total_len;
470 &bp ->
data[6], first_len,
473 if (total_len > 0 && first_len != total_len) {
475 &bp->
data[6 + first_len],
476 total_len - first_len,
482 &bp ->
data [6], total_len,
522 int overload_avail,
int terminate,
int bootpp,
525 #define PRIORITY_COUNT 300 528 unsigned char buffer[4096], agentopts[1024];
530 unsigned mb_size = 0, mb_max = 0;
531 unsigned option_size = 0, agent_size = 0;
537 int overload_used = 0;
538 int of1 = 0, of2 = 0;
540 memset(&ds, 0,
sizeof ds);
553 client_state, in_options,
554 cfg_options, scope, op,
MDL) != 0)) {
555 if (ds.
len >= sizeof (u_int16_t)) {
557 if(!mms || (i < mms))
589 if (inpacket != NULL &&
601 if (client_state == NULL) {
606 inpacket, lease, client_state,
607 in_options, cfg_options, scope,
608 priority_list, priority_len,
611 mb_size += agent_size;
620 if (mb_size > agent_size)
621 mb_max = mb_size - agent_size;
625 if (overload_avail & 1) {
630 if (overload_avail & 2) {
651 if (prl != NULL && prl->
len > 0) {
655 priority_list[priority_len++] =
664 priority_list[priority_len++] =
674 for (i = 0; i < prl->
len; i++) {
680 priority_list[priority_len++] = prl->
data[i];
692 priority_list[priority_len++] =
DHO_FQDN;
723 priority_list[priority_len++] =
DHO_FQDN;
738 for (pp = hash[i]; pp; pp = pp->cdr) {
744 priority_list[priority_len++] =
759 for (pp = hash[i]; pp; pp = pp->cdr) {
765 priority_list[priority_len++] =
780 priority_list[priority_len++] =
790 priority_list[priority_len++] =
799 option_size =
store_options(&overload_used, buffer, index, mb_max,
800 inpacket, lease, client_state,
801 in_options, cfg_options, scope,
802 priority_list, priority_len,
803 of1, of2, terminate, vuname);
806 if (option_size == 0)
810 index += option_size;
817 if (mb_size - agent_size - index < 3)
822 buffer[index++] = overload_used;
824 if (overload_used & 1)
827 if (overload_used & 2)
833 if (mb_size - index >= agent_size) {
834 memcpy(&buffer[index], agentopts, agent_size);
837 log_error(
"Unable to store relay agent information " 846 memcpy(outpacket->
options, buffer, index);
871 struct lease *dummy_lease,
877 void *void_vsio_state) {
882 memset(&ds, 0,
sizeof(ds));
884 NULL, opt_state, NULL,
890 }
else if (universe->
tag_size == 2) {
894 }
else if (universe->
tag_size == 4) {
913 log_debug(
"No space for option %d in VSIO space %s.",
918 log_error(
"Error evaluating option %d in VSIO space %s.",
934 const int *required_opts,
943 int in_required_opts;
944 int vsio_option_code;
955 vsio_option_code = 0;
959 vsio_option_code = o->
code;
964 if (vsio_option_code == 0) {
968 if (required_opts != NULL) {
969 for (i=0; required_opts[i] != 0; i++) {
970 if (required_opts[i] == vsio_option_code) {
975 opt_state, required_opts[i]);
979 memset(&ds, 0,
sizeof(ds));
980 for (; oc != NULL ; oc = oc->
next) {
987 tmp = (
unsigned char *)buf;
995 memcpy(tmp+4, ds.
data, ds.
len);
997 bufpos += (4 + ds.
len);
1015 oro_size = oro->
len / 2;
1017 for (i=0; i<oro_size; i++) {
1018 memcpy(&code, oro->
data+(i*2), 2);
1025 in_required_opts = 0;
1026 if (required_opts != NULL) {
1027 for (j=0; required_opts[j] != 0; j++) {
1028 if (required_opts[j] == code) {
1029 in_required_opts = 1;
1034 if (in_required_opts) {
1041 if (code == vsio_option_code) {
1049 memset(&ds, 0,
sizeof(ds));
1050 for (; oc != NULL ; oc = oc->
next) {
1054 if ((ds.
len + 4) <= (buflen - bufpos)) {
1055 tmp = (
unsigned char *)buf + bufpos;
1061 memcpy(tmp+4, ds.
data, ds.
len);
1063 bufpos += (4 + ds.
len);
1070 log_error(
"Error evaluating option %d", code);
1099 if (vs.
bufpos > bufpos+8) {
1100 tmp = (
unsigned char *)buf +
1124 unsigned char *
buffer,
unsigned index,
unsigned buflen,
1130 unsigned *priority_list,
int priority_len,
1131 unsigned first_cutoff,
int second_cutoff,
int terminate,
1134 int bufix = 0, six = 0, tix = 0;
1138 int bufend, sbufend;
1149 buffer = &buffer[index];
1152 first_cutoff -= index;
1154 second_cutoff -= index;
1157 bufend = sbufend =
buflen;
1159 if (first_cutoff >= buflen)
1160 log_fatal(
"%s:%d:store_options: Invalid first cutoff.",
MDL);
1161 bufend = first_cutoff;
1163 if (second_cutoff) {
1164 if (second_cutoff >= buflen)
1165 log_fatal(
"%s:%d:store_options: Invalid second cutoff.",
1167 sbufend = second_cutoff;
1169 }
else if (second_cutoff) {
1170 if (second_cutoff >= buflen)
1171 log_fatal(
"%s:%d:store_options: Invalid second cutoff.",
MDL);
1172 bufend = second_cutoff;
1175 memset (&od, 0,
sizeof od);
1180 for (i = 0; i < priority_len; i++) {
1183 for (ix = i + 1; ix < priority_len + tto; ix++) {
1185 priority_list [ix - tto] =
1187 if (priority_list [i] == priority_list [ix]) {
1205 for (ix = i - 1 ; ix >= 0 ; ix--) {
1218 for (i = 0; i < priority_len; i++) {
1222 int optstart, soptstart, toptstart;
1224 int have_encapsulation = 0;
1228 memset (&encapsulation, 0,
sizeof encapsulation);
1229 have_encapsulation = 0;
1235 code = priority_list [i];
1239 if (code >= cfg_options -> site_code_min)
1240 u =
universes [cfg_options -> site_universe];
1249 option_code_hash_lookup(&option, u->
code_hash, &code, 0,
MDL);
1259 if ((option != NULL) &&
1260 (((oc == NULL) && (option->
format[0] ==
'E')) ||
1261 ((oc != NULL) && (option->
format[0] ==
'e')))) {
1266 s = strchr (option->
format,
'E');
1268 t = strchr (++s,
'.');
1270 memset (&name, 0,
sizeof name);
1275 if (vendor_cfg_option) {
1278 vendor_cfg_option -> code);
1286 }
else if (vuname) {
1287 name.
data = (
unsigned char *)s;
1288 name.
len = strlen (s);
1291 name.
data = (
unsigned char *)s;
1298 have_encapsulation =
1300 (&encapsulation, packet, lease, client_state,
1301 in_options, cfg_options, scope, &name));
1316 if (!oc && !have_encapsulation) {
1325 lease, client_state, in_options,
1326 cfg_options, scope, oc,
MDL);
1345 if (have_encapsulation) {
1346 length += encapsulation.
len;
1356 struct buffer *bp = (
struct buffer *)0;
1401 unsigned incr = length;
1403 unsigned char *base;
1407 ((!six && !tix && (i == priority_len - 1) &&
1408 (bufix + 2 + length < bufend)) ||
1409 (bufix + 5 + length < bufend))) {
1413 }
else if (!splitup && first_cutoff &&
1414 (first_cutoff + six + 3 + length < sbufend)) {
1415 base = &buffer[first_cutoff];
1418 }
else if (!splitup && second_cutoff &&
1419 (second_cutoff + tix + 3 + length < buflen)) {
1420 base = &buffer[second_cutoff];
1427 if (bufix + 6 < bufend) {
1428 incr = bufend - bufix - 5;
1432 }
else if (first_cutoff &&
1433 (first_cutoff + six + 4 < sbufend)) {
1434 incr = sbufend - (first_cutoff + six) - 3;
1435 base = &buffer[first_cutoff];
1438 }
else if (second_cutoff &&
1439 (second_cutoff + tix + 4 < buflen)) {
1440 incr = buflen - (second_cutoff + tix) - 3;
1441 base = &buffer[second_cutoff];
1459 base [*pix + 1] = (
unsigned char)incr;
1460 if (tto && incr == length) {
1462 memcpy (base + *pix + 2,
1463 od.
data + ix, (
unsigned)(incr - 1));
1464 base [*pix + 2 + incr - 1] = 0;
1466 memcpy (base + *pix + 2,
1467 od.
data + ix, (
unsigned)incr);
1480 if (first_cutoff && six) {
1481 if ((first_cutoff + six + 1) < sbufend)
1482 memset (&buffer[first_cutoff + six + 1],
DHO_PAD,
1483 sbufend - (first_cutoff + six + 1));
1484 else if (first_cutoff + six >= sbufend)
1485 log_fatal(
"Second buffer overflow in overloaded options.");
1487 buffer[first_cutoff + six] =
DHO_END;
1492 if (second_cutoff && tix) {
1493 if (second_cutoff + tix + 1 < buflen) {
1494 memset (&buffer[second_cutoff + tix + 1],
DHO_PAD,
1495 buflen - (second_cutoff + tix + 1));
1496 }
else if (second_cutoff + tix >= buflen)
1497 log_fatal(
"Third buffer overflow in overloaded options.");
1499 buffer[second_cutoff + tix] =
DHO_END;
1504 if ((six || tix) && (bufix + 3 > bufend))
1505 log_fatal(
"Not enough space for option overload option.");
1521 while (*p !=
'\0') {
1545 log_error(
"format_has_text(%s): 'c' atoms are illegal " 1546 "except after 'D' atoms.", format);
1558 while ((*p !=
'\0') && (*p++ !=
'.'))
1581 const char *p, *name;
1587 while (*p !=
'\0') {
1613 log_fatal(
"Corrupt format: %s", format);
1616 if (espace == NULL) {
1617 log_error(
"Unknown enumeration: %s", format);
1622 min_len += espace->
width;
1623 last_size = espace->
width;
1637 min_len -= last_size;
1658 log_error(
"format_min_length(%s): 'c' atom is illegal " 1659 "except after 'D' atom.", format);
1664 log_error(
"format_min_length(%s): No safe value " 1665 "for unknown format symbols.", format);
1678 const
unsigned char *data;
1683 static char optbuf [32768];
1684 static char *endbuf = &optbuf[
sizeof(optbuf)];
1692 char fmtbuf[32] =
"";
1696 const unsigned char *dp = data;
1699 isc_boolean_t a_array = ISC_FALSE;
1701 unsigned int octets = 0;
1708 memset (enumbuf, 0,
sizeof enumbuf);
1710 if (option->format[0] !=
'R') {
1712 for (l = i = 0; option -> format [i]; i++, l++) {
1713 if (l >=
sizeof(fmtbuf) - 1)
1714 log_fatal(
"Bounds failure on internal buffer at " 1718 log_error (
"%s: Extra codes in format string: %s",
1720 &(option -> format [i]));
1724 fmtbuf [l] = option -> format [i];
1725 switch (option -> format [i]) {
1736 while (option -> format [i] &&
1737 option -> format [i] !=
'.')
1741 for (k = 0; k < len; k++) {
1742 if (!isascii (data [k]) ||
1743 !isprint (data [k]))
1749 if (k == len || (k + 1 == len && data [k] == 0)) {
1764 log_error(
"'c' atom not following D atom in format " 1765 "string: %s", option->format);
1773 if (option->format[i+1] ==
'c')
1787 while (option -> format [i] &&
1788 option -> format [i] !=
'.')
1793 if (enumbuf[l] == NULL) {
1797 hunksize += enumbuf[l]->
width;
1798 hunkinc = enumbuf[l]->
width;
1831 log_error (
"%s: garbage in format string: %s",
1833 &(option -> format [i]));
1839 if (hunksize - opthunk > len) {
1840 log_error (
"%s: expecting at least %d bytes; got %d",
1846 if (numhunk == -1 && hunksize < len)
1853 if (a_array == ISC_TRUE) {
1865 log_error (
"%s: invalid 'a' format: %s",
1866 option->name, option->format);
1870 numhunk = ((len - hunksize) / hunkinc) + 1;
1871 len_used = hunksize + ((numhunk - 1) * hunkinc);
1880 if (hunksize == 0) {
1881 log_error (
"%s: invalid 'A' format: %s",
1882 option->name, option->format);
1886 numhunk = len / hunksize;
1887 len_used = numhunk * hunksize;
1891 if (len_used < len) {
1892 log_error (
"%s: %d extra bytes at end of array\n",
1915 fmtbuf[0]=
'R'; fmtbuf[1]=
'I'; fmtbuf[2]=0;
1916 for (i =0; i < len; i = i + octets + 5) {
1918 log_error (
"wrong subnet mask width in destination descriptor");
1922 octets = ((data[i]+7) / 8);
1925 log_error (
"classless static routes option has wrong size or " 1926 "there's some garbage in format");
1931 for (i = 0; i < numhunk; i++) {
1932 if ((a_array == ISC_TRUE) && (i != 0) && (numelem > 0)) {
1949 for (; j < numelem; j++) {
1950 switch (fmtbuf [j]) {
1953 k = pretty_text(&op, endbuf - 1, &dp,
1954 data + len, emit_quotes);
1962 for( ; dp < (data + len) ; dp += k) {
1964 const unsigned char *nbp, *nend;
1966 nend = &nbuff[
sizeof(nbuff)];
1976 if (op + 2 > endbuf)
2005 pretty_domain(&op, endbuf-1,
2045 switch (enumbuf[j]->
width) {
2061 return "<double impossible condition>";
2067 if (enumbuf [j] ->
values [i].value ==
2072 dp += enumbuf[j]->
width;
2076 sprintf(op,
"%lu", tval);
2081 memcpy(iaddr.
iabuf, dp, 4);
2082 strcpy(op,
piaddr(iaddr));
2088 iaddr.
len = (((dp[0]+7)/8)+1);
2090 log_error (
"wrong subnet mask width in destination descriptor");
2094 memcpy(iaddr.
iabuf, dp, iaddr.
len);
2101 memcpy(iaddr.
iabuf, dp, 16);
2102 strcpy(op,
piaddr(iaddr));
2106 sprintf (op,
"%ld", (
long)
getLong (dp));
2112 sprintf (op,
"%s",
"infinite");
2114 sprintf(op,
"%lu", tval);
2122 sprintf (op,
"%d", (
int)
getShort (dp));
2126 sprintf(op,
"%u", (
unsigned)
getUShort(dp));
2130 sprintf (op,
"%d", *(
const char *)dp++);
2133 sprintf (op,
"%d", *dp++);
2137 sprintf (op,
"%x", *dp++);
2140 strcpy (op, *dp++ ?
"true" :
"false");
2143 strcpy (op,
"true");
2154 if (dp == data + len)
2156 if (j + 1 < numelem && comma !=
':')
2159 if (i + 1 < numhunk) {
2162 if (dp == data + len)
2169 in_options, cfg_options, options, scope, code,
file,
line)
2185 if (!universe -> lookup_func)
2187 oc = ((*universe -> lookup_func) (universe, options, code));
2191 in_options, cfg_options, scope, oc,
2204 in_options, cfg_options, options, scope, code,
file,
line)
2223 if ((options == NULL) || (universe->
lookup_func == NULL))
2227 oc = ((*universe->
lookup_func)(universe, options, code));
2232 memset(&d1, 0,
sizeof(d1));
2234 in_options, cfg_options, scope, oc,
2240 *result = d1.
data[0];
2252 enum statement_op op;
2259 case eval_statement:
2260 case break_statement:
2262 log_error (
"bogus statement type in set_option.");
2265 case default_option_statement:
2267 option -> option -> code);
2273 case supersede_option_statement:
2274 case send_option_statement:
2279 case append_option_statement:
2280 case prepend_option_statement:
2282 option -> option -> code);
2290 log_error (
"Can't allocate const expression.");
2302 if (op == append_option_statement) {
2323 switch (((memcmp(option->
option->
format,
"Dc", 2) == 0) +
2329 log_error (
"Both options must be Dc format");
2355 if (universe -> lookup_func)
2356 return (*universe -> lookup_func) (universe, options, code);
2358 log_error (
"can't look up options in %s space.",
2374 !(options ->
universes [universe -> index]))
2377 hash = options ->
universes [universe -> index];
2380 for (bptr = hash [hashix]; bptr; bptr = bptr -> cdr) {
2391 struct buffer *bp,
unsigned char *
buffer,
unsigned length,
2392 unsigned code,
int terminatep)
2397 status = prepare_option_buffer(universe, bp, buffer, length, code,
2415 struct buffer *bp,
unsigned char *
buffer,
unsigned length,
2416 unsigned code,
int terminatep)
2421 status = prepare_option_buffer(universe, bp, buffer, length, code,
2439 unsigned char *
buffer,
unsigned length,
unsigned code,
2442 struct buffer *lbp = NULL;
2458 if (code > 0xffffffff)
2463 log_fatal(
"Inconsistent universe tag size at %s:%d.",
MDL);
2466 option_code_hash_lookup(&option, universe->
code_hash, &code, 0,
MDL);
2476 char nbuf[
sizeof(
"unknown-4294967295")];
2478 sprintf(nbuf,
"unknown-%u", code);
2487 option->
code = code;
2494 log_error(
"No memory for option code %s.%s.",
2509 log_error (
"no memory for option buffer.");
2514 memcpy (lbp ->
data,
buffer, length + terminatep);
2525 op ->
data.len = length;
2534 op ->
data.terminated = 1;
2536 op ->
data.terminated = 0;
2546 while ((op->
data.
len > min_len) &&
2564 struct packet *dummy_packet,
2565 struct lease *dummy_lease,
2570 struct universe *dummy_universe,
2571 void *void_accumulator) {
2572 int *accumulator = (
int *)void_accumulator;
2579 struct packet *dummy_packet,
2580 struct lease *dummy_lease,
2585 struct universe *dummy_universe,
2629 memset(server_oro, 0,
sizeof(*server_oro));
2631 log_fatal(
"no memory to build server ORO");
2639 server_oro->
len = 0;
2652 server_oro->
len += 2;
2667 (*universe->
save_func)(universe, options, oc, ISC_FALSE);
2669 log_error(
"can't store options in %s space.", universe->
name);
2678 (*universe->
save_func)(universe, options, oc, ISC_TRUE);
2680 log_error(
"can't store options in %s space.", universe->
name);
2703 universe -> name, oc ->
option -> name);
2707 options ->
universes [universe -> index] = (
void *)hash;
2710 for (bptr = hash [hashix]; bptr; bptr = bptr -> cdr) {
2712 (bptr -> car)) ->
option -> code ==
2728 ocloc = &(*ocloc)->
next;
2729 }
while (*ocloc != NULL);
2742 log_error (
"No memory for option_cache reference.");
2745 bptr -> cdr = hash [hashix];
2748 hash [hashix] = bptr;
2752 struct universe *universe;
2756 if (universe -> delete_func)
2757 (*universe -> delete_func) (universe, options, code);
2759 log_error (
"can't delete options from %s space.",
2764 struct universe *universe;
2778 for (bptr = hash [hashix]; bptr; bptr = bptr -> cdr) {
2787 prev -> cdr = bptr -> cdr;
2789 hash [hashix] = bptr -> cdr;
2803 if (!ptr || !*ptr) {
2804 log_error (
"Null pointer in option_cache_dereference: %s(%d)",
2806 #if defined (POINTER_DEBUG) 2828 free_option_caches = *ptr;
2831 if ((*ptr) ->
refcnt < 0) {
2832 log_error (
"%s(%d): negative refcnt!", file, line);
2833 #if defined (DEBUG_RC_HISTORY) 2834 dump_rc_history (*ptr);
2836 #if defined (POINTER_DEBUG) 2849 struct universe *universe;
2866 for (cp = heads [i]; cp; cp =
next) {
2875 dfree (heads, file, line);
2876 state ->
universes [universe -> index] = (
void *)0;
2891 if (src->
len == 0 && option->
format[0] !=
'Z')
2894 memset(&tmp, 0,
sizeof(tmp));
2943 struct universe *subu=NULL;
2947 memset(&tmp, 0,
sizeof(tmp));
2950 in_options, cfg_options, scope, oc,
MDL)) {
2964 end = strchr(++start,
'.');
2969 if (end == NULL || start == end)
2973 start, end - start,
MDL);
2977 "refers to unknown " 2978 "option space '%.*s'.",
2980 (
int)(end - start), start);
2991 client_state, in_options,
2992 cfg_options, scope, subu);
2995 }
while (ISC_FALSE);
3007 in_options, cfg_options, scope,
name)
3017 struct universe *u = NULL;
3023 log_error(
"option_space_encapsulate: option space '%.*s' does " 3024 "not exist, but is configured.",
3030 if (u->
encapsulate(result, packet, lease, client_state,
3031 in_options, cfg_options, scope, u))
3034 log_error(
"encapsulation requested for '%s' with no support.",
3061 struct universe *universe)
3064 struct universe *subu;
3067 memset(&sub, 0,
sizeof(sub));
3080 subu->
encapsulate(&sub, packet, lease, client_state,
3081 in_options, cfg_options,
3095 in_options, cfg_options, scope, universe)
3097 struct packet *packet;
3098 struct lease *lease;
3099 struct client_state *client_state;
3103 struct universe *universe;
3122 for (p = hash [i]; p; p = p -> cdr) {
3124 client_state, in_options, cfg_options,
3130 if (search_subencapsulation(result, packet, lease, client_state,
3131 in_options, cfg_options, scope, universe))
3138 in_options, cfg_options, scope, universe)
3140 struct packet *packet;
3141 struct lease *lease;
3142 struct client_state *client_state;
3146 struct universe *universe;
3162 for (ocp = head ->
first; ocp; ocp = ocp -> cdr) {
3164 lease, client_state, in_options,
3175 static unsigned char nni [] = { 1, 0 };
3177 memset (&ds, 0,
sizeof ds);
3182 if (!option_code_hash_lookup(&no_nwip->
option,
3185 log_fatal(
"Nwip option hash does not contain " 3190 client_state, in_options,
3191 cfg_options, scope, no_nwip))
3195 memset (&ds, 0,
sizeof ds);
3204 ds.
buffer -> data [0] = 2;
3205 ds.
buffer -> data [1] = 0;
3206 memcpy (&ds.
buffer -> data [2], result -> data, result -> len);
3222 fqdn_encode(
unsigned char *dst,
int dstlen,
const unsigned char *src,
3226 int i, j, len, outlen=0;
3229 for (i = 0, j = 0 ; i < srclen ; i = j) {
3230 while ((j < srclen) && (src[j] !=
'.') && (src[j] !=
'\0'))
3234 if ((outlen + 1 + len) > dstlen)
3244 memcpy(out, src + i, len);
3252 if ((outlen + 1) > dstlen)
3263 in_options, cfg_options, scope, universe)
3265 struct packet *packet;
3266 struct lease *lease;
3267 struct client_state *client_state;
3271 struct universe *universe;
3274 struct data_string results [FQDN_SUBOPTION_COUNT + 1];
3290 memset (results, 0,
sizeof results);
3291 for (ocp = head ->
first; ocp; ocp = ocp -> cdr) {
3293 if (oc ->
option -> code > FQDN_SUBOPTION_COUNT)
3297 packet, lease, client_state,
3298 in_options, cfg_options, scope,
3310 log_error (
"no memory for option buffer.");
3318 memset (&bp ->
data [0], 0, len);
3332 bp -> data [0] |= 2;
3335 bp -> data [0] |= 1;
3345 i = fqdn_encode(&bp->
data[3], len - 3,
3347 results[FQDN_FQDN].
len);
3355 result->terminated = 0;
3359 memcpy (&bp -> data [3], results [
FQDN_FQDN].data,
3362 result -> terminated = 0;
3367 if (results [i].len)
3416 struct client_state *client_state,
3420 struct universe *u,
void *stuff,
3424 struct client_state *,
3428 struct universe *,
void *))
3438 struct packet *packet,
struct lease *lease,
3439 struct client_state *client_state,
3443 struct universe *universe)
3448 unsigned char *
data;
3449 int i, len, rval = 0, count;
3450 struct data_string results[FQDN_SUBOPTION_COUNT + 1];
3459 memset(results, 0,
sizeof(results));
3460 for (ocp = head->
first ; ocp != NULL ; ocp = ocp->
cdr) {
3466 lease, client_state, in_options,
3467 cfg_options, scope, oc,
MDL);
3477 log_error(
"No memory for virtual option buffer.");
3510 count = fqdn_encode(data + 1, len - 1,
3519 result->
len += count;
3538 const unsigned char *
buffer,
unsigned length,
3541 struct buffer *bp = NULL;
3542 unsigned char *first_dot;
3543 int len, hlen, dlen;
3556 log_error(
"No memory for dhcp6.fqdn option buffer.");
3589 log_error(
"Unable to convert dhcp6.fqdn domain name to " 3596 unsigned char *fqdn_start = bp->
data + 3;
3602 first_dot = (
unsigned char *)strchr((
char *)fqdn_start,
'.');
3604 if (first_dot != NULL) {
3605 hlen = first_dot - fqdn_start;
3633 struct client_state *client_state,
3637 struct universe *u,
void *stuff,
3640 struct lease *,
struct client_state *,
3644 struct universe *,
void *))
3647 (*u ->
foreach) (packet, lease, client_state, in_options,
3648 cfg_options, scope, u, stuff, func);
3652 struct client_state *client_state,
3656 struct universe *u,
void *stuff,
3659 struct lease *,
struct client_state *,
3663 struct universe *,
void *),
3669 if (universe ->
foreach)
3670 (*universe ->
foreach) (packet, lease, client_state,
3671 in_options, cfg_options,
3672 scope, universe, stuff, func);
3676 struct client_state *client_state,
3680 struct universe *u,
void *stuff,
3684 struct client_state *,
3688 struct universe *,
void *))
3694 if (cfg_options -> universe_count <= u -> index)
3697 hash = cfg_options ->
universes [u -> index];
3703 for (p = hash [i]; p; p = p -> cdr) {
3705 (*func) (oc, packet, lease, client_state,
3706 in_options, cfg_options, scope, u, stuff);
3722 options ->
universes [universe -> index]);
3726 [universe -> index]),
MDL))
3729 options ->
universes [universe -> index]);
3733 for (tail = &head ->
first; *tail; tail = &((*tail) -> cdr)) {
3736 if (oc->
option->
code == (*ocloc)->option->code) {
3739 ocloc = &(*ocloc)->
next;
3740 }
while (*ocloc != NULL);
3749 *tail =
cons (0, 0);
3752 (&(*tail) -> car), oc,
MDL);
3757 in_options, cfg_options, scope, universe)
3759 struct packet *packet;
3760 struct lease *lease;
3761 struct client_state *client_state;
3765 struct universe *universe;
3774 cfg_options ->
universes [universe -> index]);
3778 for (oc = head ->
first; oc; oc = oc -> cdr) {
3780 lease, client_state, in_options, cfg_options,
3785 if (search_subencapsulation(result, packet, lease, client_state,
3786 in_options, cfg_options, scope, universe))
3793 struct universe *universe;
3803 options ->
universes [universe -> index]);
3807 for (tail = &head ->
first; *tail; tail = &((*tail) -> cdr)) {
3811 tmp = (*tail) -> cdr;
3813 (&(*tail) -> car),
MDL);
3822 struct universe *universe;
3832 options ->
universes [universe -> index]);
3836 for (oc = head ->
first; oc; oc = oc -> cdr) {
3847 struct universe *universe;
3858 struct client_state *client_state,
3862 struct universe *u,
void *stuff,
3866 struct client_state *,
3870 struct universe *,
void *))
3881 for (car = head ->
first; car; car = car -> cdr) {
3883 packet, lease, client_state,
3884 in_options, cfg_options, scope, u, stuff);
3888 void do_packet (interface, packet, len, from_port, from, hfrom)
3892 unsigned int from_port;
3897 struct packet *decoded_packet;
3898 #if defined (DEBUG_MEMORY_LEAKAGE) 3899 unsigned long previous_outstanding = dmalloc_outstanding;
3902 #if defined (TRACING) 3906 decoded_packet = NULL;
3908 log_error(
"do_packet: no memory for incoming packet!");
3911 decoded_packet->
raw = packet;
3915 interface_reference(&decoded_packet->
interface, interface,
MDL);
3916 decoded_packet->
haddr = hfrom;
3920 log_info(
"Discarding packet with bogus hlen.");
3942 memset(&dp, 0,
sizeof dp);
3944 decoded_packet->
options, NULL,
3956 dhcp(decoded_packet);
3958 bootp(decoded_packet);
3964 #if defined (DEBUG_MEMORY_LEAKAGE) 3965 log_info(
"generation %ld: %ld new, %ld outstanding, %ld long-term",
3967 dmalloc_outstanding - previous_outstanding,
3968 dmalloc_outstanding, dmalloc_longterm);
3969 dmalloc_dump_outstanding();
3971 #if defined (DEBUG_RC_HISTORY_EXHAUSTIVELY) 4000 int len,
int from_port,
const struct iaddr *from,
4001 isc_boolean_t was_unicast) {
4002 unsigned char msg_type;
4005 struct packet *decoded_packet;
4006 #if defined (DEBUG_MEMORY_LEAKAGE) 4007 unsigned long previous_outstanding = dmalloc_outstanding;
4012 "short packet from %s port %d, len %d, dropped",
4013 piaddr(*from), from_port, len);
4017 decoded_packet = NULL;
4019 log_error(
"do_packet6: no memory for incoming packet.");
4024 log_error(
"do_packet6: no memory for options.");
4040 interface_reference(&decoded_packet->
interface, interface,
MDL);
4042 decoded_packet->
unicast = was_unicast;
4044 msg_type = packet[0];
4059 relay->
options, len - relaylen,
4090 #if defined (DEBUG_MEMORY_LEAKAGE) 4091 log_info(
"generation %ld: %ld new, %ld outstanding, %ld long-term",
4093 dmalloc_outstanding - previous_outstanding,
4094 dmalloc_outstanding, dmalloc_longterm);
4095 dmalloc_dump_outstanding();
4097 #if defined (DEBUG_RC_HISTORY_EXHAUSTIVELY) 4105 const unsigned char *send)
4112 if (dst == NULL || dend == NULL || src == NULL || send == NULL ||
4113 *dst == NULL || *src == NULL || (*dst >= dend) || (*src > send) ||
4114 ((send - *src) > (dend - *dst)))
4117 for ( ; *src < send ; (*src)++) {
4118 if (!isascii (**src) || !isprint (**src)) {
4120 if ((*src + 1) != send || **src !=
'\0') {
4121 if (*dst + 4 > dend)
4124 sprintf(*dst,
"\\%03o",
4129 }
else if (**src ==
'"' || **src ==
'\'' || **src ==
'$' ||
4130 **src ==
'`' || **src ==
'\\' || **src ==
'|' ||
4132 if (*dst + 2 > dend)
4141 if (*dst + 1 > dend)
4154 pretty_text(
char **dst,
char *dend,
const unsigned char **src,
4155 const unsigned char *send,
int emit_quotes)
4159 if (dst == NULL || dend == NULL || src == NULL || send == NULL ||
4160 *dst == NULL || *src == NULL ||
4161 ((*dst + (emit_quotes ? 2 : 0)) > dend) || (*src > send))
4170 count =
pretty_escape(dst, dend - (emit_quotes ? 1 : 0), src, send);
4175 if (emit_quotes && (*dst < dend)) {
4187 pretty_domain(
char **dst,
char *dend,
const unsigned char **src,
4188 const unsigned char *send)
4190 const unsigned char *tend;
4194 if (dst == NULL || dend == NULL || src == NULL || send == NULL ||
4195 *dst == NULL || *src == NULL ||
4196 ((*dst + 2) > dend) || (*src >= send))
4215 tend = (*src) + tsiz;
4227 if ((status == -1) || ((*dst + 2) > dend))
4232 count += status + 1;
4248 unsigned int option_num,
4250 unsigned int data_len)
4260 &option_num, 0,
MDL)) {
4261 log_error(
"Attempting to add unknown option %d.", option_num);
4267 log_error(
"No memory for option cache adding %s (option %d).",
4268 option->
name, option_num);
4278 log_error(
"No memory for constant data adding %s (option %d).",
4279 option->
name, option_num);
4307 log_debug(
"Dropped DHCPv4 packet with zero-length client-id");
4310 }
else if (oc->
data.
len == 1) {
4317 log_debug(
"Accepted DHCPv4 packet with one-character client-id - " 4318 "a future version of ISC DHCP will reject this");
4328 log_debug(
"Dropped DHCPv4 packet with wrong " 4329 "(len == %d) pxe-client-id", oc->
data.
len);
4338 log_debug(
"Received DHCPv4 packet without client-id" 4339 " option and empty hlen field.");
4380 struct packet *packet;
4381 struct lease *lease;
4382 struct client_state *client_state;
4393 if ((packet == NULL) || (in_options == NULL) || (out_options == NULL))
4397 if (vendor_cfg_option == NULL)
4402 out_options, vendor_cfg_option->
code);
4406 memset(&name, 0,
sizeof(name));
4408 in_options, out_options, scope, oc,
MDL);
4418 if ((oc == NULL) || (oc->
data.
len == 0)) {
4434 (
const char *)name.
data);
struct option_cache * lookup_hashed_option(struct universe *universe, struct option_state *options, unsigned code)
void do_packet6(struct interface_info *, const char *, int, int, const struct iaddr *, isc_boolean_t)
#define rc_register(file, line, reference, addr, refcnt, d, f)
#define DHCP_FIXED_NON_UDP
int parse_encapsulated_suboptions(struct option_state *options, struct option *eopt, const unsigned char *buffer, unsigned len, struct universe *eu, const char *uname)
unsigned char peer_address[16]
int fqdn_option_space_encapsulate(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *universe)
void set_option(struct universe *universe, struct option_state *options, struct option_cache *option, enum statement_op op)
#define DHO_DHCP_AGENT_OPTIONS
char sname[DHCP_SNAME_LEN]
struct binding_scope * global_scope
void save_linked_option(struct universe *universe, struct option_state *options, struct option_cache *oc, isc_boolean_t appendp)
void(* save_func)(struct universe *, struct option_state *, struct option_cache *, isc_boolean_t)
struct universe * universe
void save_option(struct universe *universe, struct option_state *options, struct option_cache *oc)
u_int32_t(* get_length)(const unsigned char *)
const char * piaddr(const struct iaddr addr)
int MRns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
#define FQDN_NO_CLIENT_UPDATE
#define DHCP_MIN_OPTION_LEN
#define DHO_PXE_CLIENT_ID
unsigned char dhcpv6_transaction_id[3]
int append_option(struct data_string *dst, struct universe *universe, struct option *option, struct data_string *src)
unsigned char options[FLEXIBLE_ARRAY_MEMBER]
int format_has_text(char *format) const
void delete_linked_option(struct universe *universe, struct option_state *options, int code)
int hashed_option_space_encapsulate(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *universe)
void * dmalloc(unsigned, const char *, int)
int option_cache_dereference(struct option_cache **ptr, const char *file, int line)
int expression_allocate(struct expression **cptr, const char *file, int line)
int store_option(struct data_string *result, struct universe *universe, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct option_cache *oc)
struct enumeration * find_enumeration(const char *name, int length)
int int int log_debug(const char *,...) __attribute__((__format__(__printf__
struct option_cache * free_option_caches
void parse_vendor_option(struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *out_options, struct binding_scope **scope)
Parse a vendor option (option 43)
pair new_pair(char *file, int line) const
#define DHO_DHCP_LEASE_TIME
int option_reference(struct option **dest, struct option *src, const char *file, int line)
struct universe dhcp_universe
int fqdn_universe_decode(struct option_state *options, const unsigned char *buffer, unsigned length, struct universe *u)
struct universe * find_option_universe(struct option *eopt, const char *uname)
void data_string_forget(struct data_string *data, const char *file, int line)
struct option_cache * next
void bootp(struct packet *packet)
const char * pretty_print_option(struct option *option, const unsigned char *data, unsigned len, int emit_commas, int emit_quotes)
#define FQDN_SUBOPTION_COUNT
int option_cache_reference(struct option_cache **ptr, struct option_cache *src, const char *file, int line)
void also_save_option(struct universe *universe, struct option_state *options, struct option_cache *oc)
void delete_option(struct universe *universe, struct option_state *options, int code)
int log_error(const char *,...) __attribute__((__format__(__printf__
struct option_cache *(* lookup_func)(struct universe *, struct option_state *, unsigned)
#define DHO_DHCP_REBINDING_TIME
#define DHO_DOMAIN_NAME_SERVERS
int option_space_encapsulate(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct data_string *name)
int fqdn6_universe_decode(struct option_state *options, const unsigned char *buffer, unsigned length, struct universe *u)
const char * pdestdesc(const struct iaddr addr)
struct expression * expression
void build_server_oro(struct data_string *server_oro, struct option_state *options, const char *file, int line)
int(* decode)(struct option_state *, const unsigned char *, unsigned, struct universe *)
#define DHO_ASSOCIATED_IP
struct option_state * options
unsigned char dhcpv6_hop_count
void do_packet(struct interface_info *interface, struct dhcp_packet *packet, unsigned len, unsigned int from_port, struct iaddr from, struct hardware *hfrom)
unsigned char link_address[16]
void expression_dereference(struct expression **eptr, const char *file, int line)
unsigned char dhcpv6_msg_type
void data_string_truncate(struct data_string *dp, int len)
#define DHO_DHCP_SERVER_IDENTIFIER
void log_fatal(const char *,...) __attribute__((__format__(__printf__
#define DHCPV6_RELAY_REPL
int parse_option_buffer(struct option_state *options, const unsigned char *buffer, unsigned length, struct universe *universe)
int buffer_reference(struct buffer **ptr, struct buffer *bp, const char *file, int line)
int option_cache_allocate(struct option_cache **cptr, const char *file, int line)
struct universe vsio_universe
universe_hash_t * universe_hash
int linked_option_state_dereference(struct universe *universe, struct option_state *state, const char *file, int line)
int option_state_allocate(struct option_state **ptr, const char *file, int line)
int evaluate_option_cache(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct option_cache *oc, const char *file, int line)
struct option_cache * lookup_fqdn6_option(struct universe *universe, struct option_state *options, unsigned code)
int32_t getShort(const unsigned char *)
int option_chain_head_dereference(struct option_chain_head **ptr, const char *file, int line)
int32_t getLong(const unsigned char *)
#define DHCP_MAX_OPTION_LEN
void delete_hashed_option(struct universe *universe, struct option_state *options, int code)
void(* store_length)(unsigned char *, u_int32_t)
void linked_option_space_foreach(struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *u, void *stuff, void(*func)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *))
int fqdn6_option_space_encapsulate(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *universe)
int buffer_allocate(struct buffer **ptr, unsigned len, const char *file, int line)
char * default_option_format
struct interface_info * interface
struct enumeration_value * values
void putULong(unsigned char *, u_int32_t)
void delete_fqdn6_option(struct universe *universe, struct option_state *options, int code)
void save_hashed_option(struct universe *universe, struct option_state *options, struct option_cache *oc, isc_boolean_t appendp)
int linked_option_space_encapsulate(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *universe)
int make_concat(struct expression **expr, struct expression *left, struct expression *right)
#define DHCPV6_RELAY_FORW
int pretty_escape(char **dst, char *dend, const unsigned char **src, const unsigned char *send)
int cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, struct lease *lease, struct client_state *client_state, int mms, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, int overload_avail, int terminate, int bootpp, struct data_string *prl, const char *vuname)
int save_option_buffer(struct universe *universe, struct option_state *options, struct buffer *bp, unsigned char *buffer, unsigned length, unsigned code, int terminatep)
u_int32_t getUShort(const unsigned char *)
int hashed_option_state_dereference(struct universe *universe, struct option_state *state, const char *file, int line)
struct option * new_option(char *name, const char *file, int line) const
void dfree(void *, const char *, int)
int add_option(struct option_state *options, unsigned int option_num, void *data, unsigned int data_len)
#define DHO_CLASSLESS_STATIC_ROUTES
int store_options(int *ocount, unsigned char *buffer, unsigned index, unsigned buflen, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, unsigned *priority_list, int priority_len, unsigned first_cutoff, int second_cutoff, int terminate, const char *vuname)
struct option_cache * lookup_option(struct universe *universe, struct option_state *options, unsigned code)
int int log_info(const char *,...) __attribute__((__format__(__printf__
void suboption_foreach(struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *u, void *stuff, void(*func)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *), struct option_cache *oc, const char *vsname)
int packet6_len_okay(const char *packet, int len)
int parse_options(struct packet *packet)
u_int32_t getULong(const unsigned char *)
#define DHO_SUBNET_SELECTION
int validate_packet(struct packet *packet)
#define DHO_DHCP_MAX_MESSAGE_SIZE
int get_option(struct data_string *result, struct universe *universe, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct option_state *options, struct binding_scope **scope, unsigned code, const char *file, int line)
void fqdn6_option_space_foreach(struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *u, void *stuff, void(*func)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *))
struct universe ** universes
int store_options6(char *buf, int buflen, struct option_state *opt_state, struct packet *packet, const int *required_opts, struct data_string *oro)
int append_option_buffer(struct universe *universe, struct option_state *options, struct buffer *bp, unsigned char *buffer, unsigned length, unsigned code, int terminatep)
u_int32_t getUChar(const unsigned char *)
void option_space_foreach(struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *u, void *stuff, void(*func)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *))
void dhcpv6(struct packet *)
struct universe dhcpv6_universe
int format_min_length(char *format, struct option_cache *oc) const
int make_const_data(struct expression **expr, const unsigned char *data, unsigned len, int terminated, int allocate, const char *file, int line)
void free_pair(pair foo, const char *file, int line)
int packet_dereference(struct packet **ptr, const char *file, int line)
int packet_allocate(struct packet **ptr, const char *file, int line)
int option_chain_head_allocate(struct option_chain_head **ptr, const char *file, int line)
#define FQDN_SERVER_UPDATE
#define dmalloc_reuse(x, y, l, z)
unsigned char transaction_id[3]
int(* encapsulate)(struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *)
u_int32_t(* get_tag)(const unsigned char *)
void save_fqdn6_option(struct universe *universe, struct option_state *options, struct option_cache *oc, isc_boolean_t appendp)
int MRns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src, u_char *dst, size_t dstsiz)
void hashed_option_space_foreach(struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *u, void *stuff, void(*func)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *))
struct universe fqdn_universe
void dhcp(struct packet *packet)
int nwip_option_space_encapsulate(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *universe)
#define DHO_DHCP_OPTION_OVERLOAD
option_code_hash_t * code_hash
pair cons(caddr_t car, pair cdr)
#define DHO_DHCP_RENEWAL_TIME
struct in6_addr dhcpv6_peer_address
#define DHO_DHCP_CLIENT_IDENTIFIER
void trace_inpacket_stash(struct interface_info *, struct dhcp_packet *, unsigned, unsigned int, struct iaddr, struct hardware *)
void putUShort(unsigned char *, u_int32_t)
struct universe nwip_universe
const unsigned char * data
int get_option_int(int *result, struct universe *universe, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct option_state *options, struct binding_scope **scope, unsigned code, const char *file, int line)
#define DHO_DHCP_MESSAGE_TYPE
struct option * vendor_cfg_option
void data_string_copy(struct data_string *dest, const struct data_string *src, const char *file, int line)
void(* store_tag)(unsigned char *, u_int32_t)
struct in6_addr dhcpv6_link_address
unsigned char options[FLEXIBLE_ARRAY_MEMBER]
#define DHCP_OPTIONS_COOKIE
int option_dereference(struct option **dest, const char *file, int line)
#define DHO_VENDOR_ENCAPSULATED_OPTIONS
unsigned char options[DHCP_MAX_OPTION_LEN]
#define DHO_DHCP_REQUESTED_ADDRESS
int buffer_dereference(struct buffer **ptr, const char *file, int line)
struct option_cache * lookup_linked_option(struct universe *universe, struct option_state *options, unsigned code)
#define compute_option_hash(x)