kernel: Use a time_t to report use time in query_sa()
authorMartin Willi <martin@revosec.ch>
Mon, 23 Sep 2013 10:28:13 +0000 (12:28 +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 1d070fd..0b17d01 100644 (file)
@@ -217,7 +217,7 @@ sad_failure:
 METHOD(kernel_ipsec_t, query_sa, status_t,
        private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
        u_int32_t spi, u_int8_t protocol, mark_t mark, u_int64_t *bytes,
-       u_int64_t *packets, u_int32_t *time)
+       u_int64_t *packets, time_t *time)
 {
        return NOT_SUPPORTED;
 }
index 98fa33d..7dd9d54 100644 (file)
@@ -86,7 +86,7 @@ METHOD(kernel_ipsec_t, update_sa, status_t,
 METHOD(kernel_ipsec_t, query_sa, status_t,
        private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
        u_int32_t spi, u_int8_t protocol, mark_t mark,
-       u_int64_t *bytes, u_int64_t *packets, u_int32_t *time)
+       u_int64_t *bytes, u_int64_t *packets, time_t *time)
 {
        return NOT_SUPPORTED;
 }
index 40f253d..131b982 100644 (file)
@@ -268,7 +268,7 @@ METHOD(kernel_ipsec_t, update_sa, status_t,
 METHOD(kernel_ipsec_t, query_sa, status_t,
        private_kernel_libipsec_ipsec_t *this, host_t *src, host_t *dst,
        u_int32_t spi, u_int8_t protocol, mark_t mark, u_int64_t *bytes,
-       u_int64_t *packets, u_int32_t *time)
+       u_int64_t *packets, time_t *time)
 {
        return NOT_SUPPORTED;
 }
index bf08d2c..5bbf759 100644 (file)
@@ -71,7 +71,7 @@ METHOD(kernel_ipsec_t, update_sa, status_t,
 METHOD(kernel_ipsec_t, query_sa, status_t,
        private_load_tester_ipsec_t *this, host_t *src, host_t *dst,
        u_int32_t spi, u_int8_t protocol, mark_t mark,
-       u_int64_t *bytes, u_int64_t *packets, u_int32_t *time)
+       u_int64_t *bytes, u_int64_t *packets, time_t *time)
 {
        return NOT_SUPPORTED;
 }
index 9bd0c05..022bafc 100644 (file)
@@ -167,12 +167,12 @@ struct private_child_sa_t {
        /**
         * time of last use in seconds (inbound)
         */
-       u_int32_t my_usetime;
+       time_t my_usetime;
 
        /**
         * time of last use in seconds (outbound)
         */
-       u_int32_t other_usetime;
+       time_t other_usetime;
 
        /**
         * last number of inbound bytes
@@ -429,7 +429,7 @@ static status_t update_usebytes(private_child_sa_t *this, bool inbound)
 {
        status_t status = FAILED;
        u_int64_t bytes, packets;
-       u_int32_t time;
+       time_t time;
 
        if (inbound)
        {
index 68a8c3e..92723ce 100644 (file)
@@ -208,7 +208,7 @@ METHOD(kernel_interface_t, update_sa, status_t,
 METHOD(kernel_interface_t, query_sa, status_t,
        private_kernel_interface_t *this, host_t *src, host_t *dst,
        u_int32_t spi, u_int8_t protocol, mark_t mark,
-       u_int64_t *bytes, u_int64_t *packets, u_int32_t *time)
+       u_int64_t *bytes, u_int64_t *packets, time_t *time)
 {
        if (!this->ipsec)
        {
index 1d96f1c..f42d98f 100644 (file)
@@ -200,12 +200,12 @@ struct kernel_interface_t {
         * @param mark                  optional mark for this SA
         * @param[out] bytes    the number of bytes processed by SA
         * @param[out] packets  number of packets processed by SA
-        * @param[out] time             last time of SA use
+        * @param[out] time             last (monotonic) time of SA use
         * @return                              SUCCESS if operation completed
         */
        status_t (*query_sa) (kernel_interface_t *this, host_t *src, host_t *dst,
                                                  u_int32_t spi, u_int8_t protocol, mark_t mark,
-                                                 u_int64_t *bytes, u_int64_t *packets, u_int32_t *time);
+                                                 u_int64_t *bytes, u_int64_t *packets, time_t *time);
 
        /**
         * Delete a previously installed SA from the SAD.
index 413e592..4eb3193 100644 (file)
@@ -156,12 +156,12 @@ struct kernel_ipsec_t {
         * @param mark                  optional mark for this SA
         * @param[out] bytes    the number of bytes processed by SA
         * @param[out] packets  number of packets processed by SA
-        * @param[out] time             last time of SA use
+        * @param[out] time             last (monotonic) time of SA use
         * @return                              SUCCESS if operation completed
         */
        status_t (*query_sa) (kernel_ipsec_t *this, host_t *src, host_t *dst,
                                                  u_int32_t spi, u_int8_t protocol, mark_t mark,
-                                                 u_int64_t *bytes, u_int64_t *packets, u_int32_t *time);
+                                                 u_int64_t *bytes, u_int64_t *packets, time_t *time);
 
        /**
         * Delete a previusly installed SA from the SAD.
index 82f80fd..068fee4 100644 (file)
@@ -1911,7 +1911,7 @@ METHOD(kernel_ipsec_t, update_sa, status_t,
 METHOD(kernel_ipsec_t, query_sa, status_t,
        private_kernel_klips_ipsec_t *this, host_t *src, host_t *dst,
        u_int32_t spi, u_int8_t protocol, mark_t mark,
-       u_int64_t *bytes, u_int64_t *packets, u_int32_t *time)
+       u_int64_t *bytes, u_int64_t *packets, time_t *time)
 {
        return NOT_SUPPORTED;  /* TODO */
 }
index e06c8ea..39efc16 100644 (file)
@@ -1611,7 +1611,7 @@ static void get_replay_state(private_kernel_netlink_ipsec_t *this,
 METHOD(kernel_ipsec_t, query_sa, status_t,
        private_kernel_netlink_ipsec_t *this, host_t *src, host_t *dst,
        u_int32_t spi, u_int8_t protocol, mark_t mark,
-       u_int64_t *bytes, u_int64_t *packets, u_int32_t *time)
+       u_int64_t *bytes, u_int64_t *packets, time_t *time)
 {
        netlink_buf_t request;
        struct nlmsghdr *out = NULL, *hdr;
index 668c581..5030c5f 100644 (file)
@@ -1802,7 +1802,7 @@ METHOD(kernel_ipsec_t, update_sa, status_t,
 METHOD(kernel_ipsec_t, query_sa, status_t,
        private_kernel_pfkey_ipsec_t *this, host_t *src, host_t *dst,
        u_int32_t spi, u_int8_t protocol, mark_t mark,
-       u_int64_t *bytes, u_int64_t *packets, u_int32_t *time)
+       u_int64_t *bytes, u_int64_t *packets, time_t *time)
 {
        unsigned char request[PFKEY_BUFFER_SIZE];
        struct sadb_msg *msg, *out;