Commit 0e8b7c1c authored by Patrick McHardy's avatar Patrick McHardy

[NETFILTER]: Select source address for gateway in MASQUERADE

Suggested by Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent a41ba921
......@@ -81,6 +81,7 @@ masquerade_target(struct sk_buff **pskb,
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 @@ masquerade_target(struct sk_buff **pskb,
|| 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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment