summaryrefslogtreecommitdiffstats
path: root/src/peer.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-04-17 21:42:22 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-04-17 21:44:02 +0200
commitdaf3d6e8db9ef39b50dce040f864fb409bd7044a (patch)
tree49abaa8d953a515f4b8b445d46f7480ee1f8c3fd /src/peer.c
parent41ea8e454937444da4d2bb33fe768adb5b02776b (diff)
downloadfastd-daf3d6e8db9ef39b50dce040f864fb409bd7044a.tar
fastd-daf3d6e8db9ef39b50dce040f864fb409bd7044a.zip
Fix handling of the local address in shell commands
Without this fix, using on-establish/disestablish/verify would cause a strange zero port when a bind with a random port was used, and a segmentation fault with dynamic binds.
Diffstat (limited to 'src/peer.c')
-rw-r--r--src/peer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/peer.c b/src/peer.c
index 55f0467..f4d62e3 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -36,14 +36,14 @@ static inline void on_establish(fastd_context_t *ctx, const fastd_peer_t *peer)
if (!ctx->conf->on_establish)
return;
- fastd_shell_exec(ctx, ctx->conf->on_establish, ctx->conf->on_establish_dir, peer, &peer->sock->addr->addr, &peer->address, NULL);
+ fastd_shell_exec(ctx, ctx->conf->on_establish, ctx->conf->on_establish_dir, peer, peer->sock->bound_addr, &peer->address, NULL);
}
static inline void on_disestablish(fastd_context_t *ctx, const fastd_peer_t *peer) {
if (!ctx->conf->on_disestablish)
return;
- fastd_shell_exec(ctx, ctx->conf->on_disestablish, ctx->conf->on_disestablish_dir, peer, &peer->sock->addr->addr, &peer->address, NULL);
+ fastd_shell_exec(ctx, ctx->conf->on_disestablish, ctx->conf->on_disestablish_dir, peer, peer->sock->bound_addr, &peer->address, NULL);
}
static inline void free_socket(fastd_context_t *ctx, fastd_peer_t *peer) {