Commit 16fd5d53 authored by David S. Miller's avatar David S. Miller

Merge branch 'qrtr-Broadcasting-control-messages'

Arun Kumar Neelakantam says:

====================
net: qrtr: Broadcasting control messages

Allow messages only from control port to broadcast to avoid unnecessary
messages and reset the node to local router NODE ID in control messages
otherwise remote routers consider the packets as invalid and Drops it.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a9ba23d4 d27e77a3
...@@ -191,8 +191,13 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb, ...@@ -191,8 +191,13 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb,
hdr->type = cpu_to_le32(type); hdr->type = cpu_to_le32(type);
hdr->src_node_id = cpu_to_le32(from->sq_node); hdr->src_node_id = cpu_to_le32(from->sq_node);
hdr->src_port_id = cpu_to_le32(from->sq_port); hdr->src_port_id = cpu_to_le32(from->sq_port);
hdr->dst_node_id = cpu_to_le32(to->sq_node); if (to->sq_port == QRTR_PORT_CTRL) {
hdr->dst_port_id = cpu_to_le32(to->sq_port); hdr->dst_node_id = cpu_to_le32(node->nid);
hdr->dst_port_id = cpu_to_le32(QRTR_NODE_BCAST);
} else {
hdr->dst_node_id = cpu_to_le32(to->sq_node);
hdr->dst_port_id = cpu_to_le32(to->sq_port);
}
hdr->size = cpu_to_le32(len); hdr->size = cpu_to_le32(len);
hdr->confirm_rx = 0; hdr->confirm_rx = 0;
...@@ -764,6 +769,10 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) ...@@ -764,6 +769,10 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
node = NULL; node = NULL;
if (addr->sq_node == QRTR_NODE_BCAST) { if (addr->sq_node == QRTR_NODE_BCAST) {
enqueue_fn = qrtr_bcast_enqueue; enqueue_fn = qrtr_bcast_enqueue;
if (addr->sq_port != QRTR_PORT_CTRL) {
release_sock(sk);
return -ENOTCONN;
}
} else if (addr->sq_node == ipc->us.sq_node) { } else if (addr->sq_node == ipc->us.sq_node) {
enqueue_fn = qrtr_local_enqueue; enqueue_fn = qrtr_local_enqueue;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment