Re: How To Temporarily Suspend Network Traffic

2011-02-16 Thread Liam O'Toole
On 2011-02-15, Kelly Dean kellydea...@yahoo.com wrote:
 lrhorer wrote:
Volkan YAZICI wrote:
 I want to temporarily suspend the network traffic on a particular
 interface -- if possible, in microsecond granularity.
 I have to ask.  Why are you wanting to do this?  It seems a truly
 bizarre request.

 Maybe in order to simulate intermittent RFI on wireless networks, in order to 
 see how TCP responds. (Hint: it responds very stupidly.)

Another example is the testing of message queues. Any messaging system
worthy of the name will need to react gracefully in such situations.

-- 
Liam O'Toole
Cork, Ireland



-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/slrniln4b8.2hf.liam.p.otoole@dipsy.tubbynet



Re: How To Temporarily Suspend Network Traffic

2011-02-15 Thread Kelly Dean
lrhorer wrote:
Volkan YAZICI wrote:
 I want to temporarily suspend the network traffic on a particular
 interface -- if possible, in microsecond granularity.
 I have to ask.  Why are you wanting to do this?  It seems a truly
bizarre request.

Maybe in order to simulate intermittent RFI on wireless networks, in order to 
see how TCP responds. (Hint: it responds very stupidly.)


  


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/17203.71263...@web121506.mail.ne1.yahoo.com



Re: How To Temporarily Suspend Network Traffic

2011-02-03 Thread Chris Bannister
On Tue, Feb 01, 2011 at 03:44:57PM +, T o n g wrote:
 On Tue, 01 Feb 2011 09:16:16 -0500, Gregory Seidman wrote:
 
  Now, those are the actual commands to run from the shell. You aren't
  going to get microsecond granularity that way.
 
 FYI,
 
 $ apt-cache show sleepenh
 Package: sleepenh
 Priority: extra
 Section: universe/utils
 Installed-Size: 60
 Maintainer: Ubuntu MOTU Developers ubuntu-m...@lists.ubuntu.com
  ^^
Huh?

 Original-Maintainer: Pedro Zorzenon Neto p...@debian.org
 Architecture: amd64
 Version: 1.3-1
 Depends: libc6 (= 2.3.4)

Whereas:
$ apt-cache show sleepenh
Package: sleepenh
Priority: extra
Section: utils
Installed-Size: 60
Maintainer: Pedro Zorzenon Neto p...@debian.org
Architecture: amd64
Version: 1.3-1
Depends: libc6 (= 2.7-1)

Notice the different dependency versions?

-- 
Religion is excellent stuff for keeping common people quiet.
   -- Napoleon Bonaparte


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110204070736.GE18972@fischer



How To Temporarily Suspend Network Traffic

2011-02-01 Thread Volkan YAZICI
Hi,

I want to temporarily suspend the network traffic on a particular
interface -- if possible, in microsecond granularity. For this purpose,
ifup/ifdown ioctl() calls doesn't work. That is, for wireless,
connection isn't get recovered; for wired, it takes at least 2 seconds
to recover. I tried using tc, but it doesn't accept rate 0 parameter.
Neither iwconfig wlan0 rate 0 has any effect. (Moreover, in iwconfig
manual it is told that values below 1000 are card specific and are
usually an index in the bit-rate list.) Do you have any suggestions? Or
can you point me to some other resource/mailing-list that I can consult?


Regards.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/87tygnamfe@alamut.ozu.edu.tr



Re: How To Temporarily Suspend Network Traffic

2011-02-01 Thread Gregory Seidman
On Tue, Feb 01, 2011 at 03:56:05PM +0200, Volkan YAZICI wrote:
 I want to temporarily suspend the network traffic on a particular
 interface -- if possible, in microsecond granularity. For this purpose,
 ifup/ifdown ioctl() calls doesn't work. That is, for wireless,
 connection isn't get recovered; for wired, it takes at least 2 seconds
 to recover. I tried using tc, but it doesn't accept rate 0 parameter.
 Neither iwconfig wlan0 rate 0 has any effect. (Moreover, in iwconfig
 manual it is told that values below 1000 are card specific and are
 usually an index in the bit-rate list.) Do you have any suggestions? Or
 can you point me to some other resource/mailing-list that I can consult?

It depends on exactly what behavior you're aiming for. If you just want all
packets going in or out on that interface to be dropped, you can do it
pretty effectively with iptables. The following will drop all packets
coming in through the wlan0 interface:

iptables -A PREROUTING -i wlan0 -j DROP

This will drop all packets destined to be sent out the wlan0 interface:

iptables -A POSTROUTING -o wlan0 -j DROP

You can remove each rule by changing the -A to a -D.

Now, those are the actual commands to run from the shell. You aren't going
to get microsecond granularity that way. You can, however, dig into the
iptables source and see what system calls it's making as a result of those
options and use it in your own code. I don't know if that will get you to
microsecond granularity, but you'll have to do your own profiling to check.

 Regards.
--Greg


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110201141616.gf11...@anthropohedron.net



Re: How To Temporarily Suspend Network Traffic

2011-02-01 Thread Gregory Seidman
On Tue, Feb 01, 2011 at 07:40:06PM +0200, Volkan YAZICI wrote:
 On Tue, 1 Feb 2011 09:16:16 -0500, Gregory Seidman writes:
[...]
 Thanks Greg, but there is a small anomaly with this method. For
 instance, if I
 
 1. issue
 
  $ pv -q -L 10k /tmp/200k.dat | nc 192.168.1.1 7000
 
from terminal A,
 
 2. and after a few seconds issue
 
  # iptables -A OUTPUT -i wlan0 -j DROP  \
   sleep 2  \
   iptables -D OUTPUT -i wlan0 -j DROP
 
command (pay attention that I used OUTPUT chain instead of
{PRE,POST}ROUTING), as expected, transfer hangs up for 2 seconds, and
finishes without a problem.

I note that you are only doing this once, so there is a 2 second
interruption as expected.

 On the other hand, in the 2nd step, if I issue
 
   # while /bin/true; do \
iptables -A OUTPUT -i wlan0 -j DROP  \
usleep 10  \
iptables -D OUTPUT -i wlan0 -j DROP
 
 command (usleep is a small C program I wrote, see the attachment),
 transfer hangs after some point and stops for ~30-40secs and finishes
 when I stop the while loop. Do I miss anything? Any suggestions?

Here you are interrupting for 100,000 usecs (which is 100msecs, I believe),
but you don't sleep at all between interruptions in the while loop. That
means that it only has the time between the execution of the iptables
command at the end of the loop and the execution of the iptables command at
the beginning of the loop to actually transmit any packets. It is
unsurprising that it hangs. Make sure you sleep for a while after removing
the iptables rule.

 Best.
--Greg


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110201181515.gh11...@anthropohedron.net



Re: How To Temporarily Suspend Network Traffic

2011-02-01 Thread Volkan YAZICI
On Tue, 1 Feb 2011 13:15:15 -0500, Gregory Seidman writes:
 On Tue, Feb 01, 2011 at 07:40:06PM +0200, Volkan YAZICI wrote:
 [...]
   # while /bin/true; do \
iptables -A OUTPUT -i wlan0 -j DROP  \
usleep 10  \
iptables -D OUTPUT -i wlan0 -j DROP
 
 command (usleep is a small C program I wrote, see the attachment),
 transfer hangs after some point and stops for ~30-40secs and finishes
 when I stop the while loop. Do I miss anything? Any suggestions?

 Here you are interrupting for 100,000 usecs (which is 100msecs, I believe),
 but you don't sleep at all between interruptions in the while loop. That
 means that it only has the time between the execution of the iptables
 command at the end of the loop and the execution of the iptables command at
 the beginning of the loop to actually transmit any packets. It is
 unsurprising that it hangs. Make sure you sleep for a while after removing
 the iptables rule.

Indeed, sleeping more than I want is what I try to avoid. In other
words, I'm inclined to believe that running iptables externally doesn't
provide an interruption mechanism in milli/microsecond granularity. Any
other suggestions?


Regards.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/87oc6v391u@alamut.ozu.edu.tr



Re: How To Temporarily Suspend Network Traffic

2011-02-01 Thread Gregory Seidman
On Tue, Feb 01, 2011 at 08:26:53PM +0200, Volkan YAZICI wrote:
 On Tue, 1 Feb 2011 13:15:15 -0500, Gregory Seidman writes:
  On Tue, Feb 01, 2011 at 07:40:06PM +0200, Volkan YAZICI wrote:
  [...]
# while /bin/true; do \
 iptables -A OUTPUT -i wlan0 -j DROP  \
 usleep 10  \
 iptables -D OUTPUT -i wlan0 -j DROP
  
  command (usleep is a small C program I wrote, see the attachment),
  transfer hangs after some point and stops for ~30-40secs and finishes
  when I stop the while loop. Do I miss anything? Any suggestions?
 
  Here you are interrupting for 100,000 usecs (which is 100msecs, I believe),
  but you don't sleep at all between interruptions in the while loop. That
  means that it only has the time between the execution of the iptables
  command at the end of the loop and the execution of the iptables command at
  the beginning of the loop to actually transmit any packets. It is
  unsurprising that it hangs. Make sure you sleep for a while after removing
  the iptables rule.
 
 Indeed, sleeping more than I want is what I try to avoid. In other
 words, I'm inclined to believe that running iptables externally doesn't
 provide an interruption mechanism in milli/microsecond granularity. Any
 other suggestions?

Well, I suggested before that you look into the iptables code and make the
system calls it does rather than executing it externally.

 Regards.
--Greg


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110201183526.gi11...@anthropohedron.net



Re: How To Temporarily Suspend Network Traffic

2011-02-01 Thread lrhorer
Volkan YAZICI wrote:

 Hi,
 
 I want to temporarily suspend the network traffic on a particular
 interface -- if possible, in microsecond granularity. For this
 purpose, ifup/ifdown ioctl() calls doesn't work. That is, for
 wireless, connection isn't get recovered; for wired, it takes at least
 2 seconds to recover. I tried using tc, but it doesn't accept rate 0
 parameter. Neither iwconfig wlan0 rate 0 has any effect. (Moreover,
 in iwconfig manual it is told that values below 1000 are card specific
 and are usually an index in the bit-rate list.) Do you have any
 suggestions? Or can you point me to some other resource/mailing-list
 that I can consult?

I have to ask.  Why are you wanting to do this?  It seems a truly
bizarre request.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/uoidnytcaogzg9xqnz2dnuvz5qedn...@giganews.com