Rewrite get_option(): new version fixes at least one bug, and is much easier

to understand and verify as correct.  It also returns the length of the
extracted option.
This commit is contained in:
Nicholas J. Kain
2011-03-30 09:35:17 -04:00
parent f0865812d2
commit 1437f520ca
5 changed files with 84 additions and 55 deletions

View File

@ -79,7 +79,7 @@ unsigned char *alloc_option(unsigned char code, unsigned char *optdata,
unsigned char *alloc_dhcp_client_id_option(unsigned char type,
unsigned char *idstr, size_t idstrlen);
uint8_t *get_option(struct dhcpMessage *packet, int code);
uint8_t *get_option(struct dhcpMessage *packet, int code, ssize_t *optlen);
int end_option(uint8_t *optionptr);
int add_option_string(unsigned char *optionptr, unsigned char *string);
int add_simple_option(unsigned char *optionptr, unsigned char code, uint32_t data);