summaryrefslogtreecommitdiff
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2020-11-18 17:43:34 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2020-11-18 17:43:34 +0000
commit9a304f6ebc2246db0ee614d3ba63a7c2c6eb3e28 (patch)
tree5f0f3460dc9e0f0eb4d9ba58607859f1411d3a9b /sbin/dhclient
parentcec990e4bac4600797cf7413c9ca1b2626d1a73c (diff)
No need to call get_hw_address() from interface_state() since the
appropriate ifa is already known and ifi->rdomain does not need to be updated because a change of rdomain causes a link bounce and thus reinitialization of ifi. One less invocation of getifaddrs() during route message processing.
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/dhclient.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 165db3f6438..ec5b5f0ccb2 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.679 2020/11/06 21:53:55 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.680 2020/11/18 17:43:33 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -242,6 +242,7 @@ interface_state(struct interface_info *ifi)
{
struct ether_addr hw;
struct ifaddrs *ifap, *ifa;
+ struct sockaddr_dl *sdl;
int newlinkup, oldlinkup;
oldlinkup = LINK_STATE_IS_UP(ifi->link_state);
@@ -260,7 +261,6 @@ interface_state(struct interface_info *ifi)
ifi->mtu =
((struct if_data *)ifa->ifa_data)->ifi_mtu;
}
- freeifaddrs(ifap);
newlinkup = LINK_STATE_IS_UP(ifi->link_state);
if (newlinkup != oldlinkup) {
@@ -272,13 +272,17 @@ interface_state(struct interface_info *ifi)
if (newlinkup != 0) {
memcpy(&hw, &ifi->hw_address, sizeof(hw));
- get_hw_address(ifi);
+ sdl = (struct sockaddr_dl *)ifa->ifa_addr;
+ memcpy(ifi->hw_address.ether_addr_octet, LLADDR(sdl),
+ ETHER_ADDR_LEN);
if (memcmp(&hw, &ifi->hw_address, sizeof(hw))) {
tick_msg("", 0, INT64_MAX);
log_debug("%s: LLADDR changed", log_procname);
quit = RESTART;
}
}
+
+ freeifaddrs(ifap);
}
void