From: Jody Shumaker Date: Wed, 11 Jan 2006 05:11:45 +0000 Subject: Re: [LARTC] control p2p upload bandwidth rate Message-Id: <2af436490601102111s71440bd4w84f37ca0157752f2@mail.gmail.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============0863712920==" List-Id: References: <43AAE878.10404@phreaker.net> In-Reply-To: <43AAE878.10404@phreaker.net> To: lartc@vger.kernel.org --===============0863712920== Content-Type: multipart/alternative; boundary="----=_Part_68946_16577819.1136956305432" ------=_Part_68946_16577819.1136956305432 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline #accepts the packet if it has a mark besides the default 0 and prevents the saved mark from being changed iptables -t mangle -A PREROUTING -p tcp -m mark ! --mark 0 -j ACCEPT That section after the restore-mark rule will cause any saved marks to skip the rest of the chain. This results in only the first packets of a tcp connection having to hit their individual --set-mark rule. If you do have concerns about cpu usage or some such, I'd suggest trying trying out the ipp2p match module instead of the more generic l7match module. It's more specific to p2p and tends to be much faster than doing regular expressions. On 1/10/06, Nataniel Klug wrote: > > I have a script that makes connections for every user with his auth. So, > in this script, I have two mark tags. Can I use this tip you give to ro0o= t? > My doubt is if I use this every time some user log it will be all execute= d > again, it will not make me trouble? > I'm not sure exactly what you mean by this. If my above explanation doesn't apply, could you possibly explain or give an example? - Jody ------=_Part_68946_16577819.1136956305432 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline #accepts the packet if it has= a mark besides the=20 default 0 and prevents the saved mark from being changed
iptables -t= =20 mangle -A PREROUTING -p tcp -m mark ! --mark 0 -j ACCEPT

That sect= ion after the restore-mark rule will cause any saved marks to skip the rest= of the chain.  This results in only the first packets of a tcp connec= tion having to hit their individual --set-mark rule.  If you do have c= oncerns about cpu usage or some such,  I'd suggest trying trying out t= he ipp2p match module instead of the more generic l7match module.  It'= s more specific to p2p and tends to be much faster than doing regular expre= ssions.

On 1/10/06, Nataniel Klug <n= ata@cnett.com.br> wrote:
I have a script that makes connections= for every=20 user with his auth. So, in this script, I have two mark tags. Can I use thi= s tip=20 you give to ro0ot? My doubt is if I use this every time some user log it wi= ll be=20 all executed again, it will not make me trouble?
<= div>
I'm not sure exactly what you mean by this. If my above explanation= doesn't apply, could you possibly explain or give an example?

- Jody

------=_Part_68946_16577819.1136956305432-- --===============0863712920== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc --===============0863712920==--