43 const uint8_t *src_addr,
const uint8_t *dest_addr,
const int proto)
62#define LONGDOMAIN "a-reaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaally-long-domain"
72 const unsigned char output_1[28] =
"\x77\x1a\x07openvpn\x03net\x00\x07openvpn\x03org";
92 const unsigned char output_3[0xEC + 3 + 10 + 7 + 1] =
"\x77\xFF\x09subdomain\xEC" LONGDOMAIN "\x06top123";
98 const unsigned char output_4[0xEC + 3 + 10 + 7 + 1] =
"\x77\xFF\xFDsubdomain-" LONGDOMAIN "-top123";
117 const char output_5[12] =
"\x77\x0a\x03sub\x00\x03tld";
129 const struct CMUnitTest tests[] = {
133 return cmocka_run_group_tests_name(
"dhcp", tests, NULL, NULL);
void buf_clear(struct buffer *buf)
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
static struct buffer clear_buf(void)
Return an empty struct buffer.
static void gc_free(struct gc_arena *a)
static struct gc_arena gc_new(void)
static int buf_forward_capacity_total(const struct buffer *buf)
static void write_dhcp_search_str(struct buffer *buf, const uint8_t type, const char *const *str_array, int array_len, bool *error)
#define DHCP_DOMAIN_SEARCH
Wrapper structure for dynamically allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
Garbage collection arena used to keep track of dynamically allocated memory.
unsigned short sa_family_t
static void test_write_dhcp_search_str(void **state)
uint16_t ip_checksum(const sa_family_t af, const uint8_t *payload, const int len_payload, const uint8_t *src_addr, const uint8_t *dest_addr, const int proto)
Calculates an IP or IPv6 checksum with a pseudo header as required by TCP, UDP and ICMPv6.
const char * print_in_addr_t(in_addr_t addr, unsigned int flags, struct gc_arena *gc)