Skip to content

Commit

Permalink
Limit Number of default routes returned to 1 (hwdsl2#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
abuango authored and hwdsl2 committed Mar 9, 2019
1 parent 0679c66 commit 323e7cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vpnsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if [ "$(id -u)" != 0 ]; then
exiterr "Script must be run as root. Try 'sudo sh $0'"
fi

def_iface=$(route 2>/dev/null | grep '^default' | grep -o '[^ ]*$')
def_iface=$(route 2>/dev/null | grep -m 1 '^default' | grep -o '[^ ]*$')
[ -z "$def_iface" ] && def_iface=$(ip -4 route list 0/0 2>/dev/null | grep -Po '(?<=dev )(\S+)')
def_state=$(cat "/sys/class/net/$def_iface/operstate" 2>/dev/null)
if [ -n "$def_state" ] && [ "$def_state" != "down" ]; then
Expand Down

0 comments on commit 323e7cf

Please sign in to comment.