move ipvs to PRE/POSTROUTING
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest6 patches 10 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | move ipvs to PRE/POSTROUTINGnet/ | +7 | 0 replies | |
| 2/6 | move ipvs to PRE/POSTROUTINGnet/ | +7 | 8 replies | |
| 3/6 | move ipvs to PRE/POSTROUTINGnet/ | +0 | 0 replies | |
| 4/6 | move ipvs to PRE/POSTROUTINGnet/ | +0 | 0 replies | |
| 5/6 | move ipvs to PRE/POSTROUTINGinclude/ net/ net/ +2 more | +5 | 0 replies | |
| 6/6 | move ipvs to PRE/POSTROUTINGnet/ | +38 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/6] move ipvs to PRE/POSTROUTING
I'm a newbie at all of this so forgive me if I'm doing anything wrong. ;) I've attached the full patch here should anybody like to give it a try.
This patch set aims to separate LVS processing from netfilter processing in order to allow netfilter's capabilities to be fully utilized. The flow of traffic can visualized as:
incoming => de-lvs packets => netfilter => lvs packets => outgoing
The goal is for netfilter to only have to deal with CIP/VIP packets and for any translations netfilter might do of CIP to be transparent to LVS.
There are three main downfalls with this patch at present:
1) Having a VIP on a local interface causes the traffic to be delivered locally as VIP checks have been moved to the end of POST_ROUTING.
2) Localnode with address of 127.0.0.1 does not work as packets with a destination of 127.0.0.1 and a non-local source address are unconditionally dropped.
3) Firewall rules on existing installations will most likely break.
The first issue can probably be dealt with by The localnode issue could probably be dealt with by using a hook at the end of PREROUTING and the second issue could be handled like ipt_REDIRECT. I can't see a way to handle firewall rules though which implies that this needs to be optional and defaulting to off should it be considered for inclusion. I'd appreciate any suggestions on how that can be done elegantly.
Signature · 4 lines
Jason Stubbs <[email protected]> LINKTHINK INC. 東京都渋谷区桜ヶ丘町22-14 N.E.S S棟 3F TEL 03-5728-4772 FAX 03-5728-4773
include/net/ip_vs.h +0 -2
@@ -901,8 +901,6 @@ extern void ip_vs_zero_estimator(struct/* * Various IPVS packet transmitters (from ip_vs_xmit.c) */ -extern int ip_vs_null_xmit -(struct sk_buff *skb,struct ip_vs_conn *cp,struct ip_vs_protocol *pp);extern int ip_vs_bypass_xmit (struct sk_buff *skb,struct ip_vs_conn *cp,struct ip_vs_protocol *pp);extern int ip_vs_nat_xmit
net/ipv4/ipvs/ip_vs_conn.c +1 -4
@@ -350,6 +350,7 @@ static inline void ip_vs_bind_xmit(struc {switch (IP_VS_FWD_METHOD (cp)) {case IP_VS_CONN_F_MASQ : +case IP_VS_CONN_F_LOCALNODE : cp->packet_xmit = ip_vs_nat_xmit;break ;
@@ -361,10 +362,6 @@ static inline void ip_vs_bind_xmit(struc cp->packet_xmit = ip_vs_dr_xmit;break ; -case IP_VS_CONN_F_LOCALNODE : - cp->packet_xmit = ip_vs_null_xmit; -break ; -case IP_VS_CONN_F_BYPASS : cp->packet_xmit = ip_vs_bypass_xmit;break ;
net/ipv4/ipvs/ip_vs_core.c +41 -64
186 lines not on this page · raw message
net/ipv4/ipvs/ip_vs_proto_tcp.c +2 -1
@@ -535,7 +535,8 @@ tcp_app_conn_bind(struct ip_vs_conn *cp)int result =0 ;/* Default binding: bind app only for NAT */ -if (IP_VS_FWD_METHOD (cp) !=IP_VS_CONN_F_MASQ ) +if (IP_VS_FWD_METHOD (cp) !=IP_VS_CONN_F_MASQ && +IP_VS_FWD_METHOD (cp) !=IP_VS_CONN_F_LOCALNODE )return 0 ;/* Lookup application incarnations and bind the right one */
net/ipv4/ipvs/ip_vs_proto_udp.c +2 -1
@@ -329,7 +329,8 @@ static int udp_app_conn_bind(struct ip_vint result =0 ;/* Default binding: bind app only for NAT */ -if (IP_VS_FWD_METHOD (cp) !=IP_VS_CONN_F_MASQ ) +if (IP_VS_FWD_METHOD (cp) !=IP_VS_CONN_F_MASQ && +IP_VS_FWD_METHOD (cp) !=IP_VS_CONN_F_LOCALNODE )return 0 ;/* Lookup application incarnations and bind the right one */
net/ipv4/ipvs/ip_vs_xmit.c +9 -21
@@ -125,28 +125,15 @@ ip_vs_dst_reset(struct ip_vs_dest *dest)dst_release (old_dst); } -#define IP_VS_XMIT (skb, rt) \ +#define IP_VS_XMIT (skb) \ do { \ (skb)->ipvs_property = 1; \ skb_forward_csum(skb); \ - NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, (skb), NULL, \ - (rt)->u.dst.dev, dst_output); \ + dst_output(skb); \ } while (0)/* -* NULL transmitter (do nothing except return NF_ACCEPT) -*/ -int -ip_vs_null_xmit (struct sk_buff *skb,struct ip_vs_conn *cp, -struct ip_vs_protocol *pp) -{ -/* we do not touch skb and do not need pskb ptr */ -return NF_ACCEPT ; -} - - -/* * Bypass transmitter * Let packets bypass the destination when the destination is not * available, it may be only used in transparent cache cluster.
@@ -202,7 +189,7 @@ ip_vs_bypass_xmit(struct sk_buff *skb, s/* Another hack: avoid icmp_send in ip_fragment */ skb->local_df =1 ; -IP_VS_XMIT (skb, rt); +IP_VS_XMIT (skb);LeaveFunction (10 );return NF_STOLEN ;
@@ -278,7 +265,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, stru/* Another hack: avoid icmp_send in ip_fragment */ skb->local_df =1 ; -IP_VS_XMIT (skb, rt); +IP_VS_XMIT (skb);LeaveFunction (10 );return NF_STOLEN ;
@@ -413,7 +400,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, s/* Another hack: avoid icmp_send in ip_fragment */ skb->local_df =1 ; -IP_VS_XMIT (skb, rt); +IP_VS_XMIT (skb);LeaveFunction (10 );
@@ -471,7 +458,7 @@ ip_vs_dr_xmit(struct sk_buff *skb, struc/* Another hack: avoid icmp_send in ip_fragment */ skb->local_df =1 ; -IP_VS_XMIT (skb, rt); +IP_VS_XMIT (skb);LeaveFunction (10 );return NF_STOLEN ;
@@ -502,7 +489,8 @@ ip_vs_icmp_xmit(struct sk_buff *skb, str/* The ICMP packet for VS/TUN, VS/DR and LOCALNODE will be forwarded directly here, because there is no need to translate address/port back */ -if (IP_VS_FWD_METHOD (cp) !=IP_VS_CONN_F_MASQ ) { +if (IP_VS_FWD_METHOD (cp) !=IP_VS_CONN_F_MASQ && +IP_VS_FWD_METHOD (cp) !=IP_VS_CONN_F_LOCALNODE ) {if (cp->packet_xmit) rc = cp->packet_xmit (skb, cp, pp);else
@@ -544,7 +532,7 @@ ip_vs_icmp_xmit(struct sk_buff *skb, str/* Another hack: avoid icmp_send in ip_fragment */ skb->local_df =1 ; -IP_VS_XMIT (skb, rt); +IP_VS_XMIT (skb); rc =NF_STOLEN ; goto out;