tipc: add second source address to recvmsg()/recvfrom()

With group communication, it becomes important for a message receiver to
identify not only from which socket (identfied by a node:port tuple) the
message was sent, but also the logical identity (type:instance) of the
sending member.

We fix this by adding a second instance of struct sockaddr_tipc to the
source address area when a message is read. The extra address struct
is filled in with data found in the received message header (type,) and
in the local member representation struct (instance.)

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:24 +02:00
committed by David S. Miller
parent 75da2163db
commit 31c82a2d9d
3 changed files with 37 additions and 16 deletions
+3
View File
@@ -61,6 +61,7 @@ struct tipc_member {
struct list_head list;
u32 node;
u32 port;
u32 instance;
enum mbr_state state;
u16 bc_rcv_nxt;
};
@@ -282,6 +283,7 @@ void tipc_group_filter_msg(struct tipc_group *grp, struct sk_buff_head *inputq,
if (!tipc_group_is_receiver(m))
goto drop;
TIPC_SKB_CB(skb)->orig_member = m->instance;
__skb_queue_tail(inputq, skb);
m->bc_rcv_nxt = msg_grp_bc_seqno(hdr) + 1;
@@ -388,6 +390,7 @@ void tipc_group_member_evt(struct tipc_group *grp,
m->state = MBR_PUBLISHED;
else
m->state = MBR_JOINED;
m->instance = evt->found_lower;
tipc_group_proto_xmit(grp, m, GRP_JOIN_MSG, xmitq);
} else if (evt->event == TIPC_WITHDRAWN) {
if (!m)