[cut]
CH> This would be an appropriate time to ask:
CH> Does anybody have any fixes for or improvements to ESFQ that I don't
CH> know about? My patch doesn't have anything revolutionary -- I've been
CH> merely keeping Alexander Clouter's 2.6 port in sync with the upstream
CH> changes to SFQ.
Yes :)
Some time ago I needed to do sfq between different users in NAT-ed
environment. The users were marked by firewall marks, so I've done a
little change to esfq just adding new hash source - nfmark.
It was done for iproute2-ss020116 and kernel 2.4.26, so it's a little
old. The kernel part is still (I think, not tried) operational.
I think it makes esfq more flexible.
The patches for individual files are below.
-----------KERNEL-PATCH-----------
--- sch_esfq.c.old 2004-04-21 18:00:42.000000000 +0200
+++ sch_esfq.c 2004-01-07 21:39:24.000000000 +0100
@@ -117,6 +117,7 @@
{
u32 h, h2;
u32 hs;
+ u32 nfm;
switch (skb->protocol) {
case __constant_htons(ETH_P_IP):
@@ -124,6 +125,7 @@
struct iphdr *iph = skb->nh.iph;
h = iph->daddr;
hs = iph->saddr;
+ nfm = skb -> nfmark;
h2 = hs^iph->protocol;
if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) &&
(iph->protocol == IPPROTO_TCP ||
@@ -137,6 +139,7 @@
struct ipv6hdr *iph = skb->nh.ipv6h;
h = iph->daddr.s6_addr32[3];
hs = iph->saddr.s6_addr32[3];
+ nfm = skb->nfmark;
h2 = hs^iph->nexthdr;
if (iph->nexthdr == IPPROTO_TCP ||
iph->nexthdr == IPPROTO_UDP ||
@@ -148,6 +151,7 @@
h = (u32)(unsigned long)skb->dst;
hs = (u32)(unsigned long)skb->sk;
h2 = hs^skb->protocol;
+ nfm = skb->nfmark;
}
switch(q->hash_kind)
{
@@ -157,6 +161,8 @@
return esfq_hash_u32(q,h);
case TCA_SFQ_HASH_SRC:
return esfq_hash_u32(q,hs);
+ case TCA_SFQ_HASH_FWMARK:
+ return esfq_hash_u32(q,nfm);
default:
if (net_ratelimit())
printk(KERN_DEBUG "esfq unknown hash method, fallback
to classic\n");
--- pkt_sched.h.old 2005-10-15 09:49:10.000000000 +0200
+++ pkt_sched.h 2005-10-15 09:48:31.000000000 +0200
@@ -162,6 +162,7 @@
TCA_SFQ_HASH_CLASSIC,
TCA_SFQ_HASH_DST,
TCA_SFQ_HASH_SRC,
+ TCA_SFQ_HASH_FWMARK,
};
struct tc_sfq_qopt
------------IPROUTE----------------------
--- q_esfq.c.old 2005-10-15 09:57:08.000000000 +0200
+++ q_esfq.c 2005-10-15 09:51:36.000000000 +0200
@@ -30,7 +30,7 @@
{
fprintf(stderr, "Usage: ... esfq [ perturb SECS ] [ quantum BYTES ] [
depth FLOWS ]\n\t[ divisor HASHBITS ] [ limit PKTS ] [ hash HASHTYPE]\n");
fprintf(stderr,"Where: \n");
- fprintf(stderr,"HASHTYPE := { classic | src | dst }\n");
+ fprintf(stderr,"HASHTYPE := { classic | src | dst | fwmark }\n");
}
#define usage() return(-1)
@@ -95,6 +95,9 @@
} else
if(strcmp(*argv,"src") == 0) {
opt.hash_kind= TCA_SFQ_HASH_SRC;
+ } else
+ if(strcmp(*argv,"fwmark") == 0) {
+ opt.hash_kind= TCA_SFQ_HASH_FWMARK;
} else {
fprintf(stderr, "Illegal \"hash\"\n");
explain();
@@ -148,6 +151,9 @@
case TCA_SFQ_HASH_SRC:
fprintf(f,"src");
break;
+ case TCA_SFQ_HASH_FWMARK:
+ fprintf(f,"fw");
+ break;
default:
fprintf(f,"Unknown");
}
--
Greetings,
Robert Kurjata
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc