add TIMEOUT_PERIOD_FOR_LIVENESS_CHECK attribute support
authorDenis Vinogradov <denis.vinogradov@samsung.com>
Mon, 31 Aug 2020 05:01:58 +0000 (14:01 +0900)
committerSeongsik Kim <sz.kim@samsung.com>
Wed, 9 Sep 2020 04:36:29 +0000 (13:36 +0900)
Change-Id: I45856760eb2f84317b8b95b65f11b4e98e7b35f3
Signed-off-by: Denis Vinogradov <denis.vinogradov@samsung.com>
src/libcharon/config/peer_cfg.c
src/libcharon/config/peer_cfg.h
src/libcharon/plugins/stroke/stroke_handler.c
src/libcharon/sa/ike_sa.c
src/libcharon/sa/ike_sa.h

index 75edb73dc5ee4c27104349c77128123b26f1a219..155cc129c46c08bcc8c25d2dd31762d96c27950c 100755 (executable)
@@ -952,6 +952,12 @@ METHOD(peer_cfg_t, rewind_vendor_attributes_request_list, void,
                this->attributes_list->reset(this->attributes_list);
        }
 }
+
+METHOD(peer_cfg_t, set_dpd_interval, void,
+       private_peer_cfg_t *this, uint32_t interval)
+{
+       this->dpd = interval;
+}
 #endif
 
 METHOD(peer_cfg_t, destroy, void,
@@ -1062,6 +1068,7 @@ peer_cfg_t *peer_cfg_create(char *name, ike_cfg_t *ike_cfg,
                        .add_vendor_attributes_request_list = _add_vendor_attributes_request_list,
                        .get_next_vendor_attribute_request = _get_next_vendor_attribute_request,
                        .rewind_vendor_attributes_request_list = _rewind_vendor_attributes_request_list,
+                       .set_dpd_interval = _set_dpd_interval,
 #endif
 #ifdef ME
                        .is_mediation = _is_mediation,
index c6d759683370a08651835a2d498cadc087f06d3b..1cfb1d00c615d014ea71b093ecb764b0778bdd15 100755 (executable)
@@ -463,6 +463,11 @@ struct peer_cfg_t {
        void (*add_vendor_attributes_request_list)(peer_cfg_t *this, char *buffer);
        int (*get_next_vendor_attribute_request)(peer_cfg_t *this);
        void (*rewind_vendor_attributes_request_list)(peer_cfg_t *this);
+
+       /**
+       * Set DPD interval
+       */
+       void (*set_dpd_interval)(peer_cfg_t *this, uint32_t interval);
 #endif
 };
 
index 347135f9de3b76bdc533a28d7529f4049aed36e9..a033df61d9f2ada2d355ee30288c79128b0687ef 100755 (executable)
@@ -261,6 +261,12 @@ METHOD(attribute_handler_t, handle, bool,
                        {
                                DBG1(DBG_CFG, "processed attribute %d", type);
 
+                               if ((type == TIMEOUT_PERIOD_FOR_DPD) && (data.len == 4))
+                               {
+                                       uint32_t interval = ntohl(*((uint32_t*)data.ptr));
+                                       ike_sa->set_dpd_interval(ike_sa, interval);
+                               }
+
                                result = TRUE;
                                break;
                        }
index b8f17e07aadb8210b7f0befaf2db053c6d284793..8fe598b37dd35019453df66abc8adcbb16f803d2 100755 (executable)
@@ -3730,6 +3730,17 @@ METHOD(ike_sa_t, get_mtu, int,
 {
        return this->mtu;
 }
+
+METHOD(ike_sa_t, set_dpd_interval, void,
+       private_ike_sa_t *this, uint32_t interval)
+{
+       DBG1(DBG_IKE, "Set DPD interval to %d seconds", interval);
+
+       if (this->peer_cfg)
+       {
+               this->peer_cfg->set_dpd_interval(this->peer_cfg, interval);
+       }
+}
 #endif
 
 #ifdef VOWIFI_USE_TIMER
@@ -3878,6 +3889,7 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id, bool initiator,
                        .get_tun_name = _get_tun_name,
                        .get_mtu = _get_mtu,
                        .get_configuration_attributes = _get_configuration_attributes,
+                       .set_dpd_interval = _set_dpd_interval,
 #endif
 #ifdef ME
                        .act_as_mediation_server = _act_as_mediation_server,
index 363d8a9bc86f75c23187279028960da4e2b64c30..7a1ee761fb5e0ade456f5781d0bbc4d9552a2f9b 100755 (executable)
@@ -1254,6 +1254,11 @@ struct ike_sa_t {
        * Get configuration attributes
        */
        int (*get_configuration_attributes)(ike_sa_t *this, linked_list_t *list);
+
+       /**
+       * Set DPD interval
+       */
+       void (*set_dpd_interval)(ike_sa_t *this, uint32_t interval);
 #endif
 };