Skip to content

Commit

Permalink
Update wg_manager.sh
Browse files Browse the repository at this point in the history
FIX: Initialisation message of 'server' Peer doesn't display both IPv4+IPv6 Dual stack IP address - Thanks SNB Forum member @ZebMcKayhan
	
		wireguard-server1: Initialising Wireguard VPN (IPv6) [fdff:a37f:fa75:1::1] 'Server' Peer (wg21) on 100.126.96.1:11501 (# RT-AC86U (IPv4/IPv6) Server 1)
		should be
		wireguard-server1: Initialising Wireguard VPN (IPv6) [fdff:a37f:fa75:1::1] 'Server' Peer (wg21) on 100.126.96.1,[fdff:a37f:fa75:100::101]:11501 (# RT-AC86U (IPv4/IPv6) Server 1)
		
CHANGE: Road-Warrior 'device' Peer always assumes 'server' Peer IP is assigned IPv4/IPv6 '.1' address; hence 1st 'device' peer should be assigned address '.2'
	
		'server' Peer assigned ipv6=fdff:a37f:fa75:100::101
		'device' Peer assigned ipv6=fdff:a37f:fa75:100::2
		
		The above works, but probably tidier if the 'server' Peer base IP is used for all Road-Warrior 'device' Peers
		e.g.
		
		'server' Peer assigned ipv6=fdff:a37f:fa75:100::101
		'device' Peer assigned ipv6=fdff:a37f:fa75:100::102	
		
CHANGE: When creating new 'server' Peer using command 'peer new ipv6=xxxx:xxxx:xxxx:xxxx::xxxx', allow user to specify ANY IPv6 prefix rather than enforce Private (fcxx:|fdxx:) IPv6 restriction
  • Loading branch information
MartineauUK committed Mar 10, 2022
1 parent 7d92058 commit ff74293
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions wg_manager.sh
@@ -1,6 +1,6 @@
#!/bin/sh
VERSION="v4.16b"
#============================================================================================ © 2021-2022 Martineau v4.16b
VERSION="v4.16b2"
#============================================================================================ © 2021-2022 Martineau v4.16b2
#
# wg_manager {start|stop|restart|show|create|peer} [ [client [policy|nopolicy] |server]} [wg_instance] ]
#
Expand All @@ -24,7 +24,7 @@ VERSION="v4.16b"
#

# Maintainer: Martineau
# Last Updated Date: 09-Mar-2022
# Last Updated Date: 10-Mar-2022

#
# Description:
Expand Down Expand Up @@ -861,7 +861,8 @@ Create_Peer() {
if [ -z "$(echo "$THIS" | grep -F ":")" ];then
[ -z "$(echo "$THIS" | Is_IPv4_CIDR)" ] && { echo -e $cBRED"\a\n\t***ERROR: '$THIS' must be IPv4 CIDR"$cRESET; return 1; } # v4.15
else
[ -z "$(echo "$THIS" | sed 's~/.*$~~' | Is_Private_IPv6)" ] && { echo -e $cBRED"\a\n\t***ERROR: '$THIS' must be Private IPv6 address"$cRESET; return 1; } # v4.15
#[ -z "$(echo "$THIS" | sed 's~/.*$~~' | Is_Private_IPv6)" ] && { echo -e $cBRED"\a\n\t***ERROR: '$THIS' must be Private IPv6 address"$cRESET; return 1; } # v4.15
: # v4.16
fi
done

Expand Down Expand Up @@ -6463,7 +6464,7 @@ Create_RoadWarrior_Device() {
#if [ -z "$VPN_POOL_IP" ];then
if [ -n "$VPN_POOL" ];then
local VPN_POOL_SUBNET=${VPN_POOL%.*}
local IP=2 # v4.11
local IP=$((${VPN_POOL##*.}+1)) # v4.16 Use the 'server' (BASE IP)+1 rather than assume '.2' @ZebMcKayhan

while true
do
Expand Down Expand Up @@ -6499,7 +6500,7 @@ Create_RoadWarrior_Device() {
local VPN_POOL_PREFIX_EXPANDED=${VPN_IP_EXPANDED%:*} # v4.15
local VPN_POOL_PREFIX_COMPRESSED=$(Compress_IPv6 "${VPN_POOL_PREFIX_EXPANDED}")

local IP=2
IP=$((${VPN_POOL_IP##*:}+1)) # v4.16 Use the 'server' (BASE IP)+1 rather than assume '.2' @ZebMcKayhan

while true
do
Expand Down

0 comments on commit ff74293

Please sign in to comment.