Skip to content

Commit

Permalink
tests: discover the network interface dynamically
Browse files Browse the repository at this point in the history
- use the ip command to discover the network adapter address
  for source-address-test
  • Loading branch information
franku committed Aug 13, 2019
1 parent 7e902c9 commit 04d5916
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions regress/tests/source-addr-test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 04d5916

Please sign in to comment.