summaryrefslogtreecommitdiff
path: root/net/tipc/name_table.c
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2011-11-02 15:49:40 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-02-24 17:05:14 -0500
commitc422f1bdc3d3f9f637b3d288a6601668e26111d6 (patch)
treed3e810de3eb96a19afb65c6605af5e00620e3316 /net/tipc/name_table.c
parentc74a46110fd5f97bf9299e68e9ed0453bdacb181 (diff)
downloadlinux-3.10-c422f1bdc3d3f9f637b3d288a6601668e26111d6.tar.gz
linux-3.10-c422f1bdc3d3f9f637b3d288a6601668e26111d6.tar.bz2
linux-3.10-c422f1bdc3d3f9f637b3d288a6601668e26111d6.zip
tipc: Simplify enforcement of reserved name type prohibition
Streamlines the logic that prevents an application from binding a reserved TIPC name type to a port by moving the check to the code that handles a socket bind() operation. This allows internal TIPC subsystems to bind a reserved name without having to set an atomic flag to gain permission to use such a name. (This simplification is now possible due to the elimination of support for TIPC's native API.) Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/name_table.c')
-rw-r--r--net/tipc/name_table.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 89eb5621ebb..1196f050e33 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -114,10 +114,8 @@ struct name_table {
};
static struct name_table table;
-static atomic_t rsv_publ_ok = ATOMIC_INIT(0);
DEFINE_RWLOCK(tipc_nametbl_lock);
-
static int hash(int x)
{
return x & (tipc_nametbl_size - 1);
@@ -665,22 +663,7 @@ exit:
return res;
}
-/**
- * tipc_nametbl_publish_rsv - publish port name using a reserved name type
- */
-
-int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope,
- struct tipc_name_seq const *seq)
-{
- int res;
-
- atomic_inc(&rsv_publ_ok);
- res = tipc_publish(ref, scope, seq);
- atomic_dec(&rsv_publ_ok);
- return res;
-}
-
-/**
+/*
* tipc_nametbl_publish - add name publication to network name tables
*/
@@ -694,11 +677,6 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
tipc_max_publications);
return NULL;
}
- if ((type < TIPC_RESERVED_TYPES) && !atomic_read(&rsv_publ_ok)) {
- warn("Publication failed, reserved name {%u,%u,%u}\n",
- type, lower, upper);
- return NULL;
- }
write_lock_bh(&tipc_nametbl_lock);
table.local_publ_count++;