]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Nest: Fix leaking internal attributes in RIP and Babel
authorOndrej Zajicek <santiago@crfreenet.org>
Tue, 3 Jan 2023 16:01:54 +0000 (17:01 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Tue, 3 Jan 2023 16:01:54 +0000 (17:01 +0100)
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
nest/rt-attr.c
proto/babel/babel.c
proto/rip/rip.c

index 46744357eb2cdd989cc7c15a6979d6173e3b90eb..fcbf0539afd686f400d2a26dfa1adaacc0b1ec8e 100644 (file)
@@ -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
index 22b45db93c0f0d5fb8e9eae09dc5254aafc0dbb0..d793c72e1ef8473e7f78ef75807af5697abc63fa 100644 (file)
@@ -981,7 +981,9 @@ ea_show(struct cli *c, const eattr *e)
          bsprintf(pos, "<type %02x>", e->type);
        }
     }
-  cli_printf(c, -1012, "\t%s", buf);
+
+  if (status != GA_HIDDEN)
+    cli_printf(c, -1012, "\t%s", buf);
 }
 
 /**
index 86cec63b8a597b9f1d3dbe4e82d90e9b49243f6e..ecde07b3f74d32933336ac1d69a76cca83b25238 100644 (file)
@@ -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;
   }
index b0b5b8a16917aaa507d093f3336e1cf1d8f27cdb..5f3161ee0f64d234b260471fabd8b5f594048672 100644 (file)
@@ -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;
   }