2018-07-04 14:20:54

by Arun Kumar Neelakantam

[permalink] [raw]
Subject: [PATCH 0/2] 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(-)

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



2018-07-04 14:21:31

by Arun Kumar Neelakantam

[permalink] [raw]
Subject: [PATCH 1/2] net: qrtr: Broadcast messages only from control port

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

Signed-off-by: Arun Kumar Neelakantam <[email protected]>
---
net/qrtr/qrtr.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 2aa07b5..7ffc9a3 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -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 {
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2018-07-04 14:22:43

by Arun Kumar Neelakantam

[permalink] [raw]
Subject: [PATCH 2/2] net: qrtr: Reset the node and port ID of broadcast messages

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.

Signed-off-by: Arun Kumar Neelakantam <[email protected]>
---
net/qrtr/qrtr.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 7ffc9a3..86e1e37 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;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2018-07-05 11:22:41

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 0/2] net: qrtr: Broadcasting control messages

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

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