1
0
mirror of synced 2024-11-22 13:06:02 +03:00

Fix IP parsing

- Fix parsing private IP on some systems such as Ubuntu 18.04
This commit is contained in:
hwdsl2 2018-06-03 23:24:37 -05:00
parent 3c84f8e2ab
commit f838fcfe12
2 changed files with 2 additions and 2 deletions

View File

@ -287,7 +287,7 @@ conn xauth-psk
EOF
if ip -4 route list 0/0 2>/dev/null | grep -qs ' src '; then
PRIVATE_IP=$(ip -4 route get 1 | awk '{print $NF;exit}')
PRIVATE_IP=$(ip -4 route get 1 | sed 's/ uid .*//' | awk '{print $NF;exit}')
check_ip "$PRIVATE_IP" && sed -i "s/left=%defaultroute/left=$PRIVATE_IP/" /etc/ipsec.conf
fi

View File

@ -272,7 +272,7 @@ conn xauth-psk
EOF
if ip -4 route list 0/0 2>/dev/null | grep -qs ' src '; then
PRIVATE_IP=$(ip -4 route get 1 | awk '{print $NF;exit}')
PRIVATE_IP=$(ip -4 route get 1 | sed 's/ uid .*//' | awk '{print $NF;exit}')
check_ip "$PRIVATE_IP" && sed -i "s/left=%defaultroute/left=$PRIVATE_IP/" /etc/ipsec.conf
fi