From 8233d1249b757b0d3c18a96f030d3e5349031f4d Mon Sep 17 00:00:00 2001
From: Johannes Rudolph <johannes.rudolph@gmx.com>
Date: Tue, 18 Apr 2017 17:38:00 +0200
Subject: [PATCH] remove drop_first use own_mac address to filter own respondd
 answer add Primary mac to hoodselector respondd answer

---
 hoodselector/luasrc/usr/sbin/hoodselector | 5 ++---
 hoodselector/src/respondd.c               | 2 ++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/hoodselector/luasrc/usr/sbin/hoodselector b/hoodselector/luasrc/usr/sbin/hoodselector
index 6a742be..649230f 100755
--- a/hoodselector/luasrc/usr/sbin/hoodselector
+++ b/hoodselector/luasrc/usr/sbin/hoodselector
@@ -831,16 +831,16 @@ local function molw_get_bssid(iface)
   -- differentiate between VPN and mesh only routers
   local vpn_router_neigbour_bssids = {}
   local mesh_router_neigbour_bssids = {}
+  local own_mac = uci:get('network', 'client', 'macaddr')
   for _,respondd_if in ipairs(iface) do
     local respondd = string.format("gluon-neighbour-info -i " .. respondd_if .. " -p 1001 -d ff02::2 -r hoodselector -t 0.5")
     print(respondd)
-    local drop_first = false -- first one is node it selfe!
     for line in io.popen(respondd, 'r'):lines() do
       local obj, _, err = json.parse (line, 1, nil)
       if err then
 	io.stderr:write("json parse error!\n")
       else
-	if drop_first then
+	if obj["mac"] ~= own_mac then
 	  if obj["hoodinfo"] ~= nil then
 	    if obj["hoodinfo"]["vpnrouter"]:match("true") then
 	      if obj["selectedbssid"] ~= nil then
@@ -865,7 +865,6 @@ local function molw_get_bssid(iface)
 	    end
 	  end
 	end
-	drop_first = true
       end
     end
   end
diff --git a/hoodselector/src/respondd.c b/hoodselector/src/respondd.c
index eb975fe..1043f42 100644
--- a/hoodselector/src/respondd.c
+++ b/hoodselector/src/respondd.c
@@ -165,6 +165,8 @@ static struct json_object * respondd_provider_hoodselector(void) {
 	if(mesh_on_lan_wan)
 		 json_object_object_add(ret, "mesh", mesh_on_lan_wan);
 
+    json_object_object_add(ret, "mac", gluonutil_wrap_and_free_string(gluonutil_get_sysconfig("primary_mac")));
+
 	return ret;
 }
 
-- 
GitLab