summaryrefslogtreecommitdiff
path: root/net/tipc/monitor.c
diff options
context:
space:
mode:
authorHoang Le <hoang.h.le@dektech.com.au>2019-11-12 07:40:04 +0700
committerDavid S. Miller <davem@davemloft.net>2019-11-12 19:45:45 -0800
commit46cb01eeeb86fca6afe24dda1167b0cb95424e29 (patch)
tree521333f62319b6a56a518f1cc6444a7b05f7be5a /net/tipc/monitor.c
parent0320d1e7a3819dd81c9b2892f0ce6fd82b453bdf (diff)
tipc: update mon's self addr when node addr generated
In commit 25b0b9c4e835 ("tipc: handle collisions of 32-bit node address hash values"), the 32-bit node address only generated after one second trial period expired. However the self's addr in struct tipc_monitor do not update according to node address generated. This lead to it is always zero as initial value. As result, sorting algorithm using this value does not work as expected, neither neighbor monitoring framework. In this commit, we add a fix to update self's addr when 32-bit node address generated. Fixes: 25b0b9c4e835 ("tipc: handle collisions of 32-bit node address hash values") Acked-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/monitor.c')
-rw-r--r--net/tipc/monitor.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c
index 6a6eae88442f..58708b4c7719 100644
--- a/net/tipc/monitor.c
+++ b/net/tipc/monitor.c
@@ -665,6 +665,21 @@ void tipc_mon_delete(struct net *net, int bearer_id)
kfree(mon);
}
+void tipc_mon_reinit_self(struct net *net)
+{
+ struct tipc_monitor *mon;
+ int bearer_id;
+
+ for (bearer_id = 0; bearer_id < MAX_BEARERS; bearer_id++) {
+ mon = tipc_monitor(net, bearer_id);
+ if (!mon)
+ continue;
+ write_lock_bh(&mon->lock);
+ mon->self->addr = tipc_own_addr(net);
+ write_unlock_bh(&mon->lock);
+ }
+}
+
int tipc_nl_monitor_set_threshold(struct net *net, u32 cluster_size)
{
struct tipc_net *tn = tipc_net(net);