45 #define IPV4(a,b,c,d) \ 46 htonl ( ( (a) << 24 ) | ( (b) << 16 ) | ( (c) << 8 ) | (d) ) 63 DBG (
"inet_ntoa ( %d.%d.%d.%d ) = %s\n",
67 ( (
ntohl (
addr ) >> 0 ) & 0xff ), actual );
68 okx (
strcmp ( actual, text ) == 0, file, line );
70 #define inet_ntoa_ok( addr, text ) \ 71 inet_ntoa_okx ( addr, text, __FILE__, __LINE__ ) 87 DBG (
"inet_aton ( \"%s\" ) = %s\n", text,
inet_ntoa ( actual ) );
90 #define inet_aton_ok( text, addr ) \ 91 inet_aton_okx ( text, addr, __FILE__, __LINE__ ) 101 unsigned int line ) {
107 #define inet_aton_fail_ok( text ) \ 108 inet_aton_fail_okx ( text, __FILE__, __LINE__ ) 124 const char *
src,
int bcast,
125 const char *file,
unsigned int line ) {
131 unsigned int scope_id;
149 scope_id = (
scope ?
scope->netdev->scope_id : 0 );
156 okx ( miniroute !=
NULL, file, line );
157 DBG (
"ipv4_route ( %s, %s ) = %s",
160 DBG (
" from %s via %s\n",
174 == ( !! bcast ), file, line );
179 okx ( miniroute ==
NULL, file, line );
180 DBG (
"ipv4_route ( %s, %s ) = <unreachable>\n",
184 #define ipv4_route_ok( dest, scope, next, egress, src, bcast ) \ 185 ipv4_route_okx ( dest, scope, next, egress, src, bcast, \ 190 {
"dhcp/ip",
"192.168.0.1" },
191 {
"dhcp/netmask",
"255.255.255.0" },
192 {
"dhcp/gateway",
"192.168.0.254" } );
196 {
"dhcp/ip",
"192.168.0.2" },
197 {
"dhcp/netmask",
"255.255.255.0" },
198 {
"dhcp/gateway",
"192.168.0.254" } );
202 {
"ip",
"10.31.31.0" },
203 {
"netmask",
"255.255.255.254" },
204 {
"gateway",
"10.31.31.1" } );
208 {
"ip",
"10.32.32.32" },
209 {
"netmask",
"255.255.255.255" },
210 {
"gateway",
"192.168.32.254" } );
214 {
"ip",
"192.168.86.1" },
215 {
"netmask",
"255.255.240.0" } );
219 {
"ip",
"10.42.0.1" },
220 {
"netmask",
"255.255.0.0" },
221 {
"gateway",
"10.42.0.254" },
223 "19:0a:2b:2b:80:0a:2a:2b:2b:" 224 "10:c0:a8:0a:2a:c0:a8:" 225 "18:c0:a8:00:00:00:00:00:" 226 "00:0a:2a:01:01" } );
273 "192.168.0.10", &net0,
"192.168.0.1", 0 );
275 "192.168.0.254", &net0,
"192.168.0.1", 0 );
277 "192.168.0.255", &net0,
"192.168.0.1", 1 );
283 "192.168.0.254", &net1,
"192.168.0.2", 0 );
286 "192.168.1.3", &net1,
"192.168.1.2", 0 );
292 "10.31.31.1", &net2,
"10.31.31.0", 0 );
294 "10.31.31.1", &net2,
"10.31.31.0", 0 );
300 "192.168.32.254", &net3,
"10.32.32.32", 0 );
302 "192.168.32.254", &net3,
"10.32.32.32", 0 );
308 "192.168.87.1", &net4,
"192.168.86.1", 0 );
318 "192.168.0.9", &net0,
"192.168.0.1", 0 );
320 "10.31.31.1", &net2,
"10.31.31.0", 0 );
324 "192.168.0.9", &net1,
"192.168.0.2", 0 );
326 "10.31.31.1", &net2,
"10.31.31.0", 0 );
329 "192.168.0.254", &net1,
"192.168.0.2", 0 );
333 "192.168.0.254", &net0,
"192.168.0.1", 0 );
337 "10.31.31.1", &net2,
"10.31.31.0", 0 );
345 "10.42.99.0", &net5,
"10.42.0.1", 0 );
347 "10.42.1.1", &net5,
"10.42.0.1", 0 );
349 "10.42.1.1", &net5,
"10.42.0.1", 0 );
351 "10.42.43.43", &net5,
"10.42.0.1", 0 );
353 "10.42.192.168", &net5,
"10.42.0.1", 0 );
355 "192.168.0.8", &net5,
"10.42.0.1", 0 );
357 "192.168.0.255", &net5,
"10.42.0.1", 1 );
#define ipv4_route_ok(dest, scope, next, egress, src, bcast)
#define IN_IS_CLASSA(addr)
struct device dev
Dummy physical device.
#define testnet_set_ok(testnet, name, value)
Report a network device setting test result.
#define testnet_open_ok(testnet)
Report a network device opening test result.
struct net_device * netdev
Network device.
struct net_device * netdev
Network device.
#define IN_IS_CLASSB(addr)
#define testnet_remove_ok(testnet)
Report a network device removal test result.
Self-test infrastructure.
const char * name
Test set name.
#define testnet_close_ok(testnet)
Report a network device closing test result.
struct in_addr address
IPv4 address.
struct in_addr hostmask
Host mask.
static void inet_ntoa_okx(uint32_t addr, const char *text, const char *file, unsigned int line)
Report an inet_ntoa() test result.
struct self_test ipv4_test __self_test
IPv4 self-test.
#define okx(success, file, line)
Report test result.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
An IPv4 address/routing table entry.
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.
#define inet_aton_ok(text, addr)
struct ipv4_miniroute * ipv4_route(unsigned int scope_id, struct in_addr *dest)
Perform IPv4 routing.
uint32_t addr
Buffer address.
int inet_aton(const char *string, struct in_addr *in)
Parse IPv4 address.
char * inet_ntoa(struct in_addr in)
Convert IPv4 address to dotted-quad notation.
#define inet_ntoa_ok(addr, text)
static void inet_aton_fail_okx(const char *text, const char *file, unsigned int line)
Report an inet_aton() failure test result.
uint32_t next
Next descriptor address.
#define testnet_ok(testnet)
Report a network device creation test result.
#define IPV4(a, b, c, d)
Define inline IPv4 address.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
int strcmp(const char *first, const char *second)
Compare strings.
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
#define inet_aton_fail_ok(text)
#define IN_IS_MULTICAST(addr)
static void ipv4_test_exec(void)
Perform IPv4 self-tests.
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)
#define IN_IS_CLASSC(addr)
#define DBG(...)
Print a debugging message.
#define NULL
NULL pointer (VOID *)
static void inet_aton_okx(const char *text, uint32_t addr, const char *file, unsigned int line)
Report an inet_aton() test result.