diff options
author | David S. Miller <davem@davemloft.net> | 2018-07-05 14:20:03 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-07-05 14:20:03 +0300 |
commit | 16fd5d53e524bebe645badbbde129b4989a0001e (patch) | |
tree | afc8b015ee789204fa1326fd3dafcf6fd900efe6 | |
parent | a9ba23d48dbc6ffd08426bb10f05720e0b9f5c14 (diff) | |
parent | d27e77a3de2866b0a772803fd03cd667b5ff8a9a (diff) | |
download | linux-16fd5d53e524bebe645badbbde129b4989a0001e.tar.xz |
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: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/qrtr/qrtr.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index 2aa07b547b16..86e1e37eb4e8 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -191,8 +191,13 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb, hdr->type = cpu_to_le32(type); hdr->src_node_id = cpu_to_le32(from->sq_node); hdr->src_port_id = cpu_to_le32(from->sq_port); - hdr->dst_node_id = cpu_to_le32(to->sq_node); - hdr->dst_port_id = cpu_to_le32(to->sq_port); + if (to->sq_port == QRTR_PORT_CTRL) { + 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->confirm_rx = 0; @@ -764,6 +769,10 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) node = NULL; if (addr->sq_node == QRTR_NODE_BCAST) { 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) { enqueue_fn = qrtr_local_enqueue; } else { |