diff options
author | claudio <claudio@openbsd.org> | 2020-05-02 14:31:32 +0000 |
---|---|---|
committer | claudio <claudio@openbsd.org> | 2020-05-02 14:31:32 +0000 |
commit | a47383e2125c8ff6a2db945e8957b394455ed1e0 (patch) | |
tree | 0df94d94b1b2b3e92a1489d6614296d56db9f06a /usr.sbin/bgpctl | |
parent | Indirect the output functions through function pointers so that they (diff) | |
download | wireguard-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.c | 6 | ||||
-rw-r--r-- | usr.sbin/bgpctl/bgpctl.h | 3 |
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 *); - |