iPXE
Macros | Functions | Variables
ipv4_test.c File Reference

IPv4 tests. More...

#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <byteswap.h>
#include <ipxe/in.h>
#include <ipxe/ip.h>
#include <ipxe/test.h>
#include "netdev_test.h"

Go to the source code of this file.

Macros

#define IPV4(a, b, c, d)   htonl ( ( (a) << 24 ) | ( (b) << 16 ) | ( (c) << 8 ) | (d) )
 Define inline IPv4 address. More...
 
#define inet_ntoa_ok(addr, text)   inet_ntoa_okx ( addr, text, __FILE__, __LINE__ )
 
#define inet_aton_ok(text, addr)   inet_aton_okx ( text, addr, __FILE__, __LINE__ )
 
#define inet_aton_fail_ok(text)   inet_aton_fail_okx ( text, __FILE__, __LINE__ )
 
#define ipv4_route_ok(dest, scope, next, egress, src, bcast)
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static void inet_ntoa_okx (uint32_t addr, const char *text, const char *file, unsigned int line)
 Report an inet_ntoa() test result. More...
 
static void inet_aton_okx (const char *text, uint32_t addr, const char *file, unsigned int line)
 Report an inet_aton() test result. More...
 
static void inet_aton_fail_okx (const char *text, const char *file, unsigned int line)
 Report an inet_aton() failure test result. More...
 
static void ipv4_route_okx (const char *dest, struct testnet *scope, const char *next, struct testnet *egress, const char *src, int bcast, const char *file, unsigned int line)
 Report an ipv4_route() test result. More...
 
 TESTNET (net0, { "dhcp/ip", "192.168.0.1" }, { "dhcp/netmask", "255.255.255.0" }, { "dhcp/gateway", "192.168.0.254" })
 net0: Single address and gateway (DHCP assignment) More...
 
 TESTNET (net1, { "dhcp/ip", "192.168.0.2" }, { "dhcp/netmask", "255.255.255.0" }, { "dhcp/gateway", "192.168.0.254" })
 net1: Single address and gateway (DHCP assignment) More...
 
 TESTNET (net2, { "ip", "10.31.31.0" }, { "netmask", "255.255.255.254" }, { "gateway", "10.31.31.1" })
 net2: Small /31 subnet mask More...
 
 TESTNET (net3, { "ip", "10.32.32.32" }, { "netmask", "255.255.255.255" }, { "gateway", "192.168.32.254" })
 net3: Small /32 subnet mask More...
 
 TESTNET (net4, { "ip", "192.168.86.1" }, { "netmask", "255.255.240.0" })
 net4: Local subnet with no gateway More...
 
 TESTNET (net5, { "ip", "10.42.0.1" }, { "netmask", "255.255.0.0" }, { "gateway", "10.42.0.254" }, { "static-routes", "19:0a:2b:2b:80:0a:2a:2b:2b:" "10:c0:a8:0a:2a:c0:a8:" "18:c0:a8:00:00:00:00:00:" "00:0a:2a:01:01" })
 net5: Static routes More...
 
static void ipv4_test_exec (void)
 Perform IPv4 self-tests. More...
 

Variables

struct self_test ipv4_test __self_test
 IPv4 self-test. More...
 

Detailed Description

IPv4 tests.

Definition in file ipv4_test.c.

Macro Definition Documentation

◆ IPV4

#define IPV4 (   a,
  b,
  c,
 
)    htonl ( ( (a) << 24 ) | ( (b) << 16 ) | ( (c) << 8 ) | (d) )

Define inline IPv4 address.

Definition at line 45 of file ipv4_test.c.

◆ inet_ntoa_ok

#define inet_ntoa_ok (   addr,
  text 
)    inet_ntoa_okx ( addr, text, __FILE__, __LINE__ )

Definition at line 70 of file ipv4_test.c.

◆ inet_aton_ok

#define inet_aton_ok (   text,
  addr 
)    inet_aton_okx ( text, addr, __FILE__, __LINE__ )

Definition at line 90 of file ipv4_test.c.

◆ inet_aton_fail_ok

#define inet_aton_fail_ok (   text)    inet_aton_fail_okx ( text, __FILE__, __LINE__ )

Definition at line 107 of file ipv4_test.c.

◆ ipv4_route_ok

#define ipv4_route_ok (   dest,
  scope,
  next,
  egress,
  src,
  bcast 
)
Value:
ipv4_route_okx ( dest, scope, next, egress, src, bcast, \
__FILE__, __LINE__ )
uint8_t scope
Scope.
Definition: ena.h:18
static const void * src
Definition: string.h:47
static void ipv4_route_okx(const char *dest, struct testnet *scope, const char *next, struct testnet *egress, const char *src, int bcast, const char *file, unsigned int line)
Report an ipv4_route() test result.
Definition: ipv4_test.c:122
uint32_t next
Next descriptor address.
Definition: dwmac.h:22
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
Definition: string.h:150

Definition at line 184 of file ipv4_test.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ inet_ntoa_okx()

static void inet_ntoa_okx ( uint32_t  addr,
const char *  text,
const char *  file,
unsigned int  line 
)
static

Report an inet_ntoa() test result.

Parameters
addrIPv4 address
textExpected textual representation
fileTest code file
lineTest code line

Definition at line 56 of file ipv4_test.c.

57  {
58  struct in_addr in = { .s_addr = addr };
59  char *actual;
60 
61  /* Format address */
62  actual = inet_ntoa ( in );
63  DBG ( "inet_ntoa ( %d.%d.%d.%d ) = %s\n",
64  ( ( ntohl ( addr ) >> 24 ) & 0xff ),
65  ( ( ntohl ( addr ) >> 16 ) & 0xff ),
66  ( ( ntohl ( addr ) >> 8 ) & 0xff ),
67  ( ( ntohl ( addr ) >> 0 ) & 0xff ), actual );
68  okx ( strcmp ( actual, text ) == 0, file, line );
69 }
__be32 in[4]
Definition: CIB_PRM.h:35
#define ntohl(value)
Definition: byteswap.h:134
#define okx(success, file, line)
Report test result.
Definition: test.h:44
IP address structure.
Definition: in.h:41
uint32_t addr
Buffer address.
Definition: dwmac.h:20
char * inet_ntoa(struct in_addr in)
Convert IPv4 address to dotted-quad notation.
Definition: ipv4.c:813
int strcmp(const char *first, const char *second)
Compare strings.
Definition: string.c:173
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498

References addr, DBG, in, inet_ntoa(), ntohl, okx, and strcmp().

◆ inet_aton_okx()

static void inet_aton_okx ( const char *  text,
uint32_t  addr,
const char *  file,
unsigned int  line 
)
static

Report an inet_aton() test result.

Parameters
textTextual representation
addrExpected IPv4 address
fileTest code file
lineTest code line

Definition at line 81 of file ipv4_test.c.

82  {
83  struct in_addr actual;
84 
85  /* Parse address */
86  okx ( inet_aton ( text, &actual ) != 0, file, line );
87  DBG ( "inet_aton ( \"%s\" ) = %s\n", text, inet_ntoa ( actual ) );
88  okx ( actual.s_addr == addr, file, line );
89 };
#define okx(success, file, line)
Report test result.
Definition: test.h:44
IP address structure.
Definition: in.h:41
uint32_t addr
Buffer address.
Definition: dwmac.h:20
int inet_aton(const char *string, struct in_addr *in)
Parse IPv4 address.
Definition: ipv4.c:786
char * inet_ntoa(struct in_addr in)
Convert IPv4 address to dotted-quad notation.
Definition: ipv4.c:813
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498

References addr, DBG, inet_aton(), inet_ntoa(), okx, and in_addr::s_addr.

◆ inet_aton_fail_okx()

static void inet_aton_fail_okx ( const char *  text,
const char *  file,
unsigned int  line 
)
static

Report an inet_aton() failure test result.

Parameters
textTextual representation
fileTest code file
lineTest code line

Definition at line 100 of file ipv4_test.c.

101  {
102  struct in_addr actual;
103 
104  /* Attempt to parse address */
105  okx ( inet_aton ( text, &actual ) == 0, file, line );
106 }
#define okx(success, file, line)
Report test result.
Definition: test.h:44
IP address structure.
Definition: in.h:41
int inet_aton(const char *string, struct in_addr *in)
Parse IPv4 address.
Definition: ipv4.c:786

References inet_aton(), and okx.

◆ ipv4_route_okx()

static void ipv4_route_okx ( const char *  dest,
struct testnet scope,
const char *  next,
struct testnet egress,
const char *  src,
int  bcast,
const char *  file,
unsigned int  line 
)
static

Report an ipv4_route() test result.

Parameters
destDestination address
scopeDestination scope test network device, or NULL
nextExpected next hop address (on success)
egressExpected egress device, or NULL to expect failure
srcExpected source address (on success)
bcastExpected broadcast packet (on success)
fileTest code file
lineTest code line

Definition at line 122 of file ipv4_test.c.

125  {
126  struct ipv4_miniroute *miniroute;
127  struct in_addr in_dest;
128  struct in_addr in_src;
129  struct in_addr in_next;
130  struct in_addr actual;
131  unsigned int scope_id;
132 
133  /* Sanity checks */
134  assert ( ( scope == NULL ) || ( scope->netdev != NULL ) );
135  assert ( ( egress == NULL ) == ( src == NULL ) );
136 
137  /* Parse addresses */
138  okx ( inet_aton ( dest, &in_dest ) != 0, file, line );
139  if ( src )
140  okx ( inet_aton ( src, &in_src ) != 0, file, line );
141  if ( next ) {
142  okx ( inet_aton ( next, &in_next ) != 0, file, line );
143  } else {
144  in_next.s_addr = in_dest.s_addr;
145  }
146 
147  /* Perform routing */
148  actual.s_addr = in_dest.s_addr;
149  scope_id = ( scope ? scope->netdev->scope_id : 0 );
150  miniroute = ipv4_route ( scope_id, &actual );
151 
152  /* Validate result */
153  if ( src ) {
154 
155  /* Check that a route was found */
156  okx ( miniroute != NULL, file, line );
157  DBG ( "ipv4_route ( %s, %s ) = %s",
158  ( scope ? scope->dev.name : "<any>" ), dest,
159  inet_ntoa ( actual ) );
160  DBG ( " from %s via %s\n",
161  inet_ntoa ( miniroute->address ), egress->dev.name );
162 
163  /* Check that expected network device was used */
164  okx ( miniroute->netdev == egress->netdev, file, line );
165 
166  /* Check that expected source address was used */
167  okx ( miniroute->address.s_addr == in_src.s_addr, file, line );
168 
169  /* Check that expected next hop address was used */
170  okx ( actual.s_addr == in_next.s_addr, file, line );
171 
172  /* Check that expected broadcast choice was used */
173  okx ( ( ! ( ( ~actual.s_addr ) & miniroute->hostmask.s_addr ) )
174  == ( !! bcast ), file, line );
175 
176  } else {
177 
178  /* Routing is expected to fail */
179  okx ( miniroute == NULL, file, line );
180  DBG ( "ipv4_route ( %s, %s ) = <unreachable>\n",
181  ( scope ? scope->dev.name : "<any>" ), dest );
182  }
183 }
struct device dev
Dummy physical device.
Definition: netdev_test.h:28
uint8_t scope
Scope.
Definition: ena.h:18
struct net_device * netdev
Network device.
Definition: ip.h:72
struct net_device * netdev
Network device.
Definition: netdev_test.h:26
char name[40]
Name.
Definition: device.h:78
struct in_addr address
IPv4 address.
Definition: ip.h:83
struct in_addr hostmask
Host mask.
Definition: ip.h:133
#define okx(success, file, line)
Report test result.
Definition: test.h:44
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static const void * src
Definition: string.h:47
An IPv4 address/routing table entry.
Definition: ip.h:63
struct ipv4_miniroute * ipv4_route(unsigned int scope_id, struct in_addr *dest)
Perform IPv4 routing.
Definition: ipv4.c:309
IP address structure.
Definition: in.h:41
int inet_aton(const char *string, struct in_addr *in)
Parse IPv4 address.
Definition: ipv4.c:786
char * inet_ntoa(struct in_addr in)
Convert IPv4 address to dotted-quad notation.
Definition: ipv4.c:813
uint32_t next
Next descriptor address.
Definition: dwmac.h:22
uint32_t s_addr
Definition: in.h:42
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
Definition: string.h:150
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References ipv4_miniroute::address, assert(), DBG, dest, testnet::dev, ipv4_miniroute::hostmask, inet_aton(), inet_ntoa(), ipv4_route(), device::name, testnet::netdev, ipv4_miniroute::netdev, next, NULL, okx, in_addr::s_addr, scope, and src.

◆ TESTNET() [1/6]

TESTNET ( net0  ,
{ "dhcp/ip", "192.168.0.1" }  ,
{ "dhcp/netmask", "255.255.255.0" }  ,
{ "dhcp/gateway", "192.168.0.254" }   
)

net0: Single address and gateway (DHCP assignment)

◆ TESTNET() [2/6]

TESTNET ( net1  ,
{ "dhcp/ip", "192.168.0.2" }  ,
{ "dhcp/netmask", "255.255.255.0" }  ,
{ "dhcp/gateway", "192.168.0.254" }   
)

net1: Single address and gateway (DHCP assignment)

◆ TESTNET() [3/6]

TESTNET ( net2  ,
{ "ip", "10.31.31.0" }  ,
{ "netmask", "255.255.255.254" }  ,
{ "gateway", "10.31.31.1" }   
)

net2: Small /31 subnet mask

◆ TESTNET() [4/6]

TESTNET ( net3  ,
{ "ip", "10.32.32.32" }  ,
{ "netmask", "255.255.255.255" }  ,
{ "gateway", "192.168.32.254" }   
)

net3: Small /32 subnet mask

◆ TESTNET() [5/6]

TESTNET ( net4  ,
{ "ip", "192.168.86.1" }  ,
{ "netmask", "255.255.240.0" }   
)

net4: Local subnet with no gateway

◆ TESTNET() [6/6]

TESTNET ( net5  ,
{ "ip", "10.42.0.1" }  ,
{ "netmask", "255.255.0.0" }  ,
{ "gateway", "10.42.0.254" }  ,
{ "static-routes", "19:0a:2b:2b:80:0a:2a:2b:2b:" "10:c0:a8:0a:2a:c0:a8:" "18:c0:a8:00:00:00:00:00:" "00:0a:2a:01:01" }   
)

net5: Static routes

◆ ipv4_test_exec()

static void ipv4_test_exec ( void  )
static

Perform IPv4 self-tests.

Definition at line 232 of file ipv4_test.c.

232  {
233 
234  /* Address testing macros */
235  ok ( IN_IS_CLASSA ( IPV4 ( 10, 0, 0, 1 ) ) );
236  ok ( ! IN_IS_CLASSB ( IPV4 ( 10, 0, 0, 1 ) ) );
237  ok ( ! IN_IS_CLASSC ( IPV4 ( 10, 0, 0, 1 ) ) );
238  ok ( ! IN_IS_CLASSA ( IPV4 ( 172, 16, 0, 1 ) ) );
239  ok ( IN_IS_CLASSB ( IPV4 ( 172, 16, 0, 1 ) ) );
240  ok ( ! IN_IS_CLASSC ( IPV4 ( 172, 16, 0, 1 ) ) );
241  ok ( ! IN_IS_CLASSA ( IPV4 ( 192, 168, 0, 1 ) ) );
242  ok ( ! IN_IS_CLASSB ( IPV4 ( 192, 168, 0, 1 ) ) );
243  ok ( IN_IS_CLASSC ( IPV4 ( 192, 168, 0, 1 ) ) );
244  ok ( ! IN_IS_MULTICAST ( IPV4 ( 127, 0, 0, 1 ) ) );
245  ok ( ! IN_IS_MULTICAST ( IPV4 ( 8, 8, 8, 8 ) ) );
246  ok ( ! IN_IS_MULTICAST ( IPV4 ( 0, 0, 0, 0 ) ) );
247  ok ( ! IN_IS_MULTICAST ( IPV4 ( 223, 0, 0, 1 ) ) );
248  ok ( ! IN_IS_MULTICAST ( IPV4 ( 240, 0, 0, 1 ) ) );
249  ok ( IN_IS_MULTICAST ( IPV4 ( 224, 0, 0, 1 ) ) );
250  ok ( IN_IS_MULTICAST ( IPV4 ( 231, 89, 0, 2 ) ) );
251  ok ( IN_IS_MULTICAST ( IPV4 ( 239, 6, 1, 17 ) ) );
252 
253  /* inet_ntoa() tests */
254  inet_ntoa_ok ( IPV4 ( 127, 0, 0, 1 ), "127.0.0.1" );
255  inet_ntoa_ok ( IPV4 ( 0, 0, 0, 0 ), "0.0.0.0" );
256  inet_ntoa_ok ( IPV4 ( 255, 255, 255, 255 ), "255.255.255.255" );
257  inet_ntoa_ok ( IPV4 ( 212, 13, 204, 60 ), "212.13.204.60" );
258 
259  /* inet_aton() tests */
260  inet_aton_ok ( "212.13.204.60", IPV4 ( 212, 13, 204, 60 ) );
261  inet_aton_ok ( "127.0.0.1", IPV4 ( 127, 0, 0, 1 ) );
262 
263  /* inet_aton() failure tests */
264  inet_aton_fail_ok ( "256.0.0.1" ); /* Byte out of range */
265  inet_aton_fail_ok ( "212.13.204.60.1" ); /* Too long */
266  inet_aton_fail_ok ( "127.0.0" ); /* Too short */
267  inet_aton_fail_ok ( "1.2.3.a" ); /* Invalid characters */
268  inet_aton_fail_ok ( "127.0..1" ); /* Missing bytes */
269 
270  /* Single address and gateway */
271  testnet_ok ( &net0 );
272  ipv4_route_ok ( "192.168.0.10", NULL,
273  "192.168.0.10", &net0, "192.168.0.1", 0 );
274  ipv4_route_ok ( "10.0.0.6", NULL,
275  "192.168.0.254", &net0, "192.168.0.1", 0 );
276  ipv4_route_ok ( "192.168.0.255", NULL,
277  "192.168.0.255", &net0, "192.168.0.1", 1 );
278  testnet_remove_ok ( &net0 );
279 
280  /* Overridden DHCP-assigned address */
281  testnet_ok ( &net1 );
282  ipv4_route_ok ( "192.168.1.3", NULL,
283  "192.168.0.254", &net1, "192.168.0.2", 0 );
284  testnet_set_ok ( &net1, "ip", "192.168.1.2" );
285  ipv4_route_ok ( "192.168.1.3", NULL,
286  "192.168.1.3", &net1, "192.168.1.2", 0 );
287  testnet_remove_ok ( &net1 );
288 
289  /* Small /31 subnet */
290  testnet_ok ( &net2 );
291  ipv4_route_ok ( "10.31.31.1", NULL,
292  "10.31.31.1", &net2, "10.31.31.0", 0 );
293  ipv4_route_ok ( "212.13.204.60", NULL,
294  "10.31.31.1", &net2, "10.31.31.0", 0 );
295  testnet_remove_ok ( &net2 );
296 
297  /* Small /32 subnet */
298  testnet_ok ( &net3 );
299  ipv4_route_ok ( "10.32.32.31", NULL,
300  "192.168.32.254", &net3, "10.32.32.32", 0 );
301  ipv4_route_ok ( "8.8.8.8", NULL,
302  "192.168.32.254", &net3, "10.32.32.32", 0 );
303  testnet_remove_ok ( &net3 );
304 
305  /* No gateway */
306  testnet_ok ( &net4 );
307  ipv4_route_ok ( "192.168.87.1", NULL,
308  "192.168.87.1", &net4, "192.168.86.1", 0 );
309  ipv4_route_ok ( "192.168.96.1", NULL, NULL, NULL, NULL, 0 );
310  testnet_remove_ok ( &net4 );
311 
312  /* Multiple interfaces */
313  testnet_ok ( &net0 );
314  testnet_ok ( &net1 );
315  testnet_ok ( &net2 );
316  testnet_close_ok ( &net1 );
317  ipv4_route_ok ( "192.168.0.9", NULL,
318  "192.168.0.9", &net0, "192.168.0.1", 0 );
319  ipv4_route_ok ( "10.31.31.1", NULL,
320  "10.31.31.1", &net2, "10.31.31.0", 0 );
321  testnet_close_ok ( &net0 );
322  testnet_open_ok ( &net1 );
323  ipv4_route_ok ( "192.168.0.9", NULL,
324  "192.168.0.9", &net1, "192.168.0.2", 0 );
325  ipv4_route_ok ( "10.31.31.1", NULL,
326  "10.31.31.1", &net2, "10.31.31.0", 0 );
327  testnet_close_ok ( &net2 );
328  ipv4_route_ok ( "8.8.8.8", NULL,
329  "192.168.0.254", &net1, "192.168.0.2", 0 );
330  testnet_close_ok ( &net1 );
331  testnet_open_ok ( &net0 );
332  ipv4_route_ok ( "8.8.8.8", NULL,
333  "192.168.0.254", &net0, "192.168.0.1", 0 );
334  testnet_close_ok ( &net0 );
335  testnet_open_ok ( &net2 );
336  ipv4_route_ok ( "8.8.8.8", NULL,
337  "10.31.31.1", &net2, "10.31.31.0", 0 );
338  testnet_remove_ok ( &net2 );
339  testnet_remove_ok ( &net1 );
340  testnet_remove_ok ( &net0 );
341 
342  /* Static routes */
343  testnet_ok ( &net5 );
344  ipv4_route_ok ( "10.42.99.0", NULL,
345  "10.42.99.0", &net5, "10.42.0.1", 0 );
346  ipv4_route_ok ( "8.8.8.8", NULL,
347  "10.42.1.1", &net5, "10.42.0.1", 0 );
348  ipv4_route_ok ( "10.43.43.1", NULL,
349  "10.42.1.1", &net5, "10.42.0.1", 0 );
350  ipv4_route_ok ( "10.43.43.129", NULL,
351  "10.42.43.43", &net5, "10.42.0.1", 0 );
352  ipv4_route_ok ( "192.168.54.8", NULL,
353  "10.42.192.168", &net5, "10.42.0.1", 0 );
354  ipv4_route_ok ( "192.168.0.8", NULL,
355  "192.168.0.8", &net5, "10.42.0.1", 0 );
356  ipv4_route_ok ( "192.168.0.255", NULL,
357  "192.168.0.255", &net5, "10.42.0.1", 1 );
358  testnet_remove_ok ( &net5 );
359 }
#define ipv4_route_ok(dest, scope, next, egress, src, bcast)
Definition: ipv4_test.c:184
#define IN_IS_CLASSA(addr)
Definition: in.h:27
#define testnet_set_ok(testnet, name, value)
Report a network device setting test result.
Definition: netdev_test.h:85
#define testnet_open_ok(testnet)
Report a network device opening test result.
Definition: netdev_test.h:73
#define IN_IS_CLASSB(addr)
Definition: in.h:29
#define testnet_remove_ok(testnet)
Report a network device removal test result.
Definition: netdev_test.h:106
#define testnet_close_ok(testnet)
Report a network device closing test result.
Definition: netdev_test.h:96
#define inet_aton_ok(text, addr)
Definition: ipv4_test.c:90
#define inet_ntoa_ok(addr, text)
Definition: ipv4_test.c:70
#define testnet_ok(testnet)
Report a network device creation test result.
Definition: netdev_test.h:64
#define IPV4(a, b, c, d)
Define inline IPv4 address.
Definition: ipv4_test.c:45
#define inet_aton_fail_ok(text)
Definition: ipv4_test.c:107
#define IN_IS_MULTICAST(addr)
Definition: in.h:33
#define IN_IS_CLASSC(addr)
Definition: in.h:31
#define ok(success)
Definition: test.h:46
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References IN_IS_CLASSA, IN_IS_CLASSB, IN_IS_CLASSC, IN_IS_MULTICAST, inet_aton_fail_ok, inet_aton_ok, inet_ntoa_ok, IPV4, ipv4_route_ok, NULL, ok, testnet_close_ok, testnet_ok, testnet_open_ok, testnet_remove_ok, and testnet_set_ok.

Variable Documentation

◆ __self_test

struct self_test ipv4_test __self_test
Initial value:
= {
.name = "ipv4",
.exec = ipv4_test_exec,
}
static void ipv4_test_exec(void)
Perform IPv4 self-tests.
Definition: ipv4_test.c:232

IPv4 self-test.

Definition at line 362 of file ipv4_test.c.