All of lore.kernel.org
 help / color / mirror / Atom feed
* Obtain original address from redirected connection
@ 2006-05-02  5:54 Pedro Werneck
  2006-05-02  6:36 ` Petr Pisar
  2006-05-04 18:51 ` Pascal Hambourg
  0 siblings, 2 replies; 3+ messages in thread
From: Pedro Werneck @ 2006-05-02  5:54 UTC (permalink / raw)
  To: netfilter


Hi


I have a daemon, a sort of proxy, written in Python, who receives
redirected connections with a rule like this:

iptables -t nat -A PREROUTING -j DNAT -p TCP -s source --to-destination host:port

The problem is that I need access to the original destination address,
but I could not find a way to do that when I wrote the daemon. Someone
suggested me using ULOG and parsing the address from ulogd logfile, and
this worked for some time, but now I have several simmultaneous
connections to the daemon and things get out of sync very easily when
reading the file.

Someone suggested using SO_ORIGINAL_DST. The constant is not available
in Python socket module, so I used the value 80, from iptables_ipv4.h
headers. The problem now is that the getsockopt() call doesn't work with
any values for 'level' parameter. First I tried 0 and 6, but they give
the errors 'Invalid Argument' and 'Protocol not available' respectively.
Just for testing I tried all other values from /etc/protocols and they
give 'Operation Not Supported'.


Is it possible to do this with SO_ORIGINAL_DST, or is there any other
approach for obtaining the original address ?


Thanks for any help

-- 
Pedro Werneck


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

end of thread, other threads:[~2006-05-04 18:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-02  5:54 Obtain original address from redirected connection Pedro Werneck
2006-05-02  6:36 ` Petr Pisar
2006-05-04 18:51 ` Pascal Hambourg

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.