summaryrefslogtreecommitdiff
path: root/proto/wireguard/config.Y
diff options
context:
space:
mode:
Diffstat (limited to 'proto/wireguard/config.Y')
-rw-r--r--proto/wireguard/config.Y8
1 files changed, 7 insertions, 1 deletions
diff --git a/proto/wireguard/config.Y b/proto/wireguard/config.Y
index dceebb67..6d3b1ef6 100644
--- a/proto/wireguard/config.Y
+++ b/proto/wireguard/config.Y
@@ -12,13 +12,15 @@ CF_HDR
CF_DEFINES
+#define WG_DEFAULT_TUNNEL_TYPE 51820
+
#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)
+CF_KEYWORDS(WIREGUARD, TUNNEL_TYPE, PRIVATE_KEY, LISTEN_PORT, PUBLIC_KEY, ENDPOINT, ALLOWED_IP)
CF_GRAMMAR
@@ -27,6 +29,7 @@ proto: wireguard_proto '}' ;
wireguard_proto_start: proto_start WIREGUARD {
this_proto = proto_config_new(&proto_wireguard, $1);
init_list(&WG_CFG->peers);
+ WG_CFG->tunnel_type = WG_DEFAULT_TUNNEL_TYPE;
}
;
@@ -34,6 +37,7 @@ wireguard_proto:
wireguard_proto_start proto_name '{'
| wireguard_proto wg_proto_channel ';'
| wireguard_proto proto_item ';'
+ | wireguard_proto TUNNEL_TYPE tunnel_type ';'
| wireguard_proto INTERFACE TEXT ';' { WG_CFG->ifname = $3; }
| wireguard_proto PRIVATE_KEY private_key ';'
| wireguard_proto LISTEN_PORT listen_port ';'
@@ -66,6 +70,8 @@ wg_peer_opt_list:
| '{' wg_peer_opts '}'
;
+tunnel_type: expr { WG_CFG->tunnel_type = $1; }
+
private_key: text { WG_CFG->private_key = $1; }
listen_port: expr { WG_CFG->listen_port = $1; }