aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/subscr.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2015-01-09 02:27:09 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-12 16:24:33 -0500
commit4ac1c8d0ee9faf3a4be185cc4db1381fa0d81280 (patch)
tree361ea817ed30f0dd959ea2d87d658c8d85feebb2 /net/tipc/subscr.c
parente05b31f4bf8994d49322e9afb004ad479a129db0 (diff)
tipc: name tipc name table support net namespace
TIPC name table is used to store the mapping relationship between TIPC service name and socket port ID. When tipc supports namespace, it allows users to publish service names only owned by a certain namespace. Therefore, every namespace must have its private name table to prevent service names published to one namespace from being contaminated by other service names in another namespace. Therefore, The name table global variable (ie, nametbl) and its lock must be moved to tipc_net structure, and a parameter of namespace must be added for necessary functions so that they can obtain name table variable defined in tipc_net structure. 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/subscr.c')
-rw-r--r--net/tipc/subscr.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index e6cb959371dc..b71dbc0ae8f9 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -50,8 +50,9 @@ struct tipc_subscriber {
50 struct list_head subscription_list; 50 struct list_head subscription_list;
51}; 51};
52 52
53static void subscr_conn_msg_event(int conid, struct sockaddr_tipc *addr, 53static void subscr_conn_msg_event(struct net *net, int conid,
54 void *usr_data, void *buf, size_t len); 54 struct sockaddr_tipc *addr, void *usr_data,
55 void *buf, size_t len);
55static void *subscr_named_msg_event(int conid); 56static void *subscr_named_msg_event(int conid);
56static void subscr_conn_shutdown_event(int conid, void *usr_data); 57static void subscr_conn_shutdown_event(int conid, void *usr_data);
57 58
@@ -260,7 +261,7 @@ static void subscr_cancel(struct tipc_subscr *s,
260 * 261 *
261 * Called with subscriber lock held. 262 * Called with subscriber lock held.
262 */ 263 */
263static int subscr_subscribe(struct tipc_subscr *s, 264static int subscr_subscribe(struct net *net, struct tipc_subscr *s,
264 struct tipc_subscriber *subscriber, 265 struct tipc_subscriber *subscriber,
265 struct tipc_subscription **sub_p) { 266 struct tipc_subscription **sub_p) {
266 struct tipc_subscription *sub; 267 struct tipc_subscription *sub;
@@ -291,6 +292,7 @@ static int subscr_subscribe(struct tipc_subscr *s,
291 } 292 }
292 293
293 /* Initialize subscription object */ 294 /* Initialize subscription object */
295 sub->net = net;
294 sub->seq.type = htohl(s->seq.type, swap); 296 sub->seq.type = htohl(s->seq.type, swap);
295 sub->seq.lower = htohl(s->seq.lower, swap); 297 sub->seq.lower = htohl(s->seq.lower, swap);
296 sub->seq.upper = htohl(s->seq.upper, swap); 298 sub->seq.upper = htohl(s->seq.upper, swap);
@@ -323,14 +325,16 @@ static void subscr_conn_shutdown_event(int conid, void *usr_data)
323} 325}
324 326
325/* Handle one request to create a new subscription for the subscriber */ 327/* Handle one request to create a new subscription for the subscriber */
326static void subscr_conn_msg_event(int conid, struct sockaddr_tipc *addr, 328static void subscr_conn_msg_event(struct net *net, int conid,
327 void *usr_data, void *buf, size_t len) 329 struct sockaddr_tipc *addr, void *usr_data,
330 void *buf, size_t len)
328{ 331{
329 struct tipc_subscriber *subscriber = usr_data; 332 struct tipc_subscriber *subscriber = usr_data;
330 struct tipc_subscription *sub = NULL; 333 struct tipc_subscription *sub = NULL;
331 334
332 spin_lock_bh(&subscriber->lock); 335 spin_lock_bh(&subscriber->lock);
333 if (subscr_subscribe((struct tipc_subscr *)buf, subscriber, &sub) < 0) { 336 if (subscr_subscribe(net, (struct tipc_subscr *)buf, subscriber,
337 &sub) < 0) {
334 spin_unlock_bh(&subscriber->lock); 338 spin_unlock_bh(&subscriber->lock);
335 subscr_terminate(subscriber); 339 subscr_terminate(subscriber);
336 return; 340 return;