tproxy: use the interface primary IP address as a default value for --on-ip
authorBalazs Scheidler <bazsi@balabit.hu>
Thu, 21 Oct 2010 14:21:10 +0000 (16:21 +0200)
committerPatrick McHardy <kaber@trash.net>
Thu, 21 Oct 2010 14:21:10 +0000 (16:21 +0200)
commitcc6eb433856983e91071469c4ce57accb6947ccb
tree283b72a9aea1af83b7a48de6833d0c554e5b3a06
parentb64c9256a9b76fc9f059f71bd08ba88fb0cbba2e
tproxy: use the interface primary IP address as a default value for --on-ip

The REDIRECT target and the older TProxy versions used the primary address
of the incoming interface as the default value of the --on-ip parameter.
This was unintentionally changed during the initial TProxy submission and
caused confusion among users.

Since IPv6 has no notion of primary address, we just select the first address
on the list: this way the socket lookup finds wildcard bound sockets
properly and we cannot really do better without the user telling us the
IPv6 address of the proxy.

This is implemented for both IPv4 and IPv6.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Signed-off-by: KOVACS Krisztian <hidden@balabit.hu>
Signed-off-by: Patrick McHardy <kaber@trash.net>
net/netfilter/xt_TPROXY.c