diff --git a/net/wireguard/Makefile b/net/wireguard/Makefile index 85ab3c4f9..8dacfebc0 100644 --- a/net/wireguard/Makefile +++ b/net/wireguard/Makefile @@ -1,6 +1,7 @@ # # Copyright (C) 2016 Jason A. Donenfeld # Copyright (C) 2016 Baptiste Jonglez +# Copyright (C) 2016-2017 Dan Luedtke # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -10,20 +11,19 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=wireguard -PKG_VERSION:=0.0.20170105 +PKG_VERSION:=0.0.20170115 PKG_RELEASE:=1 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_BUILD_DIR:=$(BUILD_DIR)/WireGuard-$(PKG_VERSION) +PKG_MD5SUM:=7e5f9f4699a2d4ace90d0df5d81bf0f67205ee08c45b95e0acc379bedef5ffe8 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING -PKG_USE_MIPS16:=0 +PKG_BUILD_DIR:=$(BUILD_DIR)/WireGuard-$(PKG_VERSION) PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 # Wireguard's makefile needs this to know where to build the kernel module export KERNELDIR:=$(LINUX_DIR) diff --git a/net/wireguard/files/wireguard.sh b/net/wireguard/files/wireguard.sh index 1235f23a2..2eb30242a 100644 --- a/net/wireguard/files/wireguard.sh +++ b/net/wireguard/files/wireguard.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2016 Dan Luedtke +# Copyright 2016-2017 Dan Luedtke # Licensed to the public under the Apache License 2.0. @@ -100,6 +100,7 @@ proto_wireguard_setup() { config_load network config_get private_key "${config}" "private_key" config_get listen_port "${config}" "listen_port" + config_get addresses "${config}" "addresses" config_get mtu "${config}" "mtu" config_get preshared_key "${config}" "preshared_key" @@ -140,11 +141,31 @@ proto_wireguard_setup() { exit 1 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 - 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 - echo "adding host depedency for ${ip} at ${config}" - proto_add_host_dependency "${config}" "${ip}" + echo "adding host depedency for ${address} at ${config}" + proto_add_host_dependency "${config}" "${address}" done proto_send_update "${config}"