diff options
Diffstat (limited to 'proto/wireguard/config.Y')
-rw-r--r-- | proto/wireguard/config.Y | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/proto/wireguard/config.Y b/proto/wireguard/config.Y index ff57c9bc..dceebb67 100644 --- a/proto/wireguard/config.Y +++ b/proto/wireguard/config.Y @@ -14,6 +14,8 @@ CF_DEFINES #define WG_CFG ((struct wg_config *) this_proto) +static struct peer_config *this_peer = NULL; + CF_DECLS CF_KEYWORDS(WIREGUARD, PRIVATE_KEY, LISTEN_PORT, PUBLIC_KEY, ENDPOINT, ALLOWED_IP) @@ -24,6 +26,7 @@ proto: wireguard_proto '}' ; wireguard_proto_start: proto_start WIREGUARD { this_proto = proto_config_new(&proto_wireguard, $1); + init_list(&WG_CFG->peers); } ; @@ -39,9 +42,11 @@ wireguard_proto: wg_peer: wg_peer_start wg_peer_opt_list wg_peer_end; -wg_peer_start: PEER +wg_peer_start: PEER { this_peer = peer_new(WG_CFG); } -wg_peer_end: +wg_peer_end: { + this_peer = NULL; +} ; wg_peer_item: @@ -65,14 +70,14 @@ private_key: text { WG_CFG->private_key = $1; } listen_port: expr { WG_CFG->listen_port = $1; } -public_key: text { WG_CFG->peer.public_key = $1; } +public_key: text { this_peer->public_key = $1; } -endpoint: ipa { WG_CFG->peer.endpoint = $1; } +endpoint: ipa { this_peer->endpoint = $1; } -port: expr { WG_CFG->peer.remote_port = $1; } +port: expr { this_peer->remote_port = $1; } allowedip: - net_or_ipa { WG_CFG->peer.allowedip = $1; } + net_or_ipa { this_peer->allowedip = $1; } ; wg_proto_channel: wg_channel_start channel_opt_list wg_channel_end; |