]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: Fix ip_route_me_harder triggering ip_rt_bug
authorJulian Anastasov <ja@ssi.bg>
Sat, 18 Jun 2011 07:53:59 +0000 (07:53 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 29 Jun 2011 12:47:32 +0000 (05:47 -0700)
commit1730eeb6abb88bd51dadce53581a2ea4ee9b5d7e
treebccb0b3262b5885324f27c08858abe9c5bdce26e
parent980232e9d6d85ed7a0a10cb1dfe731f933717f46
netfilter: Fix ip_route_me_harder triggering ip_rt_bug

Avoid creating input routes with ip_route_me_harder.
It does not work for locally generated packets. Instead,
restrict sockets to provide valid saddr for output route (or
unicast saddr for transparent proxy). For other traffic
allow saddr to be unicast or local but if callers forget
to check saddr type use 0 for the output route.

The resulting handling should be:

- REJECT TCP:
- in INPUT we can provide addr_type = RTN_LOCAL but
better allow rejecting traffic delivered with
local route (no IP address => use RTN_UNSPEC to
allow also RTN_UNICAST).
- FORWARD: RTN_UNSPEC => allow RTN_LOCAL/RTN_UNICAST
saddr, add fix to ignore RTN_BROADCAST and RTN_MULTICAST
- OUTPUT: RTN_UNSPEC

- NAT, mangle, ip_queue, nf_ip_reroute: RTN_UNSPEC in LOCAL_OUT

- IPVS:
- use RTN_LOCAL in LOCAL_OUT and FORWARD after SNAT
to restrict saddr to be local

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/netfilter.c
net/ipv4/netfilter/ipt_REJECT.c