subscr.c 15.9 KB
Newer Older
Per Liden's avatar
Per Liden committed
1
2
/*
 * net/tipc/subscr.c: TIPC subscription service
3
 *
4
 * Copyright (c) 2000-2006, Ericsson AB
Per Liden's avatar
Per Liden committed
5
6
7
 * Copyright (c) 2005, Wind River Systems
 * All rights reserved.
 *
Per Liden's avatar
Per Liden committed
8
 * Redistribution and use in source and binary forms, with or without
Per Liden's avatar
Per Liden committed
9
10
 * modification, are permitted provided that the following conditions are met:
 *
Per Liden's avatar
Per Liden committed
11
12
13
14
15
16
17
18
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the names of the copyright holders nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
Per Liden's avatar
Per Liden committed
19
 *
Per Liden's avatar
Per Liden committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 * Alternatively, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Per Liden's avatar
Per Liden committed
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 * POSSIBILITY OF SUCH DAMAGE.
 */

#include "core.h"
#include "dbg.h"
#include "subscr.h"
#include "name_table.h"
#include "ref.h"

/**
 * struct subscriber - TIPC network topology subscriber
 * @ref: object reference to subscriber object itself
 * @lock: pointer to spinlock controlling access to subscriber object
 * @subscriber_list: adjacent subscribers in top. server's list of subscribers
 * @subscription_list: list of subscription objects for this subscriber
 * @port_ref: object reference to port used to communicate with subscriber
 * @swap: indicates if subscriber uses opposite endianness in its messages
 */
52

Per Liden's avatar
Per Liden committed
53
54
struct subscriber {
	u32 ref;
55
	spinlock_t *lock;
Per Liden's avatar
Per Liden committed
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
	struct list_head subscriber_list;
	struct list_head subscription_list;
	u32 port_ref;
	int swap;
};

/**
 * struct top_srv - TIPC network topology subscription service
 * @user_ref: TIPC userid of subscription service
 * @setup_port: reference to TIPC port that handles subscription requests
 * @subscription_count: number of active subscriptions (not subscribers!)
 * @subscriber_list: list of ports subscribing to service
 * @lock: spinlock govering access to subscriber list
 */

struct top_srv {
	u32 user_ref;
	u32 setup_port;
	atomic_t subscription_count;
	struct list_head subscriber_list;
	spinlock_t lock;
};

static struct top_srv topsrv = { 0 };

/**
 * htohl - convert value to endianness used by destination
 * @in: value to convert
 * @swap: non-zero if endianness must be reversed
85
 *
Per Liden's avatar
Per Liden committed
86
87
88
 * Returns converted value
 */

Sam Ravnborg's avatar
Sam Ravnborg committed
89
static u32 htohl(u32 in, int swap)
Per Liden's avatar
Per Liden committed
90
91
92
93
94
95
96
97
98
99
{
	char *c = (char *)∈

	return swap ? ((c[3] << 3) + (c[2] << 2) + (c[1] << 1) + c[0]) : in;
}

/**
 * subscr_send_event - send a message containing a tipc_event to the subscriber
 */

100
101
static void subscr_send_event(struct subscription *sub,
			      u32 found_lower,
Per Liden's avatar
Per Liden committed
102
			      u32 found_upper,
103
104
			      u32 event,
			      u32 port_ref,
Per Liden's avatar
Per Liden committed
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
			      u32 node)
{
	struct iovec msg_sect;

	msg_sect.iov_base = (void *)&sub->evt;
	msg_sect.iov_len = sizeof(struct tipc_event);

	sub->evt.event = htohl(event, sub->owner->swap);
	sub->evt.found_lower = htohl(found_lower, sub->owner->swap);
	sub->evt.found_upper = htohl(found_upper, sub->owner->swap);
	sub->evt.port.ref = htohl(port_ref, sub->owner->swap);
	sub->evt.port.node = htohl(node, sub->owner->swap);
	tipc_send(sub->owner->port_ref, 1, &msg_sect);
}

/**
121
 * tipc_subscr_overlap - test for subscription overlap with the given values
Per Liden's avatar
Per Liden committed
122
123
124
125
 *
 * Returns 1 if there is overlap, otherwise 0.
 */

126
127
int tipc_subscr_overlap(struct subscription *sub,
			u32 found_lower,
128
			u32 found_upper)
Per Liden's avatar
Per Liden committed
129
130
131
132
133
134
135
136
137
138
139
140

{
	if (found_lower < sub->seq.lower)
		found_lower = sub->seq.lower;
	if (found_upper > sub->seq.upper)
		found_upper = sub->seq.upper;
	if (found_lower > found_upper)
		return 0;
	return 1;
}

/**
141
 * tipc_subscr_report_overlap - issue event if there is subscription overlap
142
 *
Per Liden's avatar
Per Liden committed
143
144
145
 * Protected by nameseq.lock in name_table.c
 */

146
147
void tipc_subscr_report_overlap(struct subscription *sub,
				u32 found_lower,
148
				u32 found_upper,
149
150
				u32 event,
				u32 port_ref,
151
152
				u32 node,
				int must)
Per Liden's avatar
Per Liden committed
153
154
155
{
	dbg("Rep overlap %u:%u,%u<->%u,%u\n", sub->seq.type, sub->seq.lower,
	    sub->seq.upper, found_lower, found_upper);
156
	if (!tipc_subscr_overlap(sub, found_lower, found_upper))
Per Liden's avatar
Per Liden committed
157
		return;
158
	if (!must && !(sub->filter & TIPC_SUB_PORTS))
Per Liden's avatar
Per Liden committed
159
		return;
160
161

	sub->event_cb(sub, found_lower, found_upper, event, port_ref, node);
Per Liden's avatar
Per Liden committed
162
163
164
165
166
167
168
169
170
171
172
173
174
175
}

/**
 * subscr_timeout - subscription timeout has occurred
 */

static void subscr_timeout(struct subscription *sub)
{
	struct subscriber *subscriber;
	u32 subscriber_ref;

	/* Validate subscriber reference (in case subscriber is terminating) */

	subscriber_ref = sub->owner->ref;
176
	subscriber = (struct subscriber *)tipc_ref_lock(subscriber_ref);
Per Liden's avatar
Per Liden committed
177
178
179
	if (subscriber == NULL)
		return;

180
181
182
183
184
185
186
	/* Validate timeout (in case subscription is being cancelled) */

	if (sub->timeout == TIPC_WAIT_FOREVER) {
		tipc_ref_unlock(subscriber_ref);
		return;
	}

Per Liden's avatar
Per Liden committed
187
188
	/* Unlink subscription from name table */

189
	tipc_nametbl_unsubscribe(sub);
Per Liden's avatar
Per Liden committed
190
191
192

	/* Notify subscriber of timeout, then unlink subscription */

193
194
	subscr_send_event(sub,
			  sub->evt.s.seq.lower,
Per Liden's avatar
Per Liden committed
195
			  sub->evt.s.seq.upper,
196
197
			  TIPC_SUBSCR_TIMEOUT,
			  0,
Per Liden's avatar
Per Liden committed
198
199
200
201
202
			  0);
	list_del(&sub->subscription_list);

	/* Now destroy subscription */

203
	tipc_ref_unlock(subscriber_ref);
Per Liden's avatar
Per Liden committed
204
205
206
207
208
	k_term_timer(&sub->timer);
	kfree(sub);
	atomic_dec(&topsrv.subscription_count);
}

209
210
211
212
213
214
215
216
217
218
219
220
221
222
/**
 * subscr_del - delete a subscription within a subscription list
 *
 * Called with subscriber locked.
 */

static void subscr_del(struct subscription *sub)
{
	tipc_nametbl_unsubscribe(sub);
	list_del(&sub->subscription_list);
	kfree(sub);
	atomic_dec(&topsrv.subscription_count);
}

Per Liden's avatar
Per Liden committed
223
224
/**
 * subscr_terminate - terminate communication with a subscriber
225
 *
Per Liden's avatar
Per Liden committed
226
 * Called with subscriber locked.  Routine must temporarily release this lock
227
 * to enable subscription timeout routine(s) to finish without deadlocking;
Per Liden's avatar
Per Liden committed
228
 * the lock is then reclaimed to allow caller to release it upon return.
229
 * (This should work even in the unlikely event some other thread creates
Per Liden's avatar
Per Liden committed
230
231
232
233
234
235
236
237
238
239
240
 * a new object reference in the interim that uses this lock; this routine will
 * simply wait for it to be released, then claim it.)
 */

static void subscr_terminate(struct subscriber *subscriber)
{
	struct subscription *sub;
	struct subscription *sub_temp;

	/* Invalidate subscriber reference */

241
	tipc_ref_discard(subscriber->ref);
Per Liden's avatar
Per Liden committed
242
243
244
	spin_unlock_bh(subscriber->lock);

	/* Destroy any existing subscriptions for subscriber */
245

Per Liden's avatar
Per Liden committed
246
247
248
249
250
251
	list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list,
				 subscription_list) {
		if (sub->timeout != TIPC_WAIT_FOREVER) {
			k_cancel_timer(&sub->timer);
			k_term_timer(&sub->timer);
		}
252
		dbg("Term: Removing sub %u,%u,%u from subscriber %x list\n",
Per Liden's avatar
Per Liden committed
253
		    sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber);
254
		subscr_del(sub);
Per Liden's avatar
Per Liden committed
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
	}

	/* Sever connection to subscriber */

	tipc_shutdown(subscriber->port_ref);
	tipc_deleteport(subscriber->port_ref);

	/* Remove subscriber from topology server's subscriber list */

	spin_lock_bh(&topsrv.lock);
	list_del(&subscriber->subscriber_list);
	spin_unlock_bh(&topsrv.lock);

	/* Now destroy subscriber */

	spin_lock_bh(subscriber->lock);
	kfree(subscriber);
}

274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
/**
 * subscr_cancel - handle subscription cancellation request
 *
 * Called with subscriber locked.  Routine must temporarily release this lock
 * to enable the subscription timeout routine to finish without deadlocking;
 * the lock is then reclaimed to allow caller to release it upon return.
 *
 * Note that fields of 's' use subscriber's endianness!
 */

static void subscr_cancel(struct tipc_subscr *s,
			  struct subscriber *subscriber)
{
	struct subscription *sub;
	struct subscription *sub_temp;
	int found = 0;

	/* Find first matching subscription, exit if not found */

	list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list,
				 subscription_list) {
		if (!memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) {
			found = 1;
			break;
		}
	}
	if (!found)
		return;

	/* Cancel subscription timer (if used), then delete subscription */

	if (sub->timeout != TIPC_WAIT_FOREVER) {
		sub->timeout = TIPC_WAIT_FOREVER;
		spin_unlock_bh(subscriber->lock);
		k_cancel_timer(&sub->timer);
		k_term_timer(&sub->timer);
		spin_lock_bh(subscriber->lock);
	}
	dbg("Cancel: removing sub %u,%u,%u from subscriber %x list\n",
	    sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber);
	subscr_del(sub);
}

Per Liden's avatar
Per Liden committed
317
318
/**
 * subscr_subscribe - create subscription for subscriber
319
 *
Per Liden's avatar
Per Liden committed
320
321
322
323
324
325
326
327
 * Called with subscriber locked
 */

static void subscr_subscribe(struct tipc_subscr *s,
			     struct subscriber *subscriber)
{
	struct subscription *sub;

328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
	/* Determine/update subscriber's endianness */

	if (s->filter & (TIPC_SUB_PORTS | TIPC_SUB_SERVICE))
		subscriber->swap = 0;
	else
		subscriber->swap = 1;

	/* Detect & process a subscription cancellation request */

	if (s->filter & htohl(TIPC_SUB_CANCEL, subscriber->swap)) {
		s->filter &= ~htohl(TIPC_SUB_CANCEL, subscriber->swap);
		subscr_cancel(s, subscriber);
		return;
	}

Per Liden's avatar
Per Liden committed
343
344
345
	/* Refuse subscription if global limit exceeded */

	if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) {
346
347
		warn("Subscription rejected, subscription limit reached (%u)\n",
		     tipc_max_subscriptions);
Per Liden's avatar
Per Liden committed
348
349
350
351
352
353
		subscr_terminate(subscriber);
		return;
	}

	/* Allocate subscription object */

354
	sub = kzalloc(sizeof(*sub), GFP_ATOMIC);
355
356
	if (!sub) {
		warn("Subscription rejected, no memory\n");
Per Liden's avatar
Per Liden committed
357
358
359
360
361
362
363
364
365
366
367
		subscr_terminate(subscriber);
		return;
	}

	/* Initialize subscription object */

	sub->seq.type = htohl(s->seq.type, subscriber->swap);
	sub->seq.lower = htohl(s->seq.lower, subscriber->swap);
	sub->seq.upper = htohl(s->seq.upper, subscriber->swap);
	sub->timeout = htohl(s->timeout, subscriber->swap);
	sub->filter = htohl(s->filter, subscriber->swap);
368
369
	if ((!(sub->filter & TIPC_SUB_PORTS)
	     == !(sub->filter & TIPC_SUB_SERVICE))
Per Liden's avatar
Per Liden committed
370
	    || (sub->seq.lower > sub->seq.upper)) {
371
		warn("Subscription rejected, illegal request\n");
Per Liden's avatar
Per Liden committed
372
373
374
375
		kfree(sub);
		subscr_terminate(subscriber);
		return;
	}
376
	sub->event_cb = subscr_send_event;
Per Liden's avatar
Per Liden committed
377
378
379
380
381
382
383
384
385
386
387
	memcpy(&sub->evt.s, s, sizeof(struct tipc_subscr));
	INIT_LIST_HEAD(&sub->subscription_list);
	INIT_LIST_HEAD(&sub->nameseq_list);
	list_add(&sub->subscription_list, &subscriber->subscription_list);
	atomic_inc(&topsrv.subscription_count);
	if (sub->timeout != TIPC_WAIT_FOREVER) {
		k_init_timer(&sub->timer,
			     (Handler)subscr_timeout, (unsigned long)sub);
		k_start_timer(&sub->timer, sub->timeout);
	}
	sub->owner = subscriber;
388
	tipc_nametbl_subscribe(sub);
Per Liden's avatar
Per Liden committed
389
390
391
392
393
394
395
396
397
398
399
400
401
}

/**
 * subscr_conn_shutdown_event - handle termination request from subscriber
 */

static void subscr_conn_shutdown_event(void *usr_handle,
				       u32 portref,
				       struct sk_buff **buf,
				       unsigned char const *data,
				       unsigned int size,
				       int reason)
{
402
	struct subscriber *subscriber;
Per Liden's avatar
Per Liden committed
403
404
	spinlock_t *subscriber_lock;

405
	subscriber = tipc_ref_lock((u32)(unsigned long)usr_handle);
Per Liden's avatar
Per Liden committed
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
	if (subscriber == NULL)
		return;

	subscriber_lock = subscriber->lock;
	subscr_terminate(subscriber);
	spin_unlock_bh(subscriber_lock);
}

/**
 * subscr_conn_msg_event - handle new subscription request from subscriber
 */

static void subscr_conn_msg_event(void *usr_handle,
				  u32 port_ref,
				  struct sk_buff **buf,
				  const unchar *data,
				  u32 size)
{
424
	struct subscriber *subscriber;
Per Liden's avatar
Per Liden committed
425
426
	spinlock_t *subscriber_lock;

427
	subscriber = tipc_ref_lock((u32)(unsigned long)usr_handle);
Per Liden's avatar
Per Liden committed
428
429
430
431
432
433
434
435
	if (subscriber == NULL)
		return;

	subscriber_lock = subscriber->lock;
	if (size != sizeof(struct tipc_subscr))
		subscr_terminate(subscriber);
	else
		subscr_subscribe((struct tipc_subscr *)data, subscriber);
436

Per Liden's avatar
Per Liden committed
437
438
439
440
441
442
443
444
445
446
447
448
	spin_unlock_bh(subscriber_lock);
}

/**
 * subscr_named_msg_event - handle request to establish a new subscriber
 */

static void subscr_named_msg_event(void *usr_handle,
				   u32 port_ref,
				   struct sk_buff **buf,
				   const unchar *data,
				   u32 size,
449
				   u32 importance,
Per Liden's avatar
Per Liden committed
450
451
452
453
				   struct tipc_portid const *orig,
				   struct tipc_name_seq const *dest)
{
	struct subscriber *subscriber;
454
	struct iovec msg_sect = {NULL, 0};
Per Liden's avatar
Per Liden committed
455
456
457
458
459
	spinlock_t *subscriber_lock;

	dbg("subscr_named_msg_event: orig = %x own = %x,\n",
	    orig->node, tipc_own_addr);
	if (size && (size != sizeof(struct tipc_subscr))) {
460
		warn("Subscriber rejected, invalid subscription size\n");
Per Liden's avatar
Per Liden committed
461
462
463
464
465
		return;
	}

	/* Create subscriber object */

466
	subscriber = kzalloc(sizeof(struct subscriber), GFP_ATOMIC);
Per Liden's avatar
Per Liden committed
467
	if (subscriber == NULL) {
468
		warn("Subscriber rejected, no memory\n");
Per Liden's avatar
Per Liden committed
469
470
471
472
		return;
	}
	INIT_LIST_HEAD(&subscriber->subscription_list);
	INIT_LIST_HEAD(&subscriber->subscriber_list);
473
	subscriber->ref = tipc_ref_acquire(subscriber, &subscriber->lock);
Per Liden's avatar
Per Liden committed
474
	if (subscriber->ref == 0) {
475
		warn("Subscriber rejected, reference table exhausted\n");
Per Liden's avatar
Per Liden committed
476
477
478
		kfree(subscriber);
		return;
	}
479
	spin_unlock_bh(subscriber->lock);
Per Liden's avatar
Per Liden committed
480
481
482
483

	/* Establish a connection to subscriber */

	tipc_createport(topsrv.user_ref,
484
			(void *)(unsigned long)subscriber->ref,
Per Liden's avatar
Per Liden committed
485
			importance,
486
487
			NULL,
			NULL,
Per Liden's avatar
Per Liden committed
488
			subscr_conn_shutdown_event,
489
490
			NULL,
			NULL,
Per Liden's avatar
Per Liden committed
491
			subscr_conn_msg_event,
492
			NULL,
Per Liden's avatar
Per Liden committed
493
494
			&subscriber->port_ref);
	if (subscriber->port_ref == 0) {
495
		warn("Subscriber rejected, unable to create port\n");
496
		tipc_ref_discard(subscriber->ref);
Per Liden's avatar
Per Liden committed
497
498
499
500
501
502
503
504
		kfree(subscriber);
		return;
	}
	tipc_connect2port(subscriber->port_ref, orig);


	/* Add subscriber to topology server's subscriber list */

505
	tipc_ref_lock(subscriber->ref);
Per Liden's avatar
Per Liden committed
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
	spin_lock_bh(&topsrv.lock);
	list_add(&subscriber->subscriber_list, &topsrv.subscriber_list);
	spin_unlock_bh(&topsrv.lock);

	/*
	 * Subscribe now if message contains a subscription,
	 * otherwise send an empty response to complete connection handshaking
	 */

	subscriber_lock = subscriber->lock;
	if (size)
		subscr_subscribe((struct tipc_subscr *)data, subscriber);
	else
		tipc_send(subscriber->port_ref, 1, &msg_sect);

	spin_unlock_bh(subscriber_lock);
}

524
int tipc_subscr_start(void)
Per Liden's avatar
Per Liden committed
525
526
527
528
529
{
	struct tipc_name_seq seq = {TIPC_TOP_SRV, TIPC_TOP_SRV, TIPC_TOP_SRV};
	int res = -1;

	memset(&topsrv, 0, sizeof (topsrv));
530
	spin_lock_init(&topsrv.lock);
Per Liden's avatar
Per Liden committed
531
532
533
	INIT_LIST_HEAD(&topsrv.subscriber_list);

	spin_lock_bh(&topsrv.lock);
534
	res = tipc_attach(&topsrv.user_ref, NULL, NULL);
Per Liden's avatar
Per Liden committed
535
536
537
538
539
	if (res) {
		spin_unlock_bh(&topsrv.lock);
		return res;
	}

540
541
542
543
544
545
546
547
548
549
550
551
	res = tipc_createport(topsrv.user_ref,
			      NULL,
			      TIPC_CRITICAL_IMPORTANCE,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      subscr_named_msg_event,
			      NULL,
			      NULL,
			      &topsrv.setup_port);
	if (res)
Per Liden's avatar
Per Liden committed
552
553
		goto failed;

554
555
	res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq);
	if (res)
Per Liden's avatar
Per Liden committed
556
557
558
559
560
561
		goto failed;

	spin_unlock_bh(&topsrv.lock);
	return 0;

failed:
562
	err("Failed to create subscription service\n");
Per Liden's avatar
Per Liden committed
563
564
565
566
567
568
	tipc_detach(topsrv.user_ref);
	topsrv.user_ref = 0;
	spin_unlock_bh(&topsrv.lock);
	return res;
}

569
void tipc_subscr_stop(void)
Per Liden's avatar
Per Liden committed
570
571
572
573
574
575
576
{
	struct subscriber *subscriber;
	struct subscriber *subscriber_temp;
	spinlock_t *subscriber_lock;

	if (topsrv.user_ref) {
		tipc_deleteport(topsrv.setup_port);
577
		list_for_each_entry_safe(subscriber, subscriber_temp,
Per Liden's avatar
Per Liden committed
578
579
					 &topsrv.subscriber_list,
					 subscriber_list) {
580
			tipc_ref_lock(subscriber->ref);
Per Liden's avatar
Per Liden committed
581
582
583
584
585
586
587
588
589
590
591
592
593
594
			subscriber_lock = subscriber->lock;
			subscr_terminate(subscriber);
			spin_unlock_bh(subscriber_lock);
		}
		tipc_detach(topsrv.user_ref);
		topsrv.user_ref = 0;
	}
}


int tipc_ispublished(struct tipc_name const *name)
{
	u32 domain = 0;

595
	return(tipc_nametbl_translate(name->type, name->instance,&domain) != 0);
Per Liden's avatar
Per Liden committed
596
597
}