kernel: Use a time_t to report use time in query_policy()
authorMartin Willi <martin@revosec.ch>
Mon, 23 Sep 2013 10:35:33 +0000 (12:35 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 11 Oct 2013 08:23:17 +0000 (10:23 +0200)
src/charon-tkm/src/tkm/tkm_kernel_ipsec.c
src/frontends/android/jni/libandroidbridge/kernel/android_ipsec.c
src/libcharon/plugins/kernel_libipsec/kernel_libipsec_ipsec.c
src/libcharon/plugins/load_tester/load_tester_ipsec.c
src/libcharon/sa/child_sa.c
src/libhydra/kernel/kernel_interface.c
src/libhydra/kernel/kernel_interface.h
src/libhydra/kernel/kernel_ipsec.h
src/libhydra/plugins/kernel_klips/kernel_klips_ipsec.c
src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c
src/libhydra/plugins/kernel_pfkey/kernel_pfkey_ipsec.c

index 0b17d01..72c247d 100644 (file)
@@ -271,7 +271,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
 METHOD(kernel_ipsec_t, query_policy, status_t,
        private_tkm_kernel_ipsec_t *this, traffic_selector_t *src_ts,
        traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
-       u_int32_t *use_time)
+       time_t *use_time)
 {
        return NOT_SUPPORTED;
 }
index 7dd9d54..48f1487 100644 (file)
@@ -118,7 +118,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
 METHOD(kernel_ipsec_t, query_policy, status_t,
        private_kernel_android_ipsec_t *this, traffic_selector_t *src_ts,
        traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
-       u_int32_t *use_time)
+       time_t *use_time)
 {
        return NOT_SUPPORTED;
 }
index 131b982..8e7cabc 100644 (file)
@@ -555,7 +555,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
 METHOD(kernel_ipsec_t, query_policy, status_t,
        private_kernel_libipsec_ipsec_t *this, traffic_selector_t *src_ts,
        traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
-       u_int32_t *use_time)
+       time_t *use_time)
 {
        return NOT_SUPPORTED;
 }
index 5bbf759..02b1d42 100644 (file)
@@ -95,7 +95,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
 METHOD(kernel_ipsec_t, query_policy, status_t,
        private_load_tester_ipsec_t *this, traffic_selector_t *src_ts,
        traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
-       u_int32_t *use_time)
+       time_t *use_time)
 {
        *use_time = 1;
        return SUCCESS;
index 022bafc..9c3876a 100644 (file)
@@ -489,12 +489,12 @@ static bool update_usetime(private_child_sa_t *this, bool inbound)
 {
        enumerator_t *enumerator;
        traffic_selector_t *my_ts, *other_ts;
-       u_int32_t last_use = 0;
+       time_t last_use = 0;
 
        enumerator = create_policy_enumerator(this);
        while (enumerator->enumerate(enumerator, &my_ts, &other_ts))
        {
-               u_int32_t in, out, fwd;
+               time_t in, out, fwd;
 
                if (inbound)
                {
index 92723ce..cbfddd0 100644 (file)
@@ -256,7 +256,7 @@ METHOD(kernel_interface_t, add_policy, status_t,
 METHOD(kernel_interface_t, query_policy, status_t,
        private_kernel_interface_t *this, traffic_selector_t *src_ts,
        traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
-       u_int32_t *use_time)
+       time_t *use_time)
 {
        if (!this->ipsec)
        {
index f42d98f..cc47d3c 100644 (file)
@@ -264,14 +264,14 @@ struct kernel_interface_t {
         * @param dst_ts                traffic selector to match traffic dest
         * @param direction             direction of traffic, POLICY_(IN|OUT|FWD)
         * @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
         */
        status_t (*query_policy) (kernel_interface_t *this,
                                                          traffic_selector_t *src_ts,
                                                          traffic_selector_t *dst_ts,
                                                          policy_dir_t direction, mark_t mark,
-                                                         u_int32_t *use_time);
+                                                         time_t *use_time);
 
        /**
         * Remove a policy from the SPD.
index 4eb3193..25f5b38 100644 (file)
@@ -228,7 +228,7 @@ struct kernel_ipsec_t {
                                                          traffic_selector_t *src_ts,
                                                          traffic_selector_t *dst_ts,
                                                          policy_dir_t direction, mark_t mark,
-                                                         u_int32_t *use_time);
+                                                         time_t *use_time);
 
        /**
         * Remove a policy from the SPD.
index 068fee4..a226162 100644 (file)
@@ -2207,7 +2207,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
 METHOD(kernel_ipsec_t, query_policy, status_t,
        private_kernel_klips_ipsec_t *this, traffic_selector_t *src_ts,
        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="
        static const char *path_eroute = "/proc/net/ipsec_eroute";
index 39efc16..e23f220 100644 (file)
@@ -2302,7 +2302,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
 METHOD(kernel_ipsec_t, query_policy, status_t,
        private_kernel_netlink_ipsec_t *this, traffic_selector_t *src_ts,
        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;
        struct nlmsghdr *out = NULL, *hdr;
index 5030c5f..feff3a7 100644 (file)
@@ -2382,7 +2382,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
 METHOD(kernel_ipsec_t, query_policy, status_t,
        private_kernel_pfkey_ipsec_t *this, traffic_selector_t *src_ts,
        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];
        struct sadb_msg *msg, *out;