From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrick McHardy Date: Tue, 17 Aug 2004 01:24:29 +0000 Subject: Re: [LARTC] esfq hash type Message-Id: <41215E4D.2050803@trash.net> MIME-Version: 1 Content-Type: multipart/mixed; boundary="------------020705000803000102050307" List-Id: References: <1445027109.20040817024227@op.pl> In-Reply-To: <1445027109.20040817024227@op.pl> To: lartc@vger.kernel.org This is a multi-part message in MIME format. --------------020705000803000102050307 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Marcin Sura wrote: >Hi > > I have a small lan (10.0.0.0/8) behind my linux box. I use MASQUERADE to allow > users connects to internet. > > I set up an esfq qdisc for outgoing traffic. And there is a little > question. Does source hash type in esfq recognize NATed local ip's? > > No, but with this little hack (against esfq-patched kernel) it does. Regards Patrick --------------020705000803000102050307 Content-Type: text/x-patch; name="linux-2.4.24-esfq-origsource.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="linux-2.4.24-esfq-origsource.diff" diff -urN a/net/sched/sch_esfq.c b/net/sched/sch_esfq.c --- a/net/sched/sch_esfq.c 2004-06-05 15:45:19.000000000 +0200 +++ b/net/sched/sch_esfq.c 2004-06-05 15:47:21.000000000 +0200 @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -109,6 +110,18 @@ return h & (q->hash_divisor-1); } +static inline u32 esfq_get_source(struct sk_buff *skb) +{ + struct ip_conntrack *ct; + int dir; + + if (skb->nfct == NULL) + return skb->nh.iph->saddr; + ct = (struct ip_conntrack *)skb->nfct->master; + dir = CTINFO2DIR(skb->nfct - ct->infos); + return ct->tuplehash[dir].tuple.src.ip; +} + static unsigned esfq_hash(struct esfq_sched_data *q, struct sk_buff *skb) { u32 h, h2; @@ -119,7 +132,7 @@ { struct iphdr *iph = skb->nh.iph; h = iph->daddr; - hs = iph->saddr; + hs = esfq_get_source(skb); h2 = hs^iph->protocol; if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) && (iph->protocol == IPPROTO_TCP || --------------020705000803000102050307-- _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/