]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
charon-cmd: Add support for childless IKE SA initiation
authorTobias Brunner <tobias@strongswan.org>
Tue, 9 Dec 2025 09:08:35 +0000 (10:08 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 15 Jan 2026 13:12:43 +0000 (14:12 +0100)
References strongswan/strongswan#1594

src/charon-cmd/cmd/cmd_connection.c
src/charon-cmd/cmd/cmd_options.c
src/charon-cmd/cmd/cmd_options.h

index cb166009015c41e6859aff3c38dc8293ba7e35f5..65e522765e2149d9970bbb164c7a30212044b6f4 100644 (file)
@@ -122,6 +122,11 @@ struct private_cmd_connection_t {
         */
        bool key_seen;
 
+       /**
+        * Whether to use childless IKE SA initiation
+        */
+       childless_t childless;
+
        /**
         * Selected connection profile
         */
@@ -149,6 +154,7 @@ static peer_cfg_t* create_peer_cfg(private_cmd_connection_t *this)
                .remote = this->host,
                .remote_port = IKEV2_UDP_PORT,
                .fragmentation = FRAGMENTATION_YES,
+               .childless = this->childless,
        };
        peer_cfg_create_t peer = {
                .cert_policy = CERT_SEND_IF_ASKED,
@@ -542,6 +548,13 @@ METHOD(cmd_connection_t, handle, bool,
                        }
                        this->child_proposals->insert_last(this->child_proposals, proposal);
                        break;
+               case CMD_OPT_CHILDLESS:
+                       this->childless = CHILDLESS_PREFER;
+                       if (arg && streq("force", arg))
+                       {
+                               this->childless = CHILDLESS_FORCE;
+                       }
+                       break;
                case CMD_OPT_PROFILE:
                        set_profile(this, arg);
                        break;
@@ -582,6 +595,7 @@ cmd_connection_t *cmd_connection_create()
                .remote_ts = linked_list_create(),
                .ike_proposals = linked_list_create(),
                .child_proposals = linked_list_create(),
+               .childless = CHILDLESS_NEVER,
                .profile = PROF_UNDEF,
        );
 
index 8aa09050fb10b23f9485fc948e8340b9a54af16d..6731177c3dd4f2d4c9aea3a8e239368bfe3f197d 100644 (file)
@@ -63,6 +63,10 @@ cmd_option_t cmd_options[CMD_OPT_COUNT] = {
          "a single ESP proposal to offer instead of the default", {}},
        { CMD_OPT_AH_PROPOSAL, "ah-proposal", required_argument, "proposal",
          "a single AH proposal to offer instead of the default", {}},
+       { CMD_OPT_CHILDLESS, "childless", optional_argument, "force",
+         "use childless IKE SA initiation if supported by the responder, ", {
+               "passing 'force' aborts if that's not the case",
+       }},
        { CMD_OPT_PROFILE, "profile", required_argument, "name",
          "authentication profile to use, where name is one of:", {
                "  ikev2-pub, ikev2-eap, ikev2-pub-eap, ikev2-psk",
index 0fe2f5698fa987cf9a8778dab2965e0a3b0d949b..47249181bbe1f32224c1cc9085249d751b795f68 100644 (file)
@@ -48,6 +48,7 @@ enum cmd_option_type_t {
        CMD_OPT_IKE_PROPOSAL,
        CMD_OPT_AH_PROPOSAL,
        CMD_OPT_ESP_PROPOSAL,
+       CMD_OPT_CHILDLESS,
        CMD_OPT_PROFILE,
 
        CMD_OPT_COUNT