From b7baa89fbaa04ceb3227d4d43089d8e6a5326b65 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 23 Feb 2024 10:40:30 +0100 Subject: ipcpd: Add build option to use pid as address This adds a build option IPCP_DEBUG_LOCAL that will use the pid as the DT name (address) in the unicast IPCP, which is handy for integration testing and debugging. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/ipcpd/CMakeLists.txt | 2 ++ src/ipcpd/config.h.in | 2 ++ src/ipcpd/unicast/addr-auth/flat.c | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ipcpd/CMakeLists.txt b/src/ipcpd/CMakeLists.txt index 24275a4f..cd81949e 100644 --- a/src/ipcpd/CMakeLists.txt +++ b/src/ipcpd/CMakeLists.txt @@ -1,3 +1,5 @@ +set(IPCP_DEBUG_LOCAL FALSE CACHE BOOL + "Use PID as address for local debugging") set(IPCP_QOS_CUBE_BE_PRIO 50 CACHE STRING "Priority for best effort QoS cube (0-99)") set(IPCP_QOS_CUBE_VIDEO_PRIO 90 CACHE STRING diff --git a/src/ipcpd/config.h.in b/src/ipcpd/config.h.in index 5e8b1c3b..af0658d6 100644 --- a/src/ipcpd/config.h.in +++ b/src/ipcpd/config.h.in @@ -41,6 +41,8 @@ #define IPCP_LINUX_SLACK_NS @IPCP_LINUX_TIMERSLACK_NS@ +#cmakedefine IPCP_DEBUG_LOCAL + /* unicast IPCP */ #define QOS_PRIO_BE @IPCP_QOS_CUBE_BE_PRIO@ #define QOS_PRIO_VIDEO @IPCP_QOS_CUBE_VIDEO_PRIO@ diff --git a/src/ipcpd/unicast/addr-auth/flat.c b/src/ipcpd/unicast/addr-auth/flat.c index b834e86e..c4562935 100644 --- a/src/ipcpd/unicast/addr-auth/flat.c +++ b/src/ipcpd/unicast/addr-auth/flat.c @@ -69,8 +69,11 @@ uint64_t flat_address(void) { uint32_t addr = INVALID_ADDRESS; +#if defined (CONFIG_OUROBOROS_DEBUG) && defined (IPCP_DEBUG_LOCAL) + addr = getpid(); +#else while (addr == INVALID_ADDRESS) random_buffer(&addr,sizeof(addr)); - +#endif return addr; } -- cgit v1.2.3