All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Gartrell <agartrell@fb.com>
To: <netdev@vger.kernel.org>
Cc: <horms@verge.net.au>, <ja@ssi.bg>, <lvs-devel@vger.kernel.org>,
	<kernel-team@fb.com>, <ps@fb.com>,
	Alex Gartrell <agartrell@fb.com>
Subject: [PATCH net-next 05/20] ipvs: prevent mixing heterogeneous pools and synchronization
Date: Tue, 9 Sep 2014 16:40:24 -0700	[thread overview]
Message-ID: <1410306039-2977-6-git-send-email-agartrell@fb.com> (raw)
In-Reply-To: <1410306039-2977-1-git-send-email-agartrell@fb.com>

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>
---
 include/net/ip_vs.h            |  4 ++++
 net/netfilter/ipvs/ip_vs_ctl.c | 15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 7600dbe..576d7f0 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -990,6 +990,10 @@ struct netns_ipvs {
 	char			backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
 	/* net name space ptr */
 	struct net		*net;            /* Needed by timer routines */
+	/* Number of heterogeneous destinations, needed because
+	 * heterogeneous are not supported when synchronization is
+	 * enabled */
+	unsigned int		mixed_address_family_dests;
 };
 
 #define DEFAULT_SYNC_THRESHOLD	3
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 33d04ee..175945f 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,
 	struct ip_vs_scheduler *sched;
 	int conn_flags;
 
+	/* We cannot modify an address and change the address family */
+	BUG_ON(!add && udest->af != dest->af);
+
+	if (add && udest->af != svc->af)
+		ipvs->mixed_address_family_dests++;
+
 	/* set the weight and the flags */
 	atomic_set(&dest->weight, udest->weight);
 	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,
 	list_del_rcu(&dest->n_list);
 	svc->num_dests--;
 
+	if (dest->af != svc->af)
+		net_ipvs(svc->net)->mixed_address_family_dests--;
+
 	if (svcupd) {
 		struct ip_vs_scheduler *sched;
 
@@ -3245,6 +3254,12 @@ static int ip_vs_genl_new_daemon(struct net *net, struct nlattr **attrs)
 	      attrs[IPVS_DAEMON_ATTR_SYNC_ID]))
 		return -EINVAL;
 
+	/* The synchronization protocol is incompatible with mixed family
+	 * services
+	 */
+	if (net_ipvs(net)->mixed_address_family_dests > 0)
+		return -EINVAL;
+
 	return start_sync_thread(net,
 				 nla_get_u32(attrs[IPVS_DAEMON_ATTR_STATE]),
 				 nla_data(attrs[IPVS_DAEMON_ATTR_MCAST_IFN]),
-- 
1.8.1


WARNING: multiple messages have this Message-ID (diff)
From: Alex Gartrell <agartrell@fb.com>
To: netdev@vger.kernel.org
Cc: horms@verge.net.au, ja@ssi.bg, lvs-devel@vger.kernel.org,
	kernel-team@fb.com, ps@fb.com, Alex Gartrell <agartrell@fb.com>
Subject: [PATCH net-next 05/20] ipvs: prevent mixing heterogeneous pools and synchronization
Date: Tue, 9 Sep 2014 16:40:24 -0700	[thread overview]
Message-ID: <1410306039-2977-6-git-send-email-agartrell@fb.com> (raw)
In-Reply-To: <1410306039-2977-1-git-send-email-agartrell@fb.com>

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>
---
 include/net/ip_vs.h            |  4 ++++
 net/netfilter/ipvs/ip_vs_ctl.c | 15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 7600dbe..576d7f0 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -990,6 +990,10 @@ struct netns_ipvs {
 	char			backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
 	/* net name space ptr */
 	struct net		*net;            /* Needed by timer routines */
+	/* Number of heterogeneous destinations, needed because
+	 * heterogeneous are not supported when synchronization is
+	 * enabled */
+	unsigned int		mixed_address_family_dests;
 };
 
 #define DEFAULT_SYNC_THRESHOLD	3
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 33d04ee..175945f 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,
 	struct ip_vs_scheduler *sched;
 	int conn_flags;
 
+	/* We cannot modify an address and change the address family */
+	BUG_ON(!add && udest->af != dest->af);
+
+	if (add && udest->af != svc->af)
+		ipvs->mixed_address_family_dests++;
+
 	/* set the weight and the flags */
 	atomic_set(&dest->weight, udest->weight);
 	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,
 	list_del_rcu(&dest->n_list);
 	svc->num_dests--;
 
+	if (dest->af != svc->af)
+		net_ipvs(svc->net)->mixed_address_family_dests--;
+
 	if (svcupd) {
 		struct ip_vs_scheduler *sched;
 
@@ -3245,6 +3254,12 @@ static int ip_vs_genl_new_daemon(struct net *net, struct nlattr **attrs)
 	      attrs[IPVS_DAEMON_ATTR_SYNC_ID]))
 		return -EINVAL;
 
+	/* The synchronization protocol is incompatible with mixed family
+	 * services
+	 */
+	if (net_ipvs(net)->mixed_address_family_dests > 0)
+		return -EINVAL;
+
 	return start_sync_thread(net,
 				 nla_get_u32(attrs[IPVS_DAEMON_ATTR_STATE]),
 				 nla_data(attrs[IPVS_DAEMON_ATTR_MCAST_IFN]),
-- 
1.8.1


  parent reply	other threads:[~2014-09-09 23:40 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09 23:40 [PATCH net-next 00/20] Support v6 real servers in v4 pools and vice versa Alex Gartrell
2014-09-09 23:40 ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 01/20] ipvs: Add destination address family to netlink interface Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 02/20] ipvs: Supply destination addr family to ip_vs_{lookup_dest,find_dest} Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 03/20] ipvs: Pass destination address family to ip_vs_trash_get_dest Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 04/20] ipvs: Supply destination address family to ip_vs_conn_new Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` Alex Gartrell [this message]
2014-09-09 23:40   ` [PATCH net-next 05/20] ipvs: prevent mixing heterogeneous pools and synchronization Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 06/20] ipvs: Pull out crosses_local_route_boundary logic Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 07/20] ipvs: Pull out update_pmtu code Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 08/20] ipvs: Add generic ensure_mtu_is_adequate to handle mixed pools Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 09/20] ipvs: support ipv4 in ipv6 and ipv6 in ipv4 tunnel forwarding Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 10/20] ipvs: address family of LBLC entry depends on svc family Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 11/20] ipvs: address family of LBLCR " Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 12/20] ipvs: use correct address family in DH logs Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 13/20] ipvs: use correct address family in LC logs Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 14/20] ipvs: use correct address family in NQ logs Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 15/20] ipvs: use correct address family in RR logs Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 16/20] ipvs: use correct address family in SED logs Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 17/20] ipvs: use correct address family in SH logs Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 18/20] ipvs: use correct address family in WLC logs Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 19/20] ipvs: use the new dest addr family field Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-09 23:40 ` [PATCH net-next 20/20] ipvs: Allow heterogeneous pools now that we support them Alex Gartrell
2014-09-09 23:40   ` Alex Gartrell
2014-09-10  6:01 ` [PATCH net-next 00/20] Support v6 real servers in v4 pools and vice versa Julian Anastasov
2014-09-10  6:22   ` Simon Horman
2014-09-10 15:16     ` Pablo Neira Ayuso
2014-09-10 23:55       ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410306039-2977-6-git-send-email-agartrell@fb.com \
    --to=agartrell@fb.com \
    --cc=horms@verge.net.au \
    --cc=ja@ssi.bg \
    --cc=kernel-team@fb.com \
    --cc=lvs-devel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ps@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.