Skip to contentSkip to conversation

net: qrtr: Broadcasting control messages

PATCH In review Arun Kumar Neelakantam 2 participants 4 messages Jul 4, 2018 – Jul 5, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover 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.

Arun Kumar Neelakantam (2):
net: qrtr: Broadcast messages only from control port
net: qrtr: Reset the node and port ID of broadcast messages

 net/qrtr/qrtr.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

PATCH 1/2 net: qrtr: Broadcast messages only from control port

The broadcast node id should only be sent with the control port id.

---
 net/qrtr/qrtr.c | 4 ++++
 1 file changed, 4 insertions(+)
net/qrtr/qrtr.c +4 -0
index 2aa07b5..7ffc9a3 100644
@@ -764,6 +764,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 {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw

PATCH 2/2 net: qrtr: Reset the node and port ID of broadcast messages

In reply to Arun Kumar Neelakantam

All the control messages broadcast to remote routers are using QRTR_NODE_BCAST instead of using local router NODE ID which cause the packets to be dropped on remote router due to invalid NODE ID.

---
 net/qrtr/qrtr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
net/qrtr/qrtr.c +7 -2
index 7ffc9a3..86e1e37 100644
@@ -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;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#3 lore raw
In reply to Arun Kumar Neelakantam

From: Arun Kumar Neelakantam <[email protected]>
Date: Wed, 4 Jul 2018 19:49:31 +0530

Quoted 3 lines

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.

Series applied, thanks.