Transparent Proxying Patches, Take 5
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest14 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/14 | Loosen source address check on IPv4 outputinclude/ net/ | +14 | 0 replies | |
| 2/14 | Implement IP_TRANSPARENT socket optioninclude/ include/ include/ +3 more | +18 | 0 replies | |
| 3/14 | Allow binding to non-local addresses if IP_TRANSPARENT is setnet/ | +1 | 0 replies | |
| 4/14 | Conditionally enable transparent flow flag when connectinginclude/ | +4 | 0 replies | |
| 5/14 | Handle TCP SYN+ACK/ACK/RST transparencyinclude/ include/ net/ +3 more | +29 | 0 replies | |
| 6/14 | Port redirection support for TCPinclude/ include/ net/ +2 more | +6 | 0 replies | |
| 7/14 | Export UDP socket lookup functioninclude/ net/ | +12 | 0 replies | |
| 8/14 | Split Netfilter IPv4 defragmentation into a separate moduleinclude/ net/ net/ +2 more | +110 | 0 replies | |
| 9/14 | iptables tproxy coreinclude/ net/ net/ +1 more | +144 | 0 replies | |
| 10/14 | iptables socket matchnet/ net/ net/ | +114 | 0 replies | |
| 11/14 | iptables TPROXY targetinclude/ net/ net/ +1 more | +142 | 0 replies | |
| 12/14 | Don't lookup the socket if there's a socket attached to the skbnet/ | +8 | 0 replies | |
| 13/14 | Don't lookup the socket if there's a socket attached to the skbnet/ | +8 | 0 replies | |
| 14/14 | Add documentationDocumentation/ | +62 | 0 replies |
Reviews trailers per patch
3 of 14 patches have a Reviewed-by or Acked-by.
| Patch | Patrick McHardy |
|---|---|
| 1/14 | A-b |
| 2/14 | A-b |
| 3/14 | A-b |
| 4/14 | |
| 5/14 | |
| 6/14 | |
| 7/14 | |
| 8/14 | |
| 9/14 | |
| 10/14 | |
| 11/14 | |
| 12/14 | |
| 13/14 | |
| 14/14 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 00/14] Transparent Proxying Patches, Take 5
Hi Dave,
This is the fifth round of transparent proxying patches following recent discussion on netfilter-devel [1,2].
The aim of the patchset is to make non-locally bound sockets work both for receiving and sending. The target is IPv4 TCP/UDP at the moment.
Speaking of the patches, there are two big parts:
* Output path (patches 1-6): these modifications make it possible to send IPv4 datagrams with non-local source IP address by:
- Introducing a new flowi flag (FLOWI_FLAG_ANYSRC) which disables source address checking in ip_route_output_slow(). This is also necessary for some of the tricks LVS does. [3]
- Adding the IP_TRANSPARENT socket option (setting this requires CAP_NET_ADMIN to prevent source address spoofing).
- Gluing these together across the TCP/UDP code.
* Input path (patches 7-13): these changes add redirection support for TCP along with an iptables target implementing NAT-less traffic interception, and an iptables match to make ahead-of-time socket lookups on PREROUTING. These combined with a set of iptables rules and policy routing make non-locally bound sockets work.
- Netfilter IPv4 defragmentation is split into a separate module. It's not particularly pretty but I see no other way of making sure the 'socket' match gets no fragmented IPv4 packets.
- The 'socket' iptables match does a socket lookup on the destination address and matches if a socket was found.
- The 'TPROXY' iptables target provides a way to intercept traffic without NAT -- it does an ahead-of-time socket lookup on the configured address and caches the socket reference in the skb.
- IPv4 TCP and UDP input path is modified to use this stored socket reference if it's present.
The last patch adds a short intro on how to use it. A trivial patch for netcat demonstrating the necessary modifications for proxies is available separately at [4].
References:
[1] http://marc.info/?l=netfilter-devel&m=119118672703285&w=2
[2] http://marc.info/?l=netfilter-devel&m=119135774918622&w=2
[3] http://marc.info/?l=linux-netdev&m=118065358510836&w=2
[4] http://people.netfilter.org/hidden/tproxy/netcat-ip_transparent-support.patch
Signature · 1 line
KOVACS Krisztian