summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authortobhe <tobhe@cvs.openbsd.org>2020-06-03 17:56:43 +0000
committertobhe <tobhe@cvs.openbsd.org>2020-06-03 17:56:43 +0000
commit8d7b8115963f382f2bb4d6795e8578df372c54c4 (patch)
treecaf8073865c1135c7db72d89fd5e7ceb17bfbe16 /sbin
parent9fa50c46892b1c523c2f1cc4610bc6617da3dccc (diff)
Pass sockaddr instead of sockaddr_storage to sa_address.
ok patrick@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/iked/iked.h5
-rw-r--r--sbin/iked/ikev2.c14
-rw-r--r--sbin/iked/policy.c11
3 files changed, 16 insertions, 14 deletions
diff --git a/sbin/iked/iked.h b/sbin/iked/iked.h
index 866f342f4a0..7a1cda921fb 100644
--- a/sbin/iked/iked.h
+++ b/sbin/iked/iked.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iked.h,v 1.151 2020/05/26 20:24:31 tobhe Exp $ */
+/* $OpenBSD: iked.h,v 1.152 2020/06/03 17:56:42 tobhe Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -806,8 +806,7 @@ struct iked_sa *
struct iked_policy *);
void sa_free(struct iked *, struct iked_sa *);
void sa_free_flows(struct iked *, struct iked_saflows *);
-int sa_address(struct iked_sa *, struct iked_addr *,
- struct sockaddr_storage *);
+int sa_address(struct iked_sa *, struct iked_addr *, struct sockaddr *);
void childsa_free(struct iked_childsa *);
struct iked_childsa *
childsa_lookup(struct iked_sa *, uint64_t, uint8_t);
diff --git a/sbin/iked/ikev2.c b/sbin/iked/ikev2.c
index c17371afb5a..316af196a3d 100644
--- a/sbin/iked/ikev2.c
+++ b/sbin/iked/ikev2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ikev2.c,v 1.229 2020/06/02 19:37:47 tobhe Exp $ */
+/* $OpenBSD: ikev2.c,v 1.230 2020/06/03 17:56:42 tobhe Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -633,8 +633,10 @@ ikev2_recv(struct iked *env, struct iked_message *msg)
sa->sa_msgid_current = msg->msg_msgid;
}
- if (sa_address(sa, &sa->sa_peer, &msg->msg_peer) == -1 ||
- sa_address(sa, &sa->sa_local, &msg->msg_local) == -1)
+ if (sa_address(sa, &sa->sa_peer, (struct sockaddr *)&msg->msg_peer)
+ == -1 ||
+ sa_address(sa, &sa->sa_local, (struct sockaddr *)&msg->msg_local)
+ == -1)
return;
sa->sa_fd = msg->msg_fd;
@@ -3720,8 +3722,10 @@ ikev2_init_create_child_sa(struct iked *env, struct iked_message *msg)
sa->sa_nextr = NULL;
/* Setup address, socket and NAT information */
sa_state(env, dsa, IKEV2_STATE_CLOSING);
- sa_address(dsa, &dsa->sa_peer, &sa->sa_peer.addr);
- sa_address(dsa, &dsa->sa_local, &sa->sa_local.addr);
+ sa_address(dsa, &dsa->sa_peer,
+ (struct sockaddr *)&sa->sa_peer.addr);
+ sa_address(dsa, &dsa->sa_local,
+ (struct sockaddr *)&sa->sa_local.addr);
dsa->sa_fd = sa->sa_fd;
dsa->sa_natt = sa->sa_natt;
dsa->sa_udpencap = sa->sa_udpencap;
diff --git a/sbin/iked/policy.c b/sbin/iked/policy.c
index 8992f37bd99..4b1f3c7738b 100644
--- a/sbin/iked/policy.c
+++ b/sbin/iked/policy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: policy.c,v 1.63 2020/05/26 20:24:31 tobhe Exp $ */
+/* $OpenBSD: policy.c,v 1.64 2020/06/03 17:56:42 tobhe Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -541,13 +541,12 @@ sa_free_flows(struct iked *env, struct iked_saflows *head)
int
-sa_address(struct iked_sa *sa, struct iked_addr *addr,
- struct sockaddr_storage *peer)
+sa_address(struct iked_sa *sa, struct iked_addr *addr, struct sockaddr *peer)
{
bzero(addr, sizeof(*addr));
- addr->addr_af = peer->ss_family;
- addr->addr_port = htons(socket_getport((struct sockaddr *)peer));
- memcpy(&addr->addr, peer, sizeof(*peer));
+ addr->addr_af = peer->sa_family;
+ addr->addr_port = htons(socket_getport(peer));
+ memcpy(&addr->addr, peer, peer->sa_len);
if (socket_af((struct sockaddr *)&addr->addr, addr->addr_port) == -1) {
log_debug("%s: invalid address", __func__);
return (-1);