diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2012-01-08 15:28:27 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2012-01-08 15:31:34 +0100 |
commit | 53ffbff39f054e1302fb296327b9bb1b4f88226c (patch) | |
tree | 6e0f21ac671dd1cf35d7a3322a89ebb304b0c2c6 /lib | |
parent | eb1451a3a0c45a4cc62dd0f1f3c3157ec38e2f8e (diff) |
Implements support for link-local addresses in BGP.
Thanks Matthias Schiffer for the original patch.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/printf.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/printf.c b/lib/printf.c index c3f7074d..14af1062 100644 --- a/lib/printf.c +++ b/lib/printf.c @@ -12,6 +12,8 @@ #include <errno.h> +#include "nest/iface.h" + /* we use this so that we can do without the ctype library */ #define is_digit(c) ((c) >= '0' && (c) <= '9') @@ -138,6 +140,7 @@ int bvsnprintf(char *buf, int size, const char *fmt, va_list args) char *str, *start; const char *s; char ipbuf[STD_ADDRESS_P_LENGTH+1]; + struct iface *iface; int flags; /* flags to number() */ @@ -279,6 +282,21 @@ int bvsnprintf(char *buf, int size, const char *fmt, va_list args) s = ipbuf; goto str; + /* Interface scope after link-local IP address */ + case 'J': + iface = va_arg(args, struct iface *); + if (!iface) + continue; + if (!size) + return -1; + + *str++ = '%'; + start++; + size--; + + s = iface->name; + goto str; + /* Router/Network ID - essentially IPv4 address in u32 value */ case 'R': x = va_arg(args, u32); |