summaryrefslogtreecommitdiffstats
path: root/src/peer.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-03-31 19:38:18 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-03-31 19:38:18 +0200
commitee8b2de4b795fbc3b292e14c9f088244a7e08690 (patch)
tree561cfa9b830d315e4307d8c1aeceb1c475e192da /src/peer.c
parent0c82651c30bf543903ca05df4e5b179201353ee1 (diff)
downloadfastd-ee8b2de4b795fbc3b292e14c9f088244a7e08690.tar
fastd-ee8b2de4b795fbc3b292e14c9f088244a7e08690.zip
ecfxp: refresh session key periodically
Diffstat (limited to 'src/peer.c')
-rw-r--r--src/peer.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/peer.c b/src/peer.c
index 653a62f..7fe8c0e 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -153,6 +153,8 @@ fastd_peer* fastd_peer_set_established_merge(fastd_context *ctx, fastd_peer *per
ctx->conf->protocol->free_peer_state(ctx, perm_peer);
+ fastd_task_delete_peer_handshakes(ctx, perm_peer);
+
perm_peer->address = temp_peer->address;
perm_peer->state = STATE_ESTABLISHED;
perm_peer->seen = temp_peer->seen;
@@ -174,24 +176,6 @@ fastd_peer* fastd_peer_set_established_merge(fastd_context *ctx, fastd_peer *per
return perm_peer;
}
-const fastd_eth_addr* fastd_get_source_address(const fastd_context *ctx, fastd_buffer buffer) {
- switch (ctx->conf->mode) {
- case MODE_TAP:
- return (fastd_eth_addr*)&((struct ethhdr*)buffer.data)->h_source;
- default:
- exit_bug(ctx, "invalid mode");
- }
-}
-
-const fastd_eth_addr* fastd_get_dest_address(const fastd_context *ctx, fastd_buffer buffer) {
- switch (ctx->conf->mode) {
- case MODE_TAP:
- return (fastd_eth_addr*)&((struct ethhdr*)buffer.data)->h_dest;
- default:
- exit_bug(ctx, "invalid mode");
- }
-}
-
void fastd_peer_set_established(fastd_context *ctx, fastd_peer *peer) {
fastd_task_delete_peer_handshakes(ctx, peer);
@@ -209,6 +193,23 @@ void fastd_peer_set_established(fastd_context *ctx, fastd_peer *peer) {
}
}
+const fastd_eth_addr* fastd_get_source_address(const fastd_context *ctx, fastd_buffer buffer) {
+ switch (ctx->conf->mode) {
+ case MODE_TAP:
+ return (fastd_eth_addr*)&((struct ethhdr*)buffer.data)->h_source;
+ default:
+ exit_bug(ctx, "invalid mode");
+ }
+}
+
+const fastd_eth_addr* fastd_get_dest_address(const fastd_context *ctx, fastd_buffer buffer) {
+ switch (ctx->conf->mode) {
+ case MODE_TAP:
+ return (fastd_eth_addr*)&((struct ethhdr*)buffer.data)->h_dest;
+ default:
+ exit_bug(ctx, "invalid mode");
+ }
+}
static inline int fastd_eth_addr_cmp(const fastd_eth_addr *addr1, const fastd_eth_addr *addr2) {
return memcmp(addr1->data, addr2->data, ETH_ALEN);