summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2024-02-23 10:40:30 +0100
committerSander Vrijders <sander@ouroboros.rocks>2024-02-23 16:41:38 +0100
commitb7baa89fbaa04ceb3227d4d43089d8e6a5326b65 (patch)
tree3f03b349c4645a2a7bc21c0bc5a9d9c57604122b
parentf796e85856382b6beba5c108d74ecf9baf8bb773 (diff)
downloadouroboros-b7baa89fbaa04ceb3227d4d43089d8e6a5326b65.tar.gz
ouroboros-b7baa89fbaa04ceb3227d4d43089d8e6a5326b65.zip
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 <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r--src/ipcpd/CMakeLists.txt2
-rw-r--r--src/ipcpd/config.h.in2
-rw-r--r--src/ipcpd/unicast/addr-auth/flat.c5
3 files changed, 8 insertions, 1 deletions
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;
}