include @TOP_OBJDIR@/src/config/Makefile.config
include @TOP_OBJDIR@/src/config/Makefile.pthread
-MODULE_CFLAGS=-I$(srcdir)/..
+MODULE_CFLAGS=-I$(srcdir)/.. -I$(srcdir)/../..
+CFLAGS_network.o = -Wno-strict-prototypes
-all check test tests: config.o servers.o ubik.o rxkad.o
+all check test tests: config.o servers.o ubik.o rxkad.o network.o
clean:
rm -f *.o
struct rx_securityClass *secClass,
int secIndex,
struct ubik_client **ubikClient);
+
+/* network.c */
+extern int afstest_IsLoopbackNetworkDefault(void);
+extern int afstest_SkipTestsIfLoopbackNetIsDefault(void);
--- /dev/null
+#include <afsconfig.h>
+#include <afs/param.h>
+#include <afs/cellconfig.h>
+#include <rx/rx.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <netdb.h>
+#include <string.h>
+
+#include <tests/tap/basic.h>
+#include "common.h"
+
+extern int h_errno;
+
+/*! 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=0;
+ retval=afstest_IsLoopbackNetworkDefault();
+ if(retval==1) {
+ skip_all("Default IP address is on the loopback network!\n");
+ }
+
+ return retval;
+}