aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/addr.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-05 15:42:06 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-05 15:42:06 +0000
commit08e517da1b18105b16fe7124f304f248a7a86e2f (patch)
tree8d864b0d4f3ddb551d1b025d78ac9002f191f2f0 /src/libutil/addr.c
parentc9e6e26319c08a0e440a9e27b9bf3743e32ad70b (diff)
downloadrspamd-08e517da1b18105b16fe7124f304f248a7a86e2f.tar.gz
rspamd-08e517da1b18105b16fe7124f304f248a7a86e2f.zip
[Minor] Copy ipv6 address in full on accept
Diffstat (limited to 'src/libutil/addr.c')
-rw-r--r--src/libutil/addr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libutil/addr.c b/src/libutil/addr.c
index 138dc1318..15480a9ad 100644
--- a/src/libutil/addr.c
+++ b/src/libutil/addr.c
@@ -248,18 +248,19 @@ rspamd_accept_from_socket (gint sock, rspamd_inet_addr_t **target,
addr = rspamd_inet_addr_create (AF_INET, NULL);
memcpy (&addr->u.in.addr.s4.sin_addr, &p[12],
sizeof (struct in_addr));
+ addr->u.in.addr.s4.sin_port = su.s6.sin6_port;
}
else {
/* Something strange but not mapped v4 address */
addr = rspamd_inet_addr_create (AF_INET6, NULL);
- memcpy (&addr->u.in.addr.s6.sin6_addr, &su.s6.sin6_addr,
- sizeof (struct in6_addr));
+ memcpy (&addr->u.in.addr.s6, &su.s6,
+ sizeof (struct sockaddr_in6));
}
}
else {
addr = rspamd_inet_addr_create (AF_INET6, NULL);
- memcpy (&addr->u.in.addr.s6.sin6_addr, &su.s6.sin6_addr,
- sizeof (struct in6_addr));
+ memcpy (&addr->u.in.addr.s6, &su.s6,
+ sizeof (struct sockaddr_in6));
}
}