hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/tipc/discover.c
....@@ -74,7 +74,7 @@
7474 /**
7575 * tipc_disc_init_msg - initialize a link setup message
7676 * @net: the applicable net namespace
77
- * @type: message type (request or response)
77
+ * @mtyp: message type (request or response)
7878 * @b: ptr to bearer issuing message
7979 */
8080 static void tipc_disc_init_msg(struct net *net, struct sk_buff *skb,
....@@ -94,6 +94,7 @@
9494 msg_set_dest_domain(hdr, dest_domain);
9595 msg_set_bc_netid(hdr, tn->net_id);
9696 b->media->addr2msg(msg_media_addr(hdr), &b->addr);
97
+ msg_set_peer_net_hash(hdr, tipc_net_hash_mixes(net, tn->random));
9798 msg_set_node_id(hdr, tipc_own_id(net));
9899 }
99100
....@@ -146,8 +147,8 @@
146147 {
147148 struct net *net = d->net;
148149 struct tipc_net *tn = tipc_net(net);
149
- bool trial = time_before(jiffies, tn->addr_trial_end);
150150 u32 self = tipc_own_addr(net);
151
+ bool trial = time_before(jiffies, tn->addr_trial_end) && !self;
151152
152153 if (mtyp == DSC_TRIAL_FAIL_MSG) {
153154 if (!trial)
....@@ -166,7 +167,7 @@
166167
167168 /* Apply trial address if we just left trial period */
168169 if (!trial && !self) {
169
- tipc_sched_net_finalize(net, tn->trial_addr);
170
+ schedule_work(&tn->work);
170171 msg_set_prevnode(buf_msg(d->skb), tn->trial_addr);
171172 msg_set_type(buf_msg(d->skb), DSC_REQ_MSG);
172173 }
....@@ -193,6 +194,7 @@
193194 {
194195 struct tipc_net *tn = tipc_net(net);
195196 struct tipc_msg *hdr = buf_msg(skb);
197
+ u32 pnet_hash = msg_peer_net_hash(hdr);
196198 u16 caps = msg_node_capabilities(hdr);
197199 bool legacy = tn->legacy_addr_format;
198200 u32 sugg = msg_sugg_node_addr(hdr);
....@@ -208,7 +210,10 @@
208210 u32 self;
209211 int err;
210212
211
- skb_linearize(skb);
213
+ if (skb_linearize(skb)) {
214
+ kfree_skb(skb);
215
+ return;
216
+ }
212217 hdr = buf_msg(skb);
213218
214219 if (caps & TIPC_NODE_ID128)
....@@ -241,7 +246,7 @@
241246 return;
242247 if (!tipc_in_scope(legacy, b->domain, src))
243248 return;
244
- tipc_node_check_dest(net, src, peer_id, b, caps, signature,
249
+ tipc_node_check_dest(net, src, peer_id, b, caps, signature, pnet_hash,
245250 &maddr, &respond, &dupl_addr);
246251 if (dupl_addr)
247252 disc_dupl_alert(b, src, &maddr);
....@@ -305,7 +310,7 @@
305310 if (!time_before(jiffies, tn->addr_trial_end) && !tipc_own_addr(net)) {
306311 mod_timer(&d->timer, jiffies + TIPC_DISC_INIT);
307312 spin_unlock_bh(&d->lock);
308
- tipc_sched_net_finalize(net, tn->trial_addr);
313
+ schedule_work(&tn->work);
309314 return;
310315 }
311316
....@@ -337,7 +342,7 @@
337342 * @net: the applicable net namespace
338343 * @b: ptr to bearer issuing requests
339344 * @dest: destination address for request messages
340
- * @dest_domain: network domain to which links can be established
345
+ * @skb: pointer to created frame
341346 *
342347 * Returns 0 if successful, otherwise -errno.
343348 */
....@@ -391,7 +396,6 @@
391396 * tipc_disc_reset - reset object to send periodic link setup requests
392397 * @net: the applicable net namespace
393398 * @b: ptr to bearer issuing requests
394
- * @dest_domain: network domain to which links can be established
395399 */
396400 void tipc_disc_reset(struct net *net, struct tipc_bearer *b)
397401 {