child-cfg: Make HW offload auto mode configurable

Until now the configuration available to user for HW offload were:
hw_offload = no
hw_offload = yes

With this commit users will be able to configure auto mode using:
hw_offload = auto

Signed-off-by: Adi Nissim <[email protected]>
Reviewed-by: Aviv Heller <[email protected]>
This commit is contained in:
Adi Nissim
2018-03-21 10:32:02 +01:00
committed by Tobias Brunner
parent ee26f7156f
commit 8ced1570ab
5 changed files with 50 additions and 18 deletions
+13
View File
@@ -142,6 +142,11 @@ struct private_child_cfg_t {
* anti-replay window size
*/
uint32_t replay_window;
/**
* HW offload mode
*/
hw_offload_t hw_offload;
};
METHOD(child_cfg_t, get_name, char*,
@@ -467,6 +472,12 @@ METHOD(child_cfg_t, get_start_action, action_t,
return this->start_action;
}
METHOD(child_cfg_t, get_hw_offload, hw_offload_t,
private_child_cfg_t *this)
{
return this->hw_offload;
}
METHOD(child_cfg_t, get_dpd_action, action_t,
private_child_cfg_t *this)
{
@@ -652,6 +663,7 @@ child_cfg_t *child_cfg_create(char *name, child_cfg_create_t *data)
.equals = _equals,
.get_ref = _get_ref,
.destroy = _destroy,
.get_hw_offload = _get_hw_offload,
},
.name = strdup(name),
.options = data->options,
@@ -674,6 +686,7 @@ child_cfg_t *child_cfg_create(char *name, child_cfg_create_t *data)
.other_ts = linked_list_create(),
.replay_window = lib->settings->get_int(lib->settings,
"%s.replay_window", DEFAULT_REPLAY_WINDOW, lib->ns),
.hw_offload = data->hw_offload,
);
return &this->public;
+11 -5
View File
@@ -182,6 +182,13 @@ struct child_cfg_t {
*/
action_t (*get_dpd_action) (child_cfg_t *this);
/**
* Get the HW offload mode to use for the CHILD_SA.
*
* @return hw offload mode
*/
hw_offload_t (*get_hw_offload) (child_cfg_t *this);
/**
* Action to take if CHILD_SA gets closed.
*
@@ -305,14 +312,11 @@ enum child_cfg_option_t {
/** Install outbound FWD IPsec policies to bypass drop policies */
OPT_FWD_OUT_POLICIES = (1<<4),
/** Enable hardware offload, if supported by the IPsec backend */
OPT_HW_OFFLOAD = (1<<5),
/** Force 96-bit truncation for SHA-256 */
OPT_SHA256_96 = (1<<6),
OPT_SHA256_96 = (1<<5),
/** Set mark on inbound SAs */
OPT_MARK_IN_SA = (1<<7),
OPT_MARK_IN_SA = (1<<6),
};
/**
@@ -347,6 +351,8 @@ struct child_cfg_create_t {
action_t close_action;
/** updown script to execute on up/down event (cloned) */
char *updown;
/** HW offload mode */
hw_offload_t hw_offload;
};
/**