]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
peer-cfg: Add option to prevent roaming between IP addresses/interfaces
authorTobias Brunner <tobias@strongswan.org>
Tue, 15 Nov 2016 15:22:32 +0000 (16:22 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 17 Feb 2017 10:33:34 +0000 (11:33 +0100)
src/libcharon/config/peer_cfg.c
src/libcharon/config/peer_cfg.h

index 5d7ab076e7ea3780d97f8627c83e9bb3706a0ffc..108db44854e851b49faf82a6e8186396780e8957 100644 (file)
@@ -95,6 +95,11 @@ struct private_peer_cfg_t {
         */
        bool use_mobike;
 
+       /**
+        * Prevent roaming to different addresses/interfaces
+        */
+       bool no_roaming;
+
        /**
         * Use aggressive mode?
         */
@@ -502,6 +507,12 @@ METHOD(peer_cfg_t, use_mobike, bool,
        return this->use_mobike;
 }
 
+METHOD(peer_cfg_t, no_roaming, bool,
+       private_peer_cfg_t *this)
+{
+       return this->no_roaming;
+}
+
 METHOD(peer_cfg_t, use_aggressive, bool,
        private_peer_cfg_t *this)
 {
@@ -673,6 +684,7 @@ METHOD(peer_cfg_t, equals, bool,
                this->unique == other->unique &&
                this->keyingtries == other->keyingtries &&
                this->use_mobike == other->use_mobike &&
+               this->no_roaming == other->no_roaming &&
                this->rekey_time == other->rekey_time &&
                this->reauth_time == other->reauth_time &&
                this->jitter_time == other->jitter_time &&
@@ -760,6 +772,7 @@ peer_cfg_t *peer_cfg_create(char *name, ike_cfg_t *ike_cfg,
                        .get_reauth_time = _get_reauth_time,
                        .get_over_time = _get_over_time,
                        .use_mobike = _use_mobike,
+                       .no_roaming = _no_roaming,
                        .use_aggressive = _use_aggressive,
                        .use_pull_mode = _use_pull_mode,
                        .get_dpd = _get_dpd,
@@ -790,7 +803,8 @@ peer_cfg_t *peer_cfg_create(char *name, ike_cfg_t *ike_cfg,
                .reauth_time = data->reauth_time,
                .jitter_time = data->jitter_time,
                .over_time = data->over_time,
-               .use_mobike = !data->no_mobike,
+               .use_mobike = !data->no_mobike && !data->no_roaming,
+               .no_roaming = data->no_roaming,
                .aggressive = data->aggressive,
                .pull_mode = !data->push_mode,
                .dpd = data->dpd,
index b294ae72f7fb6fbb9fc15e32a0efa3df9fd23adf..100a3dbfac7b9f80acab27deaba9ae31d1cf191c 100644 (file)
@@ -248,6 +248,13 @@ struct peer_cfg_t {
         */
        uint32_t (*get_over_time)(peer_cfg_t *this);
 
+       /**
+        * Prevent roaming to different IP addressess and interfaces.
+        *
+        * @return                      TRUE to prevent roaming
+        */
+       bool (*no_roaming) (peer_cfg_t *this);
+
        /**
         * Use MOBIKE (RFC4555) if peer supports it?
         *
@@ -387,6 +394,8 @@ struct peer_cfg_create_t {
        uint32_t over_time;
        /** Disable MOBIKE (RFC4555) */
        bool no_mobike;
+       /** Prevent roaming to different IP addresses/interfaces (disables MOBIKE) */
+       bool no_roaming;
        /** Use/accept aggressive mode with IKEv1 */
        bool aggressive;
        /** TRUE to use modeconfig push, FALSE for pull */