aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToke Høiland-Jørgensen <toke@toke.dk>2018-05-13 20:15:50 +0200
committerYousong Zhou <yszhou4tech@gmail.com>2018-05-25 09:30:42 +0800
commit6cc65b05f311ee108f244991f8020365c64520c8 (patch)
tree742722e0318d06ad35a4e63450f2251ae225029f
parent0e3cc084968fc052c3826fe9ccc320c1347bc8ab (diff)
downloadupstream-6cc65b05f311ee108f244991f8020365c64520c8.tar.gz
upstream-6cc65b05f311ee108f244991f8020365c64520c8.tar.bz2
upstream-6cc65b05f311ee108f244991f8020365c64520c8.zip
wireguard: Add support for ip6prefix config option
This makes it easier to distribute prefixes over a wireguard tunnel interface, by simply setting the ip6prefix option in uci (just like with other protocols). Obviously, routing etc needs to be setup properly for things to work; this just adds the config option so the prefix can be assigned to other interfaces. Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
-rw-r--r--package/network/services/wireguard/files/wireguard.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/package/network/services/wireguard/files/wireguard.sh b/package/network/services/wireguard/files/wireguard.sh
index 7b18a2e0ec..96fa7215ff 100644
--- a/package/network/services/wireguard/files/wireguard.sh
+++ b/package/network/services/wireguard/files/wireguard.sh
@@ -113,6 +113,7 @@ proto_wireguard_setup() {
config_get addresses "${config}" "addresses"
config_get mtu "${config}" "mtu"
config_get fwmark "${config}" "fwmark"
+ config_get ip6prefix "${config}" "ip6prefix"
# create interface
ip link del dev "${config}" 2>/dev/null
@@ -169,6 +170,11 @@ proto_wireguard_setup() {
esac
done
+ # support ip6 prefixes
+ for prefix in ${ip6prefix}; do
+ proto_add_ipv6_prefix "$prefix"
+ done
+
# endpoint dependency
wg show "${config}" endpoints | \
sed -E 's/\[?([0-9.:a-f]+)\]?:([0-9]+)/\1 \2/' | \