]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: add %pIA for struct ipaddr *
authorDavid Lamparter <equinox@diac24.net>
Sun, 29 Mar 2020 09:09:14 +0000 (11:09 +0200)
committerDavid Lamparter <equinox@diac24.net>
Tue, 14 Jul 2020 09:15:47 +0000 (11:15 +0200)
Signed-off-by: David Lamparter <equinox@diac24.net>
lib/ipaddr.h
lib/prefix.c

index 46e70966ebdf9ae87a12ec09a33f22208c36c1e5..a96c9788bc375f6445c7dc240fd65e523e156c60 100644 (file)
@@ -124,6 +124,10 @@ static inline bool ipaddr_isset(struct ipaddr *ip)
        return (0 != memcmp(&a, ip, sizeof(struct ipaddr)));
 }
 
+#ifdef _FRR_ATTRIBUTE_PRINTFRR
+#pragma FRR printfrr_ext "%pIA"  (struct ipaddr *)
+#endif
+
 #ifdef __cplusplus
 }
 #endif
index 0900100be31174528d30e7f980fe37c192e557ce..7f660d03d8a89856c89e03be48dc57b52bdefa4a 100644 (file)
@@ -22,6 +22,7 @@
 #include <zebra.h>
 
 #include "prefix.h"
+#include "ipaddr.h"
 #include "vty.h"
 #include "sockunion.h"
 #include "memory.h"
@@ -1316,6 +1317,16 @@ char *esi_to_str(const esi_t *esi, char *buf, int size)
        return ptr;
 }
 
+printfrr_ext_autoreg_p("IA", printfrr_ia)
+static ssize_t printfrr_ia(char *buf, size_t bsz, const char *fmt,
+                          int prec, const void *ptr)
+{
+       const struct ipaddr *ipa = ptr;
+
+       ipaddr2str(ipa, buf, bsz);
+       return 2;
+}
+
 printfrr_ext_autoreg_p("I4", printfrr_i4)
 static ssize_t printfrr_i4(char *buf, size_t bsz, const char *fmt,
                           int prec, const void *ptr)