2012-09-22 04:14:37 +01:00
|
|
|
#include <afsconfig.h>
|
|
|
|
#include <afs/param.h>
|
2012-10-10 14:42:21 +01:00
|
|
|
|
|
|
|
#include <roken.h>
|
|
|
|
|
2012-09-22 04:14:37 +01:00
|
|
|
#include <afs/cellconfig.h>
|
|
|
|
#include <rx/rx.h>
|
|
|
|
|
|
|
|
#include <tests/tap/basic.h>
|
|
|
|
#include "common.h"
|
|
|
|
|
2012-10-10 14:45:03 +01:00
|
|
|
/*!
|
|
|
|
* Check if the current machine's hostname resolves to the loopback
|
2012-09-22 04:14:37 +01:00
|
|
|
* network.
|
|
|
|
*/
|
|
|
|
int
|
2012-10-10 14:45:03 +01:00
|
|
|
afstest_IsLoopbackNetworkDefault(void)
|
|
|
|
{
|
|
|
|
char hostname[MAXHOSTCHARS];
|
|
|
|
afs_uint32 addr;
|
|
|
|
struct hostent *host;
|
2012-09-22 04:14:37 +01:00
|
|
|
|
2012-10-10 14:45:03 +01:00
|
|
|
gethostname(hostname, sizeof(hostname));
|
|
|
|
host = gethostbyname(hostname);
|
|
|
|
memcpy(&addr, host->h_addr, sizeof(addr));
|
2012-09-22 04:14:37 +01:00
|
|
|
|
2012-10-10 14:45:03 +01:00
|
|
|
return(rx_IsLoopbackAddr(ntohl(addr)));
|
2012-09-22 04:14:37 +01:00
|
|
|
}
|
|
|
|
|
2012-10-10 14:45:03 +01:00
|
|
|
/*!
|
|
|
|
* Skips all TAP tests if the current machine's hostname resolves to the
|
2012-09-22 04:14:37 +01:00
|
|
|
* loopback network.
|
|
|
|
*/
|
|
|
|
int
|
2012-10-10 14:45:03 +01:00
|
|
|
afstest_SkipTestsIfLoopbackNetIsDefault(void)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
retval = afstest_IsLoopbackNetworkDefault();
|
|
|
|
if (retval == 1) {
|
|
|
|
skip_all("Default IP address is on the loopback network!\n");
|
|
|
|
}
|
|
|
|
return retval;
|
2012-09-22 04:14:37 +01:00
|
|
|
}
|