summaryrefslogtreecommitdiff
path: root/sbin/ipf/ifaddr.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/ipf/ifaddr.c')
-rw-r--r--sbin/ipf/ifaddr.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/sbin/ipf/ifaddr.c b/sbin/ipf/ifaddr.c
deleted file mode 100644
index 59e3fcf1b8a..00000000000
--- a/sbin/ipf/ifaddr.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: ifaddr.c,v 1.7 2001/01/30 04:26:01 kjell Exp $ */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#include <arpa/inet.h>
-#include <string.h>
-#include <err.h>
-#include "ifaddr.h"
-
-/*
- * if_addr():
- * given a string containing an interface name (e.g. "ppp0")
- * return the IP address it represents
- *
- * The OpenBSD community considers this feature to be quite useful and
- * suggests inclusion into other platforms. The closest alternative is
- * to define /etc/networks with suitable values.
- */
-int if_addr(name, ap)
- char *name;
- struct in_addr *ap;
-{
- struct sockaddr_in *sin;
- struct ifreq ifr;
- int s;
-
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- warn("socket");
- return (0);
- }
-
- strncpy(ifr.ifr_name, name, IFNAMSIZ);
- ifr.ifr_name[IFNAMSIZ - 1] = '\0';
-
- if (ioctl(s, SIOCGIFADDR, &ifr) < 0)
- return (0);
-
- sin = (struct sockaddr_in *)&ifr.ifr_addr;
- *ap = sin->sin_addr;
-
- return (1);
-}