diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2019-04-02 15:34:46 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2019-04-02 15:34:46 +0200 |
commit | b12562d5c325c43eb193679bf072fd86da6ce021 (patch) | |
tree | 20bc804f7d6be527e6185dd5241044aa628f09fa | |
parent | db024d47ac6222164ded89bc8d7d7d5407e3ef39 (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 16dad4ff..35b69c54 100644 --- a/proto/wireguard/wireguard.c +++ b/proto/wireguard/wireguard.c @@ -987,14 +987,67 @@ struct peer_config *peer_new(struct wg_config *c) return pc; } + +static void +wg_channel_init(struct channel *CH, struct channel_config *CHC) +{ + struct wg_channel *ch = (struct wg_channel*)CH; + 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) +{ + /* 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 = (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 = (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 = (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 = { |