public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@linuxcare.com.au>
To: "Christian Worm Mortensen" <worm@dkik.dk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Networking on 2.4: Finding source of a masqgraded packet and source/destination MAC address
Date: Thu, 01 Mar 2001 17:30:50 +1100	[thread overview]
Message-ID: <E14YMby-00086I-00@halfway> (raw)
In-Reply-To: Your message of "Wed, 28 Feb 2001 22:19:29 BST." <01a001c0a1cc$22bd5e50$5f01a8c0@worm>

In message <01a001c0a1cc$22bd5e50$5f01a8c0@worm> you write:
> Hi,
> 
> I am the author of the WRR (http://wipl-wrr.dkik.dk/wrr) qdisc, an extension 
to the 2.2 kernels which is supposed to run on a router/bridge/firewall and do 
Weighted Round Robin scheduling with a class for each local machine.
> 
> Now, I want to port this scheduler to 2.4. One of the problems is that someti
mes I have an outgoing (to the world) packet which has been masqgraded. I want 
to account this packet to the local machine which has originally generated it. 
On 2.2. I used the following code to get the IP address of the local machine:
> 

If they are using masquerading, the nfct will be set.  Use
#include <linux/netfilter_ipv4/ip_conntrack.h>


enum ip_conntrack_info ctinfo;
struct ip_conntrack *ct;

ct = ip_conntrack_get(skb, &ctinfo);
if (ct) {
	/* We want the initial source. */
	ipaddr = ct->tuplehash[CTINFO2DIR(ctinfo)].tuple.src.ip;
} else {
	ipaddr = skb->nh.iph.saddr;
}

Cheers!
Rusty.
--
Premature optmztion is rt of all evl. --DK

      reply	other threads:[~2001-03-01  6:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-28 21:19 Networking on 2.4: Finding source of a masqgraded packet and source/destination MAC address Christian Worm Mortensen
2001-03-01  6:30 ` Rusty Russell [this message]

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=E14YMby-00086I-00@halfway \
    --to=rusty@linuxcare.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=worm@dkik.dk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox