Skip to contentSkip to conversation

tcpdump01: specify interface for ping

PATCH In review Simon Xu 2 participants 3 messages Nov 11, 2013 – Nov 20, 2013

lore
Share & tools
lore

Simon Xu

author
#0 lore raw

PATCH 1/1 tcpdump01: specify interface for ping

Always specify interface for ping because it is possible that pings to RHOST can go through multiple interfaces. Also add -q to ping.

---
 testcases/network/tcp_cmds/tcpdump/tcpdump01 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/network/tcp_cmds/tcpdump/tcpdump01 +2 -2
index 6d6d399..6296ad2 100755
@@ -51,7 +51,7 @@ do_setup()
     # Find the first interface that can ping RHOST
     IF=""
     for i in $(netstat -i | tail -n+3 | sed '/^lo/d' | cut -f1 -d' '); do
-        ping -I $i -c 3 $RHOST && { IF="$i"; break; }
+        ping -I $i -c 3 -q $RHOST && { IF="$i"; break; }
     done
     test -z $IF && end_testcase "Could not find an interface that can ping remote host $RHOST"
     IFNAME=${IF}
@@ -62,7 +62,7 @@ do_setup()
 
 do_test()
 {
-    ping -f $RHOST > /dev/null 2>&1 &
+    ping -I $IFNAME -f $RHOST > /dev/null 2>&1 &
     if ! tcpdump -i $IFNAME -c $NUMLOOPS > $OUTFILE; then
         end_testcase "Problems trying to launch tcpdump"
     fi
Signature · 13 lines
1.8.4.2


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
author
#1 lore raw

Could anyone help to review?

Thanks
Simon

Quoted 22 lines · Simon Xu

Always specify interface for ping because it is possible that pings to RHOST can go through multiple interfaces. Also add -q to ping.

---
  testcases/network/tcp_cmds/tcpdump/tcpdump01 | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
testcases/network/tcp_cmds/tcpdump/tcpdump01 +1 -1
index 6d6d399..6296ad2 100755
@@ -51,7 +51,7 @@ do_setup()
      # Find the first interface that can ping RHOST
      IF=""
      for i in $(netstat -i | tail -n+3 | sed '/^lo/d' | cut -f1 -d' '); do
-        ping -I $i -c 3 $RHOST && { IF="$i"; break; }
+        ping -I $i -c 3 -q $RHOST && { IF="$i"; break; }
      done
      test -z $IF && end_testcase "Could not find an interface that can ping remote host $RHOST"
      IFNAME=${IF}

testcases/network/tcp_cmds/tcpdump/tcpdump01 do_setup() · line 68

Quoted 8 lines
testcases/network/tcp_cmds/tcpdump/tcpdump01 +1 -1
@@ -62,7 +62,7 @@ do_setup()
 
  do_test()
  {
-    ping -f $RHOST > /dev/null 2>&1 &
+    ping -I $IFNAME -f $RHOST > /dev/null 2>&1 &
      if ! tcpdump -i $IFNAME -c $NUMLOOPS > $OUTFILE; then
          end_testcase "Problems trying to launch tcpdump"
      fi

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free app hosting. Or install the open source package on any LAMP server. Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
In reply to Simon Xu

Hi!

Quoted 4 lines

Always specify interface for ping because it is possible that pings to RHOST can go through multiple interfaces. Also add -q to ping.

Pushed, thanks.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list