| stat_route0 PROHIBIT { this_srt->dest = RTD_PROHIBIT; }
;
+CF_CLI(SHOW STATIC, optsym, [<name>], [[Show details of static protocol]])
+{ static_show(proto_get_named($3, &proto_static)); } ;
+
CF_CODE
CF_END
#include "nest/iface.h"
#include "nest/protocol.h"
#include "nest/route.h"
+#include "nest/cli.h"
#include "conf/conf.h"
+#include "lib/string.h"
#include "static.h"
e->net = n;
e->pflags = 0;
rte_update(p->table, n, p, e);
+ r->installed = 1;
}
static void
n = net_find(p->table, r->net, r->masklen);
if (n)
rte_update(p->table, n, p, NULL);
+ r->installed = 0;
}
static int
dump: static_dump,
start: static_start,
};
+
+static void
+static_show_rt(struct static_route *r)
+{
+ byte via[STD_ADDRESS_P_LENGTH + 16];
+
+ switch (r->dest)
+ {
+ case RTD_ROUTER: bsprintf(via, "via %I", r->via); break;
+ case RTD_DEVICE: bsprintf(via, "to %s", r->if_name); break;
+ case RTD_BLACKHOLE: bsprintf(via, "blackhole"); break;
+ case RTD_UNREACHABLE: bsprintf(via, "unreachable"); break;
+ case RTD_PROHIBIT: bsprintf(via, "prohibited"); break;
+ default: bsprintf(via, "???");
+ }
+ cli_msg(-1009, "%I/%d %s%s", r->net, r->masklen, via, r->installed ? "" : " (dormant)");
+}
+
+void
+static_show(struct proto *P)
+{
+ struct static_config *c = (void *) P->cf;
+ struct static_route *r;
+
+ WALK_LIST(r, c->other_routes)
+ static_show_rt(r);
+ WALK_LIST(r, c->iface_routes)
+ static_show_rt(r);
+ cli_msg(0, "");
+}