diff options
-rw-r--r-- | net/tipc/addr.h | 20 | ||||
-rw-r--r-- | net/tipc/bearer.c | 2 | ||||
-rw-r--r-- | net/tipc/name_table.c | 6 | ||||
-rw-r--r-- | net/tipc/node.c | 2 |
4 files changed, 24 insertions, 6 deletions
diff --git a/net/tipc/addr.h b/net/tipc/addr.h index e4f35afe3207..d706a1d92be8 100644 --- a/net/tipc/addr.h +++ b/net/tipc/addr.h | |||
@@ -50,12 +50,30 @@ static inline u32 tipc_cluster_mask(u32 addr) | |||
50 | return addr & TIPC_CLUSTER_MASK; | 50 | return addr & TIPC_CLUSTER_MASK; |
51 | } | 51 | } |
52 | 52 | ||
53 | static inline int in_own_cluster(u32 addr) | 53 | static inline int in_own_cluster_exact(u32 addr) |
54 | { | 54 | { |
55 | return !((addr ^ tipc_own_addr) >> 12); | 55 | return !((addr ^ tipc_own_addr) >> 12); |
56 | } | 56 | } |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * in_own_node - test for node inclusion; <0.0.0> always matches | ||
60 | */ | ||
61 | |||
62 | static inline int in_own_node(u32 addr) | ||
63 | { | ||
64 | return (addr == tipc_own_addr) || !addr; | ||
65 | } | ||
66 | |||
67 | /** | ||
68 | * in_own_cluster - test for cluster inclusion; <0.0.0> always matches | ||
69 | */ | ||
70 | |||
71 | static inline int in_own_cluster(u32 addr) | ||
72 | { | ||
73 | return in_own_cluster_exact(addr) || !addr; | ||
74 | } | ||
75 | |||
76 | /** | ||
59 | * addr_domain - convert 2-bit scope value to equivalent message lookup domain | 77 | * addr_domain - convert 2-bit scope value to equivalent message lookup domain |
60 | * | 78 | * |
61 | * Needed when address of a named message must be looked up a second time | 79 | * Needed when address of a named message must be looked up a second time |
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 5dfd89c40429..0bfdeba91d51 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
@@ -449,7 +449,7 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority) | |||
449 | if (tipc_in_scope(disc_domain, tipc_own_addr)) { | 449 | if (tipc_in_scope(disc_domain, tipc_own_addr)) { |
450 | disc_domain = tipc_own_addr & TIPC_CLUSTER_MASK; | 450 | disc_domain = tipc_own_addr & TIPC_CLUSTER_MASK; |
451 | res = 0; /* accept any node in own cluster */ | 451 | res = 0; /* accept any node in own cluster */ |
452 | } else if (in_own_cluster(disc_domain)) | 452 | } else if (in_own_cluster_exact(disc_domain)) |
453 | res = 0; /* accept specified node in own cluster */ | 453 | res = 0; /* accept specified node in own cluster */ |
454 | } | 454 | } |
455 | if (res) { | 455 | if (res) { |
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 5d7004262647..1e0518da19da 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
@@ -342,7 +342,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, | |||
342 | list_add(&publ->zone_list, &info->zone_list); | 342 | list_add(&publ->zone_list, &info->zone_list); |
343 | info->zone_list_size++; | 343 | info->zone_list_size++; |
344 | 344 | ||
345 | if (in_own_cluster(node)) { | 345 | if (in_own_cluster_exact(node)) { |
346 | list_add(&publ->cluster_list, &info->cluster_list); | 346 | list_add(&publ->cluster_list, &info->cluster_list); |
347 | info->cluster_list_size++; | 347 | info->cluster_list_size++; |
348 | } | 348 | } |
@@ -411,7 +411,7 @@ found: | |||
411 | 411 | ||
412 | /* Remove publication from cluster scope list, if present */ | 412 | /* Remove publication from cluster scope list, if present */ |
413 | 413 | ||
414 | if (in_own_cluster(node)) { | 414 | if (in_own_cluster_exact(node)) { |
415 | list_del(&publ->cluster_list); | 415 | list_del(&publ->cluster_list); |
416 | info->cluster_list_size--; | 416 | info->cluster_list_size--; |
417 | } | 417 | } |
@@ -604,7 +604,7 @@ u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode) | |||
604 | publ = list_first_entry(&info->node_list, struct publication, | 604 | publ = list_first_entry(&info->node_list, struct publication, |
605 | node_list); | 605 | node_list); |
606 | list_move_tail(&publ->node_list, &info->node_list); | 606 | list_move_tail(&publ->node_list, &info->node_list); |
607 | } else if (in_own_cluster(*destnode)) { | 607 | } else if (in_own_cluster_exact(*destnode)) { |
608 | if (list_empty(&info->cluster_list)) | 608 | if (list_empty(&info->cluster_list)) |
609 | goto no_match; | 609 | goto no_match; |
610 | publ = list_first_entry(&info->cluster_list, struct publication, | 610 | publ = list_first_entry(&info->cluster_list, struct publication, |
diff --git a/net/tipc/node.c b/net/tipc/node.c index a34cabc2c43a..6a71bea91db0 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -72,7 +72,7 @@ struct tipc_node *tipc_node_find(u32 addr) | |||
72 | struct tipc_node *node; | 72 | struct tipc_node *node; |
73 | struct hlist_node *pos; | 73 | struct hlist_node *pos; |
74 | 74 | ||
75 | if (unlikely(!in_own_cluster(addr))) | 75 | if (unlikely(!in_own_cluster_exact(addr))) |
76 | return NULL; | 76 | return NULL; |
77 | 77 | ||
78 | hlist_for_each_entry(node, pos, &node_htable[tipc_hashfn(addr)], hash) { | 78 | hlist_for_each_entry(node, pos, &node_htable[tipc_hashfn(addr)], hash) { |