summaryrefslogtreecommitdiff
path: root/sbin/iked
diff options
context:
space:
mode:
authortobhe <tobhe@cvs.openbsd.org>2020-03-16 09:07:41 +0000
committertobhe <tobhe@cvs.openbsd.org>2020-03-16 09:07:41 +0000
commit52c14a7072c4608fdc9336acebdc01f6e6257236 (patch)
treedd1e7e19337f1223791a0295bafa9250e42fad98 /sbin/iked
parentfc346359f7560e4794e0d48b96f931aacc1fc9d7 (diff)
Correctly calculate IPv6 address leases from small address pools.
Bug report and fix from Chuck Zmudzinski <frchuckz (at) gmail (dot) com> ok patrick@
Diffstat (limited to 'sbin/iked')
-rw-r--r--sbin/iked/ikev2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/iked/ikev2.c b/sbin/iked/ikev2.c
index 2dd2b2c648d..56d00df3363 100644
--- a/sbin/iked/ikev2.c
+++ b/sbin/iked/ikev2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ikev2.c,v 1.195 2020/03/10 18:54:52 tobhe Exp $ */
+/* $OpenBSD: ikev2.c,v 1.196 2020/03/16 09:07:40 tobhe Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -6092,7 +6092,9 @@ ikev2_cp_setaddr(struct iked *env, struct iked_sa *sa, sa_family_t family)
break;
case AF_INET6:
memcpy(in6, cfg6, sizeof(*in6));
- nhost = htonl(host);
+ memcpy(&nhost, &cfg6->sin6_addr.s6_addr[12],
+ sizeof(uint32_t));
+ nhost = (nhost & mask) | htonl(host);
memcpy(&in6->sin6_addr.s6_addr[12], &nhost,
sizeof(uint32_t));
break;