[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4B15F393.5030808@gmail.com>
Date: Wed, 02 Dec 2009 05:56:51 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Ashwani Wason <ashwas@...il.com>
CC: netdev@...r.kernel.org, tproxy@...ts.balabit.hu
Subject: Re: SO_BINDTODEVICE and IP_TRANSPARENT (TPROXY)
Ashwani Wason a écrit :
> After debugging a bit into how nf_tproxy_get_sock_v4() looks up a
> listener for foreign connections using __inet_lookup_listener() and
> compute_score() I found that the problem was happening because of the
> way I had the TPROXY rules setup. Those rules work if the proxy has a
> single listening socket for INADDR_ANY. If multiple listening sockets
> must be used, one for each local address, which is the case for using
> SO_BINDTODEVICE then the TPROXY rules must also be "fully qualified"
> (with interface name [-i] and IP address thereof [--on-ip]). So the
> rules in my example change as follows...
>
> Instead of using:
>
>> iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 4002
>
> Use:
>
> iptables -t mangle -A PREROUTING *-i eth0* -p tcp --dport 80 -j TPROXY
> --tproxy-mark 0x1/0x1 *--on-ip 192.168.0.65* --on-port 4002
> iptables -t mangle -A PREROUTING *-i eth1* -p tcp --dport 80 -j TPROXY
> --tproxy-mark 0x1/0x1 *--on-ip 192.168.1.65* --on-port 4002
>
> With these rules the listening socket was looked up correctly and the
> sk_bound_dev_if of the socket was honored.
>
> - Ashwani
>
> PS: Sorry to anyone (Jamal) who already spent any time on this.
> PPS: Copying the tproxy list in case someone else is looking for this
> stuff in the future.
Thanks a lot for sharing your discoveries :)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists