nat/redirect question
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Jesper L. Nielsen
Hello Harald.
I've been puzzling around with netfilter for quite a while now, debugging and digging into the code. Now I wish to write my own little thing for the NAT table.
Quoted 7 lines
The idea is to make a NAT helper that is bound to incoming port 80. The helper should be able to parse the packages containing HTTP requests, and upon seing af defined host, lets say 'slashdot.org' it should be able to redirect this trafic to a different port (eg. port 8000).
So normal traffic flows by into port 80, but upon a HTTP request
containing the line: 'Host: slashdot.org', it should be sent to port 8000, which could be a different HTTP server, listening on port 8000.
how do you want to do that?
you cannot have a couple of packets pass, and then at a certain point within the TCP stream start redirecting packets to other hosts/sockets/...
At the time you see the ULR (http get request), the tcp connectin is established, the full handshake has completed, window scaling/ecn/... has been negotiated, etc.
The only solution for your problem seems to be a transparent proxy which redirects part of the traffic, and passes on all other traffic.
Quoted 2 lines
Thank you
Jesper L. Nielsen
Signature · 5 lines
Live long and prosper - Harald Welte / [email protected] http://www.gnumonks.org/ ============================================================================ "If this were a dictatorship, it'd be a heck of a lot easier, just so long as I'm the dictator." -- George W. Bush Dec 18, 2000
Quoted 15 lines · Harald Welte
Quoted 8 lines · Jesper L. Nielsen
Hello Harald.
The idea is to make a NAT helper that is bound to incoming port 80. The helper should be able to parse the packages containing HTTP requests, and upon seing af defined host, lets say 'slashdot.org' it should be able to redirect this trafic to a different port (eg. port 8000).
So normal traffic flows by into port 80, but upon a HTTP request
containing the line: 'Host: slashdot.org', it should be sent to port 8000, which could be a different HTTP server, listening on port 8000.how do you want to do that?
you cannot have a couple of packets pass, and then at a certain point within the TCP stream start redirecting packets to other hosts/sockets/...
Quoted 6 lines
At the time you see the ULR (http get request), the tcp connectin is established, the full handshake has completed, window scaling/ecn/... has been negotiated, etc.
The only solution for your problem seems to be a transparent proxy which redirects part of the traffic, and passes on all other traffic.
In fact transparent HTTP proxies usually read in the whole request (method + headers), and start connecting to the server after the request has been successfully parsed. Zorp for example does exactly this, and it is easy to do this kind of job.
Signature · 2 lines
Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1