diff options
author | Hakan Olsson <ho@cvs.openbsd.org> | 2001-06-29 18:52:18 +0000 |
---|---|---|
committer | Hakan Olsson <ho@cvs.openbsd.org> | 2001-06-29 18:52:18 +0000 |
commit | 9b1cd4b782681b4130d746d3ed6f4efbaeaa89ca (patch) | |
tree | 3ab56060102464963360c1550ef0f40c9a40cc5b /sbin/isakmpd | |
parent | 3d6be290c7eacaeaa47182b99ba881001085d78e (diff) |
Change get_src/get_dst API as we get the length with sa_len.
Diffstat (limited to 'sbin/isakmpd')
-rw-r--r-- | sbin/isakmpd/cookie.c | 7 | ||||
-rw-r--r-- | sbin/isakmpd/dnssec.c | 4 | ||||
-rw-r--r-- | sbin/isakmpd/exchange.c | 5 | ||||
-rw-r--r-- | sbin/isakmpd/ike_phase_1.c | 7 | ||||
-rw-r--r-- | sbin/isakmpd/ike_quick_mode.c | 15 | ||||
-rw-r--r-- | sbin/isakmpd/ipsec.c | 37 | ||||
-rw-r--r-- | sbin/isakmpd/message.c | 19 | ||||
-rw-r--r-- | sbin/isakmpd/pf_key_v2.c | 39 | ||||
-rw-r--r-- | sbin/isakmpd/policy.c | 12 | ||||
-rw-r--r-- | sbin/isakmpd/sa.c | 10 | ||||
-rw-r--r-- | sbin/isakmpd/transport.h | 10 | ||||
-rw-r--r-- | sbin/isakmpd/udp.c | 16 |
12 files changed, 81 insertions, 100 deletions
diff --git a/sbin/isakmpd/cookie.c b/sbin/isakmpd/cookie.c index 39e2d1b781e..27b1bbe5947 100644 --- a/sbin/isakmpd/cookie.c +++ b/sbin/isakmpd/cookie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cookie.c,v 1.8 2001/06/29 18:12:07 ho Exp $ */ +/* $OpenBSD: cookie.c,v 1.9 2001/06/29 18:52:16 ho Exp $ */ /* $EOM: cookie.c,v 1.21 1999/08/05 15:00:04 niklas Exp $ */ /* @@ -63,13 +63,12 @@ cookie_gen (struct transport *t, struct exchange *exchange, u_int8_t *buf, { struct hash* hash = hash_get (HASH_SHA1); struct sockaddr *name; - int name_len; u_int8_t tmpsecret[COOKIE_SECRET_SIZE]; hash->Init (hash->ctx); - (*t->vtbl->get_dst) (t, &name, &name_len); + (*t->vtbl->get_dst) (t, &name); hash->Update (hash->ctx, (u_int8_t *)name, name->sa_len); - (*t->vtbl->get_src) (t, &name, &name_len); + (*t->vtbl->get_src) (t, &name); hash->Update (hash->ctx, (u_int8_t *)name, name->sa_len); if (exchange->initiator == 0) hash->Update (hash->ctx, exchange->cookies + ISAKMP_HDR_ICOOKIE_OFF, diff --git a/sbin/isakmpd/dnssec.c b/sbin/isakmpd/dnssec.c index bfc74b3651c..061c857094a 100644 --- a/sbin/isakmpd/dnssec.c +++ b/sbin/isakmpd/dnssec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dnssec.c,v 1.5 2001/06/29 03:39:04 ho Exp $ */ +/* $OpenBSD: dnssec.c,v 1.6 2001/06/29 18:52:16 ho Exp $ */ /* * Copyright (c) 2001 Håkan Olsson. All rights reserved. @@ -91,7 +91,7 @@ dns_get_key (int type, struct message *msg, int *keylen) } /* Get peer IP address */ - msg->transport->vtbl->get_dst (msg->transport, &dst, &i); + msg->transport->vtbl->get_dst (msg->transport, &dst); /* Get peer name and aliases */ switch (dst->sa_family) { diff --git a/sbin/isakmpd/exchange.c b/sbin/isakmpd/exchange.c index 8e1a9727446..9cfb5fa6462 100644 --- a/sbin/isakmpd/exchange.c +++ b/sbin/isakmpd/exchange.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exchange.c,v 1.51 2001/06/27 00:48:21 angelos Exp $ */ +/* $OpenBSD: exchange.c,v 1.52 2001/06/29 18:52:16 ho Exp $ */ /* $EOM: exchange.c,v 1.143 2000/12/04 00:02:25 angelos Exp $ */ /* @@ -947,7 +947,6 @@ exchange_setup_p1 (struct message *msg, u_int32_t doi) struct transport *t = msg->transport; struct exchange *exchange; struct sockaddr *dst; - int dst_len; char *name = 0, *policy = 0, *str; u_int32_t want_doi; u_int8_t type; @@ -966,7 +965,7 @@ exchange_setup_p1 (struct message *msg, u_int32_t doi) * XXX Assumes IPv4. It might make sense to search through several * policies too. */ - t->vtbl->get_dst (t, &dst, &dst_len); + t->vtbl->get_dst (t, &dst); name = conf_get_str ("Phase 1", inet_ntoa (((struct sockaddr_in *)dst)->sin_addr)); if (name) diff --git a/sbin/isakmpd/ike_phase_1.c b/sbin/isakmpd/ike_phase_1.c index d3a32c1923e..e601619370e 100644 --- a/sbin/isakmpd/ike_phase_1.c +++ b/sbin/isakmpd/ike_phase_1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ike_phase_1.c,v 1.27 2001/06/29 04:12:00 ho Exp $ */ +/* $OpenBSD: ike_phase_1.c,v 1.28 2001/06/29 18:52:16 ho Exp $ */ /* $EOM: ike_phase_1.c,v 1.31 2000/12/11 23:47:56 niklas Exp $ */ /* @@ -785,7 +785,6 @@ ike_phase_1_send_ID (struct message *msg) char header[80]; ssize_t sz; struct sockaddr *src; - int src_len; int initiator = exchange->initiator; u_int8_t **id; size_t *id_len; @@ -823,7 +822,7 @@ ike_phase_1_send_ID (struct message *msg) { case IPSEC_ID_IPV4_ADDR: case IPSEC_ID_IPV6_ADDR: - msg->transport->vtbl->get_src (msg->transport, &src, &src_len); + msg->transport->vtbl->get_src (msg->transport, &src); /* Already in network byteorder. */ memcpy (buf + ISAKMP_ID_DATA_OFF, sockaddr_data (src), @@ -843,7 +842,7 @@ ike_phase_1_send_ID (struct message *msg) } else { - msg->transport->vtbl->get_src (msg->transport, &src, &src_len); + msg->transport->vtbl->get_src (msg->transport, &src); switch (src->sa_family) { case AF_INET: diff --git a/sbin/isakmpd/ike_quick_mode.c b/sbin/isakmpd/ike_quick_mode.c index 6d08570b574..8ad5053671c 100644 --- a/sbin/isakmpd/ike_quick_mode.c +++ b/sbin/isakmpd/ike_quick_mode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ike_quick_mode.c,v 1.51 2001/06/29 17:59:34 ho Exp $ */ +/* $OpenBSD: ike_quick_mode.c,v 1.52 2001/06/29 18:52:16 ho Exp $ */ /* $EOM: ike_quick_mode.c,v 1.139 2001/01/26 10:43:17 niklas Exp $ */ /* @@ -451,7 +451,6 @@ initiator_send_HASH_SA_NONCE (struct message *msg) struct ipsec_sa *isa = msg->isakmp_sa->data; struct hash *hash = hash_get (isa->hash); struct sockaddr *src; - socklen_t srclen; if (!ipsec_add_hash_payload (msg, hash->hashsize)) return -1; @@ -889,7 +888,7 @@ initiator_send_HASH_SA_NONCE (struct message *msg) /* If we're here, then we are the initiator, so use initiator address for local ID */ - msg->transport->vtbl->get_src (msg->transport, &src, &srclen); + msg->transport->vtbl->get_src (msg->transport, &src); sz = ISAKMP_ID_SZ + sockaddr_len (src); id = calloc (sz, sizeof (char)); @@ -1006,7 +1005,6 @@ initiator_recv_HASH_SA_NONCE (struct message *msg) u_int8_t *rest; size_t rest_len; struct sockaddr *src, *dst; - socklen_t srclen, dstlen; /* Allocate the prf and start calculating our HASH(1). XXX Share? */ LOG_DBG_BUF ((LOG_NEGOTIATION, 90, "initiator_recv_HASH_SA_NONCE: SKEYID_a", @@ -1123,8 +1121,8 @@ initiator_recv_HASH_SA_NONCE (struct message *msg) ie->flags = IPSEC_EXCH_FLAG_NO_ID; /* Get initiator and responder addresses. */ - msg->transport->vtbl->get_src (msg->transport, &src, &srclen); - msg->transport->vtbl->get_dst (msg->transport, &dst, &dstlen); + msg->transport->vtbl->get_src (msg->transport, &src); + msg->transport->vtbl->get_dst (msg->transport, &dst); ie->id_ci_sz = ISAKMP_ID_DATA_OFF + sockaddr_len (src); ie->id_cr_sz = ISAKMP_ID_DATA_OFF + sockaddr_len (dst); ie->id_ci = calloc (ie->id_ci_sz, sizeof (char)); @@ -1416,7 +1414,6 @@ responder_recv_HASH_SA_NONCE (struct message *msg) int retval = -1; struct proto *proto; struct sockaddr *src, *dst; - socklen_t srclen, dstlen; char *name; hashp = TAILQ_FIRST (&msg->payload[ISAKMP_PAYLOAD_HASH]); @@ -1536,8 +1533,8 @@ responder_recv_HASH_SA_NONCE (struct message *msg) ie->flags = IPSEC_EXCH_FLAG_NO_ID; /* Get initiator and responder addresses. */ - msg->transport->vtbl->get_src (msg->transport, &src, &srclen); - msg->transport->vtbl->get_dst (msg->transport, &dst, &dstlen); + msg->transport->vtbl->get_src (msg->transport, &src); + msg->transport->vtbl->get_dst (msg->transport, &dst); ie->id_ci_sz = ISAKMP_ID_DATA_OFF + sockaddr_len (src); ie->id_cr_sz = ISAKMP_ID_DATA_OFF + sockaddr_len (dst); ie->id_ci = calloc (ie->id_ci_sz, sizeof (char)); diff --git a/sbin/isakmpd/ipsec.c b/sbin/isakmpd/ipsec.c index 438264b640c..30682474948 100644 --- a/sbin/isakmpd/ipsec.c +++ b/sbin/isakmpd/ipsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec.c,v 1.48 2001/06/29 18:05:24 ho Exp $ */ +/* $OpenBSD: ipsec.c,v 1.49 2001/06/29 18:52:17 ho Exp $ */ /* $EOM: ipsec.c,v 1.143 2000/12/11 23:57:42 niklas Exp $ */ /* @@ -201,19 +201,18 @@ ipsec_sa_check (struct sa *sa, void *v_arg) struct dst_spi_proto_arg *arg = v_arg; struct proto *proto; struct sockaddr *dst, *src; - int dstlen, srclen; int incoming; if (sa->phase != 2 || !(sa->flags & SA_FLAG_READY)) return 0; - sa->transport->vtbl->get_dst (sa->transport, &dst, &dstlen); + sa->transport->vtbl->get_dst (sa->transport, &dst); if (memcmp (sockaddr_data (dst), sockaddr_data (arg->dst), sockaddr_len (dst)) == 0) incoming = 0; else { - sa->transport->vtbl->get_src (sa->transport, &src, &srclen); + sa->transport->vtbl->get_src (sa->transport, &src); if (memcmp (sockaddr_data (src), sockaddr_data (arg->dst), sockaddr_len (src)) == 0) incoming = 1; @@ -929,7 +928,7 @@ static void ipsec_invalid_spi (struct message *msg, struct payload *p) { struct sockaddr *dst; - int invspisz, off, dstlen; + int invspisz, off; u_int32_t spi; u_int16_t totsiz; u_int8_t spisz; @@ -953,7 +952,7 @@ ipsec_invalid_spi (struct message *msg, struct payload *p) } memcpy (&spi, p->p + off, sizeof spi); - msg->transport->vtbl->get_dst (msg->transport, &dst, &dstlen); + msg->transport->vtbl->get_dst (msg->transport, &dst); /* delete matching SPI's from this peer */ ipsec_delete_spi_list (dst, 0, (u_int8_t *)&spi, 1, "INVALID_SPI"); @@ -1474,7 +1473,6 @@ static u_int8_t * ipsec_get_spi (size_t *sz, u_int8_t proto, struct message *msg) { struct sockaddr *dst, *src; - int dstlen, srclen; struct transport *transport = msg->transport; if (msg->exchange->phase == 1) @@ -1485,9 +1483,9 @@ ipsec_get_spi (size_t *sz, u_int8_t proto, struct message *msg) else { /* We are the destination in the SA we want a SPI for. */ - transport->vtbl->get_src (transport, &dst, &dstlen); + transport->vtbl->get_src (transport, &dst); /* The peer is the source. */ - transport->vtbl->get_dst (transport, &src, &srclen); + transport->vtbl->get_dst (transport, &src); return sysdep_ipsec_get_spi (sz, proto, src, src->sa_len, dst, dst->sa_len, msg->exchange->seq); } @@ -1505,7 +1503,6 @@ ipsec_handle_leftover_payload (struct message *msg, u_int8_t type, { u_int32_t spisz, nspis; struct sockaddr *dst; - socklen_t dstlen; int reenter = 0; u_int8_t *spis, proto; struct sa *sa; @@ -1544,7 +1541,7 @@ ipsec_handle_leftover_payload (struct message *msg, u_int8_t type, /* extract SPI and get dst address */ memcpy (spis, payload->p + ISAKMP_DELETE_SPI_OFF, nspis * spisz); - msg->transport->vtbl->get_dst (msg->transport, &dst, &dstlen); + msg->transport->vtbl->get_dst (msg->transport, &dst); ipsec_delete_spi_list (dst, proto, spis, nspis, "DELETE"); @@ -1561,8 +1558,8 @@ ipsec_handle_leftover_payload (struct message *msg, u_int8_t type, * ready. Exchanges will timeout themselves and then the * non-ready SAs will disappear too. */ - msg->transport->vtbl->get_dst (msg->transport, &dst, &dstlen); - while ((sa = sa_lookup_by_peer (dst, dstlen)) != 0) + msg->transport->vtbl->get_dst (msg->transport, &dst); + while ((sa = sa_lookup_by_peer (dst, dst->sa_len)) != 0) { /* * Don't delete the current SA -- we received the notification @@ -2011,7 +2008,6 @@ ipsec_add_contact (struct message *msg) { struct contact *new_contacts; struct sockaddr *dst, *addr; - socklen_t dstlen; int cnt; if (contact_cnt == contact_limit) @@ -2027,16 +2023,16 @@ ipsec_add_contact (struct message *msg) contact_limit = cnt; contacts = new_contacts; } - msg->transport->vtbl->get_dst (msg->transport, &dst, &dstlen); - addr = malloc (dstlen); + msg->transport->vtbl->get_dst (msg->transport, &dst); + addr = malloc (dst->sa_len); if (!addr) { - log_error ("ipsec_add_contact: malloc (%d) failed", dstlen); + log_error ("ipsec_add_contact: malloc (%d) failed", dst->sa_len); return -1; } - memcpy (addr, dst, dstlen); + memcpy (addr, dst, dst->sa_len); contacts[contact_cnt].addr = addr; - contacts[contact_cnt++].len = dstlen; + contacts[contact_cnt++].len = dst->sa_len; /* * XXX There are better algorithms for already mostly-sorted data like @@ -2052,7 +2048,8 @@ ipsec_contacted (struct message *msg) { struct contact contact; - msg->transport->vtbl->get_dst (msg->transport, &contact.addr, &contact.len); + msg->transport->vtbl->get_dst (msg->transport, &contact.addr); + contact.len = contact.addr->sa_len; return contacts ? (bsearch (&contact, contacts, contact_cnt, sizeof *contacts, addr_cmp) != 0) diff --git a/sbin/isakmpd/message.c b/sbin/isakmpd/message.c index a8429a4b743..43fcfa1bf15 100644 --- a/sbin/isakmpd/message.c +++ b/sbin/isakmpd/message.c @@ -1,4 +1,4 @@ -/* $OpenBSD: message.c,v 1.42 2001/04/24 07:27:37 niklas Exp $ */ +/* $OpenBSD: message.c,v 1.43 2001/06/29 18:52:17 ho Exp $ */ /* $EOM: message.c,v 1.156 2000/10/10 12:36:39 provos Exp $ */ /* @@ -1345,10 +1345,9 @@ message_send_delete (struct sa *sa) struct proto *proto; struct sa *isakmp_sa; struct sockaddr *dst; - socklen_t dstlen; - sa->transport->vtbl->get_dst (sa->transport, &dst, &dstlen); - isakmp_sa = sa_isakmp_lookup_by_peer (dst, dstlen); + sa->transport->vtbl->get_dst (sa->transport, &dst); + isakmp_sa = sa_isakmp_lookup_by_peer (dst, dst->sa_len); if (!isakmp_sa) { /* @@ -1450,9 +1449,8 @@ message_drop (struct message *msg, int notify, struct proto *proto, { struct transport *t = msg->transport; struct sockaddr *dst; - int dst_len; - t->vtbl->get_dst (t, &dst, &dst_len); + t->vtbl->get_dst (t, &dst); /* XXX Assumes IPv4. */ log_print ("dropped message from %s port %d due to notification type %s", @@ -1503,7 +1501,6 @@ message_packet_log (struct message *msg) { #ifdef USE_DEBUG struct sockaddr *src, *dst; - int srclen, dstlen; /* Don't log retransmissions. Redundant for incoming packets... */ if (msg->xmits > 0) @@ -1512,13 +1509,13 @@ message_packet_log (struct message *msg) /* Figure out direction. */ if (msg->exchange && msg->exchange->initiator ^ (msg->exchange->step % 2)) { - msg->transport->vtbl->get_src (msg->transport, &src, &srclen); - msg->transport->vtbl->get_dst (msg->transport, &dst, &dstlen); + msg->transport->vtbl->get_src (msg->transport, &src); + msg->transport->vtbl->get_dst (msg->transport, &dst); } else { - msg->transport->vtbl->get_src (msg->transport, &dst, &dstlen); - msg->transport->vtbl->get_dst (msg->transport, &src, &srclen); + msg->transport->vtbl->get_src (msg->transport, &dst); + msg->transport->vtbl->get_dst (msg->transport, &src); } log_packet_iov (src, dst, msg->iov, msg->iovlen); diff --git a/sbin/isakmpd/pf_key_v2.c b/sbin/isakmpd/pf_key_v2.c index b63bbaedb7c..6ee51fd2043 100644 --- a/sbin/isakmpd/pf_key_v2.c +++ b/sbin/isakmpd/pf_key_v2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_key_v2.c,v 1.70 2001/06/29 18:05:24 ho Exp $ */ +/* $OpenBSD: pf_key_v2.c,v 1.71 2001/06/29 18:52:17 ho Exp $ */ /* $EOM: pf_key_v2.c,v 1.79 2000/12/12 00:33:19 niklas Exp $ */ /* @@ -776,7 +776,7 @@ pf_key_v2_set_spi (struct sa *sa, struct proto *proto, int incoming, struct sockaddr *src, *dst; struct sadb_ident *sid = 0; char *pp; - int srclen, dstlen, keylen, hashlen, err, idtype; + int keylen, hashlen, err, idtype; struct pf_key_v2_msg *update = 0, *ret = 0; struct ipsec_proto *iproto = proto->data; #if defined (SADB_X_CREDTYPE_NONE) || defined (SADB_X_AUTHTYPE_NONE) @@ -923,9 +923,9 @@ pf_key_v2_set_spi (struct sa *sa, struct proto *proto, int incoming, goto cleanup; } if (incoming) - sa->transport->vtbl->get_src (sa->transport, &dst, &dstlen); + sa->transport->vtbl->get_src (sa->transport, &dst); else - sa->transport->vtbl->get_dst (sa->transport, &dst, &dstlen); + sa->transport->vtbl->get_dst (sa->transport, &dst); #ifdef KAME msg.sadb_msg_seq = (incoming ? pf_key_v2_seq_by_sa (proto->spi[incoming], @@ -1022,9 +1022,9 @@ pf_key_v2_set_spi (struct sa *sa, struct proto *proto, int incoming, * Setup the ADDRESS extensions. */ if (incoming) - sa->transport->vtbl->get_dst (sa->transport, &src, &srclen); + sa->transport->vtbl->get_dst (sa->transport, &src); else - sa->transport->vtbl->get_src (sa->transport, &src, &srclen); + sa->transport->vtbl->get_src (sa->transport, &src); len = sizeof *addr + PF_KEY_V2_ROUND (src->sa_len); addr = calloc (1, len); if (!addr) @@ -2060,7 +2060,7 @@ pf_key_v2_enable_sa (struct sa *sa, struct sa *isakmp_sa) { struct ipsec_sa *isa = sa->data; struct sockaddr *dst, *src; - int dstlen, srclen, error; + int error; struct proto *proto = TAILQ_FIRST (&sa->protos); int sidtype = 0, didtype = 0, sidlen = 0, didlen = 0; u_int8_t *sid = 0, *did = 0; @@ -2069,8 +2069,8 @@ pf_key_v2_enable_sa (struct sa *sa, struct sa *isakmp_sa) struct sockaddr *hostmask = (struct sockaddr *)&hostmask_storage; #endif /* SADB_X_EXT_FLOW_TYPE */ - sa->transport->vtbl->get_dst (sa->transport, &dst, &dstlen); - sa->transport->vtbl->get_src (sa->transport, &src, &srclen); + sa->transport->vtbl->get_dst (sa->transport, &dst); + sa->transport->vtbl->get_src (sa->transport, &src); #ifdef SADB_X_EXT_FLOW_TYPE if (isakmp_sa->id_i) @@ -2278,7 +2278,6 @@ pf_key_v2_disable_sa (struct sa *sa, int incoming) { struct ipsec_sa *isa = sa->data; struct sockaddr *dst, *src; - int dstlen, srclen; struct proto *proto = TAILQ_FIRST (&sa->protos); #ifndef SADB_X_EXT_FLOW_TYPE struct sockaddr_storage hostmask_storage; @@ -2286,8 +2285,8 @@ pf_key_v2_disable_sa (struct sa *sa, int incoming) int error; #endif /* SADB_X_EXT_FLOW_TYPE */ - sa->transport->vtbl->get_dst (sa->transport, &dst, &dstlen); - sa->transport->vtbl->get_src (sa->transport, &src, &srclen); + sa->transport->vtbl->get_dst (sa->transport, &dst); + sa->transport->vtbl->get_src (sa->transport, &src); if (!incoming) return pf_key_v2_flow (isa->src_net, isa->src_mask, isa->dst_net, @@ -2345,7 +2344,7 @@ pf_key_v2_delete_spi (struct sa *sa, struct proto *proto, int incoming) struct sadb_sa ssa; struct sadb_address *addr = 0; struct sockaddr *saddr; - int saddrlen, len, err; + int len, err; struct pf_key_v2_msg *delete = 0, *ret = 0; #ifdef KAME struct sadb_x_sa2 ssa2; @@ -2411,9 +2410,9 @@ pf_key_v2_delete_spi (struct sa *sa, struct proto *proto, int incoming) * Setup the ADDRESS extensions. */ if (incoming) - sa->transport->vtbl->get_dst (sa->transport, &saddr, &saddrlen); + sa->transport->vtbl->get_dst (sa->transport, &saddr); else - sa->transport->vtbl->get_src (sa->transport, &saddr, &saddrlen); + sa->transport->vtbl->get_src (sa->transport, &saddr); len = sizeof *addr + PF_KEY_V2_ROUND (saddr->sa_len); addr = calloc (1, len); if (!addr) @@ -2441,9 +2440,9 @@ pf_key_v2_delete_spi (struct sa *sa, struct proto *proto, int incoming) addr = 0; if (incoming) - sa->transport->vtbl->get_src (sa->transport, &saddr, &saddrlen); + sa->transport->vtbl->get_src (sa->transport, &saddr); else - sa->transport->vtbl->get_dst (sa->transport, &saddr, &saddrlen); + sa->transport->vtbl->get_dst (sa->transport, &saddr); len = sizeof *addr + PF_KEY_V2_ROUND (saddr->sa_len); addr = calloc (1, len); if (!addr) @@ -3797,7 +3796,7 @@ pf_key_v2_group_spis (struct sa *sa, struct proto *proto1, struct sadb_protocol protocol; struct pf_key_v2_msg *grpspis = 0, *ret = 0; struct sockaddr *saddr; - int saddrlen, err; + int err; size_t len; #ifdef KAME struct sadb_x_sa2 kamesa2; @@ -3857,9 +3856,9 @@ pf_key_v2_group_spis (struct sa *sa, struct proto *proto1, * Setup the ADDRESS extensions. */ if (incoming) - sa->transport->vtbl->get_src (sa->transport, &saddr, &saddrlen); + sa->transport->vtbl->get_src (sa->transport, &saddr); else - sa->transport->vtbl->get_dst (sa->transport, &saddr, &saddrlen); + sa->transport->vtbl->get_dst (sa->transport, &saddr); len = sizeof *addr + PF_KEY_V2_ROUND (saddr->sa_len); addr = calloc (1, len); if (!addr) diff --git a/sbin/isakmpd/policy.c b/sbin/isakmpd/policy.c index ef0566eef8d..25872a73dc6 100644 --- a/sbin/isakmpd/policy.c +++ b/sbin/isakmpd/policy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: policy.c,v 1.33 2001/06/29 04:12:01 ho Exp $ */ +/* $OpenBSD: policy.c,v 1.34 2001/06/29 18:52:17 ho Exp $ */ /* $EOM: policy.c,v 1.49 2000/10/24 13:33:39 niklas Exp $ */ /* @@ -628,7 +628,7 @@ policy_callback (char *name) } } - policy_sa->transport->vtbl->get_src (policy_sa->transport, &sin, &fmt); + policy_sa->transport->vtbl->get_src (policy_sa->transport, &sin); if (sockaddr2text (sin, &addr, 1)) { log_error ("policy_callback: sockaddr2text failed"); @@ -637,7 +637,7 @@ policy_callback (char *name) memcpy (local_ike_address, addr, sizeof local_ike_address); free (addr); - policy_sa->transport->vtbl->get_dst (policy_sa->transport, &sin, &fmt); + policy_sa->transport->vtbl->get_dst (policy_sa->transport, &sin); if (sockaddr2text (sin, &addr, 1)) { log_error ("policy_callback: sockaddr2text failed"); @@ -1048,8 +1048,7 @@ policy_callback (char *name) } else { - policy_sa->transport->vtbl->get_dst (policy_sa->transport, &sin, - &fmt); + policy_sa->transport->vtbl->get_dst (policy_sa->transport, &sin); switch (sin->sa_family) { case AF_INET: @@ -1265,8 +1264,7 @@ policy_callback (char *name) else { policy_sa->transport->vtbl->get_src (policy_sa->transport, - (struct sockaddr **)&sin, - &fmt); + (struct sockaddr **)&sin); switch (sin->sa_family) { case AF_INET: diff --git a/sbin/isakmpd/sa.c b/sbin/isakmpd/sa.c index 5ca81f05815..413d837f140 100644 --- a/sbin/isakmpd/sa.c +++ b/sbin/isakmpd/sa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sa.c,v 1.44 2001/06/29 18:12:07 ho Exp $ */ +/* $OpenBSD: sa.c,v 1.45 2001/06/29 18:52:17 ho Exp $ */ /* $EOM: sa.c,v 1.112 2000/12/12 00:22:52 niklas Exp $ */ /* @@ -196,13 +196,12 @@ sa_check_peer (struct sa *sa, void *v_addr) { struct addr_arg *addr = v_addr; struct sockaddr *dst; - socklen_t dstlen; if (!sa->transport || (sa->flags & SA_FLAG_READY) == 0 || (addr->phase && addr->phase != sa->phase)) return 0; - sa->transport->vtbl->get_dst (sa->transport, &dst, &dstlen); + sa->transport->vtbl->get_dst (sa->transport, &dst); return dst->sa_len == addr->len && memcmp (dst, addr->addr, dst->sa_len) == 0; } @@ -221,14 +220,13 @@ isakmp_sa_check (struct sa *sa, void *v_arg) { struct dst_isakmpspi_arg *arg = v_arg; struct sockaddr *dst, *src; - int dstlen, srclen; if (sa->phase != 1 || !(sa->flags & SA_FLAG_READY)) return 0; /* verify address is either src or dst for this sa */ - sa->transport->vtbl->get_dst (sa->transport, &dst, &dstlen); - sa->transport->vtbl->get_src (sa->transport, &src, &srclen); + sa->transport->vtbl->get_dst (sa->transport, &dst); + sa->transport->vtbl->get_src (sa->transport, &src); if (memcmp (src, arg->dst, SA_LEN(src)) && memcmp (dst, arg->dst, SA_LEN(dst))) return 0; diff --git a/sbin/isakmpd/transport.h b/sbin/isakmpd/transport.h index 4a8aba5eb6b..eede865606d 100644 --- a/sbin/isakmpd/transport.h +++ b/sbin/isakmpd/transport.h @@ -1,4 +1,4 @@ -/* $OpenBSD: transport.h,v 1.7 2000/08/03 07:23:55 niklas Exp $ */ +/* $OpenBSD: transport.h,v 1.8 2001/06/29 18:52:17 ho Exp $ */ /* $EOM: transport.h,v 1.16 2000/07/17 18:57:59 provos Exp $ */ /* @@ -84,15 +84,15 @@ struct transport_vtbl { /* * Fill out a sockaddr structure with the transport's destination end's - * address info. XXX Why not size_t * instead of int *? + * address info. */ - void (*get_dst) (struct transport *, struct sockaddr **, int *); + void (*get_dst) (struct transport *, struct sockaddr **); /* * Fill out a sockaddr structure with the transport's source end's - * address info. XXX Why not size_t * instead of int *? + * address info. */ - void (*get_src) (struct transport *, struct sockaddr **, int *); + void (*get_src) (struct transport *, struct sockaddr **); /* * Return a string with decoded src and dst information diff --git a/sbin/isakmpd/udp.c b/sbin/isakmpd/udp.c index f1121c20c43..b4a6bc55e61 100644 --- a/sbin/isakmpd/udp.c +++ b/sbin/isakmpd/udp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp.c,v 1.30 2001/06/07 08:14:21 angelos Exp $ */ +/* $OpenBSD: udp.c,v 1.31 2001/06/29 18:52:17 ho Exp $ */ /* $EOM: udp.c,v 1.57 2001/01/26 10:09:57 niklas Exp $ */ /* @@ -89,8 +89,8 @@ static int udp_fd_isset (struct transport *, fd_set *); static void udp_handle_message (struct transport *); static struct transport *udp_make (struct sockaddr_in *); static int udp_send_message (struct message *); -static void udp_get_dst (struct transport *, struct sockaddr **, int *); -static void udp_get_src (struct transport *, struct sockaddr **, int *); +static void udp_get_dst (struct transport *, struct sockaddr **); +static void udp_get_src (struct transport *, struct sockaddr **); static char *udp_decode_ids (struct transport *); static struct transport_vtbl udp_transport_vtbl = { @@ -575,24 +575,22 @@ udp_send_message (struct message *msg) /* * Get transport T's peer address and stuff it into the sockaddr pointed - * to by DST. Put its length into DST_LEN. + * to by DST. */ static void -udp_get_dst (struct transport *t, struct sockaddr **dst, int *dst_len) +udp_get_dst (struct transport *t, struct sockaddr **dst) { *dst = (struct sockaddr *)&((struct udp_transport *)t)->dst; - *dst_len = sizeof ((struct udp_transport *)t)->dst; } /* * Get transport T's local address and stuff it into the sockaddr pointed - * to by SRC. Put its length into SRC_LEN. + * to by SRC. */ static void -udp_get_src (struct transport *t, struct sockaddr **src, int *src_len) +udp_get_src (struct transport *t, struct sockaddr **src) { *src = (struct sockaddr *)&((struct udp_transport *)t)->src; - *src_len = sizeof ((struct udp_transport *)t)->src; } static char * |