ianharrier / synology-scripts

Scripts for Synology DSM
MIT License
112 stars 34 forks source link

issue after updating to Synology DSM 7.1 #16

Closed Taasadi closed 2 years ago

Taasadi commented 2 years ago

After updating to Synology DSM 7.1 I had an issue with the script and did some debugging by running the script and individual lines manually using SSH and found that the below line is the issue, the script is unable to get the tunnel interface due to position change which caused the awk to return a blank value, so I changed the print $7 to $5 and the fixed the issue and command return tun0

Ex: for the $CLIENT_IP inet 10.33.33.33/24 scope global tun0

issue return blank:local TUNNEL_INTERFACE=$(ip addr | grep $CLIENT_IP | awk '{ print $7 }')

Fix return tun0:local TUNNEL_INTERFACE=$(ip addr | grep $CLIENT_IP | awk '{ print $5 }')

beornlake commented 2 years ago

Confirmed. Just updated my test system to DSM 7.1-42661 today and behavior is the same that you found. I'll see if I can put together a patch that modifies behavior based on DSM version.

DSM Version VPN Type ip addr command output
6.2–7.0.1 OpenVPN inet 10.20.43.2/24 brd 10.20.43.255 scope global tun0
7.1 OpenVPN inet 10.20.43.2/24 scope global tun0
7.1 L2TP/IPSec inet 192.168.10.240 peer 192.168.10.254/32 scope global ppp300

Update: After some quick testing it looks like only the OpenVPN tunnel output drops down to 5 fields; my L2TP/IPSec connection remained at 7. I don't have a PPTP connection to test (and I've actually removed PPTP from my version of the script anyway). As far as I can tell, for these Synology VPN connections, the tunnel interface is always the last item in the line. If that's the case, we can easily just replace $5/$7 with $NF (awk's shorthand for "number of fields") to just get whatever the final element is.

melbnz commented 2 years ago

confirmed working 'fix' with openvpn - thanks @Taasadi

ianharrier commented 2 years ago

This is resolved in version 1.3.1. Thanks for reporting!