All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Andy Furniss <andy.furniss@dsl.pipex.com>
Cc: linuximq@yahoogroups.com,  netfilter-devel@lists.netfilter.org
Subject: Re: [linuximq] Re: [PATCH] pom-ng version of IMQ target (file is attached this time)
Date: Sat, 05 Jun 2004 14:56:48 +0200	[thread overview]
Message-ID: <40C1C310.7070605@trash.net> (raw)
In-Reply-To: <40BD1CC7.7080605@dsl.pipex.com>

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

Andy Furniss wrote:
> Patrick McHardy wrote:
>
>> Your mail made me realize I need patch for exactly the same issue
>> with ESFQ for work, so if you need it I can send it to you.
> 
> 
> Yea - it would be nice to see the right way to do it :-)

With this patch esfq uses the original source address if the packet has
been SNATed. It's a hack, but it solves the problem without IMQ.

> 
> I guessed using the example of the ingress NAT patch and changed egress 
> postrouting hook to NF_IP_PRI_NAT_SRC - 1.
> 
> It seems to be OK for me - are there other safe places where IMQ is OK 
> or any to be avoided?

I don't know about the current patches, you better ask the people
maintaining them.

Regards
Patrick

> 
> Andy.
> 


[-- Attachment #2: esfq-source.diff --]
[-- Type: text/x-patch, Size: 1093 bytes --]

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 <linux/etherdevice.h>
 #include <linux/notifier.h>
 #include <linux/init.h>
+#include <linux/netfilter_ipv4/ip_conntrack.h>
 #include <net/ip.h>
 #include <linux/ipv6.h>
 #include <net/route.h>
@@ -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 ||

  reply	other threads:[~2004-06-05 12:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-12 21:59 [PATCH] pom-ng version of IMQ target (file is attached this time) Brad Fisher
2004-05-13  2:13 ` Patrick McHardy
2004-05-13 16:03   ` Brad Fisher
2004-05-31 12:59     ` [linuximq] " Andy Furniss
2004-06-01 23:17       ` Patrick McHardy
2004-06-02  0:18         ` Andy Furniss
2004-06-05 12:56           ` Patrick McHardy [this message]
2004-06-03 15:24       ` Andre Correa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40C1C310.7070605@trash.net \
    --to=kaber@trash.net \
    --cc=andy.furniss@dsl.pipex.com \
    --cc=linuximq@yahoogroups.com \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.