1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-02-15 00:01:53 +00:00

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 <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
This commit is contained in:
Andrey Gusakov 2014-08-11 22:24:40 +04:00 committed by David Herrmann
parent e40f7f744e
commit 9b801d6b0e

View file

@ -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) {