summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.c6
-rw-r--r--src/config.y2
-rw-r--r--src/resolve.c1
3 files changed, 7 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c
index 09a0adc..8ae1ca6 100644
--- a/src/config.c
+++ b/src/config.c
@@ -236,10 +236,12 @@ void fastd_config_bind_address(fastd_context *ctx, fastd_config *conf, const fas
addr->addr = *address;
addr->bindtodev = bindtodev ? strdup(bindtodev) : NULL;
- if (address->sa.sa_family != AF_INET6 && (default_v4 || !conf->bind_addr_default_v4))
+ fastd_peer_address_simplify(&addr->addr);
+
+ if (addr->addr.sa.sa_family != AF_INET6 && (default_v4 || !conf->bind_addr_default_v4))
conf->bind_addr_default_v4 = addr;
- if (address->sa.sa_family != AF_INET && (default_v6 || !conf->bind_addr_default_v6))
+ if (addr->addr.sa.sa_family != AF_INET && (default_v6 || !conf->bind_addr_default_v6))
conf->bind_addr_default_v6 = addr;
}
diff --git a/src/config.y b/src/config.y
index d576b91..66912a2 100644
--- a/src/config.y
+++ b/src/config.y
@@ -347,6 +347,7 @@ peer_remote: TOK_ADDR4 port {
conf->peers->address.in.sin_family = AF_INET;
conf->peers->address.in.sin_addr = $1;
conf->peers->address.in.sin_port = htons($2);
+ fastd_peer_address_simplify(&conf->peers->address);
}
| TOK_ADDR6 port {
free(conf->peers->hostname);
@@ -355,6 +356,7 @@ peer_remote: TOK_ADDR4 port {
conf->peers->address.in6.sin6_family = AF_INET6;
conf->peers->address.in6.sin6_addr = $1;
conf->peers->address.in6.sin6_port = htons($2);
+ fastd_peer_address_simplify(&conf->peers->address);
}
| maybe_af TOK_STRING port maybe_float {
free(conf->peers->hostname);
diff --git a/src/resolve.c b/src/resolve.c
index a0a9312..642fd67 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -78,6 +78,7 @@ static void* resolve_peer(void *varg) {
if (!error) {
pr_verbose(arg->ctx, "resolved host `%s' successfully", arg->hostname);
memcpy(&ret.addr, res->ai_addr, res->ai_addrlen);
+ fastd_peer_address_simplify(&ret.addr);
}
else {
ret.addr.sa.sa_family = AF_UNSPEC;