diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-01-17 03:21:04 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-01-17 03:21:04 +0000 |
commit | 61bbdea32163ff82c9b274e52da6e7a8703824a1 (patch) | |
tree | e284f56c6ffd2e401d7e37cd8841225e86cb6356 /sbin | |
parent | 24b31bcfbdcdbac933ce04e327d9ad8419e746d1 (diff) |
Move "link X -> Y" debug messages into insterface_state() where
the link field is actually modified. Thus catching all
places where a link state change might be detected.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dhclient/dhclient.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 5e98c795c62..68699d1db0b 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.607 2019/01/14 04:54:46 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.608 2019/01/17 03:21:03 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -266,6 +266,9 @@ void interface_state(struct interface_info *ifi) { struct ifaddrs *ifap, *ifa; + int newlinkup, oldlinkup; + + oldlinkup = LINK_STATE_IS_UP(ifi->link_state); if (getifaddrs(&ifap) != 0) fatal("getifaddrs"); @@ -278,8 +281,14 @@ interface_state(struct interface_info *ifi) } else { ifi->link_state = ((struct if_data *)ifa->ifa_data)->ifi_link_state; } - freeifaddrs(ifap); + + newlinkup = LINK_STATE_IS_UP(ifi->link_state); + if (newlinkup != oldlinkup) { + log_debug("%s: link %s -> %s", log_procname, + (oldlinkup != 0) ? "up" : "down", + (newlinkup != 0) ? "up" : "down"); + } } void @@ -394,9 +403,6 @@ rtm_dispatch(struct interface_info *ifi, struct rt_msghdr *rtm) } if (newlinkup != oldlinkup) { - log_debug("%s: link %s -> %s", log_procname, - (oldlinkup != 0) ? "up" : "down", - (newlinkup != 0) ? "up" : "down"); ifi->state = S_PREBOOT; state_preboot(ifi); } |