txtinfo: also print gateways without a tc in /gat
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 3 Dec 2015 14:25:13 +0000 (15:25 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 3 Dec 2015 15:43:34 +0000 (16:43 +0100)
Like in /sgw

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/txtinfo/src/olsrd_txtinfo.c

index 9ab75db..2d331f4 100644 (file)
@@ -340,11 +340,7 @@ void ipc_print_gateways(struct autobuf *abuf) {
       {
         char v4, v6;
         const char *v4type, *v6type;
-        struct tc_entry *tc;
-
-        if ((tc = olsr_lookup_tc_entry(&gw->originator)) == NULL) {
-          continue;
-        }
+        struct tc_entry *tc = olsr_lookup_tc_entry(&gw->originator);
 
         if (gw == olsr_get_inet_gateway(false)) {
           v4 = 's';
@@ -377,8 +373,8 @@ void ipc_print_gateways(struct autobuf *abuf) {
             v4, //
             v6, //
             olsr_ip_to_string(&buf, &gw->originator), //
-            get_linkcost_text(tc->path_cost, true, &lqbuf), //
-            tc->hops, //
+            get_linkcost_text(!tc ? ROUTE_COST_BROKEN : tc->path_cost, true, &lqbuf), //
+            !tc ? 0 : tc->hops, //
             gw->uplink, //
             gw->downlink, //
             v4type, //