0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-23 02:01:55 +00:00

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.
This commit is contained in:
Ondrej Zajicek 2023-01-03 17:01:54 +01:00 committed by Igor Putovny
parent 82be0ba400
commit 37399f48c0
4 changed files with 10 additions and 4 deletions

View File

@ -94,6 +94,7 @@ void protos_dump_all(void);
#define GA_UNKNOWN 0 /* Attribute not recognized */ #define GA_UNKNOWN 0 /* Attribute not recognized */
#define GA_NAME 1 /* Result = name */ #define GA_NAME 1 /* Result = name */
#define GA_FULL 2 /* Result = both name and value */ #define GA_FULL 2 /* Result = both name and value */
#define GA_HIDDEN 3 /* Attribute should not be printed */
/* /*
* Known protocols * Known protocols

View File

@ -981,7 +981,9 @@ ea_show(struct cli *c, const eattr *e)
bsprintf(pos, "<type %02x>", e->type); bsprintf(pos, "<type %02x>", e->type);
} }
} }
cli_printf(c, -1012, "\t%s", buf);
if (status != GA_HIDDEN)
cli_printf(c, -1012, "\t%s", buf);
} }
/** /**

View File

@ -2081,9 +2081,6 @@ babel_get_attr(const eattr *a, byte *buf, int buflen UNUSED)
{ {
switch (a->id) switch (a->id)
{ {
case EA_BABEL_SEQNO:
return GA_FULL;
case EA_BABEL_METRIC: case EA_BABEL_METRIC:
bsprintf(buf, "metric: %d", a->u.data); bsprintf(buf, "metric: %d", a->u.data);
return GA_FULL; return GA_FULL;
@ -2096,6 +2093,9 @@ babel_get_attr(const eattr *a, byte *buf, int buflen UNUSED)
return GA_FULL; return GA_FULL;
} }
case EA_BABEL_SEQNO:
return GA_HIDDEN;
default: default:
return GA_UNKNOWN; return GA_UNKNOWN;
} }

View File

@ -1233,6 +1233,9 @@ rip_get_attr(const eattr *a, byte *buf, int buflen UNUSED)
bsprintf(buf, "tag: %04x", a->u.data); bsprintf(buf, "tag: %04x", a->u.data);
return GA_FULL; return GA_FULL;
case EA_RIP_FROM:
return GA_HIDDEN;
default: default:
return GA_UNKNOWN; return GA_UNKNOWN;
} }