Remove F_DOWN from flags since kroutes can no longer be marked down.
Also clean up the flag printing code and printf() and increase the size
of destionation and gateway so that more IPv6 addrs fit.
OK tb@
-/* $OpenBSD: bgpctl.c,v 1.280 2022/07/07 12:17:57 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.281 2022/07/28 10:40:25 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
{
static char buf[8];
- if (flags & F_DOWN)
- strlcpy(buf, " ", sizeof(buf));
- else
- strlcpy(buf, "*", sizeof(buf));
-
if (flags & F_BGPD)
- strlcat(buf, "B", sizeof(buf));
+ strlcpy(buf, "B", sizeof(buf));
else if (flags & F_CONNECTED)
- strlcat(buf, "C", sizeof(buf));
+ strlcpy(buf, "C", sizeof(buf));
else if (flags & F_STATIC)
- strlcat(buf, "S", sizeof(buf));
+ strlcpy(buf, "S", sizeof(buf));
else
- strlcat(buf, " ", sizeof(buf));
+ strlcpy(buf, " ", sizeof(buf));
if (flags & F_NEXTHOP)
strlcat(buf, "N", sizeof(buf));
else
strlcat(buf, " ", sizeof(buf));
- if (strlcat(buf, " ", sizeof(buf)) >= sizeof(buf))
- errx(1, "%s buffer too small", __func__);
-
return buf;
}
-/* $OpenBSD: output.c,v 1.24 2022/07/08 16:12:11 claudio Exp $ */
+/* $OpenBSD: output.c,v 1.25 2022/07/28 10:40:25 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
"MsgRcvd", "MsgSent", "OutQ", "Up/Down", "State/PrfRcvd");
break;
case SHOW_FIB:
- printf("flags: * = valid, B = BGP, C = Connected, "
- "S = Static\n");
+ printf("flags: B = BGP, C = Connected, S = Static\n");
printf(" "
"N = BGP Nexthop reachable via this route\n");
printf(" r = reject route, b = blackhole route\n\n");
- printf("flags prio destination gateway\n");
+ printf("%-5s %-4s %-32s %-32s\n", "flags", "prio",
+ "destination", "gateway");
break;
case SHOW_FIB_TABLES:
printf("%-5s %-20s %-8s\n", "Table", "Description", "State");
if (asprintf(&p, "%s/%u", log_addr(&kf->prefix), kf->prefixlen) == -1)
err(1, NULL);
- printf("%s%4i %-20s ", fmt_fib_flags(kf->flags), kf->priority, p);
+ printf("%-5s %4i %-32s ", fmt_fib_flags(kf->flags), kf->priority, p);
free(p);
if (kf->flags & F_CONNECTED)
-/* $OpenBSD: output_json.c,v 1.19 2022/07/08 16:12:11 claudio Exp $ */
+/* $OpenBSD: output_json.c,v 1.20 2022/07/28 10:40:25 claudio Exp $ */
/*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
json_do_printf("prefix", "%s/%u", log_addr(&kf->prefix), kf->prefixlen);
json_do_uint("priority", kf->priority);
- json_do_bool("up", !(kf->flags & F_DOWN));
if (kf->flags & F_BGPD)
origin = "bgp";
else if (kf->flags & F_CONNECTED)