net/wireguard: add support for fwmark option
authordanrl <redacted>
Fri, 24 Feb 2017 14:07:50 +0000 (15:07 +0100)
committerdanrl <redacted>
Mon, 27 Feb 2017 19:44:33 +0000 (20:44 +0100)
Adds support for the fwmark option.

FwMark is a 32-bit fwmark for outgoing packets.
If set to 0 or "off", this option is disabled.

Signed-off-by: Dan Luedtke <redacted>
net/wireguard/Makefile
net/wireguard/files/wireguard.sh

index bee9ea5d136a864685fb882086e7ee952a4c9a8d..7802d7e71622d126a40d963cc0797b95d872c8c3 100644 (file)
@@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/kernel.mk
 PKG_NAME:=wireguard
 
 PKG_VERSION:=0.0.20170223
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/
index 2eb30242a664128a595c0b3d9bf5b7308715ce9e..638ddd922199c68727df3f6f86ac3c8864d842e1 100644 (file)
@@ -22,6 +22,7 @@ proto_wireguard_init_config() {
   proto_config_add_int    "listen_port"
   proto_config_add_int    "mtu"
   proto_config_add_string "preshared_key"
+  proto_config_add_string "fwmark"
   available=1
   no_proto_task=1
 }
@@ -103,6 +104,7 @@ proto_wireguard_setup() {
   config_get addresses     "${config}" "addresses"
   config_get mtu           "${config}" "mtu"
   config_get preshared_key "${config}" "preshared_key"
+  config_get fwmark        "${config}" "fwmark"
 
   # create interface
   ip link del dev "${config}" 2>/dev/null
@@ -125,6 +127,9 @@ proto_wireguard_setup() {
   if [ "${preshared_key}" ]; then
     echo "PresharedKey=${preshared_key}" >> "${wg_cfg}"
   fi
+  if [ "${fwmark}" ]; then
+    echo "FwMark=${fwmark}" >> "${wg_cfg}"
+  fi
   config_foreach proto_wireguard_setup_peer "wireguard_${config}"
 
   # apply configuration file
git clone https://git.99rst.org/PROJECT