mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
f0a57e9de6
Reformat the loopback tests to match our house style - 4 spaces for first indent, a tab for the second, and so on, opening brace of a function on a newline, spaces around assignments, and so on. Change-Id: I54f168ca143e7ff46c9d82289331b8314849f848 Reviewed-on: http://gerrit.openafs.org/8229 Reviewed-by: Derrick Brashear <shadow@your-file-system.com> Tested-by: BuildBot <buildbot@rampaginggeek.com>
45 lines
888 B
C
45 lines
888 B
C
#include <afsconfig.h>
|
|
#include <afs/param.h>
|
|
|
|
#include <roken.h>
|
|
|
|
#include <afs/cellconfig.h>
|
|
#include <rx/rx.h>
|
|
|
|
#include <tests/tap/basic.h>
|
|
#include "common.h"
|
|
|
|
/*!
|
|
* Check if the current machine's hostname resolves to the loopback
|
|
* network.
|
|
*/
|
|
int
|
|
afstest_IsLoopbackNetworkDefault(void)
|
|
{
|
|
char hostname[MAXHOSTCHARS];
|
|
afs_uint32 addr;
|
|
struct hostent *host;
|
|
|
|
gethostname(hostname, sizeof(hostname));
|
|
host = gethostbyname(hostname);
|
|
memcpy(&addr, host->h_addr, sizeof(addr));
|
|
|
|
return(rx_IsLoopbackAddr(ntohl(addr)));
|
|
}
|
|
|
|
/*!
|
|
* Skips all TAP tests if the current machine's hostname resolves to the
|
|
* loopback network.
|
|
*/
|
|
int
|
|
afstest_SkipTestsIfLoopbackNetIsDefault(void)
|
|
{
|
|
int retval;
|
|
|
|
retval = afstest_IsLoopbackNetworkDefault();
|
|
if (retval == 1) {
|
|
skip_all("Default IP address is on the loopback network!\n");
|
|
}
|
|
return retval;
|
|
}
|