17static struct netif test_netif6;
24 fail_unless(
netif == &test_netif6);
25 fail_unless(
p !=
NULL);
36 netif->output_ip6 = ethip6_output;
49 fail_unless(
n == &test_netif6);
61ip6_test_handle_timers(
int count)
87 tcpip_thread_poll_one();
96test_ip6_ll_addr_iter(
int expected_ctr1,
int expected_ctr2)
102 ip6_test_handle_timers(500);
109 ip6_test_handle_timers(500);
117 ip6_test_handle_timers(500);
126 ip6_test_handle_timers(500);
141 test_ip6_ll_addr_iter(0, 0);
144 netif_create_ip6_linklocal_address(&test_netif6, 1);
155 const char *full_ipv6_addr =
"0:0:0:0:0:FFFF:D4CC:65D2";
156 const char *shortened_ipv6_addr =
"::FFFF:D4CC:65D2";
157 const char *full_ipv4_mapped_addr =
"0:0:0:0:0:FFFF:212.204.101.210";
158 const char *shortened_ipv4_mapped_addr =
"::FFFF:212.204.101.210";
159 const char *bogus_ipv4_mapped_addr =
"::FFFF:212.204.101.2101";
163 memset(&addr6, 0,
sizeof(addr6));
164 ret = ip6addr_aton(full_ipv6_addr, &addr6);
165 fail_unless(
ret == 1);
166 fail_unless(
memcmp(&addr6, &addr_expected, 16) == 0);
169 fail_unless(
ret == 1);
170 fail_unless(
memcmp(&
addr, &addr_expected, 16) == 0);
173 memset(&addr6, 0,
sizeof(addr6));
174 ret = ip6addr_aton(shortened_ipv6_addr, &addr6);
175 fail_unless(
ret == 1);
176 fail_unless(
memcmp(&addr6, &addr_expected, 16) == 0);
179 fail_unless(
ret == 1);
180 fail_unless(
memcmp(&
addr, &addr_expected, 16) == 0);
183 memset(&addr6, 0,
sizeof(addr6));
184 ret = ip6addr_aton(shortened_ipv4_mapped_addr, &addr6);
185 fail_unless(
ret == 1);
186 fail_unless(
memcmp(&addr6, &addr_expected, 16) == 0);
189 fail_unless(
ret == 1);
190 fail_unless(
memcmp(&
addr, &addr_expected, 16) == 0);
193 memset(&addr6, 0,
sizeof(addr6));
194 ret = ip6addr_aton(full_ipv4_mapped_addr, &addr6);
195 fail_unless(
ret == 1);
196 fail_unless(
memcmp(&addr6, &addr_expected, 16) == 0);
199 fail_unless(
ret == 1);
200 fail_unless(
memcmp(&
addr, &addr_expected, 16) == 0);
203 memset(&addr6, 0,
sizeof(addr6));
204 ret = ip6addr_aton(bogus_ipv4_mapped_addr, &addr6);
205 fail_unless(
ret == 0);
208 fail_unless(
ret == 0);
221 fail_unless(!
strcmp(
str,
"::FFFF:212.204.101.210"));
225struct test_addr_and_str {
232 struct test_addr_and_str
tests[] = {
233 {
IPADDR6_INIT_HOST(0xfe800000, 0x00000000, 0xb2a1a2ff, 0xfea3a4a5),
"FE80::B2A1:A2FF:FEA3:A4A5"},
234 {
IPADDR6_INIT_HOST(0xfe800000, 0xff000000, 0xb2a1a2ff, 0xfea3a4a5),
"FE80:0:FF00:0:B2A1:A2FF:FEA3:A4A5"},
235 {
IPADDR6_INIT_HOST(0xfe800000, 0xff000000, 0xb2000000, 0x0000a4a5),
"FE80:0:FF00:0:B200::A4A5"},
253 const u8_t test_mac_addr[6] = {0xb0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5};
257 memset(zeros, 0,
sizeof(zeros));
259 fail_unless(test_netif6.hwaddr_len == 6);
260 fail_unless(!
memcmp(test_netif6.hwaddr, zeros, 6));
262 fail_unless(test_netif6.ip6_addr_state[0] == 0);
263 fail_unless(!
memcmp(netif_ip6_addr(&test_netif6, 0), zeros,
sizeof(ip6_addr_t)));
266 memcpy(test_netif6.hwaddr, test_mac_addr, 6);
269 netif_create_ip6_linklocal_address(&test_netif6, 1);
270 fail_unless(
IP_IS_V6(&test_netif6.ip6_addr[0]));
271 fail_unless(!
memcmp(&netif_ip6_addr(&test_netif6, 0)->
addr, expected_ip6_addr_1, 16));
273 fail_unless(netif_ip6_addr(&test_netif6, 0)->
zone == (test_netif6.num + 1));
276 memset(&test_netif6.ip6_addr[0], 0,
sizeof(ip6_addr_t));
277 test_netif6.ip6_addr_state[0] = 0;
280 netif_create_ip6_linklocal_address(&test_netif6, 0);
281 fail_unless(
IP_IS_V6(&test_netif6.ip6_addr[0]));
282 fail_unless(!
memcmp(&netif_ip6_addr(&test_netif6, 0)->
addr, expected_ip6_addr_2, 16));
284 fail_unless(netif_ip6_addr(&test_netif6, 0)->
zone == (test_netif6.num + 1));
287 memset(&test_netif6.ip6_addr[0], 0,
sizeof(ip6_addr_t));
288 test_netif6.ip6_addr_state[0] = 0;
291 memset(&test_netif6.hwaddr, 0,
sizeof(test_netif6.hwaddr));
295static struct pbuf *cloned_pbuf =
NULL;
304START_TEST(test_ip6_dest_unreachable_chained_pbuf)
311 0x60, 0x00, 0x27, 0x03, 0x00, 0x2d, 0x11, 0x40,
312 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
313 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
314 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
315 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
316 0x01, 0xff, 0x03, 0xff, 0x00, 0x2d, 0x00, 0x00,
319 u8_t udp_payload[] =
"abcdefghijklmnopqrstuvwxyz0123456789";
329 data->payload = udp_payload;
335 netif_ip6_addr_set(&test_netif6, 0,
ip_2_ip6(&my_addr));
336 netif_ip6_addr_set_state(&test_netif6, 0, IP6_ADDR_VALID);
337 test_netif6.output_ip6 = clone_output;
340 ip6_input(
header, &test_netif6);
344 fail_unless(cloned_pbuf);
347 fail_unless(ip6_addr_packed_eq(
ip_2_ip6(&my_addr), &outhdr->src, IP6_NO_ZONE));
348 fail_unless(ip6_addr_packed_eq(
ip_2_ip6(&peer_addr), &outhdr->dest, IP6_NO_ZONE));
355 fail_unless(
memcmp(icmpptr,
udp_hdr,
sizeof(
udp_hdr)) == 0,
"mismatch in copied ip6/udp header");
357 fail_unless(
memcmp(icmpptr, udp_payload,
sizeof(udp_payload)) == 0,
"mismatch in copied udp payload");
373 test_netif6.mtu = 1500;
375 netif_ip6_addr_set(&test_netif6, 0,
ip_2_ip6(&my_addr));
376 netif_ip6_addr_set_state(&test_netif6, 0, IP6_ADDR_VALID);
381 for (
i = 0;
i < 16;
i++) {
383 fail_unless(
p !=
NULL);
414 test_netif6.mtu = 1500;
416 netif_ip6_addr_set(&test_netif6, 0,
ip_2_ip6(&my_addr));
417 netif_ip6_addr_set_state(&test_netif6, 0, IP6_ADDR_VALID);
418 test_netif6.output_ip6 = direct_output;
445 TESTFUNC(test_ip6_dest_unreachable_chained_pbuf),
446 TESTFUNC(test_ip6_frag_pbuf_len_assert),
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define LWIP_ARRAYSIZE(x)
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum const GLvoid * addr
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
#define LWIP_UNUSED_ARG(x)
#define LWIP_IPV6_DUP_DETECT_ATTEMPTS
#define NETIF_FLAG_ETHERNET
#define NETIF_FLAG_BROADCAST
void netif_set_link_down(struct netif *netif)
void netif_set_down(struct netif *netif)
void netif_remove(struct netif *netif)
void netif_set_default(struct netif *netif)
void netif_set_link_up(struct netif *netif)
void netif_set_up(struct netif *netif)
struct netif * netif_add_noaddr(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
void pbuf_cat(struct pbuf *h, struct pbuf *t)
void pbuf_chain(struct pbuf *h, struct pbuf *t)
struct pbuf * pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
u8_t pbuf_free(struct pbuf *p)
struct pbuf * pbuf_clone(pbuf_layer layer, pbuf_type type, struct pbuf *p)
#define ipaddr_aton(cp, addr)
#define IPADDR6_INIT_HOST(a, b, c, d)
Suite * create_suite(const char *name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown)
void lwip_check_ensure_no_alloc(unsigned int skip)
#define memcpy(s1, s2, n)
static struct test_info tests[]
struct netif * netif_list
struct netif * netif_default
netif_linkoutput_fn linkoutput
static err_t default_netif_linkoutput(struct netif *netif, struct pbuf *p)
static err_t default_netif_init(struct netif *netif)
static void default_netif_add(void)
static void default_netif_remove(void)
static int linkoutput_ctr
static int linkoutput_byte_ctr
END_TEST Suite * ip6_suite(void)