summaryrefslogtreecommitdiff
path: root/tests/lib/test_printfrr.c
diff options
context:
space:
mode:
authorG. Paul Ziemba <p-fbsd-bugs@ziemba.us>2021-09-09 08:25:03 -0700
committerG. Paul Ziemba <p-fbsd-bugs@ziemba.us>2021-09-14 10:06:57 -0700
commit016cfe701e2091cf94da129faf29f67999cad72e (patch)
tree892299d1156b2a3bf16ce498fefb9ec8f3c949a5 /tests/lib/test_printfrr.c
parent4250098311f4e6ca9da45ceed9e270c1cba6fba7 (diff)
lib,doc,tests: printfrr %pNHcg, %pNHci
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
Diffstat (limited to 'tests/lib/test_printfrr.c')
-rw-r--r--tests/lib/test_printfrr.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/lib/test_printfrr.c b/tests/lib/test_printfrr.c
index 21b3a916b8..06996a2f13 100644
--- a/tests/lib/test_printfrr.c
+++ b/tests/lib/test_printfrr.c
@@ -24,6 +24,7 @@
#include "lib/printfrr.h"
#include "lib/memory.h"
#include "lib/prefix.h"
+#include "lib/nexthop.h"
static int errors;
@@ -253,5 +254,25 @@ int main(int argc, char **argv)
printchk("\"\"", "%pSQqn", (char *)NULL);
printchk("(null)", "%pSQq", (char *)NULL);
+ /*
+ * %pNH<foo> tests
+ *
+ * gateway addresses only for now: interfaces require more setup
+ */
+ printchk("(null)", "%pNHcg", NULL);
+ printchk("(null)", "%pNHci", NULL);
+
+ struct nexthop nh;
+
+ memset(&nh, 0, sizeof(nh));
+
+ nh.type = NEXTHOP_TYPE_IPV4;
+ inet_aton("3.2.1.0", &nh.gate.ipv4);
+ printchk("3.2.1.0", "%pNHcg", &nh);
+
+ nh.type = NEXTHOP_TYPE_IPV6;
+ inet_pton(AF_INET6, "fe2c::34", &nh.gate.ipv6);
+ printchk("fe2c::34", "%pNHcg", &nh);
+
return !!errors;
}