summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1999-05-01 22:58:04 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1999-05-01 22:58:04 +0000
commit3e490524805e5f4207c7ebbcb8c25fee8e03f002 (patch)
tree7641984fcceb73f668745b04b7b8e44ba308d778 /sbin
parentd60438171e0dadb2428dde892dda3ca5f1e7307d (diff)
TO-DO: Merge with EOM 1.36
sa.c: Merge with EOM 1.90 message.c: Merge with EOM 1.131 message.h: Merge with EOM 1.47 author: niklas Send DELETE payloads in informational exchanges
Diffstat (limited to 'sbin')
-rw-r--r--sbin/isakmpd/TO-DO6
-rw-r--r--sbin/isakmpd/message.c46
-rw-r--r--sbin/isakmpd/message.h5
-rw-r--r--sbin/isakmpd/sa.c7
4 files changed, 51 insertions, 13 deletions
diff --git a/sbin/isakmpd/TO-DO b/sbin/isakmpd/TO-DO
index 1197f57074d..d5eaeddf765 100644
--- a/sbin/isakmpd/TO-DO
+++ b/sbin/isakmpd/TO-DO
@@ -1,5 +1,5 @@
-$OpenBSD: TO-DO,v 1.10 1999/04/30 11:48:06 niklas Exp $
-$EOM: TO-DO,v 1.35 1999/04/30 11:37:43 niklas Exp $
+$OpenBSD: TO-DO,v 1.11 1999/05/01 22:58:02 niklas Exp $
+$EOM: TO-DO,v 1.36 1999/05/01 22:37:29 niklas Exp $
This file is pretty lame as it should really contain a lot more given that
the program is far from ready in any area.
@@ -55,7 +55,7 @@ the program is far from ready in any area.
* New group mode.
-* DELETE payload handling, and generation from ui.
+* DELETE payload handling, and generation from ui. [generation done]
* Deal well with incoming informational exchanges. [done]
diff --git a/sbin/isakmpd/message.c b/sbin/isakmpd/message.c
index f694c81007d..d98c0bd5ca1 100644
--- a/sbin/isakmpd/message.c
+++ b/sbin/isakmpd/message.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: message.c,v 1.17 1999/04/30 11:48:19 niklas Exp $ */
-/* $EOM: message.c,v 1.130 1999/04/29 21:43:14 niklas Exp $ */
+/* $OpenBSD: message.c,v 1.18 1999/05/01 22:58:02 niklas Exp $ */
+/* $EOM: message.c,v 1.131 1999/05/01 22:36:32 niklas Exp $ */
/*
* Copyright (c) 1998, 1999 Niklas Hallqvist. All rights reserved.
@@ -1207,7 +1207,7 @@ struct info_args {
} n;
struct {
u_int16_t nspis;
- u_int8_t **spi;
+ u_int8_t *spis;
} d;
} u;
};
@@ -1246,6 +1246,40 @@ message_send_notification (struct message *msg, struct sa *isakmp_sa,
0, &args, 0, 0);
}
+/* Send a DELETE inside an informational exchange for each protocol in SA. */
+void
+message_send_delete (struct sa *sa)
+{
+ struct info_args args;
+ 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);
+ if (!isakmp_sa)
+ {
+ /*
+ * XXX We ought to setup an ISAKMP SA with our peer here and send
+ * the DELETE over that one.
+ */
+ return;
+ }
+
+ args.discr = 'D';
+ args.doi = sa->doi->id;
+ args.u.d.nspis = 1;
+ for (proto = TAILQ_FIRST (&sa->protos); proto;
+ proto = TAILQ_NEXT (proto, link))
+ {
+ args.proto = proto->proto;
+ args.spi_sz = proto->spi_sz[1];
+ args.u.d.spis = proto->spi[1];
+ exchange_establish_p2 (isakmp_sa, ISAKMP_EXCH_INFO, 0, &args, 0 ,0);
+ }
+}
+
/* Build the informational message into MSG. */
int
message_send_info (struct message *msg)
@@ -1285,7 +1319,7 @@ message_send_info (struct message *msg)
SET_ISAKMP_DELETE_PROTO (buf, args->proto);
SET_ISAKMP_DELETE_SPI_SZ (buf, args->spi_sz);
SET_ISAKMP_DELETE_NSPIS (buf, args->u.d.nspis);
- memcpy (buf + ISAKMP_DELETE_SPI_OFF, args->u.d.spi,
+ memcpy (buf + ISAKMP_DELETE_SPI_OFF, args->u.d.spis,
args->u.d.nspis * args->spi_sz);
break;
}
@@ -1657,6 +1691,10 @@ message_negotiate_sa (struct message *msg,
return -1;
}
+/*
+ * Add SA, proposal and transform payload(s) to MSG out of information
+ * found in the exchange MSG is part of..
+ */
int
message_add_sa_payload (struct message *msg)
{
diff --git a/sbin/isakmpd/message.h b/sbin/isakmpd/message.h
index abb45f007cf..73144011dd0 100644
--- a/sbin/isakmpd/message.h
+++ b/sbin/isakmpd/message.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: message.h,v 1.9 1999/04/30 11:46:24 niklas Exp $ */
-/* $EOM: message.h,v 1.46 1999/04/29 10:51:30 niklas Exp $ */
+/* $OpenBSD: message.h,v 1.10 1999/05/01 22:58:03 niklas Exp $ */
+/* $EOM: message.h,v 1.47 1999/05/01 22:36:34 niklas Exp $ */
/*
* Copyright (c) 1998, 1999 Niklas Hallqvist. All rights reserved.
@@ -175,6 +175,7 @@ extern int message_register_post_send (struct message *,
void (*) (struct message *));
extern void message_post_send (struct message *);
extern void message_send (struct message *);
+extern void message_send_delete (struct sa *);
extern int message_send_info (struct message *);
extern void message_send_notification (struct message *, struct sa *,
u_int16_t, struct proto *, int);
diff --git a/sbin/isakmpd/sa.c b/sbin/isakmpd/sa.c
index 8e7d398aa2d..6fd4b441ad2 100644
--- a/sbin/isakmpd/sa.c
+++ b/sbin/isakmpd/sa.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: sa.c,v 1.17 1999/04/30 11:46:06 niklas Exp $ */
-/* $EOM: sa.c,v 1.89 1999/04/29 12:08:00 niklas Exp $ */
+/* $OpenBSD: sa.c,v 1.18 1999/05/01 22:58:02 niklas Exp $ */
+/* $EOM: sa.c,v 1.90 1999/05/01 22:36:31 niklas Exp $ */
/*
* Copyright (c) 1998, 1999 Niklas Hallqvist. All rights reserved.
@@ -587,8 +587,7 @@ sa_add_transform (struct sa *sa, struct payload *xf, int initiator,
void
sa_delete (struct sa *sa, int notify)
{
- /* XXX we do not send DELETE payloads just yet. */
-
+ message_send_delete (sa);
sa_free (sa);
}