aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/config.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2015-01-09 02:27:05 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-12 16:24:32 -0500
commitf2f9800d4955a96d92896841d8ba9b04201deaa1 (patch)
tree3b817800cfd8fcb2de6d5a3d7eb4fff972fba681 /net/tipc/config.c
parentc93d3baa24095887005647984cff5de8c63d3611 (diff)
tipc: make tipc node table aware of net namespace
Global variables associated with node table are below: - node table list (node_htable) - node hash table list (tipc_node_list) - node table lock (node_list_lock) - node number counter (tipc_num_nodes) - node link number counter (tipc_num_links) To make node table support namespace, above global variables must be moved to tipc_net structure in order to keep secret for different namespaces. As a consequence, these variables are allocated and initialized when namespace is created, and deallocated when namespace is destroyed. After the change, functions associated with these variables have to utilize a namespace pointer to access them. So adding namespace pointer as a parameter of these functions is the major change made in the commit. Signed-off-by: Ying Xue <ying.xue@windriver.com> Tested-by: Tero Aho <Tero.Aho@coriant.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/config.c')
-rw-r--r--net/tipc/config.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 28d4272803c4..cf2d417ad488 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -150,12 +150,12 @@ static struct sk_buff *cfg_enable_bearer(struct net *net)
150 return tipc_cfg_reply_none(); 150 return tipc_cfg_reply_none();
151} 151}
152 152
153static struct sk_buff *cfg_disable_bearer(void) 153static struct sk_buff *cfg_disable_bearer(struct net *net)
154{ 154{
155 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_BEARER_NAME)) 155 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_BEARER_NAME))
156 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 156 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
157 157
158 if (tipc_disable_bearer((char *)TLV_DATA(req_tlv_area))) 158 if (tipc_disable_bearer(net, (char *)TLV_DATA(req_tlv_area)))
159 return tipc_cfg_reply_error_string("unable to disable bearer"); 159 return tipc_cfg_reply_error_string("unable to disable bearer");
160 160
161 return tipc_cfg_reply_none(); 161 return tipc_cfg_reply_none();
@@ -232,16 +232,20 @@ struct sk_buff *tipc_cfg_do_cmd(struct net *net, u32 orig_node, u16 cmd,
232 rep_tlv_buf = tipc_cfg_reply_none(); 232 rep_tlv_buf = tipc_cfg_reply_none();
233 break; 233 break;
234 case TIPC_CMD_GET_NODES: 234 case TIPC_CMD_GET_NODES:
235 rep_tlv_buf = tipc_node_get_nodes(req_tlv_area, req_tlv_space); 235 rep_tlv_buf = tipc_node_get_nodes(net, req_tlv_area,
236 req_tlv_space);
236 break; 237 break;
237 case TIPC_CMD_GET_LINKS: 238 case TIPC_CMD_GET_LINKS:
238 rep_tlv_buf = tipc_node_get_links(req_tlv_area, req_tlv_space); 239 rep_tlv_buf = tipc_node_get_links(net, req_tlv_area,
240 req_tlv_space);
239 break; 241 break;
240 case TIPC_CMD_SHOW_LINK_STATS: 242 case TIPC_CMD_SHOW_LINK_STATS:
241 rep_tlv_buf = tipc_link_cmd_show_stats(req_tlv_area, req_tlv_space); 243 rep_tlv_buf = tipc_link_cmd_show_stats(net, req_tlv_area,
244 req_tlv_space);
242 break; 245 break;
243 case TIPC_CMD_RESET_LINK_STATS: 246 case TIPC_CMD_RESET_LINK_STATS:
244 rep_tlv_buf = tipc_link_cmd_reset_stats(req_tlv_area, req_tlv_space); 247 rep_tlv_buf = tipc_link_cmd_reset_stats(net, req_tlv_area,
248 req_tlv_space);
245 break; 249 break;
246 case TIPC_CMD_SHOW_NAME_TABLE: 250 case TIPC_CMD_SHOW_NAME_TABLE:
247 rep_tlv_buf = tipc_nametbl_get(req_tlv_area, req_tlv_space); 251 rep_tlv_buf = tipc_nametbl_get(req_tlv_area, req_tlv_space);
@@ -261,13 +265,14 @@ struct sk_buff *tipc_cfg_do_cmd(struct net *net, u32 orig_node, u16 cmd,
261 case TIPC_CMD_SET_LINK_TOL: 265 case TIPC_CMD_SET_LINK_TOL:
262 case TIPC_CMD_SET_LINK_PRI: 266 case TIPC_CMD_SET_LINK_PRI:
263 case TIPC_CMD_SET_LINK_WINDOW: 267 case TIPC_CMD_SET_LINK_WINDOW:
264 rep_tlv_buf = tipc_link_cmd_config(req_tlv_area, req_tlv_space, cmd); 268 rep_tlv_buf = tipc_link_cmd_config(net, req_tlv_area,
269 req_tlv_space, cmd);
265 break; 270 break;
266 case TIPC_CMD_ENABLE_BEARER: 271 case TIPC_CMD_ENABLE_BEARER:
267 rep_tlv_buf = cfg_enable_bearer(net); 272 rep_tlv_buf = cfg_enable_bearer(net);
268 break; 273 break;
269 case TIPC_CMD_DISABLE_BEARER: 274 case TIPC_CMD_DISABLE_BEARER:
270 rep_tlv_buf = cfg_disable_bearer(); 275 rep_tlv_buf = cfg_disable_bearer(net);
271 break; 276 break;
272 case TIPC_CMD_SET_NODE_ADDR: 277 case TIPC_CMD_SET_NODE_ADDR:
273 rep_tlv_buf = cfg_set_own_addr(net); 278 rep_tlv_buf = cfg_set_own_addr(net);