From 444308d6a5e3cefe1804cddeafae387899a81eae Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Thu, 20 Jul 2023 20:50:42 +0200 Subject: [PATCH] Make wireguard mtu configurable --- vpn/wireguard/defaults/main.yml | 3 +++ vpn/wireguard/meta/argument_specs.yml | 3 +++ vpn/wireguard/templates/IFACE | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 vpn/wireguard/defaults/main.yml diff --git a/vpn/wireguard/defaults/main.yml b/vpn/wireguard/defaults/main.yml new file mode 100644 index 0000000..696603f --- /dev/null +++ b/vpn/wireguard/defaults/main.yml @@ -0,0 +1,3 @@ +--- +vpn_wireguard_iface: "wg0" +vpn_wireguard_mtu: 1420 diff --git a/vpn/wireguard/meta/argument_specs.yml b/vpn/wireguard/meta/argument_specs.yml index e4f919a..b821dd1 100644 --- a/vpn/wireguard/meta/argument_specs.yml +++ b/vpn/wireguard/meta/argument_specs.yml @@ -9,6 +9,9 @@ argument_specs: vpn_wireguard_iface: type: "str" required: true + vpn_wireguard_mtu: + type: "int" + required: true vpn_wireguard_role: type: "str" required: true diff --git a/vpn/wireguard/templates/IFACE b/vpn/wireguard/templates/IFACE index 9d41c96..8a9a75f 100644 --- a/vpn/wireguard/templates/IFACE +++ b/vpn/wireguard/templates/IFACE @@ -2,7 +2,7 @@ auto {{ vpn_wireguard_iface }} iface {{ vpn_wireguard_iface }} inet static pre-up /usr/local/sbin/ip-link-add.sh $IFACE type wireguard pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf - pre-up ip link set mtu 1420 dev $IFACE + pre-up ip link set mtu {{ vpn_wireguard_mtu }} dev $IFACE post-up /usr/local/sbin/post-up-$IFACE-inet.nft post-up /usr/local/sbin/post-up-$IFACE-ipv4.nft