Skip to content

Commit e9a441b

Browse files
Kirill Tkhaidavem330
authored andcommitted
xfrm: Register xfrm_dev_notifier in appropriate place
Currently, driver registers it from pernet_operations::init method, and this breaks modularity, because initialization of net namespace and netdevice notifiers are orthogonal actions. We don't have per-namespace netdevice notifiers; all of them are global for all devices in all namespaces. Signed-off-by: Kirill Tkhai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent caeeeda commit e9a441b

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

include/net/xfrm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1894,7 +1894,7 @@ static inline struct xfrm_offload *xfrm_offload(struct sk_buff *skb)
18941894
#endif
18951895
}
18961896

1897-
void __net_init xfrm_dev_init(void);
1897+
void __init xfrm_dev_init(void);
18981898

18991899
#ifdef CONFIG_XFRM_OFFLOAD
19001900
void xfrm_dev_resume(struct sk_buff *skb);

net/xfrm/xfrm_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ static struct notifier_block xfrm_dev_notifier = {
350350
.notifier_call = xfrm_dev_event,
351351
};
352352

353-
void __net_init xfrm_dev_init(void)
353+
void __init xfrm_dev_init(void)
354354
{
355355
register_netdevice_notifier(&xfrm_dev_notifier);
356356
}

net/xfrm/xfrm_policy.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2895,8 +2895,6 @@ static int __net_init xfrm_policy_init(struct net *net)
28952895
INIT_LIST_HEAD(&net->xfrm.policy_all);
28962896
INIT_WORK(&net->xfrm.policy_hash_work, xfrm_hash_resize);
28972897
INIT_WORK(&net->xfrm.policy_hthresh.work, xfrm_hash_rebuild);
2898-
if (net_eq(net, &init_net))
2899-
xfrm_dev_init();
29002898
return 0;
29012899

29022900
out_bydst:
@@ -2999,6 +2997,7 @@ void __init xfrm_init(void)
29992997
INIT_WORK(&xfrm_pcpu_work[i], xfrm_pcpu_work_fn);
30002998

30012999
register_pernet_subsys(&xfrm_net_ops);
3000+
xfrm_dev_init();
30023001
seqcount_init(&xfrm_policy_hash_generation);
30033002
xfrm_input_init();
30043003
}

0 commit comments

Comments
 (0)