kernel: Use a time_t to report use time in query_policy()
This commit is contained in:
@@ -271,7 +271,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
|||||||
METHOD(kernel_ipsec_t, query_policy, status_t,
|
METHOD(kernel_ipsec_t, query_policy, status_t,
|
||||||
private_tkm_kernel_ipsec_t *this, traffic_selector_t *src_ts,
|
private_tkm_kernel_ipsec_t *this, traffic_selector_t *src_ts,
|
||||||
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
||||||
u_int32_t *use_time)
|
time_t *use_time)
|
||||||
{
|
{
|
||||||
return NOT_SUPPORTED;
|
return NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
|||||||
METHOD(kernel_ipsec_t, query_policy, status_t,
|
METHOD(kernel_ipsec_t, query_policy, status_t,
|
||||||
private_kernel_android_ipsec_t *this, traffic_selector_t *src_ts,
|
private_kernel_android_ipsec_t *this, traffic_selector_t *src_ts,
|
||||||
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
||||||
u_int32_t *use_time)
|
time_t *use_time)
|
||||||
{
|
{
|
||||||
return NOT_SUPPORTED;
|
return NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -555,7 +555,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
|||||||
METHOD(kernel_ipsec_t, query_policy, status_t,
|
METHOD(kernel_ipsec_t, query_policy, status_t,
|
||||||
private_kernel_libipsec_ipsec_t *this, traffic_selector_t *src_ts,
|
private_kernel_libipsec_ipsec_t *this, traffic_selector_t *src_ts,
|
||||||
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
||||||
u_int32_t *use_time)
|
time_t *use_time)
|
||||||
{
|
{
|
||||||
return NOT_SUPPORTED;
|
return NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
|||||||
METHOD(kernel_ipsec_t, query_policy, status_t,
|
METHOD(kernel_ipsec_t, query_policy, status_t,
|
||||||
private_load_tester_ipsec_t *this, traffic_selector_t *src_ts,
|
private_load_tester_ipsec_t *this, traffic_selector_t *src_ts,
|
||||||
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
||||||
u_int32_t *use_time)
|
time_t *use_time)
|
||||||
{
|
{
|
||||||
*use_time = 1;
|
*use_time = 1;
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|||||||
@@ -489,12 +489,12 @@ static bool update_usetime(private_child_sa_t *this, bool inbound)
|
|||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
traffic_selector_t *my_ts, *other_ts;
|
traffic_selector_t *my_ts, *other_ts;
|
||||||
u_int32_t last_use = 0;
|
time_t last_use = 0;
|
||||||
|
|
||||||
enumerator = create_policy_enumerator(this);
|
enumerator = create_policy_enumerator(this);
|
||||||
while (enumerator->enumerate(enumerator, &my_ts, &other_ts))
|
while (enumerator->enumerate(enumerator, &my_ts, &other_ts))
|
||||||
{
|
{
|
||||||
u_int32_t in, out, fwd;
|
time_t in, out, fwd;
|
||||||
|
|
||||||
if (inbound)
|
if (inbound)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ METHOD(kernel_interface_t, add_policy, status_t,
|
|||||||
METHOD(kernel_interface_t, query_policy, status_t,
|
METHOD(kernel_interface_t, query_policy, status_t,
|
||||||
private_kernel_interface_t *this, traffic_selector_t *src_ts,
|
private_kernel_interface_t *this, traffic_selector_t *src_ts,
|
||||||
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
||||||
u_int32_t *use_time)
|
time_t *use_time)
|
||||||
{
|
{
|
||||||
if (!this->ipsec)
|
if (!this->ipsec)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -264,14 +264,14 @@ struct kernel_interface_t {
|
|||||||
* @param dst_ts traffic selector to match traffic dest
|
* @param dst_ts traffic selector to match traffic dest
|
||||||
* @param direction direction of traffic, POLICY_(IN|OUT|FWD)
|
* @param direction direction of traffic, POLICY_(IN|OUT|FWD)
|
||||||
* @param mark optional mark
|
* @param mark optional mark
|
||||||
* @param[out] use_time the time of this SA's last use
|
* @param[out] use_time the (monotonic) time of this SA's last use
|
||||||
* @return SUCCESS if operation completed
|
* @return SUCCESS if operation completed
|
||||||
*/
|
*/
|
||||||
status_t (*query_policy) (kernel_interface_t *this,
|
status_t (*query_policy) (kernel_interface_t *this,
|
||||||
traffic_selector_t *src_ts,
|
traffic_selector_t *src_ts,
|
||||||
traffic_selector_t *dst_ts,
|
traffic_selector_t *dst_ts,
|
||||||
policy_dir_t direction, mark_t mark,
|
policy_dir_t direction, mark_t mark,
|
||||||
u_int32_t *use_time);
|
time_t *use_time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a policy from the SPD.
|
* Remove a policy from the SPD.
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ struct kernel_ipsec_t {
|
|||||||
traffic_selector_t *src_ts,
|
traffic_selector_t *src_ts,
|
||||||
traffic_selector_t *dst_ts,
|
traffic_selector_t *dst_ts,
|
||||||
policy_dir_t direction, mark_t mark,
|
policy_dir_t direction, mark_t mark,
|
||||||
u_int32_t *use_time);
|
time_t *use_time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a policy from the SPD.
|
* Remove a policy from the SPD.
|
||||||
|
|||||||
@@ -2207,7 +2207,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
|||||||
METHOD(kernel_ipsec_t, query_policy, status_t,
|
METHOD(kernel_ipsec_t, query_policy, status_t,
|
||||||
private_kernel_klips_ipsec_t *this, traffic_selector_t *src_ts,
|
private_kernel_klips_ipsec_t *this, traffic_selector_t *src_ts,
|
||||||
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
||||||
u_int32_t *use_time)
|
time_t *use_time)
|
||||||
{
|
{
|
||||||
#define IDLE_PREFIX "idle="
|
#define IDLE_PREFIX "idle="
|
||||||
static const char *path_eroute = "/proc/net/ipsec_eroute";
|
static const char *path_eroute = "/proc/net/ipsec_eroute";
|
||||||
|
|||||||
@@ -2302,7 +2302,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
|||||||
METHOD(kernel_ipsec_t, query_policy, status_t,
|
METHOD(kernel_ipsec_t, query_policy, status_t,
|
||||||
private_kernel_netlink_ipsec_t *this, traffic_selector_t *src_ts,
|
private_kernel_netlink_ipsec_t *this, traffic_selector_t *src_ts,
|
||||||
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
||||||
u_int32_t *use_time)
|
time_t *use_time)
|
||||||
{
|
{
|
||||||
netlink_buf_t request;
|
netlink_buf_t request;
|
||||||
struct nlmsghdr *out = NULL, *hdr;
|
struct nlmsghdr *out = NULL, *hdr;
|
||||||
|
|||||||
@@ -2382,7 +2382,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
|||||||
METHOD(kernel_ipsec_t, query_policy, status_t,
|
METHOD(kernel_ipsec_t, query_policy, status_t,
|
||||||
private_kernel_pfkey_ipsec_t *this, traffic_selector_t *src_ts,
|
private_kernel_pfkey_ipsec_t *this, traffic_selector_t *src_ts,
|
||||||
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
||||||
u_int32_t *use_time)
|
time_t *use_time)
|
||||||
{
|
{
|
||||||
unsigned char request[PFKEY_BUFFER_SIZE];
|
unsigned char request[PFKEY_BUFFER_SIZE];
|
||||||
struct sadb_msg *msg, *out;
|
struct sadb_msg *msg, *out;
|
||||||
|
|||||||
Reference in New Issue
Block a user