summaryrefslogtreecommitdiffstats
path: root/src/log.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-01-26 09:23:00 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-01-26 09:23:00 +0100
commit534ae7240bc5cad6edb9fd160cdb0ff0eb4778de (patch)
tree9d77fdd80b3fb5da130de1c55b5f96406814447a /src/log.c
parentb78d55b69ed9d9c88d12f0159e78973ad0d70b49 (diff)
downloadfastd-534ae7240bc5cad6edb9fd160cdb0ff0eb4778de.tar
fastd-534ae7240bc5cad6edb9fd160cdb0ff0eb4778de.zip
Add support for link-local bind addresses
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/log.c b/src/log.c
index 81dfb20..fb3a8af 100644
--- a/src/log.c
+++ b/src/log.c
@@ -68,11 +68,11 @@ static size_t snprint_peer_address(const fastd_context_t *ctx, char *buffer, siz
if (inet_ntop(AF_INET6, &address->in6.sin6_addr, addr_buf, sizeof(addr_buf))) {
if (IN6_IS_ADDR_LINKLOCAL(&address->in6.sin6_addr)) {
char ifname_buf[IF_NAMESIZE];
- return snprintf_safe(buffer, size, "[%s%%%s]:%u", addr_buf, if_indextoname(address->in6.sin6_scope_id, ifname_buf), ntohs(address->in6.sin6_port));
- }
- else {
- return snprintf_safe(buffer, size, "[%s]:%u", addr_buf, ntohs(address->in6.sin6_port));
+ if (if_indextoname(address->in6.sin6_scope_id, ifname_buf))
+ return snprintf_safe(buffer, size, "[%s%%%s]:%u", addr_buf, if_indextoname(address->in6.sin6_scope_id, ifname_buf), ntohs(address->in6.sin6_port));
}
+
+ return snprintf_safe(buffer, size, "[%s]:%u", addr_buf, ntohs(address->in6.sin6_port));
}
else
return 0;