tipc: add ability to order and receive topology events in driver

As preparation for introducing communication groups, we add the ability
to issue topology subscriptions and receive topology events from kernel
space. This will make it possible for group member sockets to keep track
of other group members.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jon Maloy
2017-10-13 11:04:17 +02:00
committed by David S. Miller
parent 2d0d21c12d
commit 14c04493cb
5 changed files with 124 additions and 40 deletions

View File

@@ -896,6 +896,10 @@ exit:
kfree_skb(skb);
}
static void tipc_sk_top_evt(struct tipc_sock *tsk, struct tipc_event *evt)
{
}
/**
* tipc_sendmsg - send message in connectionless manner
* @sock: socket structure
@@ -1671,20 +1675,24 @@ static bool filter_rcv(struct sock *sk, struct sk_buff *skb,
struct tipc_msg *hdr = buf_msg(skb);
unsigned int limit = rcvbuf_limit(sk, skb);
int err = TIPC_OK;
int usr = msg_user(hdr);
u32 onode;
if (unlikely(msg_user(hdr) == CONN_MANAGER)) {
tipc_sk_proto_rcv(tsk, skb, xmitq);
return false;
}
if (unlikely(usr == SOCK_WAKEUP)) {
onode = msg_orignode(hdr);
if (unlikely(!msg_isdata(hdr))) {
switch (msg_user(hdr)) {
case CONN_MANAGER:
tipc_sk_proto_rcv(tsk, skb, xmitq);
return false;
case SOCK_WAKEUP:
u32_del(&tsk->cong_links, msg_orignode(hdr));
tsk->cong_link_cnt--;
sk->sk_write_space(sk);
break;
case TOP_SRV:
tipc_sk_top_evt(tsk, (void *)msg_data(hdr));
break;
default:
break;
}
kfree_skb(skb);
u32_del(&tsk->cong_links, onode);
tsk->cong_link_cnt--;
sk->sk_write_space(sk);
return false;
}