Fix IP parsing
- Fix parsing private IP on some systems such as Ubuntu 18.04
This commit is contained in:
parent
3c84f8e2ab
commit
f838fcfe12
@ -287,7 +287,7 @@ conn xauth-psk
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
if ip -4 route list 0/0 2>/dev/null | grep -qs ' src '; then
|
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
|
check_ip "$PRIVATE_IP" && sed -i "s/left=%defaultroute/left=$PRIVATE_IP/" /etc/ipsec.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ conn xauth-psk
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
if ip -4 route list 0/0 2>/dev/null | grep -qs ' src '; then
|
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
|
check_ip "$PRIVATE_IP" && sed -i "s/left=%defaultroute/left=$PRIVATE_IP/" /etc/ipsec.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user