summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dhclient.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2018-11-12 16:46:03 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2018-11-12 16:46:03 +0000
commit9059a5ac62dec9a180436c176c98e8f2897db2e1 (patch)
treebf58bc419848042592bf9e3bfad34d11ed46008b /sbin/dhclient/dhclient.c
parentb564c3a21ad0dca8fbecac73e55bac6f9911c12e (diff)
Restart when SSID change is noted in RTM_80211INFO. Thus ensuring
correct lease is discovered/renewed and lease file is properly updated. Improves co-existance with new 'join' feature. Issues first noted and many tests by anton@. Many suggestions and tweaks from claudio@, stsp@, anton@. ok claudio@ stsp@ anton@ phessler@
Diffstat (limited to 'sbin/dhclient/dhclient.c')
-rw-r--r--sbin/dhclient/dhclient.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 2557bb39157..64b835b4dbb 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.589 2018/11/11 00:55:11 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.590 2018/11/12 16:46:02 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -314,6 +314,7 @@ routehandler(struct interface_info *ifi, int routefd)
struct if_msghdr *ifm;
struct if_announcemsghdr *ifan;
struct ifa_msghdr *ifam;
+ struct if_ieee80211_data *ifie;
char *rtmmsg;
ssize_t n;
int newlinkup, oldlinkup;
@@ -386,6 +387,19 @@ routehandler(struct interface_info *ifi, int routefd)
state_preboot(ifi);
}
break;
+ case RTM_80211INFO:
+ if (rtm->rtm_index != ifi->index)
+ break;
+ ifie = &((struct if_ieee80211_msghdr *)rtm)->ifim_ifie;
+ if (ifi->ssid_len != ifie->ifie_nwid_len ||
+ memcmp(ifi->ssid, ifie->ifie_nwid, ifie->ifie_nwid_len)
+ != 0) {
+ tick_msg("", 0, INT64_MAX);
+ log_warnx("%s: SSID changed", log_procname);
+ quit = SIGHUP;
+ goto done;
+ }
+ break;
case RTM_IFANNOUNCE:
ifan = (struct if_announcemsghdr *)rtm;
if (ifan->ifan_what == IFAN_DEPARTURE &&
@@ -608,7 +622,7 @@ main(int argc, char *argv[])
rtfilter = ROUTE_FILTER(RTM_PROPOSAL) | ROUTE_FILTER(RTM_IFINFO) |
ROUTE_FILTER(RTM_NEWADDR) | ROUTE_FILTER(RTM_DELADDR) |
- ROUTE_FILTER(RTM_IFANNOUNCE);
+ ROUTE_FILTER(RTM_IFANNOUNCE) | ROUTE_FILTER(RTM_80211INFO);
if (setsockopt(routefd, PF_ROUTE, ROUTE_MSGFILTER,
&rtfilter, sizeof(rtfilter)) == -1)