linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] net: qrtr: Broadcasting control messages
@ 2018-07-04 14:19 Arun Kumar Neelakantam
  2018-07-04 14:19 ` [PATCH 1/2] net: qrtr: Broadcast messages only from control port Arun Kumar Neelakantam
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-04 14:19 UTC (permalink / raw)
  To: davem, bjorn.andersson
  Cc: netdev, linux-kernel, linux-arm-msm, Arun Kumar Neelakantam

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] net: qrtr: Broadcast messages only from control port
  2018-07-04 14:19 [PATCH 0/2] net: qrtr: Broadcasting control messages Arun Kumar Neelakantam
@ 2018-07-04 14:19 ` Arun Kumar Neelakantam
  2018-07-04 14:19 ` [PATCH 2/2] net: qrtr: Reset the node and port ID of broadcast messages Arun Kumar Neelakantam
  2018-07-05 11:20 ` [PATCH 0/2] net: qrtr: Broadcasting control messages David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-04 14:19 UTC (permalink / raw)
  To: davem, bjorn.andersson
  Cc: netdev, linux-kernel, linux-arm-msm, Arun Kumar Neelakantam,
	Florian Westphal, Nicolas Dechesne, Denys Vlasenko

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

Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] net: qrtr: Reset the node and port ID of broadcast messages
  2018-07-04 14:19 [PATCH 0/2] net: qrtr: Broadcasting control messages Arun Kumar Neelakantam
  2018-07-04 14:19 ` [PATCH 1/2] net: qrtr: Broadcast messages only from control port Arun Kumar Neelakantam
@ 2018-07-04 14:19 ` Arun Kumar Neelakantam
  2018-07-05 11:20 ` [PATCH 0/2] net: qrtr: Broadcasting control messages David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-04 14:19 UTC (permalink / raw)
  To: davem, bjorn.andersson
  Cc: netdev, linux-kernel, linux-arm-msm, Arun Kumar Neelakantam,
	Florian Westphal, Hannes Frederic Sowa, Denys Vlasenko,
	Nicolas Dechesne

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 <aneela@codeaurora.org>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] net: qrtr: Broadcasting control messages
  2018-07-04 14:19 [PATCH 0/2] net: qrtr: Broadcasting control messages Arun Kumar Neelakantam
  2018-07-04 14:19 ` [PATCH 1/2] net: qrtr: Broadcast messages only from control port Arun Kumar Neelakantam
  2018-07-04 14:19 ` [PATCH 2/2] net: qrtr: Reset the node and port ID of broadcast messages Arun Kumar Neelakantam
@ 2018-07-05 11:20 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-07-05 11:20 UTC (permalink / raw)
  To: aneela; +Cc: bjorn.andersson, netdev, linux-kernel, linux-arm-msm

From: Arun Kumar Neelakantam <aneela@codeaurora.org>
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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-05 11:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-04 14:19 [PATCH 0/2] net: qrtr: Broadcasting control messages Arun Kumar Neelakantam
2018-07-04 14:19 ` [PATCH 1/2] net: qrtr: Broadcast messages only from control port Arun Kumar Neelakantam
2018-07-04 14:19 ` [PATCH 2/2] net: qrtr: Reset the node and port ID of broadcast messages Arun Kumar Neelakantam
2018-07-05 11:20 ` [PATCH 0/2] net: qrtr: Broadcasting control messages David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).