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 {
1443
1443
void xfrm_init (void );
1444
1444
void xfrm4_init (void );
1445
1445
int xfrm_state_init (struct net * net );
1446
+ void xfrm_dev_init (void );
1446
1447
void xfrm_state_fini (struct net * net );
1447
1448
void xfrm4_state_init (void );
1448
1449
void xfrm4_protocol_init (void );
Original file line number Diff line number Diff line change 4
4
5
5
obj-$(CONFIG_XFRM) := xfrm_policy.o xfrm_state.o xfrm_hash.o \
6
6
xfrm_input.o xfrm_output.o \
7
- xfrm_sysctl.o xfrm_replay.o
7
+ xfrm_sysctl.o xfrm_replay.o xfrm_device.o
8
8
obj-$(CONFIG_XFRM_STATISTICS) += xfrm_proc.o
9
9
obj-$(CONFIG_XFRM_ALGO) += xfrm_algo.o
10
10
obj-$(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 <[email protected] >
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)
2929
2929
}
2930
2930
EXPORT_SYMBOL (xfrm_policy_unregister_afinfo );
2931
2931
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
-
2947
2932
#ifdef CONFIG_XFRM_STATISTICS
2948
2933
static int __net_init xfrm_statistics_init (struct net * net )
2949
2934
{
@@ -3020,7 +3005,7 @@ static int __net_init xfrm_policy_init(struct net *net)
3020
3005
INIT_WORK (& net -> xfrm .policy_hash_work , xfrm_hash_resize );
3021
3006
INIT_WORK (& net -> xfrm .policy_hthresh .work , xfrm_hash_rebuild );
3022
3007
if (net_eq (net , & init_net ))
3023
- register_netdevice_notifier ( & xfrm_dev_notifier );
3008
+ xfrm_dev_init ( );
3024
3009
return 0 ;
3025
3010
3026
3011
out_bydst :
You can’t perform that action at this time.
0 commit comments