aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/link.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index b1f0bee54eac..fb886b525d95 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -410,6 +410,11 @@ char *tipc_link_name(struct tipc_link *l)
410 return l->name; 410 return l->name;
411} 411}
412 412
413u32 tipc_link_state(struct tipc_link *l)
414{
415 return l->state;
416}
417
413/** 418/**
414 * tipc_link_create - create a new link 419 * tipc_link_create - create a new link
415 * @n: pointer to associated node 420 * @n: pointer to associated node
@@ -841,9 +846,14 @@ void tipc_link_reset(struct tipc_link *l)
841 l->in_session = false; 846 l->in_session = false;
842 l->session++; 847 l->session++;
843 l->mtu = l->advertised_mtu; 848 l->mtu = l->advertised_mtu;
849 spin_lock_bh(&l->wakeupq.lock);
850 spin_lock_bh(&l->inputq->lock);
851 skb_queue_splice_init(&l->wakeupq, l->inputq);
852 spin_unlock_bh(&l->inputq->lock);
853 spin_unlock_bh(&l->wakeupq.lock);
854
844 __skb_queue_purge(&l->transmq); 855 __skb_queue_purge(&l->transmq);
845 __skb_queue_purge(&l->deferdq); 856 __skb_queue_purge(&l->deferdq);
846 skb_queue_splice_init(&l->wakeupq, l->inputq);
847 __skb_queue_purge(&l->backlogq); 857 __skb_queue_purge(&l->backlogq);
848 l->backlog[TIPC_LOW_IMPORTANCE].len = 0; 858 l->backlog[TIPC_LOW_IMPORTANCE].len = 0;
849 l->backlog[TIPC_MEDIUM_IMPORTANCE].len = 0; 859 l->backlog[TIPC_MEDIUM_IMPORTANCE].len = 0;
@@ -1380,6 +1390,36 @@ static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe,
1380 __skb_queue_tail(xmitq, skb); 1390 __skb_queue_tail(xmitq, skb);
1381} 1391}
1382 1392
1393void tipc_link_create_dummy_tnl_msg(struct tipc_link *l,
1394 struct sk_buff_head *xmitq)
1395{
1396 u32 onode = tipc_own_addr(l->net);
1397 struct tipc_msg *hdr, *ihdr;
1398 struct sk_buff_head tnlq;
1399 struct sk_buff *skb;
1400 u32 dnode = l->addr;
1401
1402 skb_queue_head_init(&tnlq);
1403 skb = tipc_msg_create(TUNNEL_PROTOCOL, FAILOVER_MSG,
1404 INT_H_SIZE, BASIC_H_SIZE,
1405 dnode, onode, 0, 0, 0);
1406 if (!skb) {
1407 pr_warn("%sunable to create tunnel packet\n", link_co_err);
1408 return;
1409 }
1410
1411 hdr = buf_msg(skb);
1412 msg_set_msgcnt(hdr, 1);
1413 msg_set_bearer_id(hdr, l->peer_bearer_id);
1414
1415 ihdr = (struct tipc_msg *)msg_data(hdr);
1416 tipc_msg_init(onode, ihdr, TIPC_LOW_IMPORTANCE, TIPC_DIRECT_MSG,
1417 BASIC_H_SIZE, dnode);
1418 msg_set_errcode(ihdr, TIPC_ERR_NO_PORT);
1419 __skb_queue_tail(&tnlq, skb);
1420 tipc_link_xmit(l, &tnlq, xmitq);
1421}
1422
1383/* tipc_link_tnl_prepare(): prepare and return a list of tunnel packets 1423/* tipc_link_tnl_prepare(): prepare and return a list of tunnel packets
1384 * with contents of the link's transmit and backlog queues. 1424 * with contents of the link's transmit and backlog queues.
1385 */ 1425 */
@@ -1476,6 +1516,9 @@ bool tipc_link_validate_msg(struct tipc_link *l, struct tipc_msg *hdr)
1476 return false; 1516 return false;
1477 if (session != curr_session) 1517 if (session != curr_session)
1478 return false; 1518 return false;
1519 /* Extra sanity check */
1520 if (!link_is_up(l) && msg_ack(hdr))
1521 return false;
1479 if (!(l->peer_caps & TIPC_LINK_PROTO_SEQNO)) 1522 if (!(l->peer_caps & TIPC_LINK_PROTO_SEQNO))
1480 return true; 1523 return true;
1481 /* Accept only STATE with new sequence number */ 1524 /* Accept only STATE with new sequence number */