wireguard: new version and usability improvements
Signed-off-by: Dan Luedtke <mail@danrl.com>
This commit is contained in:
parent
b75248b45b
commit
e0c2f5bdc8
2 changed files with 30 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 2016 Jason A. Donenfeld <Jason@zx2c4.com>
|
# Copyright (C) 2016 Jason A. Donenfeld <Jason@zx2c4.com>
|
||||||
# Copyright (C) 2016 Baptiste Jonglez <openwrt@bitsofnetworks.org>
|
# Copyright (C) 2016 Baptiste Jonglez <openwrt@bitsofnetworks.org>
|
||||||
|
# Copyright (C) 2016-2017 Dan Luedtke <mail@danrl.com>
|
||||||
#
|
#
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
|
@ -10,20 +11,19 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||||
|
|
||||||
PKG_NAME:=wireguard
|
PKG_NAME:=wireguard
|
||||||
|
|
||||||
PKG_VERSION:=0.0.20170105
|
PKG_VERSION:=0.0.20170115
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz
|
PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz
|
||||||
# This is actually SHA256, but OpenWRT/LEDE will figure it out based on the length
|
|
||||||
PKG_MD5SUM:=1bd990eeae6fbf599ccddde81caa92770f58623ad9705f875bcfab8254583896
|
|
||||||
PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/
|
PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/WireGuard-$(PKG_VERSION)
|
PKG_MD5SUM:=7e5f9f4699a2d4ace90d0df5d81bf0f67205ee08c45b95e0acc379bedef5ffe8
|
||||||
|
|
||||||
PKG_LICENSE:=GPL-2.0
|
PKG_LICENSE:=GPL-2.0
|
||||||
PKG_LICENSE_FILES:=COPYING
|
PKG_LICENSE_FILES:=COPYING
|
||||||
|
|
||||||
PKG_USE_MIPS16:=0
|
PKG_BUILD_DIR:=$(BUILD_DIR)/WireGuard-$(PKG_VERSION)
|
||||||
PKG_BUILD_PARALLEL:=1
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
PKG_USE_MIPS16:=0
|
||||||
|
|
||||||
# Wireguard's makefile needs this to know where to build the kernel module
|
# Wireguard's makefile needs this to know where to build the kernel module
|
||||||
export KERNELDIR:=$(LINUX_DIR)
|
export KERNELDIR:=$(LINUX_DIR)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright 2016 Dan Luedtke <mail@danrl.com>
|
# Copyright 2016-2017 Dan Luedtke <mail@danrl.com>
|
||||||
# Licensed to the public under the Apache License 2.0.
|
# Licensed to the public under the Apache License 2.0.
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,6 +100,7 @@ proto_wireguard_setup() {
|
||||||
config_load network
|
config_load network
|
||||||
config_get private_key "${config}" "private_key"
|
config_get private_key "${config}" "private_key"
|
||||||
config_get listen_port "${config}" "listen_port"
|
config_get listen_port "${config}" "listen_port"
|
||||||
|
config_get addresses "${config}" "addresses"
|
||||||
config_get mtu "${config}" "mtu"
|
config_get mtu "${config}" "mtu"
|
||||||
config_get preshared_key "${config}" "preshared_key"
|
config_get preshared_key "${config}" "preshared_key"
|
||||||
|
|
||||||
|
@ -140,11 +141,31 @@ proto_wireguard_setup() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# add ip addresses
|
||||||
|
for address in ${addresses}; do
|
||||||
|
case "${address}" in
|
||||||
|
*:*/*)
|
||||||
|
proto_add_ipv6_address "${address%%/*}" "${address##*/}"
|
||||||
|
;;
|
||||||
|
*.*/*)
|
||||||
|
proto_add_ipv4_address "${address%%/*}" "${address##*/}"
|
||||||
|
;;
|
||||||
|
*:*)
|
||||||
|
proto_add_ipv6_address "${address%%/*}" "128"
|
||||||
|
;;
|
||||||
|
*.*)
|
||||||
|
proto_add_ipv4_address "${address%%/*}" "32"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# endpoint dependency
|
# endpoint dependency
|
||||||
wg show "${config}" endpoints | while IFS=$'\t:' read -r key ip port; do
|
wg show "${config}" endpoints | \
|
||||||
|
sed -E 's/\[?([0-9.:a-f]+)\]?:([0-9]+)/\1 \2/' | \
|
||||||
|
while IFS=$'\t ' read -r key address port; do
|
||||||
[ -n "${port}" ] || continue
|
[ -n "${port}" ] || continue
|
||||||
echo "adding host depedency for ${ip} at ${config}"
|
echo "adding host depedency for ${address} at ${config}"
|
||||||
proto_add_host_dependency "${config}" "${ip}"
|
proto_add_host_dependency "${config}" "${address}"
|
||||||
done
|
done
|
||||||
|
|
||||||
proto_send_update "${config}"
|
proto_send_update "${config}"
|
||||||
|
|
Loading…
Reference in a new issue