summaryrefslogtreecommitdiffstats
path: root/lib/nametokva.c
diff options
context:
space:
mode:
authorcy <cy@FreeBSD.org>2013-07-19 05:41:57 +0000
committercy <cy@FreeBSD.org>2013-07-19 05:41:57 +0000
commit672af8808c0e7c15f330b401482f9271c2eb3fa6 (patch)
tree225b5acf68c01bc6a260b386c2b2dbf4fa2839e3 /lib/nametokva.c
parent71e82d94e82560b20789833f60056506de34de8b (diff)
downloadFreeBSD-src-672af8808c0e7c15f330b401482f9271c2eb3fa6.zip
FreeBSD-src-672af8808c0e7c15f330b401482f9271c2eb3fa6.tar.gz
As per the developers handbook (5.3.1 step 1), prepare the vendor trees for
import of new ipfilter vendor sources by flattening them. To keep the tags consistent with dist, the tags are also flattened. Approved by: glebius (Mentor)
Diffstat (limited to 'lib/nametokva.c')
-rw-r--r--lib/nametokva.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/nametokva.c b/lib/nametokva.c
new file mode 100644
index 0000000..89e3474
--- /dev/null
+++ b/lib/nametokva.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2002 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * $Id: nametokva.c,v 1.1.4.1 2006/06/16 17:21:07 darrenr Exp $
+ */
+
+#include "ipf.h"
+
+#include <sys/ioctl.h>
+#include <fcntl.h>
+
+ipfunc_t nametokva(name, iocfunc)
+char *name;
+ioctlfunc_t iocfunc;
+{
+ ipfunc_resolve_t res;
+ int fd;
+
+ strncpy(res.ipfu_name, name, sizeof(res.ipfu_name));
+ res.ipfu_addr = NULL;
+ fd = -1;
+
+ if ((opts & OPT_DONOTHING) == 0) {
+ fd = open(IPL_NAME, O_RDONLY);
+ if (fd == -1)
+ return NULL;
+ }
+ (void) (*iocfunc)(fd, SIOCFUNCL, &res);
+ if (fd >= 0)
+ close(fd);
+ if (res.ipfu_addr == NULL)
+ res.ipfu_addr = (ipfunc_t)-1;
+ return res.ipfu_addr;
+}
OpenPOWER on IntegriCloud