All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@redhat.com>
Cc: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>
Subject: [PATCH 2.6 10/19]: Select source address for gateway in MASQUERADE
Date: Mon, 25 Oct 2004 02:49:35 +0200	[thread overview]
Message-ID: <417C4D9F.50401@trash.net> (raw)

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

Select source address for gateway in MASQUERADE, based
on Herbert's suggestion.



[-- Attachment #2: 10.diff --]
[-- Type: text/x-patch, Size: 1397 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/10/20 20:27:59+02:00 kaber@coreworks.de 
#   [NETFILTER]: Select source address for gateway in MASQUERADE
#   
#   Suggested by Herbert Xu <herbert@gondor.apana.org.au>
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/ipv4/netfilter/ipt_MASQUERADE.c
#   2004/10/20 20:26:59+02:00 kaber@coreworks.de +3 -1
#   [NETFILTER]: Select source address for gateway in MASQUERADE
#   
#   Suggested by Herbert Xu <herbert@gondor.apana.org.au>
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
diff -Nru a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c
--- a/net/ipv4/netfilter/ipt_MASQUERADE.c	2004-10-22 03:39:37 +02:00
+++ b/net/ipv4/netfilter/ipt_MASQUERADE.c	2004-10-22 03:39:37 +02:00
@@ -81,6 +81,7 @@
 	enum ip_conntrack_info ctinfo;
 	const struct ip_nat_multi_range *mr;
 	struct ip_nat_multi_range newrange;
+	struct rtable *rt;
 	u_int32_t newsrc;
 
 	IP_NF_ASSERT(hooknum == NF_IP_POST_ROUTING);
@@ -95,7 +96,8 @@
 	                    || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY));
 
 	mr = targinfo;
-	newsrc = inet_select_addr(out, 0, RT_SCOPE_UNIVERSE);
+	rt = (struct rtable *)(*pskb)->dst;
+	newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE);
 	if (!newsrc) {
 		printk("MASQUERADE: %s ate my IP address\n", out->name);
 		return NF_DROP;

                 reply	other threads:[~2004-10-25  0:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=417C4D9F.50401@trash.net \
    --to=kaber@trash.net \
    --cc=davem@redhat.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.