From eae0e6ac59805dcbe3101be82764f51e63a3faf9 Mon Sep 17 00:00:00 2001 From: lemoer Date: Sat, 11 Jan 2020 17:50:02 +0100 Subject: [PATCH] use bssid instead of iface name --- package/gluon-mesh-batman-adv/src/respondd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/package/gluon-mesh-batman-adv/src/respondd.c b/package/gluon-mesh-batman-adv/src/respondd.c index 88eb4b6a..a4b4fe5d 100644 --- a/package/gluon-mesh-batman-adv/src/respondd.c +++ b/package/gluon-mesh-batman-adv/src/respondd.c @@ -718,6 +718,10 @@ static struct json_object * get_wifi_neighbours(const char *ifname) { if (iw->assoclist(ifname, buf, &len) < 0) return NULL; + char *ifaddr = gluonutil_get_interface_address(ifname); + if (!ifaddr) + return NULL; + struct json_object *neighbours = json_object_new_object(); struct iwinfo_assoclist_entry *entry; @@ -730,7 +734,7 @@ static struct json_object * get_wifi_neighbours(const char *ifname) { json_object_object_add(obj, "signal", json_object_new_int(entry->signal)); json_object_object_add(obj, "noise", json_object_new_int(entry->noise)); json_object_object_add(obj, "inactive", json_object_new_int(entry->inactive)); - json_object_object_add(obj, "iface", json_object_new_string(ifname)); + json_object_object_add(obj, "bssid", json_object_new_string(ifaddr)); char mac[18]; snprintf(mac, sizeof(mac), "%02x:%02x:%02x:%02x:%02x:%02x", @@ -740,6 +744,8 @@ static struct json_object * get_wifi_neighbours(const char *ifname) { json_object_object_add(neighbours, mac, obj); } + free(ifaddr); + struct json_object *ret = json_object_new_object(); if (json_object_object_length(neighbours))