aboutsummaryrefslogtreecommitdiffstats
path: root/src/wireguard.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wireguard.h')
-rw-r--r--src/wireguard.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/wireguard.h b/src/wireguard.h
index ecd26e2..332cb28 100644
--- a/src/wireguard.h
+++ b/src/wireguard.h
@@ -91,7 +91,8 @@ enum wg_state {
WG_STATE_NEW = 0,
WG_STATE_MADE_INITIATION,
WG_STATE_RECV_INITIATION,
- WG_STATE_WAIT_CONFIRM,
+ WG_STATE_MADE_RESPONSE,
+ WG_STATE_RECV_RESPONSE,
WG_STATE_INITIATOR,
WG_STATE_RESPONDER,
};
@@ -141,7 +142,6 @@ struct wg_timers {
struct timeout t_broken;
struct timeout t_reinit;
struct timeout t_cleanup;
- struct timespec t_last_handshake;
uint16_t t_pka_interval;
};
@@ -150,7 +150,6 @@ struct wg_session {
uint32_t s_remote_id; /* Static */
struct wg_peer *s_peer; /* Static */
struct timespec s_created;
- SLIST_ENTRY(wg_session) s_entry; /* Protected by p_lock */
/* All protected by s_lock */
struct rwlock s_lock;
@@ -185,18 +184,19 @@ struct wg_peer {
struct rwlock p_lock;
struct wg_cookie p_cookie;
struct wg_timers p_timers;
- struct timespec p_last_handshake;
struct timespec p_last_initiation;
uint64_t p_tx_bytes;
uint64_t p_rx_bytes;
struct wg_privkey p_shared;
uint8_t p_attempts;
- SLIST_HEAD(,wg_session) p_sessions;
+ struct wg_session *p_hs_session;
+ struct wg_session *p_ks_session;
+ struct wg_session *p_ks_session_old;
struct wg_timestamp { uint8_t t[WG_TIMESTAMP_SIZE]; } p_timestamp;
};
struct wg_device {
- void (*d_outq)(struct wg_peer *, enum wg_pkt_type);
+ void (*d_outq)(struct wg_peer *, enum wg_pkt_type, uint32_t);
struct fixed_map d_peers;
struct fixed_map d_sessions;
struct rwlock d_lock;
@@ -216,7 +216,6 @@ enum wg_error {
WG_REPLAY,
WG_REJECT,
WG_INVALID_PKT,
- WG_REKEY,
WG_STATE,
WG_MAC,
WG_ID,
@@ -243,7 +242,7 @@ static char *wg_error_str[] = {
/* WireGuard functions */
void wg_device_init(struct wg_device *,
- void (*)(struct wg_peer *, enum wg_pkt_type));
+ void (*)(struct wg_peer *, enum wg_pkt_type, uint32_t));
void wg_device_setkey(struct wg_device *, struct wg_privkey *);
struct wg_peer *wg_device_new_peer(struct wg_device *, struct wg_pubkey *, void *);
struct wg_peer *wg_device_ref_peerkey(struct wg_device *, struct wg_pubkey *);
@@ -257,13 +256,12 @@ void wg_peer_setshared(struct wg_peer *, struct wg_privkey *);
void wg_peer_getshared(struct wg_peer *, struct wg_privkey *);
void wg_peer_clean(struct wg_peer *);
struct timespec wg_peer_last_handshake(struct wg_peer *);
-enum wg_error wg_peer_has_transport_session(struct wg_peer *);
+struct wg_session *wg_peer_hs_session(struct wg_peer *);
+struct wg_session *wg_peer_ks_session(struct wg_peer *);
struct wg_session *wg_device_new_session(struct wg_device *);
struct wg_session *wg_device_ref_session(struct wg_device *, uint32_t);
-void wg_session_ref(struct wg_session *);
void wg_session_put(struct wg_session *);
-void wg_session_drop(struct wg_session *);
enum wg_error wg_device_rx_initiation(struct wg_device *,
struct wg_msg_initiation *, struct wg_session **);