Skip to content

Commit 09e22d3

Browse files
committed
Fix detection of default interface
1 parent bd29302 commit 09e22d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

slib.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ setconfig () {
443443
# Detect the primary IP address
444444
# works across most Linux and FreeBSD (maybe)
445445
detect_ip () {
446-
defaultdev=$(ip ro ls|grep default|head -1|awk '{print $5}')
446+
defaultdev=$(ip ro ls|grep default|head -1|sed -e 's/.*\sdev\s//g'|awk '{print $1}')
447447
primaryaddr=$(ip -f inet addr show dev "$defaultdev" | grep 'inet ' | awk '{print $2}' | head -1 | cut -d"/" -f1 | cut -f1)
448448
if [ "$primaryaddr" ]; then
449449
log_debug "Primary address detected as $primaryaddr"

0 commit comments

Comments
 (0)