summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2019-04-02 15:34:46 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2020-05-08 18:52:55 +0200
commitb1c4a1954eb715aa657b0aa357ae9dffe2475b0b (patch)
treeb3a8cebb77606f751d856e5130196e10510af053 /proto
parentb0b652abbb3b1e136219324afd6ff666da366d9f (diff)
Wireguard: Add channel hooks
Diffstat (limited to 'proto')
-rw-r--r--proto/wireguard/wireguard.c63
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 = {