From 5f530f2b71a6ca7b682e620ed493e814a214e2a6 Mon Sep 17 00:00:00 2001 From: Chris Lew Date: Tue, 9 Jul 2019 17:12:49 -0700 Subject: [PATCH] net: qrtr: Add dynamic node id configuration Add support to configure the node id through defconfig. This is useful for targets that are unable to configure the node id through qrtr-ns because of security reasons. The local node id can still be overridden by the ns if it is capable. Change-Id: Ie9fec2ae276948340f4f5a7e0374d554502a0ee1 Signed-off-by: Chris Lew --- net/qrtr/Kconfig | 11 +++++++++++ net/qrtr/qrtr.c | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/net/qrtr/Kconfig b/net/qrtr/Kconfig index b74e6fc2222e..be1c32e10f18 100644 --- a/net/qrtr/Kconfig +++ b/net/qrtr/Kconfig @@ -14,6 +14,17 @@ config QRTR if QRTR +config QRTR_NODE_ID + int "QRTR Local Node ID" + default 1 + ---help--- + This option is used to configure the QRTR Node ID for the local + processor. The node ID published to other nodes within the system. + This value can be overridden by the name service application. This + option is for configurations where Node ID needs to be customized + but the name service application is not priveleged enough to use + netlink sockets. + config QRTR_SMD tristate "SMD IPC Router channels" depends on RPMSG || (COMPILE_TEST && RPMSG=n) diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index 2d940d7a2d75..1f96dac37147 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -122,7 +122,7 @@ static inline struct qrtr_sock *qrtr_sk(struct sock *sk) return container_of(sk, struct qrtr_sock, sk); } -static unsigned int qrtr_local_nid = 1; +static unsigned int qrtr_local_nid = CONFIG_QRTR_NODE_ID; /* for node ids */ static RADIX_TREE(qrtr_nodes, GFP_KERNEL);