Commit 5ccbf891 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso
Browse files


Pablo Neira Ayuso says:

====================
IPVS updates for v5.5

1) Two patches to speedup ipvs netns dismantle, from Haishuang Yan.

2) Three patches to add selftest script for ipvs, also from
   Haishuang Yan.

3) Simplify __ip_vs_get_out_rt() from zhang kai.
====================

Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parents 63f55acf 176a5204
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1324,7 +1324,7 @@ void ip_vs_protocol_net_cleanup(struct netns_ipvs *ipvs);
void ip_vs_control_net_cleanup(struct netns_ipvs *ipvs);
void ip_vs_estimator_net_cleanup(struct netns_ipvs *ipvs);
void ip_vs_sync_net_cleanup(struct netns_ipvs *ipvs);
void ip_vs_service_net_cleanup(struct netns_ipvs *ipvs);
void ip_vs_service_nets_cleanup(struct list_head *net_list);

/* IPVS application functions
 * (from ip_vs_app.c)
+28 −19
Original line number Diff line number Diff line
@@ -2402,11 +2402,14 @@ estimator_fail:
	return -ENOMEM;
}

static void __net_exit __ip_vs_cleanup(struct net *net)
static void __net_exit __ip_vs_cleanup_batch(struct list_head *net_list)
{
	struct netns_ipvs *ipvs = net_ipvs(net);
	struct netns_ipvs *ipvs;
	struct net *net;

	ip_vs_service_net_cleanup(ipvs);	/* ip_vs_flush() with locks */
	ip_vs_service_nets_cleanup(net_list);	/* ip_vs_flush() with locks */
	list_for_each_entry(net, net_list, exit_list) {
		ipvs = net_ipvs(net);
		ip_vs_conn_net_cleanup(ipvs);
		ip_vs_app_net_cleanup(ipvs);
		ip_vs_protocol_net_cleanup(ipvs);
@@ -2415,6 +2418,7 @@ static void __net_exit __ip_vs_cleanup(struct net *net)
		IP_VS_DBG(2, "ipvs netns %d released\n", ipvs->gen);
		net->ipvs = NULL;
	}
}

static int __net_init __ip_vs_dev_init(struct net *net)
{
@@ -2429,27 +2433,32 @@ hook_fail:
	return ret;
}

static void __net_exit __ip_vs_dev_cleanup(struct net *net)
static void __net_exit __ip_vs_dev_cleanup_batch(struct list_head *net_list)
{
	struct netns_ipvs *ipvs = net_ipvs(net);
	struct netns_ipvs *ipvs;
	struct net *net;

	EnterFunction(2);
	list_for_each_entry(net, net_list, exit_list) {
		ipvs = net_ipvs(net);
		nf_unregister_net_hooks(net, ip_vs_ops, ARRAY_SIZE(ip_vs_ops));
		ipvs->enable = 0;	/* Disable packet reception */
		smp_wmb();
		ip_vs_sync_net_cleanup(ipvs);
	}
	LeaveFunction(2);
}

static struct pernet_operations ipvs_core_ops = {
	.init = __ip_vs_init,
	.exit = __ip_vs_cleanup,
	.exit_batch = __ip_vs_cleanup_batch,
	.id   = &ip_vs_net_id,
	.size = sizeof(struct netns_ipvs),
};

static struct pernet_operations ipvs_core_dev_ops = {
	.init = __ip_vs_dev_init,
	.exit = __ip_vs_dev_cleanup,
	.exit_batch = __ip_vs_dev_cleanup_batch,
};

/*
+9 −3
Original line number Diff line number Diff line
@@ -1607,14 +1607,20 @@ static int ip_vs_flush(struct netns_ipvs *ipvs, bool cleanup)

/*
 *	Delete service by {netns} in the service table.
 *	Called by __ip_vs_cleanup()
 *	Called by __ip_vs_batch_cleanup()
 */
void ip_vs_service_net_cleanup(struct netns_ipvs *ipvs)
void ip_vs_service_nets_cleanup(struct list_head *net_list)
{
	struct netns_ipvs *ipvs;
	struct net *net;

	EnterFunction(2);
	/* Check for "full" addressed entries */
	mutex_lock(&__ip_vs_mutex);
	list_for_each_entry(net, net_list, exit_list) {
		ipvs = net_ipvs(net);
		ip_vs_flush(ipvs, true);
	}
	mutex_unlock(&__ip_vs_mutex);
	LeaveFunction(2);
}
+6 −12
Original line number Diff line number Diff line
@@ -407,12 +407,9 @@ __ip_vs_get_out_rt(struct netns_ipvs *ipvs, int skb_af, struct sk_buff *skb,
		goto err_put;

	skb_dst_drop(skb);
	if (noref) {
		if (!local)
	if (noref)
		skb_dst_set_noref(skb, &rt->dst);
	else
			skb_dst_set(skb, dst_clone(&rt->dst));
	} else
		skb_dst_set(skb, &rt->dst);

	return local;
@@ -574,12 +571,9 @@ __ip_vs_get_out_rt_v6(struct netns_ipvs *ipvs, int skb_af, struct sk_buff *skb,
		goto err_put;

	skb_dst_drop(skb);
	if (noref) {
		if (!local)
	if (noref)
		skb_dst_set_noref(skb, &rt->dst);
	else
			skb_dst_set(skb, dst_clone(&rt->dst));
	} else
		skb_dst_set(skb, &rt->dst);

	return local;
+1 −1
Original line number Diff line number Diff line
@@ -2,6 +2,6 @@
# Makefile for netfilter selftests

TEST_PROGS := nft_trans_stress.sh nft_nat.sh bridge_brouter.sh \
	conntrack_icmp_related.sh nft_flowtable.sh
	conntrack_icmp_related.sh nft_flowtable.sh ipvs.sh

include ../lib.mk
Loading