summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dispatch.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2017-07-24 17:15:42 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2017-07-24 17:15:42 +0000
commit5b0d8e3b0a2d62233959d1fd990018c2c58adf2b (patch)
treedb28a6365b9fe9e6c6b93554115f1eaf4817e2ee /sbin/dhclient/dispatch.c
parentb84655eb18ef8086ff4f9e7debecbe62452e5857 (diff)
Shuffle some declarations and functions into the only
files they are used in. Tweak a bunch of whitespace.
Diffstat (limited to 'sbin/dhclient/dispatch.c')
-rw-r--r--sbin/dhclient/dispatch.c101
1 files changed, 1 insertions, 100 deletions
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c
index 6536c2c6fb6..9c77cbb7569 100644
--- a/sbin/dhclient/dispatch.c
+++ b/sbin/dhclient/dispatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dispatch.c,v 1.134 2017/07/14 16:21:03 krw Exp $ */
+/* $OpenBSD: dispatch.c,v 1.135 2017/07/24 17:15:41 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -46,9 +46,7 @@
#include <net/if.h>
#include <net/if_arp.h>
-#include <net/if_dl.h>
#include <net/if_media.h>
-#include <net/if_types.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
@@ -74,49 +72,6 @@
void packethandler(struct interface_info *ifi);
-void
-get_hw_address(struct interface_info *ifi)
-{
- struct ifaddrs *ifap, *ifa;
- struct sockaddr_dl *sdl;
- struct if_data *ifdata;
- int found;
-
- if (getifaddrs(&ifap) != 0)
- fatalx("getifaddrs failed");
-
- found = 0;
- for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
- if ((ifa->ifa_flags & IFF_LOOPBACK) ||
- (ifa->ifa_flags & IFF_POINTOPOINT))
- continue;
-
- if (strcmp(ifi->name, ifa->ifa_name) != 0)
- continue;
- found = 1;
-
- if (ifa->ifa_addr->sa_family != AF_LINK)
- continue;
-
- sdl = (struct sockaddr_dl *)ifa->ifa_addr;
- if (sdl->sdl_type != IFT_ETHER ||
- sdl->sdl_alen != ETHER_ADDR_LEN)
- continue;
-
- ifdata = ifa->ifa_data;
- ifi->rdomain = ifdata->ifi_rdomain;
-
- memcpy(ifi->hw_address.ether_addr_octet, LLADDR(sdl),
- ETHER_ADDR_LEN);
- ifi->flags |= IFI_VALID_LLADDR;
- }
-
- if (found == 0)
- fatalx("%s: no such interface", ifi->name);
-
- freeifaddrs(ifap);
-}
-
/*
* Loop waiting for packets, timeouts or routing messages.
*/
@@ -330,60 +285,6 @@ packethandler(struct interface_info *ifi)
}
void
-interface_link_forceup(char *name, int ioctlfd)
-{
- struct ifreq ifr;
-
- memset(&ifr, 0, sizeof(ifr));
- strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- if (ioctl(ioctlfd, SIOCGIFFLAGS, (caddr_t)&ifr) == -1) {
- log_warn("SIOCGIFFLAGS");
- return;
- }
-
- /* Force it up if it isn't already. */
- if ((ifr.ifr_flags & IFF_UP) == 0) {
- ifr.ifr_flags |= IFF_UP;
- if (ioctl(ioctlfd, SIOCSIFFLAGS, (caddr_t)&ifr) == -1) {
- log_warn("SIOCSIFFLAGS");
- return;
- }
- }
-}
-
-int
-interface_status(char *name)
-{
- struct ifaddrs *ifap, *ifa;
- struct if_data *ifdata;
-
- if (getifaddrs(&ifap) != 0)
- fatalx("getifaddrs failed");
-
- for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
- if ((ifa->ifa_flags & IFF_LOOPBACK) ||
- (ifa->ifa_flags & IFF_POINTOPOINT))
- continue;
-
- if (strcmp(name, ifa->ifa_name) != 0)
- continue;
-
- if (ifa->ifa_addr->sa_family != AF_LINK)
- continue;
-
- if ((ifa->ifa_flags & (IFF_UP|IFF_RUNNING)) !=
- (IFF_UP|IFF_RUNNING))
- return 0;
-
- ifdata = ifa->ifa_data;
-
- return LINK_STATE_IS_UP(ifdata->ifi_link_state);
- }
-
- return 0;
-}
-
-void
set_timeout(struct interface_info *ifi, time_t secs,
void (*where)(struct interface_info *))
{