summaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/core.c2
-rw-r--r--net/tipc/core.h3
-rw-r--r--net/tipc/node.c18
-rw-r--r--net/tipc/node.h6
4 files changed, 27 insertions, 2 deletions
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 5b38f5164281..27cccd101ef6 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -43,6 +43,7 @@
43#include "net.h" 43#include "net.h"
44#include "socket.h" 44#include "socket.h"
45#include "bcast.h" 45#include "bcast.h"
46#include "node.h"
46 47
47#include <linux/module.h> 48#include <linux/module.h>
48 49
@@ -59,6 +60,7 @@ static int __net_init tipc_init_net(struct net *net)
59 tn->node_addr = 0; 60 tn->node_addr = 0;
60 tn->trial_addr = 0; 61 tn->trial_addr = 0;
61 tn->addr_trial_end = 0; 62 tn->addr_trial_end = 0;
63 tn->capabilities = TIPC_NODE_CAPABILITIES;
62 memset(tn->node_id, 0, sizeof(tn->node_id)); 64 memset(tn->node_id, 0, sizeof(tn->node_id));
63 memset(tn->node_id_string, 0, sizeof(tn->node_id_string)); 65 memset(tn->node_id_string, 0, sizeof(tn->node_id_string));
64 tn->mon_threshold = TIPC_DEF_MON_THRESHOLD; 66 tn->mon_threshold = TIPC_DEF_MON_THRESHOLD;
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 8020a6c360ff..7a68e1b6a066 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -122,6 +122,9 @@ struct tipc_net {
122 /* Topology subscription server */ 122 /* Topology subscription server */
123 struct tipc_topsrv *topsrv; 123 struct tipc_topsrv *topsrv;
124 atomic_t subscription_count; 124 atomic_t subscription_count;
125
126 /* Cluster capabilities */
127 u16 capabilities;
125}; 128};
126 129
127static inline struct tipc_net *tipc_net(struct net *net) 130static inline struct tipc_net *tipc_net(struct net *net)
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 2dc4919ab23c..2717893e9dbe 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -383,6 +383,11 @@ static struct tipc_node *tipc_node_create(struct net *net, u32 addr,
383 tipc_link_update_caps(l, capabilities); 383 tipc_link_update_caps(l, capabilities);
384 } 384 }
385 write_unlock_bh(&n->lock); 385 write_unlock_bh(&n->lock);
386 /* Calculate cluster capabilities */
387 tn->capabilities = TIPC_NODE_CAPABILITIES;
388 list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
389 tn->capabilities &= temp_node->capabilities;
390 }
386 goto exit; 391 goto exit;
387 } 392 }
388 n = kzalloc(sizeof(*n), GFP_ATOMIC); 393 n = kzalloc(sizeof(*n), GFP_ATOMIC);
@@ -433,6 +438,11 @@ static struct tipc_node *tipc_node_create(struct net *net, u32 addr,
433 break; 438 break;
434 } 439 }
435 list_add_tail_rcu(&n->list, &temp_node->list); 440 list_add_tail_rcu(&n->list, &temp_node->list);
441 /* Calculate cluster capabilities */
442 tn->capabilities = TIPC_NODE_CAPABILITIES;
443 list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
444 tn->capabilities &= temp_node->capabilities;
445 }
436 trace_tipc_node_create(n, true, " "); 446 trace_tipc_node_create(n, true, " ");
437exit: 447exit:
438 spin_unlock_bh(&tn->node_list_lock); 448 spin_unlock_bh(&tn->node_list_lock);
@@ -589,6 +599,7 @@ static void tipc_node_clear_links(struct tipc_node *node)
589 */ 599 */
590static bool tipc_node_cleanup(struct tipc_node *peer) 600static bool tipc_node_cleanup(struct tipc_node *peer)
591{ 601{
602 struct tipc_node *temp_node;
592 struct tipc_net *tn = tipc_net(peer->net); 603 struct tipc_net *tn = tipc_net(peer->net);
593 bool deleted = false; 604 bool deleted = false;
594 605
@@ -604,6 +615,13 @@ static bool tipc_node_cleanup(struct tipc_node *peer)
604 deleted = true; 615 deleted = true;
605 } 616 }
606 tipc_node_write_unlock(peer); 617 tipc_node_write_unlock(peer);
618
619 /* Calculate cluster capabilities */
620 tn->capabilities = TIPC_NODE_CAPABILITIES;
621 list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
622 tn->capabilities &= temp_node->capabilities;
623 }
624
607 spin_unlock_bh(&tn->node_list_lock); 625 spin_unlock_bh(&tn->node_list_lock);
608 return deleted; 626 return deleted;
609} 627}
diff --git a/net/tipc/node.h b/net/tipc/node.h
index 4f59a30e989a..2404225c5d58 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -51,7 +51,8 @@ enum {
51 TIPC_BLOCK_FLOWCTL = (1 << 3), 51 TIPC_BLOCK_FLOWCTL = (1 << 3),
52 TIPC_BCAST_RCAST = (1 << 4), 52 TIPC_BCAST_RCAST = (1 << 4),
53 TIPC_NODE_ID128 = (1 << 5), 53 TIPC_NODE_ID128 = (1 << 5),
54 TIPC_LINK_PROTO_SEQNO = (1 << 6) 54 TIPC_LINK_PROTO_SEQNO = (1 << 6),
55 TIPC_MCAST_RBCTL = (1 << 7)
55}; 56};
56 57
57#define TIPC_NODE_CAPABILITIES (TIPC_SYN_BIT | \ 58#define TIPC_NODE_CAPABILITIES (TIPC_SYN_BIT | \
@@ -60,7 +61,8 @@ enum {
60 TIPC_BCAST_RCAST | \ 61 TIPC_BCAST_RCAST | \
61 TIPC_BLOCK_FLOWCTL | \ 62 TIPC_BLOCK_FLOWCTL | \
62 TIPC_NODE_ID128 | \ 63 TIPC_NODE_ID128 | \
63 TIPC_LINK_PROTO_SEQNO) 64 TIPC_LINK_PROTO_SEQNO | \
65 TIPC_MCAST_RBCTL)
64#define INVALID_BEARER_ID -1 66#define INVALID_BEARER_ID -1
65 67
66void tipc_node_stop(struct net *net); 68void tipc_node_stop(struct net *net);