diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2019-04-02 15:34:46 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-01-12 23:34:17 +0100 |
commit | ec5503271d694f4555ff963db452143e3a510ba5 (patch) | |
tree | 848c89f29fd8c3067d9616c2b72730b15edd1a93 | |
parent | 96d40ff314340d50c0bc142b4b2140e52ef58b29 (diff) |
Wireguard: Add channel hooks
-rw-r--r-- | proto/wireguard/wireguard.c | 63 |
1 files changed, 58 insertions, 5 deletions
diff --git a/proto/wireguard/wireguard.c b/proto/wireguard/wireguard.c index 20a42b5a..bdc76590 100644 --- a/proto/wireguard/wireguard.c +++ b/proto/wireguard/wireguard.c @@ -986,14 +986,67 @@ struct peer_config *peer_new(struct wg_config *c) return pc; } + +static void +wg_channel_init(struct channel *CH, struct channel_config *CHC UNUSED) +{ + struct proto *P = CH->proto; + + /* Create new instance */ + log(L_TRACE "WG: wg_channel_init"); +} + +static int +wg_channel_reconfigure(struct channel *CH, struct channel_config *CHC UNUSED, + int *import_changed UNUSED, int *export_changed UNUSED) +{ + /* Try to reconfigure instance, returns success */ + log(L_TRACE "WG: wg_channel_reconfigure"); + return 1; +} + +static int +wg_channel_start(struct channel *CH) +{ + struct wg_channel *ch UNUSED = (struct wg_channel*)CH; + struct proto *P = CH->proto; + + /* Start the instance */ + log(L_TRACE "WG: wg_channel_start"); +#if 0 + fib_init(&ch->rtable, P->pool, ch->c.net_type, sizeof(struct wg_entry), + OFFSETOF(struct wg_entry, n), 0, wg_init_entry); +#endif + return 1; +} + +static void +wg_channel_shutdown(struct channel *CH) +{ + struct wg_channel *ch UNUSED = (struct wg_channel*)CH; + + /* Stop the instance */ + log(L_TRACE "WG: wg_channel_shutdown"); +} + +static void +wg_channel_cleanup(struct channel *CH) +{ + struct wg_channel *ch UNUSED = (struct wg_channel*)CH; + + /* Channel finished flush */ + log(L_TRACE "WG: wg_channel_cleanup"); +} + + struct channel_class channel_wg = { .channel_size = sizeof(struct wg_channel), .config_size = sizeof(struct wg_channel_config), - /* .init = wg_channel_init, */ - /* .start = wg_channel_start, */ - /* .shutdown = wg_channel_shutdown, */ - /* .cleanup = wg_channel_cleanup, */ - /* .reconfigure = wg_channel_reconfigure, */ + .init = wg_channel_init, + .start = wg_channel_start, + .shutdown = wg_channel_shutdown, + .cleanup = wg_channel_cleanup, + .reconfigure = wg_channel_reconfigure, }; struct protocol proto_wireguard = { |