From e13a614420ed6585bc0cefa395e634ef08bdd98c Mon Sep 17 00:00:00 2001
From: Sven Eckelmann <sven@narfation.org>
Date: Tue, 26 Feb 2019 20:02:58 +0100
Subject: [PATCH] gluon-status-page-mesh-batman-adv: Save if metrics chose
 neighbor as own best nexthop

The commit a0800497352e ("gluon-status-page-mesh-batman-adv: Retrieve TQ of
neighbors with non-best direct link") removed the check whether a neighbor
has the BATADV_ATTR_FLAG_BEST set. But consumers may still want to filter
out or mark neighbors which don't have this flag set. To assist with such a
feature, enhance the neighbor object with an extra boolean "best" attribute
which stores whether the BATADV_ATTR_FLAG_BEST was found or not.

Reported-by: Vincent Wiemann <webmaster@codefetch.de>
---
 .../gluon-status-page-mesh-batman-adv/src/neighbours-batadv.c    | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/gluon-status-page-mesh-batman-adv/src/neighbours-batadv.c b/package/gluon-status-page-mesh-batman-adv/src/neighbours-batadv.c
index 53b99046d..9c2be2f7d 100644
--- a/package/gluon-status-page-mesh-batman-adv/src/neighbours-batadv.c
+++ b/package/gluon-status-page-mesh-batman-adv/src/neighbours-batadv.c
@@ -75,6 +75,7 @@ static int parse_orig_list_netlink_cb(struct nl_msg *msg, void *arg)
 
   json_object_object_add(neigh, "tq", json_object_new_int(tq * 100 / 255));
   json_object_object_add(neigh, "ifname", json_object_new_string(ifname));
+  json_object_object_add(neigh, "best", json_object_new_boolean(attrs[BATADV_ATTR_FLAG_BEST]));
 
   json_object_object_add(opts->obj, mac1, neigh);
 
-- 
GitLab