summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dispatch.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2012-06-24 16:01:19 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2012-06-24 16:01:19 +0000
commit03c9f4e68367b75f6c3a2dc21ff459c891eb7ebe (patch)
tree8444999bfe7b0e115b41c4ffde41853ee6d06a86 /sbin/dhclient/dispatch.c
parentc090cde0fbe9c5a32b2a7cbb2472ec07ffcfa58c (diff)
Nuke interface_link_status() (check media status only) and use
interface_status() (check IFF_UP|IFF_RUNNING and media status). The interface is forced up when dhclient starts so the flags should be correct. Thanks to guenther@ for pointing out the original raison d'etre of the difference between the two.
Diffstat (limited to 'sbin/dhclient/dispatch.c')
-rw-r--r--sbin/dhclient/dispatch.c33
1 files changed, 1 insertions, 32 deletions
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c
index 206cef12f36..6bc23353711 100644
--- a/sbin/dhclient/dispatch.c
+++ b/sbin/dhclient/dispatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dispatch.c,v 1.50 2012/06/22 01:01:59 krw Exp $ */
+/* $OpenBSD: dispatch.c,v 1.51 2012/06/24 16:01:18 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -400,37 +400,6 @@ cancel_timeout(void (*where)(void))
}
int
-interface_link_status(char *ifname)
-{
- struct ifmediareq ifmr;
- int sock;
-
- if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
- error("Can't create socket");
-
- memset(&ifmr, 0, sizeof(ifmr));
- strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name));
- if (ioctl(sock, SIOCGIFMEDIA, (caddr_t)&ifmr) == -1) {
- /* EINVAL/ENOTTY -> link state unknown. treat as active */
-#ifdef DEBUG
- if (errno != EINVAL && errno != ENOTTY)
- debug("ioctl(SIOCGIFMEDIA) on %s: %m", ifname);
-#endif
- close(sock);
- return (1);
- }
- close(sock);
-
- if (ifmr.ifm_status & IFM_AVALID) {
- if (ifmr.ifm_status & IFM_ACTIVE)
- return (1);
- else
- return (0);
- }
- return (1);
-}
-
-int
get_rdomain(char *name)
{
int rv = 0, s;