summaryrefslogtreecommitdiffstats
path: root/src/fastd.h
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/fastd.h
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/fastd.h')
-rw-r--r--src/fastd.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/fastd.h b/src/fastd.h
index 9b1191a..9736e08 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -142,6 +142,7 @@ struct fastd_bind_address {
struct fastd_socket {
int fd;
const fastd_bind_address_t *addr;
+ fastd_peer_address_t *bound_addr;
fastd_peer_t *peer;
};
@@ -458,6 +459,11 @@ static inline void fastd_socket_close(fastd_context_t *ctx, fastd_socket_t *sock
sock->fd = -2;
}
+
+ if (sock->bound_addr) {
+ free(sock->bound_addr);
+ sock->bound_addr = NULL;
+ }
}
static inline bool timespec_after(const struct timespec *tp1, const struct timespec *tp2) {