summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/isakmpd/exchange.c9
-rw-r--r--sbin/isakmpd/ike_auth.c5
-rw-r--r--sbin/isakmpd/ike_phase_1.c4
-rw-r--r--sbin/isakmpd/ike_quick_mode.c6
-rw-r--r--sbin/isakmpd/ipsec.c5
-rw-r--r--sbin/isakmpd/message.c15
-rw-r--r--sbin/isakmpd/message.h3
7 files changed, 17 insertions, 30 deletions
diff --git a/sbin/isakmpd/exchange.c b/sbin/isakmpd/exchange.c
index 1bc8fdcee07..4db8da8e2da 100644
--- a/sbin/isakmpd/exchange.c
+++ b/sbin/isakmpd/exchange.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exchange.c,v 1.120 2005/05/26 05:14:17 hshoexer Exp $ */
+/* $OpenBSD: exchange.c,v 1.121 2005/05/26 06:11:09 hshoexer Exp $ */
/* $EOM: exchange.c,v 1.143 2000/12/04 00:02:25 angelos Exp $ */
/*
@@ -244,8 +244,7 @@ exchange_handle_leftover_payloads(struct message *msg)
if (i == ISAKMP_PAYLOAD_PROPOSAL ||
i == ISAKMP_PAYLOAD_TRANSFORM)
continue;
- for (p = payload_first(msg, i); p;
- p = TAILQ_NEXT(p, link)) {
+ TAILQ_FOREACH(p, &msg->payload[i], link) {
if (p->flags & PL_MARK)
continue;
if (!doi->handle_leftover_payload ||
@@ -1562,11 +1561,11 @@ exchange_save_nonce(struct message *msg)
int
exchange_save_certreq(struct message *msg)
{
- struct payload *cp = payload_first(msg, ISAKMP_PAYLOAD_CERT_REQ);
+ struct payload *cp;
struct exchange *exchange = msg->exchange;
struct certreq_aca *aca;
- for (; cp; cp = TAILQ_NEXT(cp, link)) {
+ TAILQ_FOREACH(cp, &msg->payload[ISAKMP_PAYLOAD_CERT_REQ], link) {
cp->flags |= PL_MARK;
aca = certreq_decode(GET_ISAKMP_CERTREQ_TYPE(cp->p), cp->p +
ISAKMP_CERTREQ_AUTHORITY_OFF, GET_ISAKMP_GEN_LENGTH(cp->p)
diff --git a/sbin/isakmpd/ike_auth.c b/sbin/isakmpd/ike_auth.c
index 0f91069b616..85c984447b3 100644
--- a/sbin/isakmpd/ike_auth.c
+++ b/sbin/isakmpd/ike_auth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ike_auth.c,v 1.102 2005/04/08 22:32:10 cloder Exp $ */
+/* $OpenBSD: ike_auth.c,v 1.103 2005/05/26 06:11:09 hshoexer Exp $ */
/* $EOM: ike_auth.c,v 1.59 2000/11/21 00:21:31 angelos Exp $ */
/*
@@ -611,8 +611,7 @@ rsa_sig_decode_hash(struct message *msg)
* XXX I believe this is the wrong spot for this. CERTs can appear
* anytime.
*/
- for (p = payload_first(msg, ISAKMP_PAYLOAD_CERT); p;
- p = TAILQ_NEXT(p, link)) {
+ TAILQ_FOREACH(p, &msg->payload[ISAKMP_PAYLOAD_CERT], link) {
p->flags |= PL_MARK;
/*
diff --git a/sbin/isakmpd/ike_phase_1.c b/sbin/isakmpd/ike_phase_1.c
index 88335a5ccb9..7f3efef95e9 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.62 2005/04/08 22:32:10 cloder Exp $ */
+/* $OpenBSD: ike_phase_1.c,v 1.63 2005/05/26 06:11:09 hshoexer Exp $ */
/* $EOM: ike_phase_1.c,v 1.31 2000/12/11 23:47:56 niklas Exp $ */
/*
@@ -351,7 +351,7 @@ ike_phase_1_initiator_send_SA(struct message *msg)
memcpy(ie->sa_i_b + sa_len - ISAKMP_GEN_SZ,
payload_first(msg, ISAKMP_PAYLOAD_PROPOSAL)->p, proposal_len);
transforms_len = 0;
- for (i = 0, p = payload_first(msg, ISAKMP_PAYLOAD_TRANSFORM);
+ for (i = 0, p = TAILQ_FIRST(&msg->payload[ISAKMP_PAYLOAD_TRANSFORM]);
i < conf->cnt; i++, p = TAILQ_NEXT(p, link)) {
memcpy(ie->sa_i_b + sa_len + proposal_len + transforms_len -
ISAKMP_GEN_SZ, p->p, transform_len[i]);
diff --git a/sbin/isakmpd/ike_quick_mode.c b/sbin/isakmpd/ike_quick_mode.c
index 4ddbf55c223..eb7a576ec8c 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.95 2005/04/08 22:32:10 cloder Exp $ */
+/* $OpenBSD: ike_quick_mode.c,v 1.96 2005/05/26 06:11:09 hshoexer Exp $ */
/* $EOM: ike_quick_mode.c,v 1.139 2001/01/26 10:43:17 niklas Exp $ */
/*
@@ -1196,9 +1196,7 @@ initiator_recv_HASH_SA_NONCE(struct message *msg)
}
/* Build the protection suite in our SA. */
- for (xf = payload_first(msg, ISAKMP_PAYLOAD_TRANSFORM); xf;
- xf = TAILQ_NEXT(xf, link)) {
-
+ TAILQ_FOREACH(xf, &msg->payload[ISAKMP_PAYLOAD_TRANSFORM], link) {
/*
* XXX We could check that the proposal each transform
* belongs to is unique.
diff --git a/sbin/isakmpd/ipsec.c b/sbin/isakmpd/ipsec.c
index d04f9d1c600..605caa4d6a7 100644
--- a/sbin/isakmpd/ipsec.c
+++ b/sbin/isakmpd/ipsec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsec.c,v 1.118 2005/05/04 10:05:01 hshoexer Exp $ */
+/* $OpenBSD: ipsec.c,v 1.119 2005/05/26 06:11:09 hshoexer Exp $ */
/* $EOM: ipsec.c,v 1.143 2000/12/11 23:57:42 niklas Exp $ */
/*
@@ -1007,8 +1007,7 @@ ipsec_responder(struct message *msg)
script = isakmp_cfg_responder;
break;
case ISAKMP_EXCH_INFO:
- for (p = payload_first(msg, ISAKMP_PAYLOAD_NOTIFY); p;
- p = TAILQ_NEXT(p, link)) {
+ TAILQ_FOREACH(p, &msg->payload[ISAKMP_PAYLOAD_NOTIFY], link) {
type = GET_ISAKMP_NOTIFY_MSG_TYPE(p->p);
LOG_DBG((LOG_EXCHANGE, 10,
"ipsec_responder: got NOTIFY of type %s",
diff --git a/sbin/isakmpd/message.c b/sbin/isakmpd/message.c
index 06bddf145b8..9a421854bb4 100644
--- a/sbin/isakmpd/message.c
+++ b/sbin/isakmpd/message.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: message.c,v 1.111 2005/05/26 05:14:17 hshoexer Exp $ */
+/* $OpenBSD: message.c,v 1.112 2005/05/26 06:11:09 hshoexer Exp $ */
/* $EOM: message.c,v 1.156 2000/10/10 12:36:39 provos Exp $ */
/*
@@ -349,7 +349,7 @@ message_parse_proposal(struct message *msg, struct payload *p,
ZERO(&payload_set);
SET(ISAKMP_PAYLOAD_TRANSFORM, &payload_set);
if (message_parse_payloads(msg,
- payload_last(msg, ISAKMP_PAYLOAD_PROPOSAL),
+ TAILQ_LAST(&msg->payload[ISAKMP_PAYLOAD_PROPOSAL], payload_head),
ISAKMP_PAYLOAD_TRANSFORM, buf + ISAKMP_PROP_SPI_OFF +
GET_ISAKMP_PROP_SPI_SZ(buf), &payload_set, message_parse_transform)
== -1)
@@ -1211,7 +1211,7 @@ message_validate_payloads(struct message *msg)
struct field *f;
for (i = ISAKMP_PAYLOAD_SA; i < ISAKMP_PAYLOAD_MAX; i++)
- for (p = payload_first(msg, i); p; p = TAILQ_NEXT(p, link)) {
+ TAILQ_FOREACH(p, &msg->payload[i], link) {
LOG_DBG((LOG_MESSAGE, 60, "message_validate_payloads: "
"payload %s at %p of message %p",
constant_name(isakmp_payload_cst, i), p->p, msg));
@@ -2118,8 +2118,7 @@ message_negotiate_sa(struct message *msg, int (*validate)(struct exchange *,
*/
sa = TAILQ_FIRST(&exchange->sa_list);
- for (tp = payload_first(msg, ISAKMP_PAYLOAD_TRANSFORM); tp;
- tp = next_tp) {
+ TAILQ_FOREACH(tp, &msg->payload[ISAKMP_PAYLOAD_TRANSFORM], link) {
propp = tp->context;
sap = propp->context;
sap->flags |= PL_MARK;
@@ -2508,9 +2507,3 @@ payload_first(struct message *msg, u_int8_t payload)
{
return TAILQ_FIRST(&msg->payload[payload]);
}
-
-struct payload *
-payload_last(struct message *msg, u_int8_t payload)
-{
- return TAILQ_LAST(&msg->payload[payload], payload_head);
-}
diff --git a/sbin/isakmpd/message.h b/sbin/isakmpd/message.h
index f7b15d8d09f..7d9b1e87431 100644
--- a/sbin/isakmpd/message.h
+++ b/sbin/isakmpd/message.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: message.h,v 1.23 2005/04/08 16:52:41 deraadt Exp $ */
+/* $OpenBSD: message.h,v 1.24 2005/05/26 06:11:09 hshoexer Exp $ */
/* $EOM: message.h,v 1.51 2000/10/10 12:36:39 provos Exp $ */
/*
@@ -196,7 +196,6 @@ extern void message_send_notification(struct message *, struct sa *,
extern void message_setup_header(struct message *, u_int8_t, u_int8_t,
u_int8_t *);
struct payload *payload_first(struct message *, u_int8_t);
-struct payload *payload_last(struct message *, u_int8_t);
extern void message_send_dpd_notify(struct sa*, u_int16_t, u_int32_t);