From 37399f48c08a09b04408bd88af48649854f8ba2a Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Tue, 3 Jan 2023 17:01:54 +0100 Subject: [PATCH] Nest: Fix leaking internal attributes in RIP and Babel During backporting attribute changes from 3.0-branch, some internal attributes (RIP iface and Babel seqno) leaked to 'show route all' output. Allow protocols to hide specific attributes with GA_HIDDEN value. Thanks to Nigel Kukard for the bugreport. --- nest/protocol.h | 1 + nest/rt-attr.c | 4 +++- proto/babel/babel.c | 6 +++--- proto/rip/rip.c | 3 +++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/nest/protocol.h b/nest/protocol.h index 46744357..fcbf0539 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -94,6 +94,7 @@ void protos_dump_all(void); #define GA_UNKNOWN 0 /* Attribute not recognized */ #define GA_NAME 1 /* Result = name */ #define GA_FULL 2 /* Result = both name and value */ +#define GA_HIDDEN 3 /* Attribute should not be printed */ /* * Known protocols diff --git a/nest/rt-attr.c b/nest/rt-attr.c index 22b45db9..d793c72e 100644 --- a/nest/rt-attr.c +++ b/nest/rt-attr.c @@ -981,7 +981,9 @@ ea_show(struct cli *c, const eattr *e) bsprintf(pos, "", e->type); } } - cli_printf(c, -1012, "\t%s", buf); + + if (status != GA_HIDDEN) + cli_printf(c, -1012, "\t%s", buf); } /** diff --git a/proto/babel/babel.c b/proto/babel/babel.c index 86cec63b..ecde07b3 100644 --- a/proto/babel/babel.c +++ b/proto/babel/babel.c @@ -2081,9 +2081,6 @@ babel_get_attr(const eattr *a, byte *buf, int buflen UNUSED) { switch (a->id) { - case EA_BABEL_SEQNO: - return GA_FULL; - case EA_BABEL_METRIC: bsprintf(buf, "metric: %d", a->u.data); return GA_FULL; @@ -2096,6 +2093,9 @@ babel_get_attr(const eattr *a, byte *buf, int buflen UNUSED) return GA_FULL; } + case EA_BABEL_SEQNO: + return GA_HIDDEN; + default: return GA_UNKNOWN; } diff --git a/proto/rip/rip.c b/proto/rip/rip.c index b0b5b8a1..5f3161ee 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -1233,6 +1233,9 @@ rip_get_attr(const eattr *a, byte *buf, int buflen UNUSED) bsprintf(buf, "tag: %04x", a->u.data); return GA_FULL; + case EA_RIP_FROM: + return GA_HIDDEN; + default: return GA_UNKNOWN; }