diff options
Diffstat (limited to 'net/tipc')
| -rw-r--r-- | net/tipc/bearer.c | 7 | ||||
| -rw-r--r-- | net/tipc/config.c | 2 | ||||
| -rw-r--r-- | net/tipc/core.c | 109 | ||||
| -rw-r--r-- | net/tipc/core.h | 1 | ||||
| -rw-r--r-- | net/tipc/name_table.c | 3 | ||||
| -rw-r--r-- | net/tipc/netlink.c | 8 | ||||
| -rw-r--r-- | net/tipc/ref.c | 3 | ||||
| -rw-r--r-- | net/tipc/server.c | 5 | ||||
| -rw-r--r-- | net/tipc/server.h | 2 | ||||
| -rw-r--r-- | net/tipc/socket.c | 8 | 
10 files changed, 66 insertions, 82 deletions
| diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index a38c89969c68..574b86193b15 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
| @@ -610,8 +610,13 @@ static struct notifier_block notifier = { | |||
| 610 | 610 | ||
| 611 | int tipc_bearer_setup(void) | 611 | int tipc_bearer_setup(void) | 
| 612 | { | 612 | { | 
| 613 | int err; | ||
| 614 | |||
| 615 | err = register_netdevice_notifier(¬ifier); | ||
| 616 | if (err) | ||
| 617 | return err; | ||
| 613 | dev_add_pack(&tipc_packet_type); | 618 | dev_add_pack(&tipc_packet_type); | 
| 614 | return register_netdevice_notifier(¬ifier); | 619 | return 0; | 
| 615 | } | 620 | } | 
| 616 | 621 | ||
| 617 | void tipc_bearer_cleanup(void) | 622 | void tipc_bearer_cleanup(void) | 
| diff --git a/net/tipc/config.c b/net/tipc/config.c index c301a9a592d8..e74eef2e7490 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c | |||
| @@ -181,7 +181,7 @@ static struct sk_buff *cfg_set_own_addr(void) | |||
| 181 | if (tipc_own_addr) | 181 | if (tipc_own_addr) | 
| 182 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED | 182 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED | 
| 183 | " (cannot change node address once assigned)"); | 183 | " (cannot change node address once assigned)"); | 
| 184 | tipc_core_start_net(addr); | 184 | tipc_net_start(addr); | 
| 185 | return tipc_cfg_reply_none(); | 185 | return tipc_cfg_reply_none(); | 
| 186 | } | 186 | } | 
| 187 | 187 | ||
| diff --git a/net/tipc/core.c b/net/tipc/core.c index f9e88d8b04ca..80c20647b3d2 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c | |||
| @@ -77,37 +77,13 @@ struct sk_buff *tipc_buf_acquire(u32 size) | |||
| 77 | } | 77 | } | 
| 78 | 78 | ||
| 79 | /** | 79 | /** | 
| 80 | * tipc_core_stop_net - shut down TIPC networking sub-systems | ||
| 81 | */ | ||
| 82 | static void tipc_core_stop_net(void) | ||
| 83 | { | ||
| 84 | tipc_net_stop(); | ||
| 85 | tipc_bearer_cleanup(); | ||
| 86 | } | ||
| 87 | |||
| 88 | /** | ||
| 89 | * start_net - start TIPC networking sub-systems | ||
| 90 | */ | ||
| 91 | int tipc_core_start_net(unsigned long addr) | ||
| 92 | { | ||
| 93 | int res; | ||
| 94 | |||
| 95 | tipc_net_start(addr); | ||
| 96 | res = tipc_bearer_setup(); | ||
| 97 | if (res < 0) | ||
| 98 | goto err; | ||
| 99 | return res; | ||
| 100 | |||
| 101 | err: | ||
| 102 | tipc_core_stop_net(); | ||
| 103 | return res; | ||
| 104 | } | ||
| 105 | |||
| 106 | /** | ||
| 107 | * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode | 80 | * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode | 
| 108 | */ | 81 | */ | 
| 109 | static void tipc_core_stop(void) | 82 | static void tipc_core_stop(void) | 
| 110 | { | 83 | { | 
| 84 | tipc_handler_stop(); | ||
| 85 | tipc_net_stop(); | ||
| 86 | tipc_bearer_cleanup(); | ||
| 111 | tipc_netlink_stop(); | 87 | tipc_netlink_stop(); | 
| 112 | tipc_cfg_stop(); | 88 | tipc_cfg_stop(); | 
| 113 | tipc_subscr_stop(); | 89 | tipc_subscr_stop(); | 
| @@ -122,30 +98,65 @@ static void tipc_core_stop(void) | |||
| 122 | */ | 98 | */ | 
| 123 | static int tipc_core_start(void) | 99 | static int tipc_core_start(void) | 
| 124 | { | 100 | { | 
| 125 | int res; | 101 | int err; | 
| 126 | 102 | ||
| 127 | get_random_bytes(&tipc_random, sizeof(tipc_random)); | 103 | get_random_bytes(&tipc_random, sizeof(tipc_random)); | 
| 128 | 104 | ||
| 129 | res = tipc_handler_start(); | 105 | err = tipc_handler_start(); | 
| 130 | if (!res) | 106 | if (err) | 
| 131 | res = tipc_ref_table_init(tipc_max_ports, tipc_random); | 107 | goto out_handler; | 
| 132 | if (!res) | 108 | |
| 133 | res = tipc_nametbl_init(); | 109 | err = tipc_ref_table_init(tipc_max_ports, tipc_random); | 
| 134 | if (!res) | 110 | if (err) | 
| 135 | res = tipc_netlink_start(); | 111 | goto out_reftbl; | 
| 136 | if (!res) | 112 | |
| 137 | res = tipc_socket_init(); | 113 | err = tipc_nametbl_init(); | 
| 138 | if (!res) | 114 | if (err) | 
| 139 | res = tipc_register_sysctl(); | 115 | goto out_nametbl; | 
| 140 | if (!res) | 116 | |
| 141 | res = tipc_subscr_start(); | 117 | err = tipc_netlink_start(); | 
| 142 | if (!res) | 118 | if (err) | 
| 143 | res = tipc_cfg_init(); | 119 | goto out_netlink; | 
| 144 | if (res) { | 120 | |
| 145 | tipc_handler_stop(); | 121 | err = tipc_socket_init(); | 
| 146 | tipc_core_stop(); | 122 | if (err) | 
| 147 | } | 123 | goto out_socket; | 
| 148 | return res; | 124 | |
| 125 | err = tipc_register_sysctl(); | ||
| 126 | if (err) | ||
| 127 | goto out_sysctl; | ||
| 128 | |||
| 129 | err = tipc_subscr_start(); | ||
| 130 | if (err) | ||
| 131 | goto out_subscr; | ||
| 132 | |||
| 133 | err = tipc_cfg_init(); | ||
| 134 | if (err) | ||
| 135 | goto out_cfg; | ||
| 136 | |||
| 137 | err = tipc_bearer_setup(); | ||
| 138 | if (err) | ||
| 139 | goto out_bearer; | ||
| 140 | |||
| 141 | return 0; | ||
| 142 | out_bearer: | ||
| 143 | tipc_cfg_stop(); | ||
| 144 | out_cfg: | ||
| 145 | tipc_subscr_stop(); | ||
| 146 | out_subscr: | ||
| 147 | tipc_unregister_sysctl(); | ||
| 148 | out_sysctl: | ||
| 149 | tipc_socket_stop(); | ||
| 150 | out_socket: | ||
| 151 | tipc_netlink_stop(); | ||
| 152 | out_netlink: | ||
| 153 | tipc_nametbl_stop(); | ||
| 154 | out_nametbl: | ||
| 155 | tipc_ref_table_stop(); | ||
| 156 | out_reftbl: | ||
| 157 | tipc_handler_stop(); | ||
| 158 | out_handler: | ||
| 159 | return err; | ||
| 149 | } | 160 | } | 
| 150 | 161 | ||
| 151 | static int __init tipc_init(void) | 162 | static int __init tipc_init(void) | 
| @@ -174,8 +185,6 @@ static int __init tipc_init(void) | |||
| 174 | 185 | ||
| 175 | static void __exit tipc_exit(void) | 186 | static void __exit tipc_exit(void) | 
| 176 | { | 187 | { | 
| 177 | tipc_handler_stop(); | ||
| 178 | tipc_core_stop_net(); | ||
| 179 | tipc_core_stop(); | 188 | tipc_core_stop(); | 
| 180 | pr_info("Deactivated\n"); | 189 | pr_info("Deactivated\n"); | 
| 181 | } | 190 | } | 
| diff --git a/net/tipc/core.h b/net/tipc/core.h index 5569d96b4da3..4dfe137587bb 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
| @@ -90,7 +90,6 @@ extern int tipc_random __read_mostly; | |||
| 90 | /* | 90 | /* | 
| 91 | * Routines available to privileged subsystems | 91 | * Routines available to privileged subsystems | 
| 92 | */ | 92 | */ | 
| 93 | int tipc_core_start_net(unsigned long); | ||
| 94 | int tipc_handler_start(void); | 93 | int tipc_handler_start(void); | 
| 95 | void tipc_handler_stop(void); | 94 | void tipc_handler_stop(void); | 
| 96 | int tipc_netlink_start(void); | 95 | int tipc_netlink_start(void); | 
| diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 92a1533af4e0..48302be175ce 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
| @@ -945,9 +945,6 @@ void tipc_nametbl_stop(void) | |||
| 945 | { | 945 | { | 
| 946 | u32 i; | 946 | u32 i; | 
| 947 | 947 | ||
| 948 | if (!table.types) | ||
| 949 | return; | ||
| 950 | |||
| 951 | /* Verify name table is empty, then release it */ | 948 | /* Verify name table is empty, then release it */ | 
| 952 | write_lock_bh(&tipc_nametbl_lock); | 949 | write_lock_bh(&tipc_nametbl_lock); | 
| 953 | for (i = 0; i < TIPC_NAMETBL_SIZE; i++) { | 950 | for (i = 0; i < TIPC_NAMETBL_SIZE; i++) { | 
| diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c index 9f72a6376362..3aaf73de9e2d 100644 --- a/net/tipc/netlink.c +++ b/net/tipc/netlink.c | |||
| @@ -83,8 +83,6 @@ static struct genl_ops tipc_genl_ops[] = { | |||
| 83 | }, | 83 | }, | 
| 84 | }; | 84 | }; | 
| 85 | 85 | ||
| 86 | static int tipc_genl_family_registered; | ||
| 87 | |||
| 88 | int tipc_netlink_start(void) | 86 | int tipc_netlink_start(void) | 
| 89 | { | 87 | { | 
| 90 | int res; | 88 | int res; | 
| @@ -94,16 +92,10 @@ int tipc_netlink_start(void) | |||
| 94 | pr_err("Failed to register netlink interface\n"); | 92 | pr_err("Failed to register netlink interface\n"); | 
| 95 | return res; | 93 | return res; | 
| 96 | } | 94 | } | 
| 97 | |||
| 98 | tipc_genl_family_registered = 1; | ||
| 99 | return 0; | 95 | return 0; | 
| 100 | } | 96 | } | 
| 101 | 97 | ||
| 102 | void tipc_netlink_stop(void) | 98 | void tipc_netlink_stop(void) | 
| 103 | { | 99 | { | 
| 104 | if (!tipc_genl_family_registered) | ||
| 105 | return; | ||
| 106 | |||
| 107 | genl_unregister_family(&tipc_genl_family); | 100 | genl_unregister_family(&tipc_genl_family); | 
| 108 | tipc_genl_family_registered = 0; | ||
| 109 | } | 101 | } | 
| diff --git a/net/tipc/ref.c b/net/tipc/ref.c index 2a2a938dc22c..de3d593e2fee 100644 --- a/net/tipc/ref.c +++ b/net/tipc/ref.c | |||
| @@ -126,9 +126,6 @@ int tipc_ref_table_init(u32 requested_size, u32 start) | |||
| 126 | */ | 126 | */ | 
| 127 | void tipc_ref_table_stop(void) | 127 | void tipc_ref_table_stop(void) | 
| 128 | { | 128 | { | 
| 129 | if (!tipc_ref_table.entries) | ||
| 130 | return; | ||
| 131 | |||
| 132 | vfree(tipc_ref_table.entries); | 129 | vfree(tipc_ref_table.entries); | 
| 133 | tipc_ref_table.entries = NULL; | 130 | tipc_ref_table.entries = NULL; | 
| 134 | } | 131 | } | 
| diff --git a/net/tipc/server.c b/net/tipc/server.c index b635ca347a87..373979789a73 100644 --- a/net/tipc/server.c +++ b/net/tipc/server.c | |||
| @@ -573,7 +573,6 @@ int tipc_server_start(struct tipc_server *s) | |||
| 573 | kmem_cache_destroy(s->rcvbuf_cache); | 573 | kmem_cache_destroy(s->rcvbuf_cache); | 
| 574 | return ret; | 574 | return ret; | 
| 575 | } | 575 | } | 
| 576 | s->enabled = 1; | ||
| 577 | return ret; | 576 | return ret; | 
| 578 | } | 577 | } | 
| 579 | 578 | ||
| @@ -583,10 +582,6 @@ void tipc_server_stop(struct tipc_server *s) | |||
| 583 | int total = 0; | 582 | int total = 0; | 
| 584 | int id; | 583 | int id; | 
| 585 | 584 | ||
| 586 | if (!s->enabled) | ||
| 587 | return; | ||
| 588 | |||
| 589 | s->enabled = 0; | ||
| 590 | spin_lock_bh(&s->idr_lock); | 585 | spin_lock_bh(&s->idr_lock); | 
| 591 | for (id = 0; total < s->idr_in_use; id++) { | 586 | for (id = 0; total < s->idr_in_use; id++) { | 
| 592 | con = idr_find(&s->conn_idr, id); | 587 | con = idr_find(&s->conn_idr, id); | 
| diff --git a/net/tipc/server.h b/net/tipc/server.h index 98b23f20bc0f..be817b0b547e 100644 --- a/net/tipc/server.h +++ b/net/tipc/server.h | |||
| @@ -56,7 +56,6 @@ | |||
| 56 | * @name: server name | 56 | * @name: server name | 
| 57 | * @imp: message importance | 57 | * @imp: message importance | 
| 58 | * @type: socket type | 58 | * @type: socket type | 
| 59 | * @enabled: identify whether server is launched or not | ||
| 60 | */ | 59 | */ | 
| 61 | struct tipc_server { | 60 | struct tipc_server { | 
| 62 | struct idr conn_idr; | 61 | struct idr conn_idr; | 
| @@ -74,7 +73,6 @@ struct tipc_server { | |||
| 74 | const char name[TIPC_SERVER_NAME_LEN]; | 73 | const char name[TIPC_SERVER_NAME_LEN]; | 
| 75 | int imp; | 74 | int imp; | 
| 76 | int type; | 75 | int type; | 
| 77 | int enabled; | ||
| 78 | }; | 76 | }; | 
| 79 | 77 | ||
| 80 | int tipc_conn_sendmsg(struct tipc_server *s, int conid, | 78 | int tipc_conn_sendmsg(struct tipc_server *s, int conid, | 
| diff --git a/net/tipc/socket.c b/net/tipc/socket.c index aab4948f0aff..a4cf274455aa 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
| @@ -70,8 +70,6 @@ static const struct proto_ops msg_ops; | |||
| 70 | static struct proto tipc_proto; | 70 | static struct proto tipc_proto; | 
| 71 | static struct proto tipc_proto_kern; | 71 | static struct proto tipc_proto_kern; | 
| 72 | 72 | ||
| 73 | static int sockets_enabled; | ||
| 74 | |||
| 75 | /* | 73 | /* | 
| 76 | * Revised TIPC socket locking policy: | 74 | * Revised TIPC socket locking policy: | 
| 77 | * | 75 | * | 
| @@ -2027,8 +2025,6 @@ int tipc_socket_init(void) | |||
| 2027 | proto_unregister(&tipc_proto); | 2025 | proto_unregister(&tipc_proto); | 
| 2028 | goto out; | 2026 | goto out; | 
| 2029 | } | 2027 | } | 
| 2030 | |||
| 2031 | sockets_enabled = 1; | ||
| 2032 | out: | 2028 | out: | 
| 2033 | return res; | 2029 | return res; | 
| 2034 | } | 2030 | } | 
| @@ -2038,10 +2034,6 @@ int tipc_socket_init(void) | |||
| 2038 | */ | 2034 | */ | 
| 2039 | void tipc_socket_stop(void) | 2035 | void tipc_socket_stop(void) | 
| 2040 | { | 2036 | { | 
| 2041 | if (!sockets_enabled) | ||
| 2042 | return; | ||
| 2043 | |||
| 2044 | sockets_enabled = 0; | ||
| 2045 | sock_unregister(tipc_family_ops.family); | 2037 | sock_unregister(tipc_family_ops.family); | 
| 2046 | proto_unregister(&tipc_proto); | 2038 | proto_unregister(&tipc_proto); | 
| 2047 | } | 2039 | } | 
