summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bgpctl
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2020-05-02 14:31:32 +0000
committerclaudio <claudio@openbsd.org>2020-05-02 14:31:32 +0000
commita47383e2125c8ff6a2db945e8957b394455ed1e0 (patch)
tree0df94d94b1b2b3e92a1489d6614296d56db9f06a /usr.sbin/bgpctl
parentIndirect the output functions through function pointers so that they (diff)
downloadwireguard-openbsd-a47383e2125c8ff6a2db945e8957b394455ed1e0.tar.xz
wireguard-openbsd-a47383e2125c8ff6a2db945e8957b394455ed1e0.zip
Adjust fmt_attr() to pass in -1 for flags to tell it you don't care
about the flags of the attribute. Part of the JSON output diff. OK job@, benno@, deraadt@
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r--usr.sbin/bgpctl/bgpctl.c6
-rw-r--r--usr.sbin/bgpctl/bgpctl.h3
2 files changed, 4 insertions, 5 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index c4a877f4909..434750c4100 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.260 2020/05/02 14:28:10 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.261 2020/05/02 14:31:32 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -766,7 +766,7 @@ fmt_errstr(u_int8_t errcode, u_int8_t subcode)
}
const char *
-fmt_attr(u_int8_t type, u_int8_t flags)
+fmt_attr(u_int8_t type, int flags)
{
#define CHECK_FLAGS(s, t, m) \
if (((s) & ~(ATTR_DEFMASK | (m))) != (t)) pflags = 1
@@ -845,7 +845,7 @@ fmt_attr(u_int8_t type, u_int8_t flags)
pflags = 1;
break;
}
- if (pflags) {
+ if (flags != -1 && pflags) {
strlcat(cstr, " flags [", sizeof(cstr));
if (flags & ATTR_OPTIONAL)
strlcat(cstr, "O", sizeof(cstr));
diff --git a/usr.sbin/bgpctl/bgpctl.h b/usr.sbin/bgpctl/bgpctl.h
index f829bf9e6ba..922ab9c15ca 100644
--- a/usr.sbin/bgpctl/bgpctl.h
+++ b/usr.sbin/bgpctl/bgpctl.h
@@ -49,8 +49,7 @@ const char *fmt_ovs(u_int8_t, int);
const char *fmt_auth_method(enum auth_method);
const char *fmt_mem(long long);
const char *fmt_errstr(u_int8_t, u_int8_t);
-const char *fmt_attr(u_int8_t, u_int8_t);
+const char *fmt_attr(u_int8_t, int);
const char *fmt_community(u_int16_t, u_int16_t);
const char *fmt_large_community(u_int32_t, u_int32_t, u_int32_t);
const char *fmt_ext_community(u_int8_t *);
-