Unverified Commit 2c13ab84 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15085 ila: call nf_unregister_net_hooks() sooner

parents 26a383fc 58adb531
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ int ila_lwt_init(void);
void ila_lwt_fini(void);

int ila_xlat_init_net(struct net *net);
void ila_xlat_pre_exit_net(struct net *net);
void ila_xlat_exit_net(struct net *net);

int ila_xlat_nl_cmd_add_mapping(struct sk_buff *skb, struct genl_info *info);
+6 −0
Original line number Diff line number Diff line
@@ -71,6 +71,11 @@ static __net_init int ila_init_net(struct net *net)
	return err;
}

static __net_exit void ila_pre_exit_net(struct net *net)
{
	ila_xlat_pre_exit_net(net);
}

static __net_exit void ila_exit_net(struct net *net)
{
	ila_xlat_exit_net(net);
@@ -78,6 +83,7 @@ static __net_exit void ila_exit_net(struct net *net)

static struct pernet_operations ila_net_ops = {
	.init = ila_init_net,
	.pre_exit = ila_pre_exit_net,
	.exit = ila_exit_net,
	.id   = &ila_net_id,
	.size = sizeof(struct ila_net),
+9 −4
Original line number Diff line number Diff line
@@ -626,6 +626,15 @@ int ila_xlat_init_net(struct net *net)
	return 0;
}

void ila_xlat_pre_exit_net(struct net *net)
{
	struct ila_net *ilan = net_generic(net, ila_net_id);

	if (ilan->xlat.hooks_registered)
		nf_unregister_net_hooks(net, ila_nf_hook_ops,
					ARRAY_SIZE(ila_nf_hook_ops));
}

void ila_xlat_exit_net(struct net *net)
{
	struct ila_net *ilan = net_generic(net, ila_net_id);
@@ -633,10 +642,6 @@ void ila_xlat_exit_net(struct net *net)
	rhashtable_free_and_destroy(&ilan->xlat.rhash_table, ila_free_cb, NULL);

	free_bucket_spinlocks(ilan->xlat.locks);

	if (ilan->xlat.hooks_registered)
		nf_unregister_net_hooks(net, ila_nf_hook_ops,
					ARRAY_SIZE(ila_nf_hook_ops));
}

static int ila_xlat_addr(struct sk_buff *skb, bool sir2ila)