aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/discover.c18
-rw-r--r--net/tipc/net.c17
-rw-r--r--net/tipc/node.c7
3 files changed, 27 insertions, 15 deletions
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 9f666e0650e2..2830709957bd 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -133,6 +133,8 @@ static void disc_dupl_alert(struct tipc_bearer *b, u32 node_addr,
133} 133}
134 134
135/* tipc_disc_addr_trial(): - handle an address uniqueness trial from peer 135/* tipc_disc_addr_trial(): - handle an address uniqueness trial from peer
136 * Returns true if message should be dropped by caller, i.e., if it is a
137 * trial message or we are inside trial period. Otherwise false.
136 */ 138 */
137static bool tipc_disc_addr_trial_msg(struct tipc_discoverer *d, 139static bool tipc_disc_addr_trial_msg(struct tipc_discoverer *d,
138 struct tipc_media_addr *maddr, 140 struct tipc_media_addr *maddr,
@@ -168,8 +170,9 @@ static bool tipc_disc_addr_trial_msg(struct tipc_discoverer *d,
168 msg_set_type(buf_msg(d->skb), DSC_REQ_MSG); 170 msg_set_type(buf_msg(d->skb), DSC_REQ_MSG);
169 } 171 }
170 172
173 /* Accept regular link requests/responses only after trial period */
171 if (mtyp != DSC_TRIAL_MSG) 174 if (mtyp != DSC_TRIAL_MSG)
172 return false; 175 return trial;
173 176
174 sugg_addr = tipc_node_try_addr(net, peer_id, src); 177 sugg_addr = tipc_node_try_addr(net, peer_id, src);
175 if (sugg_addr) 178 if (sugg_addr)
@@ -284,7 +287,6 @@ static void tipc_disc_timeout(struct timer_list *t)
284{ 287{
285 struct tipc_discoverer *d = from_timer(d, t, timer); 288 struct tipc_discoverer *d = from_timer(d, t, timer);
286 struct tipc_net *tn = tipc_net(d->net); 289 struct tipc_net *tn = tipc_net(d->net);
287 u32 self = tipc_own_addr(d->net);
288 struct tipc_media_addr maddr; 290 struct tipc_media_addr maddr;
289 struct sk_buff *skb = NULL; 291 struct sk_buff *skb = NULL;
290 struct net *net = d->net; 292 struct net *net = d->net;
@@ -298,12 +300,14 @@ static void tipc_disc_timeout(struct timer_list *t)
298 goto exit; 300 goto exit;
299 } 301 }
300 302
301 /* Did we just leave the address trial period ? */ 303 /* Trial period over ? */
302 if (!self && !time_before(jiffies, tn->addr_trial_end)) { 304 if (!time_before(jiffies, tn->addr_trial_end)) {
303 self = tn->trial_addr; 305 /* Did we just leave it ? */
304 tipc_net_finalize(net, self); 306 if (!tipc_own_addr(net))
305 msg_set_prevnode(buf_msg(d->skb), self); 307 tipc_net_finalize(net, tn->trial_addr);
308
306 msg_set_type(buf_msg(d->skb), DSC_REQ_MSG); 309 msg_set_type(buf_msg(d->skb), DSC_REQ_MSG);
310 msg_set_prevnode(buf_msg(d->skb), tipc_own_addr(net));
307 } 311 }
308 312
309 /* Adjust timeout interval according to discovery phase */ 313 /* Adjust timeout interval according to discovery phase */
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 4fbaa0464405..a7f6964c3a4b 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -121,12 +121,17 @@ int tipc_net_init(struct net *net, u8 *node_id, u32 addr)
121 121
122void tipc_net_finalize(struct net *net, u32 addr) 122void tipc_net_finalize(struct net *net, u32 addr)
123{ 123{
124 tipc_set_node_addr(net, addr); 124 struct tipc_net *tn = tipc_net(net);
125 smp_mb(); 125
126 tipc_named_reinit(net); 126 spin_lock_bh(&tn->node_list_lock);
127 tipc_sk_reinit(net); 127 if (!tipc_own_addr(net)) {
128 tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, 128 tipc_set_node_addr(net, addr);
129 TIPC_CLUSTER_SCOPE, 0, addr); 129 tipc_named_reinit(net);
130 tipc_sk_reinit(net);
131 tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr,
132 TIPC_CLUSTER_SCOPE, 0, addr);
133 }
134 spin_unlock_bh(&tn->node_list_lock);
130} 135}
131 136
132void tipc_net_stop(struct net *net) 137void tipc_net_stop(struct net *net)
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 6a44eb812baf..0453bd451ce8 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -797,6 +797,7 @@ static u32 tipc_node_suggest_addr(struct net *net, u32 addr)
797} 797}
798 798
799/* tipc_node_try_addr(): Check if addr can be used by peer, suggest other if not 799/* tipc_node_try_addr(): Check if addr can be used by peer, suggest other if not
800 * Returns suggested address if any, otherwise 0
800 */ 801 */
801u32 tipc_node_try_addr(struct net *net, u8 *id, u32 addr) 802u32 tipc_node_try_addr(struct net *net, u8 *id, u32 addr)
802{ 803{
@@ -819,12 +820,14 @@ u32 tipc_node_try_addr(struct net *net, u8 *id, u32 addr)
819 if (n) { 820 if (n) {
820 addr = n->addr; 821 addr = n->addr;
821 tipc_node_put(n); 822 tipc_node_put(n);
823 return addr;
822 } 824 }
823 /* Even this node may be in trial phase */ 825
826 /* Even this node may be in conflict */
824 if (tn->trial_addr == addr) 827 if (tn->trial_addr == addr)
825 return tipc_node_suggest_addr(net, addr); 828 return tipc_node_suggest_addr(net, addr);
826 829
827 return addr; 830 return 0;
828} 831}
829 832
830void tipc_node_check_dest(struct net *net, u32 addr, 833void tipc_node_check_dest(struct net *net, u32 addr,