jsoninfo: only show gateways of the request IP version in /gateways
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 3 Dec 2015 16:03:57 +0000 (17:03 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 3 Dec 2015 16:04:07 +0000 (17:04 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/jsoninfo/src/olsrd_jsoninfo.c

index 3041f22..8b25f34 100644 (file)
@@ -374,6 +374,10 @@ static void ipc_print_gateways_ipvx(struct autobuf *abuf, bool ipv6) {
     struct gateway_entry * gw;
     OLSR_FOR_ALL_GATEWAY_ENTRIES(gw)
         {
+          if (!(!ipv6 && gw->ipv4) && !(ipv6 && gw->ipv6)) {
+            continue;
+          }
+
           abuf_json_mark_array_entry(true, abuf);
           {
             struct tc_entry* tc = olsr_lookup_tc_entry(&gw->originator);