|
@@ -37,6 +37,30 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
37
|
37
|
/** Define inline IPv6 address */
|
38
|
38
|
#define IPV6(...) { __VA_ARGS__ }
|
39
|
39
|
|
|
40
|
+/** The unspecified IPv6 address */
|
|
41
|
+static const struct in6_addr sample_unspecified = {
|
|
42
|
+ .s6_addr = IPV6 ( 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
43
|
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ),
|
|
44
|
+};
|
|
45
|
+
|
|
46
|
+/** A sample link-local IPv6 address */
|
|
47
|
+static const struct in6_addr sample_link_local = {
|
|
48
|
+ .s6_addr = IPV6 ( 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
49
|
+ 0x00, 0x00, 0x69, 0xff, 0xfe, 0x50, 0x58, 0x45 ),
|
|
50
|
+};
|
|
51
|
+
|
|
52
|
+/** A sample global IPv6 address */
|
|
53
|
+static const struct in6_addr sample_global = {
|
|
54
|
+ .s6_addr = IPV6 ( 0x20, 0x01, 0x0b, 0xa8, 0x00, 0x00, 0x01, 0xd4,
|
|
55
|
+ 0x00, 0x00, 0x00, 0x00, 0x69, 0x50, 0x58, 0x45 ),
|
|
56
|
+};
|
|
57
|
+
|
|
58
|
+/** A sample multicast IPv6 address */
|
|
59
|
+static const struct in6_addr sample_multicast = {
|
|
60
|
+ .s6_addr = IPV6 ( 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
61
|
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 ),
|
|
62
|
+};
|
|
63
|
+
|
40
|
64
|
/**
|
41
|
65
|
* Report an inet6_ntoa() test result
|
42
|
66
|
*
|
|
@@ -97,6 +121,20 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
97
|
121
|
*/
|
98
|
122
|
static void ipv6_test_exec ( void ) {
|
99
|
123
|
|
|
124
|
+ /* Address testing macros */
|
|
125
|
+ ok ( IN6_IS_ADDR_UNSPECIFIED ( &sample_unspecified ) );
|
|
126
|
+ ok ( ! IN6_IS_ADDR_UNSPECIFIED ( &sample_link_local ) );
|
|
127
|
+ ok ( ! IN6_IS_ADDR_UNSPECIFIED ( &sample_global ) );
|
|
128
|
+ ok ( ! IN6_IS_ADDR_UNSPECIFIED ( &sample_multicast ) );
|
|
129
|
+ ok ( ! IN6_IS_ADDR_MULTICAST ( &sample_unspecified ) );
|
|
130
|
+ ok ( ! IN6_IS_ADDR_MULTICAST ( &sample_link_local ) );
|
|
131
|
+ ok ( ! IN6_IS_ADDR_MULTICAST ( &sample_global ) );
|
|
132
|
+ ok ( IN6_IS_ADDR_MULTICAST ( &sample_multicast ) );
|
|
133
|
+ ok ( ! IN6_IS_ADDR_LINKLOCAL ( &sample_unspecified ) );
|
|
134
|
+ ok ( IN6_IS_ADDR_LINKLOCAL ( &sample_link_local ) );
|
|
135
|
+ ok ( ! IN6_IS_ADDR_LINKLOCAL ( &sample_global ) );
|
|
136
|
+ ok ( ! IN6_IS_ADDR_LINKLOCAL ( &sample_multicast ) );
|
|
137
|
+
|
100
|
138
|
/* inet6_ntoa() tests */
|
101
|
139
|
inet6_ntoa_ok ( IPV6 ( 0x20, 0x01, 0x0b, 0xa8, 0x00, 0x00, 0x01, 0xd4,
|
102
|
140
|
0x00, 0x00, 0x00, 0x00, 0x69, 0x50, 0x58, 0x45 ),
|