From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fredrik =?iso-8859-1?Q?Bj=F6rk?= Fredrik.Bjork.List@varbergenergi.se Date: Fri, 17 Nov 2000 08:42:15 +0000 Subject: [LARTC] Shaping Incoming Traffic Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: lartc@vger.kernel.org
At 20:09 2000-11-16 +0000, you wrote:
>Is there no way to shape incoming traffic? With any kernel version, =
or
>even by rewriting the networking code? I understand the difficul=
ties, and
>the reasons why outgoing shaping is simple at the low-level but =
incoming
>shaping is not done even at the high-level, but what about this?=
 Use the
>TCP window field to restrict the rate of data transfer (not worr=
ying about
>the details right now; just the general feasibility). (This is f=
or a
>single box, rather than for a box on a network which has a separ=
ate router
>to shape its traffic.) If a node were to consistently violate th=
e window,
>it could be blocked until the administrator fixed the problem at=
 that
>node. (This is intended for thsoe who do not intend to violate t=
he
>policies of the server, rather than those who may wish to do so
>maliciously.)
>
>I'd just like some pointers and hints for this...it seems workab=
le to me.
>But if there is another way, or *any* way, I'd rather pursue tha=
t before
>the TCP way so I can see which is better. I'm simply discouraged=
 by the
>fact that no one seems to have tried this before, while it seems=
 a
>painfully obvious way to do it to me, so I wonder what I'm missi=
ng
>conceptually.

Try
http=
://freshmeat.net/projects/rshaper/?highlight=3Drshaper
for rshaper. I haven't tried it myself, but they use a metod where they
delay the notification of received packets to the sending host.

>From the README:

>                THEORY OF OPERATION
>                =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
>
>The  idea is easy:  whenever  a packet is   received through a n=
etwork
>interface, the rshaper module delays notification of the packet =
to the
>network subsystem of Linux according to the expected data flow f=
or the
>involved host.
>
>In order to delay reception of  the packet, the network driver m=
ust be
>modified to call the shaper's receive function instead of the st=
andard
>netif_rx().   Therefore, you  must modify  two lines  of  your n=
etwork
>device driver.  In  case you use a NE2000  clone or another 8390=
-based
>ethernet device,  you can  use the patch  included in this  pack=
age as
>"8390-X.Y.c.patch", where X.Y  is your kernel versione=
 (as  of now are
>supported versions  2.0 and  2.2). If you  are new to  patches, =
please
>refer to the last section.

Another method would be to use ICMP source quench:

http://www.faqs.org/rfcs/=
rfc1016.html

>Introduction
>
>   A gateway may discard Internet datagrams if it does not have =
the
>   buffer space needed to queue the datagrams for output to the =
next
>   network on the route to the destination network.  If a gateway
>   discards a datagram, it may send a source quench message to t=
he
>   Internet source host of the datagram.  A destination host may=
 also
>   send a source quench message if datagrams arrive too fast to =
be
>   processed.  The source quench message is a request to the hos=
t to cut
>   back the rate at which it is sending traffic to the Internet
>   destination.  The gateway may send a source quench message fo=
r every
>   message that it discards.  On receipt of a source quench mess=
age, the
>   source host should cut back the rate at which it is sending t=
raffic
>   to the specified destination until it no longer receives sour=
ce
>   quench messages from the gateway.  The source host can then g=
radually
>   increase the rate at which it sends traffic to the destinatio=
n until
>   it again receives source quench messages [1,2].
>
>   The gateway or host may send the source quench message when it
>   approaches its capacity limit rather than waiting until the c=
apacity
>   is exceeded.  This means that the data datagram which trigger=
ed the
>   source quench message may be delivered.

I'm not aware of any implementation of this method for Linux that would
suite your needs.

Cisco has shaping both for incoming and outgoing traffic. See www.cisco.com
for mor info.

/Fredrik

__________________________________________________________________________
Fredrik Bj=F6rk   Seaside Internet/Varberg Energi   Fredrik.Bjork@seaside.se