Compare commits
5 Commits
strongswan
...
087a9c32e8
| Author | SHA1 | Date | |
|---|---|---|---|
| 087a9c32e8 | |||
| 0b4abaf5fe | |||
| f978fcb51f | |||
| d7e57af704 | |||
| 5db540d4e3 |
@@ -1,4 +1,4 @@
|
||||
From 1baf500104e963e0d0d410c95e7dcec899173b77 Mon Sep 17 00:00:00 2001
|
||||
From d917774f73954cc6367e73b775ff9ea115d6fd28 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zoran=20Peri=C4=8Di=C4=87?= <zpericic@netst.org>
|
||||
Date: Tue, 9 Jul 2024 19:07:57 +0200
|
||||
Subject: [PATCH 1/4] charon: add optional source and remote overrides for
|
||||
@@ -21,7 +21,7 @@ and is a prerequisite for dmvpn support.
|
||||
7 files changed, 186 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/src/libcharon/control/controller.c b/src/libcharon/control/controller.c
|
||||
index 027f48e93..26501768d 100644
|
||||
index 027f48e937..ac4661a323 100644
|
||||
--- a/src/libcharon/control/controller.c
|
||||
+++ b/src/libcharon/control/controller.c
|
||||
@@ -1,4 +1,6 @@
|
||||
@@ -72,7 +72,7 @@ index 027f48e93..26501768d 100644
|
||||
controller_cb_t callback, void *param, level_t max_level, u_int timeout,
|
||||
bool limits)
|
||||
+{
|
||||
+ return this->public.initiate2(this, peer_cfg, child_cfg, NULL, NULL, callback, param, max_level, timeout, limits);
|
||||
+ return this->public.initiate2(&this->public, peer_cfg, child_cfg, NULL, NULL, callback, param, max_level, timeout, limits);
|
||||
+}
|
||||
+
|
||||
+METHOD(controller_t, initiate2, status_t,
|
||||
@@ -101,7 +101,7 @@ index 027f48e93..26501768d 100644
|
||||
.terminate_child = _terminate_child,
|
||||
.destroy = _destroy,
|
||||
diff --git a/src/libcharon/control/controller.h b/src/libcharon/control/controller.h
|
||||
index 36a1d4631..f5c60e2e7 100644
|
||||
index 36a1d46317..f5c60e2e72 100644
|
||||
--- a/src/libcharon/control/controller.h
|
||||
+++ b/src/libcharon/control/controller.h
|
||||
@@ -98,6 +98,34 @@ struct controller_t {
|
||||
@@ -140,7 +140,7 @@ index 36a1d4631..f5c60e2e7 100644
|
||||
* Terminate an IKE_SA and all of its CHILD_SAs.
|
||||
*
|
||||
diff --git a/src/libcharon/plugins/vici/vici_control.c b/src/libcharon/plugins/vici/vici_control.c
|
||||
index 1c236d249..932d0cb5a 100644
|
||||
index 1c236d2491..932d0cb5a8 100644
|
||||
--- a/src/libcharon/plugins/vici/vici_control.c
|
||||
+++ b/src/libcharon/plugins/vici/vici_control.c
|
||||
@@ -1,4 +1,6 @@
|
||||
@@ -229,22 +229,23 @@ index 1c236d249..932d0cb5a 100644
|
||||
|
||||
/**
|
||||
diff --git a/src/libcharon/sa/ike_sa_manager.c b/src/libcharon/sa/ike_sa_manager.c
|
||||
index 7763ae844..59852f253 100644
|
||||
index 7763ae844e..cf53e9ae00 100644
|
||||
--- a/src/libcharon/sa/ike_sa_manager.c
|
||||
+++ b/src/libcharon/sa/ike_sa_manager.c
|
||||
@@ -1,4 +1,6 @@
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2022 Tobias Brunner
|
||||
+ * Copyright (C) 2023 Zoran Peričić <zpericic@netst.org>
|
||||
+ * Copyright (C) 2014 Timo Teräs <timo.teras@iki.fi>
|
||||
* Copyright (C) 2008-2022 Tobias Brunner
|
||||
* Copyright (C) 2005-2011 Martin Willi
|
||||
* Copyright (C) 2005 Jan Hutter
|
||||
*
|
||||
@@ -1499,6 +1501,13 @@ typedef struct {
|
||||
|
||||
METHOD(ike_sa_manager_t, checkout_by_config, ike_sa_t*,
|
||||
private_ike_sa_manager_t *this, peer_cfg_t *peer_cfg)
|
||||
+{
|
||||
+ return this->public.checkout_by_config2(this, peer_cfg, NULL, NULL);
|
||||
+ return this->public.checkout_by_config2(&this->public, peer_cfg, NULL, NULL);
|
||||
+}
|
||||
+
|
||||
+METHOD(ike_sa_manager_t, checkout_by_config2, ike_sa_t*,
|
||||
@@ -302,12 +303,12 @@ index 7763ae844..59852f253 100644
|
||||
.checkout = _checkout,
|
||||
.checkout_by_message = _checkout_by_message,
|
||||
.checkout_by_config = _checkout_by_config,
|
||||
+ .checkout_by_config2 = _checkout_by_config,
|
||||
+ .checkout_by_config2 = _checkout_by_config2,
|
||||
.checkout_by_id = _checkout_by_id,
|
||||
.checkout_by_name = _checkout_by_name,
|
||||
.new_initiator_spi = _new_initiator_spi,
|
||||
diff --git a/src/libcharon/sa/ike_sa_manager.h b/src/libcharon/sa/ike_sa_manager.h
|
||||
index 004cc2216..d001f5a80 100644
|
||||
index 004cc22168..d001f5a802 100644
|
||||
--- a/src/libcharon/sa/ike_sa_manager.h
|
||||
+++ b/src/libcharon/sa/ike_sa_manager.h
|
||||
@@ -123,7 +123,8 @@ struct ike_sa_manager_t {
|
||||
@@ -350,7 +351,7 @@ index 004cc2216..d001f5a80 100644
|
||||
* Reset initiator SPI.
|
||||
*
|
||||
diff --git a/src/libcharon/sa/trap_manager.c b/src/libcharon/sa/trap_manager.c
|
||||
index 1b85c66a5..bbc480c0c 100644
|
||||
index 1b85c66a5b..bbc480c0cd 100644
|
||||
--- a/src/libcharon/sa/trap_manager.c
|
||||
+++ b/src/libcharon/sa/trap_manager.c
|
||||
@@ -523,7 +523,7 @@ METHOD(trap_manager_t, acquire, void,
|
||||
@@ -416,7 +417,7 @@ index 1b85c66a5..bbc480c0c 100644
|
||||
|
||||
if (ike_sa)
|
||||
diff --git a/src/swanctl/commands/initiate.c b/src/swanctl/commands/initiate.c
|
||||
index e0fffb907..c0fc8c595 100644
|
||||
index e0fffb907d..c0fc8c5952 100644
|
||||
--- a/src/swanctl/commands/initiate.c
|
||||
+++ b/src/swanctl/commands/initiate.c
|
||||
@@ -1,4 +1,5 @@
|
||||
@@ -472,5 +473,5 @@ index e0fffb907..c0fc8c595 100644
|
||||
{"raw", 'r', 0, "dump raw response message"},
|
||||
{"pretty", 'P', 0, "dump raw response message in pretty print"},
|
||||
--
|
||||
2.45.2
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From ea77f7d906d5e7bbe44ba6e912dd386f25414492 Mon Sep 17 00:00:00 2001
|
||||
From f6210f6ab72ead26a24a8f231eee67948d3ca543 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
|
||||
Date: Mon, 21 Sep 2015 13:42:05 +0300
|
||||
Subject: [PATCH 2/4] vici: send certificates for ike-sa events
|
||||
@@ -12,7 +12,7 @@ Signed-off-by: Timo Teräs <timo.teras@iki.fi>
|
||||
1 file changed, 42 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/libcharon/plugins/vici/vici_query.c b/src/libcharon/plugins/vici/vici_query.c
|
||||
index bacb7b101..19acc0789 100644
|
||||
index bacb7b101e..19acc0789b 100644
|
||||
--- a/src/libcharon/plugins/vici/vici_query.c
|
||||
+++ b/src/libcharon/plugins/vici/vici_query.c
|
||||
@@ -402,7 +402,7 @@ static void list_vips(private_vici_query_t *this, vici_builder_t *b,
|
||||
@@ -136,5 +136,5 @@ index bacb7b101..19acc0789 100644
|
||||
|
||||
b->begin_section(b, old->get_name(old));
|
||||
--
|
||||
2.45.2
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 3f4e26a2163bf30481887795f9faad208bfc1be0 Mon Sep 17 00:00:00 2001
|
||||
From effc140ed0ed5c7f1897c8abb6364d2d4789a4ee Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
|
||||
Date: Mon, 21 Sep 2015 13:42:11 +0300
|
||||
Subject: [PATCH 3/4] vici: add support for individual sa state changes
|
||||
@@ -14,7 +14,7 @@ Signed-off-by: Timo Teräs <timo.teras@iki.fi>
|
||||
1 file changed, 106 insertions(+)
|
||||
|
||||
diff --git a/src/libcharon/plugins/vici/vici_query.c b/src/libcharon/plugins/vici/vici_query.c
|
||||
index 19acc0789..fa1aca953 100644
|
||||
index 19acc0789b..fa1aca9536 100644
|
||||
--- a/src/libcharon/plugins/vici/vici_query.c
|
||||
+++ b/src/libcharon/plugins/vici/vici_query.c
|
||||
@@ -1774,8 +1774,16 @@ static void manage_commands(private_vici_query_t *this, bool reg)
|
||||
@@ -156,5 +156,5 @@ index 19acc0789..fa1aca953 100644
|
||||
.destroy = _destroy,
|
||||
},
|
||||
--
|
||||
2.45.2
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
From 0ceda5a95355bb803cbcdf3eeabbcb6ec2577922 Mon Sep 17 00:00:00 2001
|
||||
From 7f32aed540533e50fa05486df471ef3c19879324 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zoran=20Peri=C4=8Di=C4=87?= <zoran.pericic@infomaas.com>
|
||||
Date: Sun, 21 Jan 2024 03:11:32 +0100
|
||||
Subject: [PATCH 4/4] Support GRE key in selectors.
|
||||
Subject: [PATCH 4/4] Support GRE key in selectors with kernel-netlink.
|
||||
|
||||
Implementation use two 2-byte port fields (from/to range) to store key
|
||||
similar to ICMP.
|
||||
---
|
||||
.../kernel_netlink/kernel_netlink_ipsec.c | 20 ++++++++++++
|
||||
.../plugins/load_tester/load_tester_config.c | 22 ++++++++++++-
|
||||
src/libcharon/plugins/stroke/stroke_config.c | 22 ++++++++++++-
|
||||
src/libcharon/plugins/vici/vici_config.c | 32 ++++++++++++++++++-
|
||||
.../selectors/traffic_selector.c | 20 ++++++++++++
|
||||
.../selectors/traffic_selector.h | 12 +++++++
|
||||
src/starter/confread.c | 24 +++++++++++++-
|
||||
src/swanctl/swanctl.opt | 3 ++
|
||||
8 files changed, 151 insertions(+), 4 deletions(-)
|
||||
.../kernel_netlink/kernel_netlink_ipsec.c | 19 +++++++++++++
|
||||
.../plugins/load_tester/load_tester_config.c | 22 ++++++++++++++-
|
||||
src/libcharon/plugins/stroke/stroke_config.c | 22 ++++++++++++++-
|
||||
src/libcharon/plugins/vici/vici_config.c | 27 ++++++++++++++++++-
|
||||
.../selectors/traffic_selector.c | 20 ++++++++++++++
|
||||
.../selectors/traffic_selector.h | 12 +++++++++
|
||||
src/starter/confread.c | 24 ++++++++++++++++-
|
||||
src/swanctl/swanctl.opt | 3 +++
|
||||
8 files changed, 145 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c b/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c
|
||||
index db0b2ac37..e4e7d9ecb 100644
|
||||
index db0b2ac37a..d4f9571817 100644
|
||||
--- a/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c
|
||||
+++ b/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c
|
||||
@@ -864,6 +864,7 @@ static struct xfrm_selector ts2selector(traffic_selector_t *src,
|
||||
@@ -26,7 +28,7 @@ index db0b2ac37..e4e7d9ecb 100644
|
||||
|
||||
memset(&sel, 0, sizeof(sel));
|
||||
sel.family = (src->get_type(src) == TS_IPV4_ADDR_RANGE) ? AF_INET : AF_INET6;
|
||||
@@ -884,6 +885,25 @@ static struct xfrm_selector ts2selector(traffic_selector_t *src,
|
||||
@@ -884,6 +885,24 @@ static struct xfrm_selector ts2selector(traffic_selector_t *src,
|
||||
sel.dport = htons(traffic_selector_icmp_code(port));
|
||||
sel.dport_mask = sel.dport ? ~0 : 0;
|
||||
}
|
||||
@@ -37,7 +39,6 @@ index db0b2ac37..e4e7d9ecb 100644
|
||||
+ gre_key = htons(traffic_selector_gre_key(dst->get_from_port(dst), dst->get_to_port(dst)));
|
||||
+ if ( gre_key != 0 )
|
||||
+ {
|
||||
+ DBG2(DBG_KNL, "Policy GRE key: %d (%d-%d) %d", gre_key, dst->get_from_port(dst), dst->get_to_port(dst), traffic_selector_gre_key(dst->get_from_port(dst), dst->get_to_port(dst)));
|
||||
+ sel.sport = gre_key >> 16;
|
||||
+ sel.sport_mask = ~0;
|
||||
+ sel.dport = gre_key & 0xffff;
|
||||
@@ -53,7 +54,7 @@ index db0b2ac37..e4e7d9ecb 100644
|
||||
sel.user = 0;
|
||||
|
||||
diff --git a/src/libcharon/plugins/load_tester/load_tester_config.c b/src/libcharon/plugins/load_tester/load_tester_config.c
|
||||
index 58e1cd98a..ac67875d8 100644
|
||||
index 58e1cd98a0..f20fdae522 100644
|
||||
--- a/src/libcharon/plugins/load_tester/load_tester_config.c
|
||||
+++ b/src/libcharon/plugins/load_tester/load_tester_config.c
|
||||
@@ -498,7 +498,27 @@ static bool parse_protoport(char *token, uint16_t *from_port,
|
||||
@@ -70,15 +71,15 @@ index 58e1cd98a..ac67875d8 100644
|
||||
+ {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ end->from_port = (p >> 16) & 0xffff;
|
||||
+ end->to_port = p & 0xffff;
|
||||
+ *from_port = (p >> 16) & 0xffff;
|
||||
+ *to_port = p & 0xffff;
|
||||
+ if (*endptr)
|
||||
+ {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ } else {
|
||||
+ end->from_port = 0;
|
||||
+ end->to_port = 0;
|
||||
+ *from_port = 0;
|
||||
+ *to_port = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ else if (streq(port, "%any"))
|
||||
@@ -86,7 +87,7 @@ index 58e1cd98a..ac67875d8 100644
|
||||
*from_port = 0;
|
||||
*to_port = 0xffff;
|
||||
diff --git a/src/libcharon/plugins/stroke/stroke_config.c b/src/libcharon/plugins/stroke/stroke_config.c
|
||||
index 55db379ff..b4340b8d1 100644
|
||||
index 55db379ffe..b4340b8d1b 100644
|
||||
--- a/src/libcharon/plugins/stroke/stroke_config.c
|
||||
+++ b/src/libcharon/plugins/stroke/stroke_config.c
|
||||
@@ -927,7 +927,27 @@ static bool parse_protoport(char *token, uint16_t *from_port,
|
||||
@@ -119,10 +120,10 @@ index 55db379ff..b4340b8d1 100644
|
||||
*from_port = 0;
|
||||
*to_port = 0xffff;
|
||||
diff --git a/src/libcharon/plugins/vici/vici_config.c b/src/libcharon/plugins/vici/vici_config.c
|
||||
index c858e9945..c72c97f76 100644
|
||||
index c858e9945c..24a254689b 100644
|
||||
--- a/src/libcharon/plugins/vici/vici_config.c
|
||||
+++ b/src/libcharon/plugins/vici/vici_config.c
|
||||
@@ -715,7 +715,31 @@ CALLBACK(parse_ts, bool,
|
||||
@@ -715,7 +715,27 @@ CALLBACK(parse_ts, bool,
|
||||
proto = (uint8_t)p;
|
||||
}
|
||||
}
|
||||
@@ -131,19 +132,15 @@ index c858e9945..c72c97f76 100644
|
||||
+ {
|
||||
+ if (*port && !streq(port, "any"))
|
||||
+ {
|
||||
+ DBG2(DBG_CFG, " GRE key %s", port);
|
||||
+ p = strtol(port, &end, 0);
|
||||
+ if (p < 0 || p > 0xffffffff)
|
||||
+ {
|
||||
+ DBG2(DBG_CFG, " Invalid GRE key %s", port);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ from = (p >> 16) & 0xffff;
|
||||
+ to = p & 0xffff;
|
||||
+ DBG2(DBG_CFG, " Parsed GRE key %d-%d(%d)", from, to, p);
|
||||
+ if (*end)
|
||||
+ {
|
||||
+ DBG2(DBG_CFG, " Invalid GRE key %s", port);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ } else {
|
||||
@@ -155,7 +152,7 @@ index c858e9945..c72c97f76 100644
|
||||
{
|
||||
from = 0xffff;
|
||||
to = 0;
|
||||
@@ -752,8 +776,14 @@ CALLBACK(parse_ts, bool,
|
||||
@@ -752,6 +772,11 @@ CALLBACK(parse_ts, bool,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,12 +163,9 @@ index c858e9945..c72c97f76 100644
|
||||
+ }
|
||||
if (streq(buf, "dynamic"))
|
||||
{
|
||||
+ DBG2(DBG_CFG, " Create dynamic selector GRE key proto=%d, from_port=%d, to_port=%d", proto, from, to);
|
||||
ts = traffic_selector_create_dynamic(proto, from, to);
|
||||
}
|
||||
else if (strchr(buf, '-'))
|
||||
diff --git a/src/libstrongswan/selectors/traffic_selector.c b/src/libstrongswan/selectors/traffic_selector.c
|
||||
index fe61e3768..09757ec36 100644
|
||||
index fe61e3768b..09757ec36f 100644
|
||||
--- a/src/libstrongswan/selectors/traffic_selector.c
|
||||
+++ b/src/libstrongswan/selectors/traffic_selector.c
|
||||
@@ -205,6 +205,18 @@ static int print_icmp(printf_hook_data_t *data, uint16_t port)
|
||||
@@ -216,7 +210,7 @@ index fe61e3768..09757ec36 100644
|
||||
{
|
||||
written += print_in_hook(data, "OPAQUE");
|
||||
diff --git a/src/libstrongswan/selectors/traffic_selector.h b/src/libstrongswan/selectors/traffic_selector.h
|
||||
index 367b4fff9..b7010e4a7 100644
|
||||
index 367b4fff94..b7010e4a73 100644
|
||||
--- a/src/libstrongswan/selectors/traffic_selector.h
|
||||
+++ b/src/libstrongswan/selectors/traffic_selector.h
|
||||
@@ -272,6 +272,18 @@ static inline uint8_t traffic_selector_icmp_code(uint16_t port)
|
||||
@@ -239,7 +233,7 @@ index 367b4fff9..b7010e4a7 100644
|
||||
* Compare two traffic selectors, usable as sort function
|
||||
*
|
||||
diff --git a/src/starter/confread.c b/src/starter/confread.c
|
||||
index 5065bc369..039b6f402 100644
|
||||
index 5065bc369f..039b6f402b 100644
|
||||
--- a/src/starter/confread.c
|
||||
+++ b/src/starter/confread.c
|
||||
@@ -325,7 +325,29 @@ static void kw_end(starter_conn_t *conn, starter_end_t *end, kw_token_t token,
|
||||
@@ -274,7 +268,7 @@ index 5065bc369..039b6f402 100644
|
||||
end->from_port = 0;
|
||||
end->to_port = 0xffff;
|
||||
diff --git a/src/swanctl/swanctl.opt b/src/swanctl/swanctl.opt
|
||||
index d9fd949ed..1d63dadb8 100644
|
||||
index d9fd949ed1..1d63dadb89 100644
|
||||
--- a/src/swanctl/swanctl.opt
|
||||
+++ b/src/swanctl/swanctl.opt
|
||||
@@ -765,6 +765,9 @@ connections.<conn>.children.<child>.local_ts = dynamic
|
||||
@@ -288,5 +282,5 @@ index d9fd949ed..1d63dadb8 100644
|
||||
the Cisco Unity extension plugin is used. This is due to a limitation of the
|
||||
IKEv1 protocol, which only allows a single pair of selectors per CHILD_SA.
|
||||
--
|
||||
2.45.2
|
||||
2.49.0
|
||||
|
||||
@@ -34,7 +34,7 @@ Patch1: strongswan-5.9.7-error-no-format.patch
|
||||
Patch10: 0001-charon-add-optional-source-and-remote-overrides-for-.patch
|
||||
Patch11: 0002-vici-send-certificates-for-ike-sa-events.patch
|
||||
Patch12: 0003-vici-add-support-for-individual-sa-state-changes.patch
|
||||
Patch13: 0004-Support-GRE-key-in-selectors.patch
|
||||
Patch13: 0004-Support-GRE-key-in-selectors-with-kernel-netlink.patch
|
||||
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
|
||||
Reference in New Issue
Block a user