kernel-interface: Add feature to indicate if query_sa() returns last use time

Currently supported by libipsec and PF_KEY on macOS (FreeBSD, like Linux,
reports the time the SA was first used in sadb_lifetime_usetime - it also
triggers rekeyings based on that, which Linux doesn't, it also triggers
them if an SA is never used).
This commit is contained in:
Tobias Brunner
2023-02-22 13:20:10 +01:00
parent 1efdb0f791
commit b9131c34d3
5 changed files with 40 additions and 11 deletions
+10 -3
View File
@@ -79,6 +79,8 @@ enum kernel_feature_t {
KERNEL_NO_POLICY_UPDATES = (1<<3),
/** IPsec backend supports installing SPIs on policies */
KERNEL_POLICY_SPI = (1<<4),
/** IPsec backend reports use time per SA via query_sa() */
KERNEL_SA_USE_TIME = (1<<5),
};
/**
@@ -202,7 +204,11 @@ struct kernel_interface_t {
kernel_ipsec_update_sa_t *data);
/**
* Query the number of bytes processed by an SA from the SAD.
* Query the number of bytes and packets processed by an SA from the SAD.
*
* Some implementations may also return the last use time (as indicated by
* get_features()). This is a monotonic timestamp as returned by
* time_monotonic().
*
* @param id data identifying this SA
* @param data data to query the SA
@@ -247,11 +253,12 @@ struct kernel_interface_t {
* Query the use time of a policy.
*
* The use time of a policy is the time the policy was used
* for the last time.
* for the last time. This is a monotonic timestamp as returned by
* time_monotonic().
*
* @param id data identifying this policy
* @param data data to query the policy
* @param[out] use_time the monotonic timestamp of this SA's last use
* @param[out] use_time the monotonic timestamp of this policy's last use
* @return SUCCESS if operation completed
*/
status_t (*query_policy)(kernel_interface_t *this,