core.c (f73b12812a3d1d798b7517547ccdcf864844d2cd) core.c (fc1b6d6de2208774efd2a20bf0daddb02d18b1e0)
1/*
2 * net/tipc/core.c: TIPC module code
3 *
4 * Copyright (c) 2003-2006, 2013, Ericsson AB
5 * Copyright (c) 2005-2006, 2010-2013, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 30 unchanged lines hidden (view full) ---

39#include "core.h"
40#include "name_table.h"
41#include "subscr.h"
42#include "bearer.h"
43#include "net.h"
44#include "socket.h"
45#include "bcast.h"
46#include "node.h"
1/*
2 * net/tipc/core.c: TIPC module code
3 *
4 * Copyright (c) 2003-2006, 2013, Ericsson AB
5 * Copyright (c) 2005-2006, 2010-2013, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 30 unchanged lines hidden (view full) ---

39#include "core.h"
40#include "name_table.h"
41#include "subscr.h"
42#include "bearer.h"
43#include "net.h"
44#include "socket.h"
45#include "bcast.h"
46#include "node.h"
47#include "crypto.h"
47
48#include <linux/module.h>
49
50/* configurable TIPC parameters */
51unsigned int tipc_net_id __read_mostly;
52int sysctl_tipc_rmem[3] __read_mostly; /* min/default/max */
53
54static int __net_init tipc_init_net(struct net *net)

--- 8 unchanged lines hidden (view full) ---

63 tn->capabilities = TIPC_NODE_CAPABILITIES;
64 memset(tn->node_id, 0, sizeof(tn->node_id));
65 memset(tn->node_id_string, 0, sizeof(tn->node_id_string));
66 tn->mon_threshold = TIPC_DEF_MON_THRESHOLD;
67 get_random_bytes(&tn->random, sizeof(int));
68 INIT_LIST_HEAD(&tn->node_list);
69 spin_lock_init(&tn->node_list_lock);
70
48
49#include <linux/module.h>
50
51/* configurable TIPC parameters */
52unsigned int tipc_net_id __read_mostly;
53int sysctl_tipc_rmem[3] __read_mostly; /* min/default/max */
54
55static int __net_init tipc_init_net(struct net *net)

--- 8 unchanged lines hidden (view full) ---

64 tn->capabilities = TIPC_NODE_CAPABILITIES;
65 memset(tn->node_id, 0, sizeof(tn->node_id));
66 memset(tn->node_id_string, 0, sizeof(tn->node_id_string));
67 tn->mon_threshold = TIPC_DEF_MON_THRESHOLD;
68 get_random_bytes(&tn->random, sizeof(int));
69 INIT_LIST_HEAD(&tn->node_list);
70 spin_lock_init(&tn->node_list_lock);
71
72#ifdef CONFIG_TIPC_CRYPTO
73 err = tipc_crypto_start(&tn->crypto_tx, net, NULL);
74 if (err)
75 goto out_crypto;
76#endif
71 err = tipc_sk_rht_init(net);
72 if (err)
73 goto out_sk_rht;
74
75 err = tipc_nametbl_init(net);
76 if (err)
77 goto out_nametbl;
78

--- 9 unchanged lines hidden (view full) ---

88
89 return 0;
90
91out_bclink:
92 tipc_nametbl_stop(net);
93out_nametbl:
94 tipc_sk_rht_destroy(net);
95out_sk_rht:
77 err = tipc_sk_rht_init(net);
78 if (err)
79 goto out_sk_rht;
80
81 err = tipc_nametbl_init(net);
82 if (err)
83 goto out_nametbl;
84

--- 9 unchanged lines hidden (view full) ---

94
95 return 0;
96
97out_bclink:
98 tipc_nametbl_stop(net);
99out_nametbl:
100 tipc_sk_rht_destroy(net);
101out_sk_rht:
102
103#ifdef CONFIG_TIPC_CRYPTO
104 tipc_crypto_stop(&tn->crypto_tx);
105out_crypto:
106#endif
96 return err;
97}
98
99static void __net_exit tipc_exit_net(struct net *net)
100{
101 tipc_detach_loopback(net);
102 tipc_net_stop(net);
103 tipc_bcast_stop(net);
104 tipc_nametbl_stop(net);
105 tipc_sk_rht_destroy(net);
107 return err;
108}
109
110static void __net_exit tipc_exit_net(struct net *net)
111{
112 tipc_detach_loopback(net);
113 tipc_net_stop(net);
114 tipc_bcast_stop(net);
115 tipc_nametbl_stop(net);
116 tipc_sk_rht_destroy(net);
117#ifdef CONFIG_TIPC_CRYPTO
118 tipc_crypto_stop(&tipc_net(net)->crypto_tx);
119#endif
106}
107
108static void __net_exit tipc_pernet_pre_exit(struct net *net)
109{
110 tipc_node_pre_cleanup_net(net);
111}
112
113static struct pernet_operations tipc_pernet_pre_exit_ops = {

--- 98 unchanged lines hidden ---
120}
121
122static void __net_exit tipc_pernet_pre_exit(struct net *net)
123{
124 tipc_node_pre_cleanup_net(net);
125}
126
127static struct pernet_operations tipc_pernet_pre_exit_ops = {

--- 98 unchanged lines hidden ---