summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ipf/lib/common/gethost.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/ipf/lib/common/gethost.c')
-rw-r--r--usr/src/cmd/ipf/lib/common/gethost.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/usr/src/cmd/ipf/lib/common/gethost.c b/usr/src/cmd/ipf/lib/common/gethost.c
index bc5d8975ee..5ecea3adaf 100644
--- a/usr/src/cmd/ipf/lib/common/gethost.c
+++ b/usr/src/cmd/ipf/lib/common/gethost.c
@@ -1,3 +1,8 @@
+/*
+ * Copyright (C) 1993-2005 by Darren Reed.
+ * See the IPFILTER.LICENCE file for details on licencing.
+ */
+
#include "ipf.h"
int gethost(name, hostp)
@@ -5,8 +10,14 @@ char *name;
u_32_t *hostp;
{
struct hostent *h;
+ struct netent *n;
u_32_t addr;
+ if (!strcmp(name, "test.host.dots")) {
+ *hostp = htonl(0xfedcba98);
+ return 0;
+ }
+
if (!strcmp(name, "<thishost>"))
name = thishost;
@@ -18,5 +29,11 @@ u_32_t *hostp;
return 0;
}
}
+
+ n = getnetbyname(name);
+ if (n != NULL) {
+ *hostp = (u_32_t)htonl(n->n_net & 0xffffffff);
+ return 0;
+ }
return -1;
}