summaryrefslogtreecommitdiff
path: root/sbin/iked/config.c
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2019-05-11 16:30:24 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2019-05-11 16:30:24 +0000
commit8418aabe4f347e87b8918a840afc2e37638b61a4 (patch)
tree089751860d2b180bbc48d257841bb0bde2e10884 /sbin/iked/config.c
parent30ce14364c76e910724541dd41455566ceb351e5 (diff)
Add support for IKEv2 Message Fragmentation as defined in RFC 7383.
ok sthen@
Diffstat (limited to 'sbin/iked/config.c')
-rw-r--r--sbin/iked/config.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/sbin/iked/config.c b/sbin/iked/config.c
index 8214ac01fb5..9ebf24616d2 100644
--- a/sbin/iked/config.c
+++ b/sbin/iked/config.c
@@ -1,6 +1,7 @@
-/* $OpenBSD: config.c,v 1.49 2017/11/27 18:39:35 patrick Exp $ */
+/* $OpenBSD: config.c,v 1.50 2019/05/11 16:30:23 patrick Exp $ */
/*
+ * Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -94,12 +95,29 @@ config_free_kex(struct iked_kex *kex)
}
void
+config_free_fragments(struct iked_frag *frag)
+{
+ size_t i;
+
+ if (frag && frag->frag_arr) {
+ for (i = 0; i < frag->frag_total; i++) {
+ if (frag->frag_arr[i] != NULL)
+ free(frag->frag_arr[i]->frag_data);
+ free(frag->frag_arr[i]);
+ }
+ free(frag->frag_arr);
+ bzero(frag, sizeof(struct iked_frag));
+ }
+}
+
+void
config_free_sa(struct iked *env, struct iked_sa *sa)
{
timer_del(env, &sa->sa_timer);
timer_del(env, &sa->sa_keepalive);
timer_del(env, &sa->sa_rekey);
+ config_free_fragments(&sa->sa_fragments);
config_free_proposals(&sa->sa_proposals, 0);
config_free_childsas(env, &sa->sa_childsas, NULL, NULL);
sa_free_flows(env, &sa->sa_flows);
@@ -838,6 +856,29 @@ config_getmobike(struct iked *env, struct imsg *imsg)
}
int
+config_setfragmentation(struct iked *env)
+{
+ unsigned int boolval;
+
+ boolval = env->sc_frag;
+ proc_compose(&env->sc_ps, PROC_IKEV2, IMSG_CTL_FRAGMENTATION,
+ &boolval, sizeof(boolval));
+ return (0);
+}
+
+int
+config_getfragmentation(struct iked *env, struct imsg *imsg)
+{
+ unsigned int boolval;
+
+ IMSG_SIZE_CHECK(imsg, &boolval);
+ memcpy(&boolval, imsg->data, sizeof(boolval));
+ env->sc_frag = boolval;
+ log_debug("%s: %sfragmentation", __func__, env->sc_frag ? "" : "no ");
+ return (0);
+}
+
+int
config_setocsp(struct iked *env)
{
if (env->sc_opts & IKED_OPT_NOACTION)