summaryrefslogtreecommitdiff
path: root/sbin/isakmpd
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1999-03-02 15:48:24 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1999-03-02 15:48:24 +0000
commit878022a4b41b0c39f6054a3bc55edc20da3547cd (patch)
tree34530651cb3330ce54e3cbf58275f33c8f091e9a /sbin/isakmpd
parent08d43f3932f08d979124be6db7178485f09521f3 (diff)
sa.c: Merge with EOM 1.67
Add SA attributes, specifically stayalive sa.h: Merge with EOM 1.42 Add SA attributes, specifically stayalive pf_encap.c: Merge with EOM 1.46 Add SA attributes, specifically stayalive exchange.c: Merge with EOM 1.65 Add SA attributes, specifically stayalive
Diffstat (limited to 'sbin/isakmpd')
-rw-r--r--sbin/isakmpd/exchange.c14
-rw-r--r--sbin/isakmpd/pf_encap.c7
-rw-r--r--sbin/isakmpd/sa.c26
-rw-r--r--sbin/isakmpd/sa.h8
4 files changed, 44 insertions, 11 deletions
diff --git a/sbin/isakmpd/exchange.c b/sbin/isakmpd/exchange.c
index 2568ae54c6e..806d064d969 100644
--- a/sbin/isakmpd/exchange.c
+++ b/sbin/isakmpd/exchange.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: exchange.c,v 1.8 1999/02/26 03:37:56 niklas Exp $ */
-/* $EOM: exchange.c,v 1.64 1999/02/25 11:38:53 niklas Exp $ */
+/* $OpenBSD: exchange.c,v 1.9 1999/03/02 15:48:23 niklas Exp $ */
+/* $EOM: exchange.c,v 1.65 1999/03/02 15:42:59 niklas Exp $ */
/*
* Copyright (c) 1998 Niklas Hallqvist. All rights reserved.
@@ -1005,6 +1005,8 @@ exchange_finalize (struct message *msg)
struct exchange *exchange = msg->exchange;
struct sa *sa;
struct proto *proto;
+ struct conf_list *attrs;
+ struct conf_list_node *attr;
int i;
exchange_dump ("exchange_finalize", exchange);
@@ -1027,7 +1029,15 @@ exchange_finalize (struct message *msg)
ISAKMP_NOTIFY_STATUS_CONNECTED, proto,
i);
}
+
+ /* Setup the SA flags. */
sa->flags |= SA_FLAG_READY;
+ attrs = conf_get_list (sa->name, "Attributes");
+ if (attrs)
+ for (attr = TAILQ_FIRST (&attrs->fields); attr;
+ attr = TAILQ_NEXT (attr, link))
+ sa->flags |= sa_flag (attr->field);
+
sa->exch_type = exchange->type;
}
diff --git a/sbin/isakmpd/pf_encap.c b/sbin/isakmpd/pf_encap.c
index 04cde24c3aa..1a7b26c5c81 100644
--- a/sbin/isakmpd/pf_encap.c
+++ b/sbin/isakmpd/pf_encap.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pf_encap.c,v 1.6 1999/02/27 09:59:36 niklas Exp $ */
-/* $EOM: pf_encap.c,v 1.45 1999/02/26 14:41:31 niklas Exp $ */
+/* $OpenBSD: pf_encap.c,v 1.7 1999/03/02 15:48:23 niklas Exp $ */
+/* $EOM: pf_encap.c,v 1.46 1999/03/02 15:43:00 niklas Exp $ */
/*
* Copyright (c) 1998 Niklas Hallqvist. All rights reserved.
@@ -681,9 +681,6 @@ pf_encap_enable_sa (struct sa *sa, int initiator)
int dstlen;
struct proto *proto = TAILQ_FIRST (&sa->protos);
- /* XXX Hardwire for the time being. */
- sa->flags |= SA_FLAG_STAYALIVE;
-
sa->transport->vtbl->get_dst (sa->transport, &dst, &dstlen);
/* XXX Check why byte ordering is backwards. */
diff --git a/sbin/isakmpd/sa.c b/sbin/isakmpd/sa.c
index be7b72c4dcf..7a0dfa70f9a 100644
--- a/sbin/isakmpd/sa.c
+++ b/sbin/isakmpd/sa.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: sa.c,v 1.7 1999/02/26 03:50:09 niklas Exp $ */
-/* $EOM: sa.c,v 1.66 1999/02/25 11:39:20 niklas Exp $ */
+/* $OpenBSD: sa.c,v 1.8 1999/03/02 15:48:23 niklas Exp $ */
+/* $EOM: sa.c,v 1.67 1999/03/02 15:42:57 niklas Exp $ */
/*
* Copyright (c) 1998 Niklas Hallqvist. All rights reserved.
@@ -513,3 +513,25 @@ sa_hard_expire (struct sa *sa)
sa->death = 0;
sa_delete (sa, 1);
}
+
+/*
+ * Get a SA attribute's flag value out of textual description.
+ * XXX Kind of overkill for just one attribute, maybe simplify?
+ */
+int
+sa_flag (char *attr)
+{
+ static struct sa_flag_map {
+ char *name;
+ int flag;
+ } sa_flag_map[] = {
+ { "stayalive", SA_FLAG_STAYALIVE }
+ };
+ int i;
+
+ for (i = 0; i < sizeof sa_flag_map / sizeof sa_flag_map[0]; i++)
+ if (strcasecmp (attr, sa_flag_map[i].name) == 0)
+ return sa_flag_map[i].flag;
+ log_print (LOG_MISC, 10, "sa_flag: attribute \"%s\" unknown", attr);
+ return 0;
+}
diff --git a/sbin/isakmpd/sa.h b/sbin/isakmpd/sa.h
index 945b5fe7aba..8f6cf55c4e3 100644
--- a/sbin/isakmpd/sa.h
+++ b/sbin/isakmpd/sa.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: sa.h,v 1.6 1999/02/27 09:59:36 niklas Exp $ */
-/* $EOM: sa.h,v 1.41 1999/02/26 14:41:32 niklas Exp $ */
+/* $OpenBSD: sa.h,v 1.7 1999/03/02 15:48:23 niklas Exp $ */
+/* $EOM: sa.h,v 1.42 1999/03/02 15:42:58 niklas Exp $ */
/*
* Copyright (c) 1998 Niklas Hallqvist. All rights reserved.
@@ -151,12 +151,16 @@ struct sa {
/* Renegotiate the SA at each expiry. */
#define SA_FLAG_STAYALIVE 2
+/* Establish the SA when it is needed. */
+#define SA_FLAG_ONDEMAND 4
+
extern void proto_free (struct proto *proto);
extern int sa_add_transform (struct sa *, struct payload *, int,
struct proto **);
extern int sa_create (struct exchange *, struct transport *);
extern void sa_delete (struct sa *, int);
extern struct sa *sa_find (int (*) (struct sa *, void *), void *);
+extern int sa_flag (char *);
extern void sa_free (struct sa *);
extern void sa_free_aux (struct sa *);
extern void sa_init (void);