rx: Make rxevent_Put NULL the event ptr being put
[openafs.git] / tests / common / network.c
1 #include <afsconfig.h>
2 #include <afs/param.h>
3
4 #include <roken.h>
5
6 #include <afs/cellconfig.h>
7 #include <rx/rx.h>
8
9 #include <tests/tap/basic.h>
10 #include "common.h"
11
12 /*!
13  * Check if the current machine's hostname resolves to the loopback
14  * network.
15  */
16 int
17 afstest_IsLoopbackNetworkDefault(void)
18 {
19     char hostname[MAXHOSTCHARS];
20     afs_uint32 addr;
21     struct hostent *host;
22
23     gethostname(hostname, sizeof(hostname));
24     host = gethostbyname(hostname);
25     memcpy(&addr, host->h_addr, sizeof(addr));
26
27     return(rx_IsLoopbackAddr(ntohl(addr)));
28 }
29
30 /*!
31  * Skips all TAP tests if the current machine's hostname resolves to the
32  * loopback network.
33  */
34 int
35 afstest_SkipTestsIfLoopbackNetIsDefault(void)
36 {
37     int retval;
38
39     retval = afstest_IsLoopbackNetworkDefault();
40     if (retval == 1) {
41         skip_all("Default IP address is on the loopback network!\n");
42     }
43     return retval;
44 }