From 25a24084dac68e9a7788a30e581d4ca3db54ed5e Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 27 Mar 2019 01:33:44 +0100 Subject: Wireguard: Set up wireguard device Add private key and listen port items. --- proto/wireguard/config.Y | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'proto/wireguard/config.Y') diff --git a/proto/wireguard/config.Y b/proto/wireguard/config.Y index 9a414085..ff57c9bc 100644 --- a/proto/wireguard/config.Y +++ b/proto/wireguard/config.Y @@ -16,7 +16,7 @@ CF_DEFINES CF_DECLS -CF_KEYWORDS(WIREGUARD, PUBKEY, ENDPOINT, ALLOWED_IPS) +CF_KEYWORDS(WIREGUARD, PRIVATE_KEY, LISTEN_PORT, PUBLIC_KEY, ENDPOINT, ALLOWED_IP) CF_GRAMMAR @@ -32,6 +32,8 @@ wireguard_proto: | wireguard_proto wg_proto_channel ';' | wireguard_proto proto_item ';' | wireguard_proto INTERFACE TEXT ';' { WG_CFG->ifname = $3; } + | wireguard_proto PRIVATE_KEY private_key ';' + | wireguard_proto LISTEN_PORT listen_port ';' | wireguard_proto wg_peer ';' ; @@ -43,10 +45,10 @@ wg_peer_end: ; wg_peer_item: - PUBKEY pubkey + PUBLIC_KEY public_key | ENDPOINT endpoint | PORT port - | ALLOWED_IPS allowed_ips + | ALLOWED_IP allowedip ; wg_peer_opts: @@ -59,14 +61,18 @@ wg_peer_opt_list: | '{' wg_peer_opts '}' ; -pubkey: text { WG_CFG->peer.pubkey = $1; } +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; } endpoint: ipa { WG_CFG->peer.endpoint = $1; } port: expr { WG_CFG->peer.remote_port = $1; } -allowed_ips: - net_or_ipa { WG_CFG->peer.allowed_ips = $1; } +allowedip: + net_or_ipa { WG_CFG->peer.allowedip = $1; } ; wg_proto_channel: wg_channel_start channel_opt_list wg_channel_end; -- cgit v1.2.3