iPXE
|
IPv6 tests. More...
#include <stdint.h>
#include <string.h>
#include <byteswap.h>
#include <ipxe/ipv6.h>
#include <ipxe/test.h>
Go to the source code of this file.
Data Structures | |
struct | ipv6_test_prefix |
An IPv6 test prefix. More... | |
struct | ipv6_test_route |
An IPv6 test routing table entry. More... | |
struct | ipv6_test_table |
An IPv6 test routing table. More... | |
Macros | |
#define | IPV6(...) { __VA_ARGS__ } |
Define inline IPv6 address. More... | |
#define | PREFIX(name, LEN, MASK) |
Define a test prefix. More... | |
#define | TABLE(name, ...) |
Define a test routing table. More... | |
#define | inet6_ntoa_ok(addr, text) |
#define | inet6_aton_ok(text, addr) |
#define | inet6_aton_fail_ok(text) inet6_aton_fail_okx ( text, __FILE__, __LINE__ ) |
#define | ipv6_table_ok(table) ipv6_table_okx ( table, __FILE__, __LINE__ ) |
#define | ipv6_route_ok(table, dest, src, next) ipv6_route_okx ( table, dest, src, next, __FILE__, __LINE__ ) |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
PREFIX (prefix48, 48, "ffff:ffff:ffff::") | |
/48 prefix More... | |
PREFIX (prefix64, 64, "ffff:ffff:ffff:ffff::") | |
/64 prefix More... | |
PREFIX (prefix126, 126, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffc") | |
/126 prefix More... | |
PREFIX (prefix127, 127, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffe") | |
/127 prefix More... | |
PREFIX (prefix128, 128, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff") | |
/128 prefix More... | |
TABLE (table_link_local, { "fe80::69ff:fe50:5845", &prefix64, NULL }) | |
Routing table with only a link-local address. More... | |
TABLE (table_normal, { "fe80::69ff:fe50:5845", &prefix64, NULL }, { "2001:db8:3::1", &prefix64, "fe80::1" }) | |
Routing table with a global address. More... | |
TABLE (table_multi, { "fe80::69ff:fe50:5845", &prefix64, NULL }, { "2001:db8:3::1", &prefix64, "fe80::1" }, { "2001:db8:5::1", &prefix64, NULL }, { "2001:db8:42::1", &prefix64, "fe80::2" }, { "fd44:9112:6442::69ff:fe50:5845", &prefix64, "fe80::1" }, { "fd70:6ba9:50ae::69ff:fe50:5845", &prefix64, "fe80::3" }) | |
Routing table with multiple addresses and routers. More... | |
TABLE (table_unusual, { "2001:db8:1::1", &prefix48, "fe80::1" }, { "2001:db8:2::1", &prefix126, NULL }, { "2001:db8:3::1", &prefix127, NULL }, { "2001:db8:4::1", &prefix128, NULL }) | |
Routing table with unusual prefix lengths. More... | |
static void | inet6_ntoa_okx (const struct in6_addr *addr, const char *text, const char *file, unsigned int line) |
Report an inet6_ntoa() test result. More... | |
static void | inet6_aton_okx (const char *text, const struct in6_addr *addr, const char *file, unsigned int line) |
Report an inet6_aton() test result. More... | |
static void | inet6_aton_fail_okx (const char *text, const char *file, unsigned int line) |
Report an inet6_aton() failure test result. More... | |
static void | ipv6_table_okx (struct ipv6_test_table *table, const char *file, unsigned int line) |
Create test routing table. More... | |
static void | ipv6_route_okx (struct ipv6_test_table *table, const char *dest, const char *src, const char *next, const char *file, unsigned int line) |
Report an ipv6_route() test result. More... | |
static void | ipv6_table_del (struct ipv6_test_table *table) |
Destroy test routing table. More... | |
static void | ipv6_test_exec (void) |
Perform IPv6 self-tests. More... | |
Variables | |
static const struct in6_addr | sample_unspecified |
The unspecified IPv6 address. More... | |
static const struct in6_addr | sample_link_local |
A sample link-local IPv6 address. More... | |
static const struct in6_addr | sample_site_local |
A sample site-local IPv6 address. More... | |
static const struct in6_addr | sample_ula |
A sample ULA IPv6 address. More... | |
static const struct in6_addr | sample_global |
A sample global IPv6 address. More... | |
static const struct in6_addr | sample_multicast |
A sample multicast IPv6 address. More... | |
static struct net_device | ipv6_test_netdev |
Dummy network device used for routing tests. More... | |
struct self_test ipv6_test | __self_test |
IPv6 self-test. More... | |
IPv6 tests.
Definition in file ipv6_test.c.
#define IPV6 | ( | ... | ) | { __VA_ARGS__ } |
Define inline IPv6 address.
Definition at line 42 of file ipv6_test.c.
#define PREFIX | ( | name, | |
LEN, | |||
MASK | |||
) |
Define a test prefix.
Definition at line 73 of file ipv6_test.c.
#define TABLE | ( | name, | |
... | |||
) |
Define a test routing table.
Definition at line 80 of file ipv6_test.c.
#define inet6_ntoa_ok | ( | addr, | |
text | |||
) |
Definition at line 195 of file ipv6_test.c.
#define inet6_aton_ok | ( | text, | |
addr | |||
) |
Definition at line 219 of file ipv6_test.c.
#define inet6_aton_fail_ok | ( | text | ) | inet6_aton_fail_okx ( text, __FILE__, __LINE__ ) |
Definition at line 239 of file ipv6_test.c.
#define ipv6_table_ok | ( | table | ) | ipv6_table_okx ( table, __FILE__, __LINE__ ) |
Definition at line 312 of file ipv6_test.c.
#define ipv6_route_ok | ( | table, | |
dest, | |||
src, | |||
next | |||
) | ipv6_route_okx ( table, dest, src, next, __FILE__, __LINE__ ) |
Definition at line 380 of file ipv6_test.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
PREFIX | ( | prefix48 | , |
48 | , | ||
"ffff:ffff:ffff::" | |||
) |
/48 prefix
PREFIX | ( | prefix64 | , |
64 | , | ||
"ffff:ffff:ffff:ffff::" | |||
) |
/64 prefix
PREFIX | ( | prefix126 | , |
126 | , | ||
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffc" | |||
) |
/126 prefix
PREFIX | ( | prefix127 | , |
127 | , | ||
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffe" | |||
) |
/127 prefix
PREFIX | ( | prefix128 | , |
128 | , | ||
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" | |||
) |
/128 prefix
TABLE | ( | table_link_local | , |
{ "fe80::69ff:fe50:5845", &prefix64, NULL } | |||
) |
Routing table with only a link-local address.
TABLE | ( | table_normal | , |
{ "fe80::69ff:fe50:5845", &prefix64, NULL } | , | ||
{ "2001:db8:3::1", &prefix64, "fe80::1" } | |||
) |
Routing table with a global address.
TABLE | ( | table_multi | , |
{ "fe80::69ff:fe50:5845", &prefix64, NULL } | , | ||
{ "2001:db8:3::1", &prefix64, "fe80::1" } | , | ||
{ "2001:db8:5::1", &prefix64, NULL } | , | ||
{ "2001:db8:42::1", &prefix64, "fe80::2" } | , | ||
{ "fd44:9112:6442::69ff:fe50:5845", &prefix64, "fe80::1" } | , | ||
{ "fd70:6ba9:50ae::69ff:fe50:5845", &prefix64, "fe80::3" } | |||
) |
Routing table with multiple addresses and routers.
TABLE | ( | table_unusual | , |
{ "2001:db8:1::1", &prefix48, "fe80::1" } | , | ||
{ "2001:db8:2::1", &prefix126, NULL } | , | ||
{ "2001:db8:3::1", &prefix127, NULL } | , | ||
{ "2001:db8:4::1", &prefix128, NULL } | |||
) |
Routing table with unusual prefix lengths.
|
static |
Report an inet6_ntoa() test result.
addr | IPv6 address |
text | Expected textual representation |
file | Test code file |
line | Test code line |
Definition at line 182 of file ipv6_test.c.
References addr, DBG, inet6_ntoa(), ntohs, okx, and strcmp().
|
static |
Report an inet6_aton() test result.
text | Textual representation |
addr | Expected IPv6 address |
file | Test code file |
line | Test code line |
Definition at line 210 of file ipv6_test.c.
References addr, DBG, inet6_aton(), inet6_ntoa(), memcmp(), and okx.
|
static |
Report an inet6_aton() failure test result.
text | Textual representation |
file | Test code file |
line | Test code line |
Definition at line 233 of file ipv6_test.c.
References inet6_aton(), and okx.
|
static |
Create test routing table.
table | Test routing table |
file | Test code file |
line | Test code line |
Definition at line 249 of file ipv6_test.c.
References address, ipv6_miniroute::address, ipv6_test_table::count, IN6_IS_ADDR_UNSPECIFIED, inet6_aton(), INIT_LIST_HEAD, ipv6_add_miniroute(), ipv6_miniroutes, ipv6_test_netdev, ipv6_test_table::list, list_empty, list_first_entry, list_splice, list_splice_init, memcmp(), NULL, okx, ipv6_miniroute::prefix_len, ipv6_miniroute::prefix_mask, route(), ipv6_miniroute::router, and ipv6_test_table::routes.
|
static |
Report an ipv6_route() test result.
table | Test routing table |
dest | Destination address |
src | Expected source address, or NULL to expect failure |
next | Expected next hop address, or NULL to expect destination |
file | Test code file |
line | Test code line |
Definition at line 325 of file ipv6_test.c.
References ipv6_miniroute::address, DBG, dest, inet6_aton(), inet6_ntoa(), INIT_LIST_HEAD, ipv6_miniroutes, ipv6_route(), ipv6_test_netdev, ipv6_test_table::list, list_splice, list_splice_init, memcmp(), memcpy(), next, NULL, okx, net_device::scope_id, and src.
|
static |
Destroy test routing table.
table | Test routing table |
Definition at line 388 of file ipv6_test.c.
References INIT_LIST_HEAD, ipv6_del_miniroute(), ipv6_miniroutes, ipv6_test_table::list, list_for_each_entry_safe, list_splice, list_splice_init, and tmp.
Referenced by ipv6_test_exec().
|
static |
Perform IPv6 self-tests.
Routing table with a global address
Routing table with multiple addresses and routers
Definition at line 410 of file ipv6_test.c.
References IN6_IS_ADDR_LINKLOCAL, IN6_IS_ADDR_MULTICAST, IN6_IS_ADDR_SITELOCAL, IN6_IS_ADDR_ULA, IN6_IS_ADDR_UNSPECIFIED, inet6_aton_fail_ok, inet6_aton_ok, inet6_ntoa_ok, IPV6, ipv6_route_ok, ipv6_table_del(), ipv6_table_ok, NULL, ok, sample_global, sample_link_local, sample_multicast, sample_site_local, sample_ula, and sample_unspecified.
|
static |
The unspecified IPv6 address.
Definition at line 92 of file ipv6_test.c.
Referenced by ipv6_test_exec().
|
static |
A sample link-local IPv6 address.
Definition at line 98 of file ipv6_test.c.
Referenced by ipv6_test_exec().
|
static |
A sample site-local IPv6 address.
Definition at line 104 of file ipv6_test.c.
Referenced by ipv6_test_exec().
|
static |
A sample ULA IPv6 address.
Definition at line 110 of file ipv6_test.c.
Referenced by ipv6_test_exec().
|
static |
A sample global IPv6 address.
Definition at line 116 of file ipv6_test.c.
Referenced by ipv6_test_exec().
|
static |
A sample multicast IPv6 address.
Definition at line 122 of file ipv6_test.c.
Referenced by ipv6_test_exec().
|
static |
Dummy network device used for routing tests.
Definition at line 128 of file ipv6_test.c.
Referenced by ipv6_route_okx(), and ipv6_table_okx().
struct self_test ipv6_test __self_test |
IPv6 self-test.
Definition at line 592 of file ipv6_test.c.