-/* $OpenBSD: clparse.c,v 1.108 2017/04/03 19:59:39 krw Exp $ */
+/* $OpenBSD: clparse.c,v 1.109 2017/04/04 13:01:20 krw Exp $ */
/* Parser for dhclient config and lease files. */
TAILQ_FOREACH_SAFE(lp, &client->leases, next, pl) {
if (lp->is_static != is_static)
continue;
- if (strcmp(lp->ssid, ifi->ssid) != 0)
+ if (lp->ssid_len != lease->ssid_len)
+ continue;
+ if (memcmp(lp->ssid, lease->ssid, lp->ssid_len) != 0)
continue;
if ((lease->options[DHO_DHCP_CLIENT_IDENTIFIER].len != 0) &&
((lp->options[DHO_DHCP_CLIENT_IDENTIFIER].len !=
if (val && len <= sizeof(lease->ssid)) {
memset(lease->ssid, 0, sizeof(lease->ssid));
memcpy(lease->ssid, val, len);
+ lease->ssid_len = len;
}
free(val);
break;
-/* $OpenBSD: dhclient.c,v 1.405 2017/03/08 20:54:30 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.406 2017/04/04 13:01:20 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
if (ioctl(sock, SIOCG80211NWID, (caddr_t)&ifr) == 0) {
memset(ifi->ssid, 0, sizeof(ifi->ssid));
memcpy(ifi->ssid, nwid.i_nwid, nwid.i_len);
+ ifi->ssid_len = nwid.i_len;
}
/* Put us into the correct rdomain */
/* Run through the list of leases and see if one can be used. */
i = DHO_DHCP_CLIENT_IDENTIFIER;
TAILQ_FOREACH(lp, &client->leases, next) {
- if (strcmp(lp->ssid, ifi->ssid) != 0)
+ if (lp->ssid_len != ifi->ssid_len)
+ continue;
+ if (memcmp(lp->ssid, ifi->ssid, lp->ssid_len) != 0)
continue;
if ((lp->options[i].len != 0) && ((lp->options[i].len !=
config->send_options[i].len) ||
client->new = lease;
memcpy(client->new->ssid, ifi->ssid, sizeof(client->new->ssid));
+ client->new->ssid_len = ifi->ssid_len;
/* Stop resending DHCPREQUEST. */
cancel_timeout();
TAILQ_FOREACH_SAFE(lease, &client->leases, next, pl) {
if (lease->is_static)
break;
- if (client->active && strcmp(client->active->ssid,
- lease->ssid) != 0)
+ if (client->active == NULL)
+ continue;
+ if (client->active->ssid_len != lease->ssid_len)
+ continue;
+ if (memcmp(client->active->ssid, lease->ssid, lease->ssid_len)
+ != 0)
continue;
if (client->active == lease)
seen = 1;
/* Run through the list of leases and see if one can be used. */
time(&cur_time);
TAILQ_FOREACH(lp, &client->leases, next) {
- if (strcmp(lp->ssid, ifi->ssid) != 0)
+ if (lp->ssid_len != ifi->ssid_len)
+ continue;
+ if (memcmp(lp->ssid, ifi->ssid, lp->ssid_len) != 0)
continue;
if (addressinuse(ifi, lp->address, ifname) &&
strncmp(ifname, ifi->name, IF_NAMESIZE) != 0)
p += rslt;
sz -= rslt;
}
- if (strlen(lease->ssid)) {
+ if (lease->ssid_len != 0) {
rslt = snprintf(p, sz, " ssid ");
if (rslt == -1 || rslt >= sz)
return (NULL);
p += rslt;
sz -= rslt;
rslt = pretty_print_string(p, sz, lease->ssid,
- strlen(lease->ssid), 1);
+ lease->ssid_len, 1);
if (rslt == -1 || rslt >= sz)
return (NULL);
p += rslt;
newlease->address = oldlease->address;
newlease->next_server = oldlease->next_server;
memcpy(newlease->ssid, oldlease->ssid, sizeof(newlease->ssid));
+ newlease->ssid_len = oldlease->ssid_len;
if (oldlease->server_name) {
newlease->server_name = strdup(oldlease->server_name);