aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlex Gartrell <agartrell@fb.com>2014-09-09 19:40:24 -0400
committerSimon Horman <horms@verge.net.au>2014-09-15 20:03:35 -0400
commit391f503d69779867f05e9296ae523e9002c2d7ee (patch)
treeea11f39010e2717afe43edb4a2644e51b81cd820 /net
parentba38528aae6ee2d22226c6a78727ddc13512b068 (diff)
ipvs: prevent mixing heterogeneous pools and synchronization
The synchronization protocol is not compatible with heterogeneous pools, so we need to verify that we're not turning both on at the same time. Signed-off-by: Alex Gartrell <agartrell@fb.com> Acked-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 6bd2cc682137..462760eded94 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -779,6 +779,12 @@ __ip_vs_update_dest(struct ip_vs_service *svc, struct ip_vs_dest *dest,
779 struct ip_vs_scheduler *sched; 779 struct ip_vs_scheduler *sched;
780 int conn_flags; 780 int conn_flags;
781 781
782 /* We cannot modify an address and change the address family */
783 BUG_ON(!add && udest->af != dest->af);
784
785 if (add && udest->af != svc->af)
786 ipvs->mixed_address_family_dests++;
787
782 /* set the weight and the flags */ 788 /* set the weight and the flags */
783 atomic_set(&dest->weight, udest->weight); 789 atomic_set(&dest->weight, udest->weight);
784 conn_flags = udest->conn_flags & IP_VS_CONN_F_DEST_MASK; 790 conn_flags = udest->conn_flags & IP_VS_CONN_F_DEST_MASK;
@@ -1061,6 +1067,9 @@ static void __ip_vs_unlink_dest(struct ip_vs_service *svc,
1061 list_del_rcu(&dest->n_list); 1067 list_del_rcu(&dest->n_list);
1062 svc->num_dests--; 1068 svc->num_dests--;
1063 1069
1070 if (dest->af != svc->af)
1071 net_ipvs(svc->net)->mixed_address_family_dests--;
1072
1064 if (svcupd) { 1073 if (svcupd) {
1065 struct ip_vs_scheduler *sched; 1074 struct ip_vs_scheduler *sched;
1066 1075
@@ -3256,6 +3265,12 @@ static int ip_vs_genl_new_daemon(struct net *net, struct nlattr **attrs)
3256 attrs[IPVS_DAEMON_ATTR_SYNC_ID])) 3265 attrs[IPVS_DAEMON_ATTR_SYNC_ID]))
3257 return -EINVAL; 3266 return -EINVAL;
3258 3267
3268 /* The synchronization protocol is incompatible with mixed family
3269 * services
3270 */
3271 if (net_ipvs(net)->mixed_address_family_dests > 0)
3272 return -EINVAL;
3273
3259 return start_sync_thread(net, 3274 return start_sync_thread(net,
3260 nla_get_u32(attrs[IPVS_DAEMON_ATTR_STATE]), 3275 nla_get_u32(attrs[IPVS_DAEMON_ATTR_STATE]),
3261 nla_data(attrs[IPVS_DAEMON_ATTR_MCAST_IFN]), 3276 nla_data(attrs[IPVS_DAEMON_ATTR_MCAST_IFN]),