Skip to content
Permalink
Browse files

tests: discover the network interface dynamically

- use the ip command to discover the network adapter address
  for source-address-test
  • Loading branch information...
franku committed Aug 12, 2019
1 parent 7e902c9 commit 04d5916688329e9310f5e599f23a4dc5178f464a
Showing with 2 additions and 2 deletions.
  1. +2 −2 regress/tests/source-addr-test
@@ -55,8 +55,8 @@ if [ $os = 'FreeBSD' ]; then
INTERFACE=xn0
IP=`ifconfig ${INTERFACE} | perl -ne '/inet (.+?) / && print $1'`
elif [ $os = 'Linux' ]; then
INTERFACE=eth0
IP=`ifconfig ${INTERFACE} | perl -ne '/inet addr:(.+?) / && print $1'`
INTERFACE=$(ip addr show | awk '/inet.*brd/{print $NF; exit}')
IP=$(ip addr show | awk '/inet.*brd/{print $2; exit}' | sed 's,\(\w\+\)/.*,\1,')
fi

if [ "$IP" = '' ]; then

0 comments on commit 04d5916

Please sign in to comment.
You can’t perform that action at this time.