core.c (fdeba99b1e58ecd18c2940c453e19e4ef20ff591) core.c (d966ddcc38217a6110a6a0ff37ad2dee7d42e23e)
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

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

55 struct tipc_net *tn = net_generic(net, tipc_net_id);
56 int err;
57
58 tn->net_id = 4711;
59 tn->node_addr = 0;
60 tn->trial_addr = 0;
61 tn->addr_trial_end = 0;
62 tn->capabilities = TIPC_NODE_CAPABILITIES;
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

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

55 struct tipc_net *tn = net_generic(net, tipc_net_id);
56 int err;
57
58 tn->net_id = 4711;
59 tn->node_addr = 0;
60 tn->trial_addr = 0;
61 tn->addr_trial_end = 0;
62 tn->capabilities = TIPC_NODE_CAPABILITIES;
63 INIT_WORK(&tn->final_work.work, tipc_net_finalize_work);
63 memset(tn->node_id, 0, sizeof(tn->node_id));
64 memset(tn->node_id_string, 0, sizeof(tn->node_id_string));
65 tn->mon_threshold = TIPC_DEF_MON_THRESHOLD;
66 get_random_bytes(&tn->random, sizeof(int));
67 INIT_LIST_HEAD(&tn->node_list);
68 spin_lock_init(&tn->node_list_lock);
69
70#ifdef CONFIG_TIPC_CRYPTO

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

102 tipc_crypto_stop(&tn->crypto_tx);
103out_crypto:
104#endif
105 return err;
106}
107
108static void __net_exit tipc_exit_net(struct net *net)
109{
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
71#ifdef CONFIG_TIPC_CRYPTO

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

103 tipc_crypto_stop(&tn->crypto_tx);
104out_crypto:
105#endif
106 return err;
107}
108
109static void __net_exit tipc_exit_net(struct net *net)
110{
111 struct tipc_net *tn = tipc_net(net);
112
110 tipc_detach_loopback(net);
113 tipc_detach_loopback(net);
114 /* Make sure the tipc_net_finalize_work() finished */
115 cancel_work_sync(&tn->final_work.work);
111 tipc_net_stop(net);
112
116 tipc_net_stop(net);
117
113 /* Make sure the tipc_net_finalize_work stopped
114 * before releasing the resources.
115 */
116 flush_scheduled_work();
117 tipc_bcast_stop(net);
118 tipc_nametbl_stop(net);
119 tipc_sk_rht_destroy(net);
120#ifdef CONFIG_TIPC_CRYPTO
121 tipc_crypto_stop(&tipc_net(net)->crypto_tx);
122#endif
123}
124

--- 105 unchanged lines hidden ---
118 tipc_bcast_stop(net);
119 tipc_nametbl_stop(net);
120 tipc_sk_rht_destroy(net);
121#ifdef CONFIG_TIPC_CRYPTO
122 tipc_crypto_stop(&tipc_net(net)->crypto_tx);
123#endif
124}
125

--- 105 unchanged lines hidden ---