From: Horms Subject: [patch 2/3] Honour source routing for LVS-NAT Date: Tue, 19 Sep 2006 11:45:09 +0900 Message-ID: <20060919025203.666441000@tabatha.lab.ultramonkey.org> References: <20060919024507.458115000@tabatha.lab.ultramonkey.org> Cc: Ken Brownfield , Roberto Nibali , Farid Sarwari , Patrick McHardy , Julian Anastasov , David Black , Joseph Mack NA3T , David Miller Return-path: To: netfilter-devel@lists.netfilter.org Content-Disposition: inline; filename=ip_route_me_harder-ipvs.patch List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: netfilter-devel-bounces@lists.netfilter.org Errors-To: netfilter-devel-bounces@lists.netfilter.org List-Id: netfilter-devel.vger.kernel.org For policy routing, packets originating from this machine itself may be routed differently to packets passing through. We want this packet to be routed as if it came from this machine itself. So re-compute the routing information using ip_route_me_harder(). This patch is derived from work by Ken Brownfield Cc: Ken Brownfield Signed-Off-By: Simon Horman --- a/net/ipv4/ipvs/ip_vs_core.c +++ b/net/ipv4/ipvs/ip_vs_core.c @@ -813,6 +813,16 @@ ip_vs_out(unsigned int hooknum, struct s skb->nh.iph->saddr = cp->vaddr; ip_send_check(skb->nh.iph); + /* For policy routing, packets originating from this + * machine itself may be routed differently to packets + * passing through. We want this packet to be routed as + * if it came from this machine itself. So re-compute + * the routing information. + */ + if (ip_route_me_harder(pskb, 1) != 0) + goto drop; + skb = *pskb; + IP_VS_DBG_PKT(10, pp, skb, 0, "After SNAT"); ip_vs_out_stats(cp, skb); -- -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/