]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Showing MPLS labels in hostentry display
authorMaria Matejka <mq@ucw.cz>
Mon, 29 Jan 2024 15:56:22 +0000 (16:56 +0100)
committerMaria Matejka <mq@ucw.cz>
Mon, 29 Jan 2024 21:12:38 +0000 (22:12 +0100)
nest/rt-attr.c

index e6f70ad8d86a70f39424bb2000f0fa722b449a9b..546c67dba0bb774c75b0d92bee186fbc5f843497 100644 (file)
@@ -1373,10 +1373,20 @@ ea_show_hostentry(const struct adata *ad, byte *buf, uint size)
 {
   const struct hostentry_adata *had = (const struct hostentry_adata *) ad;
 
+  uint s = 0;
+
   if (ipa_nonzero(had->he->link) && !ipa_equal(had->he->link, had->he->addr))
-    bsnprintf(buf, size, "via %I %I table %s", had->he->addr, had->he->link, had->he->tab->name);
+    s = bsnprintf(buf, size, "via %I %I table %s", had->he->addr, had->he->link, had->he->tab->name);
   else
-    bsnprintf(buf, size, "via %I table %s", had->he->addr, had->he->tab->name);
+    s = bsnprintf(buf, size, "via %I table %s", had->he->addr, had->he->tab->name);
+
+  uint lc = HOSTENTRY_LABEL_COUNT(had);
+  if (!lc)
+    return;
+
+  s = bsnprintf((buf += s), (size -= s), " labels");
+  for (uint i=0; i < lc; i++)
+    s = bsnprintf((buf += s), (size -= s), " %u", had->labels[i]);
 }
 
 /**