/** * tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode */ static int tipc_core_start(void) { int res; get_random_bytes(&tipc_random, sizeof(tipc_random)); res = tipc_handler_start(); if (!res) res = tipc_ref_table_init(tipc_max_ports, tipc_random); if (!res) res = tipc_nametbl_init(); if (!res) res = tipc_netlink_start(); if (!res) res = tipc_socket_init(); if (!res) res = tipc_register_sysctl(); if (!res) res = tipc_subscr_start(); if (!res) res = tipc_cfg_init(); if (res) tipc_core_stop(); return res; }
static int __net_init tipc_init_net(struct net *net) { struct tipc_net *tn = net_generic(net, tipc_net_id); int err; tn->net_id = 4711; tn->own_addr = 0; get_random_bytes(&tn->random, sizeof(int)); INIT_LIST_HEAD(&tn->node_list); spin_lock_init(&tn->node_list_lock); err = tipc_sk_rht_init(net); if (err) goto out_sk_rht; err = tipc_nametbl_init(net); if (err) goto out_nametbl; err = tipc_subscr_start(net); if (err) goto out_subscr; return 0; out_subscr: tipc_nametbl_stop(net); out_nametbl: tipc_sk_rht_destroy(net); out_sk_rht: return err; }