All of lore.kernel.org
 help / color / mirror / Atom feed
* xt_gateway locks up
@ 2007-10-21 22:14 Jan Engelhardt
  2007-10-26 13:48 ` Amin Azez
  2007-10-26 14:08 ` Amin Azez
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Engelhardt @ 2007-10-21 22:14 UTC (permalink / raw)
  To: Sam Liddicott; +Cc: Netfilter Developer Mailing List

Hi Sam,


just for the fun of it, I tried:

	iptables -t mangle -A PREROUTING -m gateway --nexthop 10.10.96.1

and it locked up hard (not even sysrq-b was possible).
I am not sure why that happened - it does work properly in -t filter -A 
OUTPUT, though. I'll experiment a bit.
The codebase I am on is at 
http://dev.computergmbh.de/wsvn/misc_kernel/xt_gateway/

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

* Re: xt_gateway locks up
  2007-10-21 22:14 xt_gateway locks up Jan Engelhardt
@ 2007-10-26 13:48 ` Amin Azez
  2007-10-26 14:08 ` Amin Azez
  1 sibling, 0 replies; 5+ messages in thread
From: Amin Azez @ 2007-10-26 13:48 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Netfilter Developer Mailing List

* Jan Engelhardt wrote, On 21/10/07 23:14:
> Hi Sam,
> 
> 
> just for the fun of it, I tried:
> 
> 	iptables -t mangle -A PREROUTING -m gateway --nexthop 10.10.96.1
> 
> and it locked up hard (not even sysrq-b was possible).
> I am not sure why that happened - it does work properly in -t filter -A 
> OUTPUT, though. I'll experiment a bit.
> The codebase I am on is at 
> http://dev.computergmbh.de/wsvn/misc_kernel/xt_gateway/


Thanks for reporting this.
Is it a regular lock up or just a one off?

I would think it doesn't make sense to use it in pre-routing as no
gateway will be set.

Sam



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

* Re: xt_gateway locks up
  2007-10-21 22:14 xt_gateway locks up Jan Engelhardt
  2007-10-26 13:48 ` Amin Azez
@ 2007-10-26 14:08 ` Amin Azez
  2007-10-26 14:33   ` Jan Engelhardt
  1 sibling, 1 reply; 5+ messages in thread
From: Amin Azez @ 2007-10-26 14:08 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Netfilter Developer Mailing List

* Jan Engelhardt wrote, On 21/10/07 23:14:
> Hi Sam,
> 
> 
> just for the fun of it, I tried:
> 
> 	iptables -t mangle -A PREROUTING -m gateway --nexthop 10.10.96.1
> 
> and it locked up hard (not even sysrq-b was possible).
> I am not sure why that happened - it does work properly in -t filter -A 
> OUTPUT, though. I'll experiment a bit.
> The codebase I am on is at 
> http://dev.computergmbh.de/wsvn/misc_kernel/xt_gateway/

Yeah, my match function was very verbose:

{
        const struct ipt_gateway_info *info = matchinfo;
        const struct iphdr *iph = skb->nh.iph;

        return (  !!(info->flags & IPT_GATEWAY_INV) ^
                ( skb && skb->dst && skb->dst->neighbour &&
...

It assumes that IF skb->dst is set, that it is a neighbour table entry.

Your code is:

	dst = skb->dst;
	if ((neigh = dst->neighbour) == NULL)
		return false;


It doesn't consider that skb->dst may be NULL, which it will in PRE_ROUTING.

Sam

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

* Re: xt_gateway locks up
  2007-10-26 14:08 ` Amin Azez
@ 2007-10-26 14:33   ` Jan Engelhardt
       [not found]     ` <4722034C.5020803@ufomechanic.net>
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2007-10-26 14:33 UTC (permalink / raw)
  To: Amin Azez; +Cc: Netfilter Developer Mailing List


On Oct 26 2007 15:08, Amin Azez wrote:
>It assumes that IF skb->dst is set, that it is a neighbour table entry.
>
>Your code is:
>
>	dst = skb->dst;
>	if ((neigh = dst->neighbour) == NULL)
>		return false;
>
>
>It doesn't consider that skb->dst may be NULL, which it will in PRE_ROUTING.

That's because Patrick said it cannot be NULL :-)
http://marc.info/?l=netfilter-devel&m=118105659716253&w=2

Of course, an oops in an interrupt handler ain't that funny..

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

* Re: xt_gateway locks up
       [not found]     ` <4722034C.5020803@ufomechanic.net>
@ 2007-10-26 15:33       ` Jan Engelhardt
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2007-10-26 15:33 UTC (permalink / raw)
  To: Amin Azez; +Cc: Netfilter Developer Mailing List


On Oct 26 2007 16:10, Amin Azez wrote:
>>
>> That's because Patrick said it cannot be NULL :-)
>> http://marc.info/?l=netfilter-devel&m=118105659716253&w=2
>>
>> Of course, an oops in an interrupt handler ain't that funny..
>
>Indeed.
>
>But he was right in the planned useful case, are you using it in 
>pre-routing on bridging or something? I can't work out why you would 
>want to use it in PRE_ROUTING, i.e. before a gateway is set, unless you 
>are setting a gateway in pre-routing too. You're not storing a route in 
>the conntrack are you?

No. The experiment behind this was to:

	-t nat -A PREROUTING -i eth1 -d <address of eth0> -p tcp \
	--dport 80 -j REDIRECT --to-port 8000

i.e. that all packets destined for <public ip>:80 go to an alternate 
port. But if eth0 has a dynamic address, that is going to be hard. So 
the idea I had was to match with

	-t nat -A PREROUTING \
	-m gateway --nexthop 127.0.0.1 -p tcp --dport 80

because the routing code would decide so when it sees that the IPv4 
destination <public ip> is actually a 'local' target (ip r l table 
local).

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

end of thread, other threads:[~2007-10-26 15:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-21 22:14 xt_gateway locks up Jan Engelhardt
2007-10-26 13:48 ` Amin Azez
2007-10-26 14:08 ` Amin Azez
2007-10-26 14:33   ` Jan Engelhardt
     [not found]     ` <4722034C.5020803@ufomechanic.net>
2007-10-26 15:33       ` Jan Engelhardt

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.