Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: Packet rate limiting

From: Dan Kaminsky <dan(at)doxpara.com>
Date: Sat Jul 12 2003 - 20:42:17 EDT

OK since I just suffered through the RTOS issue, let me explain:

Lets say I want to send 100K per second.

That's 102400 bytes in a second.

Now, I can't send less than 64 bytes at a time, according to the Ethernet spec. So, that's 1600 bytes per second.

That's a 0.625ms delay in between each packet I wish to send.

Linux has a 10hz clock. That means, every time I usleep, I ain't coming back for 100ms.

So, if I try to sleep 625 microseconds, the kernel is going to go off, do some other things, and come back approximately really f*cking late.

Do you need help?X

Now, there are alternatives. I could use another Unix (freebsd and solaris wipe the floor with linux when it comes to scanrand 1.1). I could use nanosleep, which throws the processor in a busy loop so I get my precise, non-context-switching sleep. Or I could switch to a RTOS, which lets me say, "You do what you want, but in 625 microseconds, you WILL SEND THIS PACKET." That's what an RTOS gets you -- a guarantee that a specifically scheduled event _will be executed in time_.

Not to say a RTOS is necessary. Just shifting the delay mechanism to a batch architecture -- with large delays between large byte drops (which is what you're doing no matter what, because 64 byte packets are atomic)
-- works well enough.

--Dan

P.S. I might be a bit off on the numbers -- but scanrand 1.1 bandwidth limiting remains quite broken for the reasons described.



To unsubscribe, e-mail: libnet-unsubscribe@securityfocus.com For additional commands, e-mail: libnet-help@securityfocus.com Received on Sat Jul 12 21:01:05 2003

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:02:24 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library