File tree Expand file tree Collapse file tree 4 files changed +46
-17
lines changed
Expand file tree Collapse file tree 4 files changed +46
-17
lines changed Original file line number Diff line number Diff line change @@ -1443,6 +1443,7 @@ struct xfrm6_tunnel {
14431443void xfrm_init (void );
14441444void xfrm4_init (void );
14451445int xfrm_state_init (struct net * net );
1446+ void xfrm_dev_init (void );
14461447void xfrm_state_fini (struct net * net );
14471448void xfrm4_state_init (void );
14481449void xfrm4_protocol_init (void );
Original file line number Diff line number Diff line change 44
55obj-$(CONFIG_XFRM) := xfrm_policy.o xfrm_state.o xfrm_hash.o \
66 xfrm_input.o xfrm_output.o \
7- xfrm_sysctl.o xfrm_replay.o
7+ xfrm_sysctl.o xfrm_replay.o xfrm_device.o
88obj-$(CONFIG_XFRM_STATISTICS) += xfrm_proc.o
99obj-$(CONFIG_XFRM_ALGO) += xfrm_algo.o
1010obj-$(CONFIG_XFRM_USER) += xfrm_user.o
Original file line number Diff line number Diff line change 1+ /*
2+ * xfrm_device.c - IPsec device offloading code.
3+ *
4+ * Copyright (c) 2015 secunet Security Networks AG
5+ *
6+ * Author:
7+ * Steffen Klassert <steffen.klassert@secunet.com>
8+ *
9+ * This program is free software; you can redistribute it and/or
10+ * modify it under the terms of the GNU General Public License
11+ * as published by the Free Software Foundation; either version
12+ * 2 of the License, or (at your option) any later version.
13+ */
14+
15+ #include <linux/errno.h>
16+ #include <linux/module.h>
17+ #include <linux/netdevice.h>
18+ #include <linux/skbuff.h>
19+ #include <linux/slab.h>
20+ #include <linux/spinlock.h>
21+ #include <net/dst.h>
22+ #include <net/xfrm.h>
23+ #include <linux/notifier.h>
24+
25+ static int xfrm_dev_event (struct notifier_block * this , unsigned long event , void * ptr )
26+ {
27+ struct net_device * dev = netdev_notifier_info_to_dev (ptr );
28+
29+ switch (event ) {
30+ case NETDEV_DOWN :
31+ xfrm_garbage_collect (dev_net (dev ));
32+ }
33+ return NOTIFY_DONE ;
34+ }
35+
36+ static struct notifier_block xfrm_dev_notifier = {
37+ .notifier_call = xfrm_dev_event ,
38+ };
39+
40+ void __net_init xfrm_dev_init (void )
41+ {
42+ register_netdevice_notifier (& xfrm_dev_notifier );
43+ }
Original file line number Diff line number Diff line change @@ -2929,21 +2929,6 @@ void xfrm_policy_unregister_afinfo(const struct xfrm_policy_afinfo *afinfo)
29292929}
29302930EXPORT_SYMBOL (xfrm_policy_unregister_afinfo );
29312931
2932- static int xfrm_dev_event (struct notifier_block * this , unsigned long event , void * ptr )
2933- {
2934- struct net_device * dev = netdev_notifier_info_to_dev (ptr );
2935-
2936- switch (event ) {
2937- case NETDEV_DOWN :
2938- xfrm_garbage_collect (dev_net (dev ));
2939- }
2940- return NOTIFY_DONE ;
2941- }
2942-
2943- static struct notifier_block xfrm_dev_notifier = {
2944- .notifier_call = xfrm_dev_event ,
2945- };
2946-
29472932#ifdef CONFIG_XFRM_STATISTICS
29482933static int __net_init xfrm_statistics_init (struct net * net )
29492934{
@@ -3020,7 +3005,7 @@ static int __net_init xfrm_policy_init(struct net *net)
30203005 INIT_WORK (& net -> xfrm .policy_hash_work , xfrm_hash_resize );
30213006 INIT_WORK (& net -> xfrm .policy_hthresh .work , xfrm_hash_rebuild );
30223007 if (net_eq (net , & init_net ))
3023- register_netdevice_notifier ( & xfrm_dev_notifier );
3008+ xfrm_dev_init ( );
30243009 return 0 ;
30253010
30263011out_bydst :
You can’t perform that action at this time.
0 commit comments