All of lore.kernel.org
 help / color / mirror / Atom feed
* Bug (?) in ipt_reject doesn't follow policy routing (2.4.x)
@ 2003-04-13 18:53 Leen Besselink
  2003-04-13 20:13 ` Leen Besselink
  2003-04-14  7:59 ` Patrick Schaaf
  0 siblings, 2 replies; 10+ messages in thread
From: Leen Besselink @ 2003-04-13 18:53 UTC (permalink / raw)
  To: netfilter-devel

Hi netfilter-hackers,

OK, first the situation...

I use policy routing to decide (based on the from-address) on what
out-interface to send a packet (and thus a different sender IP-address and
gateway).

But... when I use reject-with tcp-reset, for a port on a host on the
network behind my firewall, the tcp-reset-packet goes over the wrong
interface.

I looked at the code and it looks like a bug to me, but there is a
comment, maybe there is a good reason not to:

        /* Routing: if not headed for us, route won't like source */
        if (ip_route_output(&rt, nskb->nh.iph->daddr,
                            local ? nskb->nh.iph->saddr : 0,
                            RT_TOS(nskb->nh.iph->tos) | RTO_CONN,
                            0) != 0)
                goto free_nskb;

If it's not a local destinated-packet it sends the sender-address to 0
when making the routing decision (probably 0.0.0.0 ?).

The calling code for send_reset sets local:

        case IPT_TCP_RESET:
                send_reset(*pskb, hooknum == NF_IP_LOCAL_IN);

When I use the send_unreach (for example with: icmp_host_unreachable),
this is not done and thus the source-based routing rules have effect:

        if (ip_route_output(&rt, iph->saddr, saddr, RT_TOS(tos), 0))
                return;

So, I think the 'local ? nskb->nh.iph->saddr : 0' can actually be
removed, am I right ?

But if there is a good reason, then I don't understand why it's not doing
the same thing for an unreachable, maybe that needs fixing instead then.

Any help would be greatly appreciated and tia,
	Leen.
_____________________________________
New things are always on the horizon.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-04-16  0:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-13 18:53 Bug (?) in ipt_reject doesn't follow policy routing (2.4.x) Leen Besselink
2003-04-13 20:13 ` Leen Besselink
2003-04-14  7:27   ` Leen Besselink
2003-04-14  7:59 ` Patrick Schaaf
2003-04-14  8:49   ` Patrick McHardy
2003-04-14 11:35     ` Leen Besselink
2003-04-14 21:09       ` Patrick McHardy
2003-04-15  7:40         ` Harald Welte
2003-04-15 14:16           ` Patrick McHardy
2003-04-16  0:20             ` Patrick McHardy

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.