From 9b801d6b0e356301bbbafcd3679c3b0c5aa1b0c7 Mon Sep 17 00:00:00 2001 From: Andrey Gusakov Date: Mon, 11 Aug 2014 22:24:40 +0400 Subject: [PATCH] wifi: reformat MACs returned from DHCP ether_ntoa() function used in DHCP server skips leading zeros so reformat is needed to make strcmp() work for mac-comparisons. Signed-off-by: Andrey Gusakov Signed-off-by: David Herrmann --- src/wifi/wifid-supplicant.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wifi/wifid-supplicant.c b/src/wifi/wifid-supplicant.c index 2d252fc..b2d9202 100644 --- a/src/wifi/wifid-supplicant.c +++ b/src/wifi/wifid-supplicant.c @@ -220,6 +220,7 @@ static int supplicant_group_comm_fn(sd_event_source *source, struct peer *p; char buf[512], *t, *ip; ssize_t l; + char mac[MAC_STRLEN]; l = recv(fd, buf, sizeof(buf) - 1, MSG_DONTWAIT); if (l < 0) { @@ -271,7 +272,8 @@ static int supplicant_group_comm_fn(sd_event_source *source, } *ip++ = 0; - sp = find_peer_by_any_mac(g->s, t); + reformat_mac(mac, t); + sp = find_peer_by_any_mac(g->s, mac); if (sp) { ip = strdup(ip); if (!ip) {