summaryrefslogtreecommitdiffstats
path: root/src/fastd.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-03-30 18:40:23 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-03-30 18:40:23 +0200
commit342d63a45a8918e45ddcf6a0b82b2f593f4bde12 (patch)
tree0f8117faa5d5e9f8b50e6e2014d9922ee0b35d14 /src/fastd.h
parent9ee88db0f8c03951b84cd266fb85f314e8852937 (diff)
downloadfastd-342d63a45a8918e45ddcf6a0b82b2f593f4bde12.tar
fastd-342d63a45a8918e45ddcf6a0b82b2f593f4bde12.zip
Limit key validity
Diffstat (limited to 'src/fastd.h')
-rw-r--r--src/fastd.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/fastd.h b/src/fastd.h
index 4db53e4..cceaaf3 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -92,6 +92,7 @@ struct _fastd_config {
fastd_protocol *protocol;
char *secret;
+ unsigned rekey;
fastd_peer_config *peers;
@@ -198,6 +199,11 @@ static inline size_t fastd_max_packet_size(const fastd_context *ctx) {
}
}
+static inline bool timespec_after(const struct timespec *tp1, const struct timespec *tp2) {
+ return (tp1->tv_sec > tp2->tv_sec ||
+ (tp1->tv_sec == tp2->tv_sec && tp1->tv_nsec > tp2->tv_nsec));
+}
+
/* returns (tp1 - tp2) in milliseconds */
static inline int timespec_diff(const struct timespec *tp1, const struct timespec *tp2) {
return ((tp1->tv_sec - tp2->tv_sec))*1000 + (tp1->tv_nsec - tp2->tv_nsec)/1e6;