aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-05-12 18:22:34 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-12 18:22:34 -0400
commite58b34425bfcb08c6bc8c520b82c37ffcec87072 (patch)
tree1a7990d7122036b3230d5ceb4e23c4f2d2d94a74
parent06c03c02ea528af0cbce50ce45ddd6a361864550 (diff)
ipvs: Use IP_VS_RT_MODE_* instead of magic constants.
[ Add some cases I missed, from Julian Anastasov ] Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/netfilter/ipvs/ip_vs_xmit.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index 6132b213eddc..5d393c5a802d 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -229,8 +229,6 @@ out_err:
229 229
230/* 230/*
231 * Get route to destination or remote server 231 * Get route to destination or remote server
232 * rt_mode: flags, &1=Allow local dest, &2=Allow non-local dest,
233 * &4=Allow redirect from remote daddr to local
234 */ 232 */
235static struct rt6_info * 233static struct rt6_info *
236__ip_vs_get_out_rt_v6(struct sk_buff *skb, struct ip_vs_dest *dest, 234__ip_vs_get_out_rt_v6(struct sk_buff *skb, struct ip_vs_dest *dest,
@@ -274,13 +272,14 @@ __ip_vs_get_out_rt_v6(struct sk_buff *skb, struct ip_vs_dest *dest,
274 } 272 }
275 273
276 local = __ip_vs_is_local_route6(rt); 274 local = __ip_vs_is_local_route6(rt);
277 if (!((local ? 1 : 2) & rt_mode)) { 275 if (!((local ? IP_VS_RT_MODE_LOCAL : IP_VS_RT_MODE_NON_LOCAL) &
276 rt_mode)) {
278 IP_VS_DBG_RL("Stopping traffic to %s address, dest: %pI6\n", 277 IP_VS_DBG_RL("Stopping traffic to %s address, dest: %pI6\n",
279 local ? "local":"non-local", daddr); 278 local ? "local":"non-local", daddr);
280 dst_release(&rt->dst); 279 dst_release(&rt->dst);
281 return NULL; 280 return NULL;
282 } 281 }
283 if (local && !(rt_mode & 4) && 282 if (local && !(rt_mode & IP_VS_RT_MODE_RDR) &&
284 !((ort = (struct rt6_info *) skb_dst(skb)) && 283 !((ort = (struct rt6_info *) skb_dst(skb)) &&
285 __ip_vs_is_local_route6(ort))) { 284 __ip_vs_is_local_route6(ort))) {
286 IP_VS_DBG_RL("Redirect from non-local address %pI6 to local " 285 IP_VS_DBG_RL("Redirect from non-local address %pI6 to local "
@@ -440,7 +439,8 @@ ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
440 439
441 EnterFunction(10); 440 EnterFunction(10);
442 441
443 if (!(rt = __ip_vs_get_out_rt_v6(skb, NULL, &iph->daddr, NULL, 0, 2))) 442 if (!(rt = __ip_vs_get_out_rt_v6(skb, NULL, &iph->daddr, NULL, 0,
443 IP_VS_RT_MODE_NON_LOCAL)))
444 goto tx_error_icmp; 444 goto tx_error_icmp;
445 445
446 /* MTU checking */ 446 /* MTU checking */
@@ -632,7 +632,9 @@ ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
632 } 632 }
633 633
634 if (!(rt = __ip_vs_get_out_rt_v6(skb, cp->dest, &cp->daddr.in6, NULL, 634 if (!(rt = __ip_vs_get_out_rt_v6(skb, cp->dest, &cp->daddr.in6, NULL,
635 0, 1|2|4))) 635 0, (IP_VS_RT_MODE_LOCAL |
636 IP_VS_RT_MODE_NON_LOCAL |
637 IP_VS_RT_MODE_RDR))))
636 goto tx_error_icmp; 638 goto tx_error_icmp;
637 local = __ip_vs_is_local_route6(rt); 639 local = __ip_vs_is_local_route6(rt);
638 /* 640 /*
@@ -875,7 +877,8 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
875 EnterFunction(10); 877 EnterFunction(10);
876 878
877 if (!(rt = __ip_vs_get_out_rt_v6(skb, cp->dest, &cp->daddr.in6, 879 if (!(rt = __ip_vs_get_out_rt_v6(skb, cp->dest, &cp->daddr.in6,
878 &saddr, 1, 1|2))) 880 &saddr, 1, (IP_VS_RT_MODE_LOCAL |
881 IP_VS_RT_MODE_NON_LOCAL))))
879 goto tx_error_icmp; 882 goto tx_error_icmp;
880 if (__ip_vs_is_local_route6(rt)) { 883 if (__ip_vs_is_local_route6(rt)) {
881 dst_release(&rt->dst); 884 dst_release(&rt->dst);
@@ -1050,7 +1053,8 @@ ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1050 EnterFunction(10); 1053 EnterFunction(10);
1051 1054
1052 if (!(rt = __ip_vs_get_out_rt_v6(skb, cp->dest, &cp->daddr.in6, NULL, 1055 if (!(rt = __ip_vs_get_out_rt_v6(skb, cp->dest, &cp->daddr.in6, NULL,
1053 0, 1|2))) 1056 0, (IP_VS_RT_MODE_LOCAL |
1057 IP_VS_RT_MODE_NON_LOCAL))))
1054 goto tx_error_icmp; 1058 goto tx_error_icmp;
1055 if (__ip_vs_is_local_route6(rt)) { 1059 if (__ip_vs_is_local_route6(rt)) {
1056 dst_release(&rt->dst); 1060 dst_release(&rt->dst);
@@ -1254,7 +1258,9 @@ ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1254 */ 1258 */
1255 1259
1256 if (!(rt = __ip_vs_get_out_rt_v6(skb, cp->dest, &cp->daddr.in6, NULL, 1260 if (!(rt = __ip_vs_get_out_rt_v6(skb, cp->dest, &cp->daddr.in6, NULL,
1257 0, 1|2|4))) 1261 0, (IP_VS_RT_MODE_LOCAL |
1262 IP_VS_RT_MODE_NON_LOCAL |
1263 IP_VS_RT_MODE_RDR))))
1258 goto tx_error_icmp; 1264 goto tx_error_icmp;
1259 1265
1260 local = __ip_vs_is_local_route6(rt); 1266 local = __ip_vs_is_local_route6(rt);