43#define DHCP_OPTION_DATA
52 unsigned char *,
int,
int,
int);
138 "larger than buffer");
142 warning(
"Many bogus options seen in offers. "
143 "Taking this offer in spite of bogus "
144 "options - hope for the best!");
146 warning(
"rejecting bogus offer.");
157 error(
"Can't allocate storage for option %s.",
175 error(
"Can't expand storage for option %s.",
202 unsigned char priority_list[300],
buffer[4096];
203 int priority_len, main_buffer_size, mainbufix;
227 if (main_buffer_size >
sizeof(
buffer))
228 main_buffer_size =
sizeof(
buffer);
246 if (prlen + priority_len >
sizeof(priority_list))
247 prlen =
sizeof(priority_list) - priority_len;
249 memcpy(&priority_list[priority_len],
252 priority_len += prlen;
254 memcpy(&priority_list[priority_len],
263 main_buffer_size - 7,
264 options, priority_list, priority_len, main_buffer_size,
276 if (option_size <= main_buffer_size - mainbufix) {
279 mainbufix += option_size;
280 if (mainbufix < main_buffer_size)
285 outpacket->
options[mainbufix++] = 1;
288 outpacket->
options[mainbufix++] = 3;
290 outpacket->
options[mainbufix++] = 1;
293 buffer, main_buffer_size - mainbufix);
304 unsigned char *priority_list,
int priority_len,
int first_cutoff,
307 int bufix = 0, option_stored[256],
i, ix;
310 memset(option_stored, 0,
sizeof(option_stored));
316 for (
i = 0;
i < priority_len;
i++) {
318 int code = priority_list[
i];
336 if (option_stored[
code])
338 option_stored[
code] = 1;
363 if (bufix < first_cutoff &&
364 bufix + incr > first_cutoff)
365 incr = first_cutoff - bufix;
366 else if (bufix < second_cutoff &&
367 bufix + incr > second_cutoff)
368 incr = second_cutoff - bufix;
374 if (bufix + 2 + incr > buflen) {
397 int emit_commas,
int emit_quotes)
399 static char optbuf[32768];
400 int hunksize = 0, numhunk = -1, numelem = 0;
401 char fmtbuf[32], *
op = optbuf;
402 int i,
j,
k, opleft =
sizeof(optbuf);
403 unsigned char *dp =
data;
409 error(
"pretty_print_option: bad code %d",
code);
419 warning(
"%s: Excess information in format string: %s",
470 warning(
"%s: garbage in format string: %s",
478 if (hunksize >
len) {
479 warning(
"%s: expecting at least %d bytes; got %d",
484 if (numhunk == -1 && hunksize <
len)
490 numhunk =
len / hunksize;
492 if (numhunk > 0 && numhunk * hunksize <
len)
493 warning(
"%s: %d extra bytes at end of array",
501 for (
i = 0;
i < numhunk;
i++) {
502 for (
j = 0;
j < numelem;
j++) {
510 for (; dp <
data +
len; dp++) {
520 }
else if (*dp ==
'"' ||
545 if (opcount >= opleft)
553 if (opcount >= opleft || opcount == -1)
561 if (opcount >= opleft || opcount == -1)
569 if (opcount >= opleft || opcount == -1)
577 if (opcount >= opleft || opcount == -1)
585 if (opcount >= opleft || opcount == -1)
591 if (opcount >= opleft || opcount == -1)
597 if (opcount >= opleft || opcount == -1)
604 if (opcount >= opleft)
609 warning(
"Unexpected format code %c", fmtbuf[
j]);
615 if (
j + 1 < numelem && comma !=
':') {
620 if (
i + 1 < numhunk) {
630 warning(
"dhcp option too large");
642 note(
"Discarding packet with invalid hlen.");
648 tp.packet_length =
len;
649 tp.client_port = from_port;
655 if (
tp.options_valid &&
664 for (
i = 0;
i < 256;
i++)
665 if (
tp.options[
i].len &&
tp.options[
i].data)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
void parse_option_buffer(struct packet *, unsigned char *, int)
int store_options(unsigned char *, int, struct tree_cache **, unsigned char *, int, int, int)
void parse_options(struct packet *)
char * pretty_print_option(unsigned int code, unsigned char *data, int len, int emit_commas, int emit_quotes)
int cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, int mms, struct tree_cache **options)
void do_packet(struct interface_info *interface, struct dhcp_packet *packet, int len, unsigned int from_port, struct iaddr from, struct hardware *hfrom)
int note(char *format,...)
int32_t getLong(unsigned char *data)
u_int16_t getUShort(unsigned char *data)
u_int32_t getULong(unsigned char *data)
int16_t getShort(unsigned char *data)
#define DHO_DHCP_MAX_MESSAGE_SIZE
#define DHO_DHCP_PARAMETER_REQUEST_LIST
#define DHCP_FIXED_NON_UDP
#define DHO_DHCP_MESSAGE_TYPE
#define DHCP_OPTIONS_COOKIE
#define DHO_DHCP_OPTION_OVERLOAD
#define DHO_DHCP_SERVER_IDENTIFIER
#define DHO_DHCP_LEASE_TIME
void bootp(struct packet *packet)
void dhcp(struct packet *packet)
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
#define memcpy(s1, s2, n)
unsigned char options[DHCP_OPTION_LEN]
struct option_data options[256]
int sizeof_dhcp_option_default_priority_list
unsigned char dhcp_option_default_priority_list[]
struct dhcp_option dhcp_options[256]