diff options
author | Todd T. Fries <todd@cvs.openbsd.org> | 2005-05-24 03:11:13 +0000 |
---|---|---|
committer | Todd T. Fries <todd@cvs.openbsd.org> | 2005-05-24 03:11:13 +0000 |
commit | 2b07327e54484e9b9a0db7cfa18b2b02f6718a0a (patch) | |
tree | e9d2d7beb7006d2da7f7ede58d432127bab3c555 | |
parent | 299bbcec9518ff11bf3f48ed7d8fed21d6461eb5 (diff) |
no more 'ifconfig $if 0.0.0.0 up' only 'ifconfig $if up' since dhclient
uses bpf exclusively
ok deraadt@, henning@, claudio@
-rw-r--r-- | sbin/dhclient/dhclient-script | 5 | ||||
-rw-r--r-- | sbin/dhclient/dispatch.c | 28 |
2 files changed, 10 insertions, 23 deletions
diff --git a/sbin/dhclient/dhclient-script b/sbin/dhclient/dhclient-script index 9d4489ea5f7..1f4e540ad52 100644 --- a/sbin/dhclient/dhclient-script +++ b/sbin/dhclient/dhclient-script @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: dhclient-script,v 1.7 2005/04/09 09:14:58 jmc Exp $ +# $OpenBSD: dhclient-script,v 1.8 2005/05/24 03:11:12 todd Exp $ # # Copyright (c) 2003 Kenneth R Westerback <krw@openbsd.org> # @@ -152,13 +152,12 @@ fi case $reason in MEDIUM) ifconfig $interface $medium - ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1 sleep 1 ;; PREINIT) delete_old_alias - ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up + ifconfig $interface up ;; ARPCHECK|ARPSEND) diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c index a0d7e90e865..5b4f350eb45 100644 --- a/sbin/dhclient/dispatch.c +++ b/sbin/dhclient/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.31 2004/09/21 04:07:03 david Exp $ */ +/* $OpenBSD: dispatch.c,v 1.32 2005/05/24 03:11:12 todd Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -67,8 +67,8 @@ void discover_interfaces(struct interface_info *iface) { struct ifaddrs *ifap, *ifa; - struct sockaddr_in foo; struct ifreq *tif; + int len = IFNAMSIZ + sizeof(struct sockaddr_storage); if (getifaddrs(&ifap) != 0) error("getifaddrs failed"); @@ -95,24 +95,12 @@ discover_interfaces(struct interface_info *iface) iface->hw_address.htype = HTYPE_ETHER; /* XXX */ memcpy(iface->hw_address.haddr, LLADDR(foo), foo->sdl_alen); - } else if (ifa->ifa_addr->sa_family == AF_INET) { - struct iaddr addr; - - memcpy(&foo, ifa->ifa_addr, sizeof(foo)); - if (foo.sin_addr.s_addr == htonl(INADDR_LOOPBACK)) - continue; - if (!iface->ifp) { - int len = IFNAMSIZ + ifa->ifa_addr->sa_len; - if ((tif = malloc(len)) == NULL) - error("no space to remember ifp"); - strlcpy(tif->ifr_name, ifa->ifa_name, IFNAMSIZ); - memcpy(&tif->ifr_addr, ifa->ifa_addr, - ifa->ifa_addr->sa_len); - iface->ifp = tif; - iface->primary_address = foo.sin_addr; - } - addr.len = 4; - memcpy(addr.iabuf, &foo.sin_addr.s_addr, addr.len); + } + if (!iface->ifp) { + if ((tif = malloc(len)) == NULL) + error("no space to remember ifp"); + strlcpy(tif->ifr_name, ifa->ifa_name, IFNAMSIZ); + iface->ifp = tif; } } |