diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-04-21 01:49:25 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-04-21 01:49:25 +0200 |
commit | 7b8a9acd7a3a31f5d393c1632d68379f8353e7d1 (patch) | |
tree | 7126ffa0af27dddde06c973fb3f880fcf2851f8b /src | |
parent | dc9fa15a48ef572a4bd26e9449a65c59d1d495ce (diff) | |
download | fastd-7b8a9acd7a3a31f5d393c1632d68379f8353e7d1.tar fastd-7b8a9acd7a3a31f5d393c1632d68379f8353e7d1.zip |
shell: add interface for link-local addresses to PEER_ADDRESS as well
Diffstat (limited to 'src')
-rw-r--r-- | src/shell.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/shell.c b/src/shell.c index c1ecfa8..656c7cc 100644 --- a/src/shell.c +++ b/src/shell.c @@ -96,6 +96,12 @@ bool fastd_shell_exec(fastd_context_t *ctx, const char *command, const char *dir case AF_INET6: inet_ntop(AF_INET6, &peer_addr->in6.sin6_addr, buf, sizeof(buf)); + + if (IN6_IS_ADDR_LINKLOCAL(&peer_addr->in6.sin6_addr)) { + if (if_indextoname(peer_addr->in6.sin6_scope_id, buf+strlen(buf)+1)) + buf[strlen(buf)] = '%'; + } + setenv("PEER_ADDRESS", buf, 1); snprintf(buf, sizeof(buf), "%u", ntohs(peer_addr->in6.sin6_port)); |