[PATCH] ipcpd: Fix RIB output for dt component

  • From: Dimitri Staessens <dimitri.staessens@xxxxxxxx>
  • To: ouroboros@xxxxxxxxxxxxx
  • Date: Thu, 14 Jun 2018 10:57:29 +0200

The RIB output length was fixed for 3 qos cubes. Now it will scale
correctly if QoS cubes are added or removed.

Signed-off-by: Dimitri Staessens <dimitri.staessens@xxxxxxxx>
---
 src/ipcpd/normal/dt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/ipcpd/normal/dt.c b/src/ipcpd/normal/dt.c
index 9ab1646..397169f 100644
--- a/src/ipcpd/normal/dt.c
+++ b/src/ipcpd/normal/dt.c
@@ -56,7 +56,8 @@
 #include <inttypes.h>
 #include <assert.h>
 
-#define STAT_FILE_LEN 2205
+#define QOS_BLOCK_LEN 672
+#define STAT_FILE_LEN (189 + QOS_BLOCK_LEN * QOS_CUBE_MAX)
 
 #ifndef CLOCK_REALTIME_COARSE
 #define CLOCK_REALTIME_COARSE CLOCK_REALTIME
@@ -110,7 +111,7 @@ static int dt_stat_read(const char * path,
 #ifdef IPCP_FLOW_STATS
         int         fd;
         int         i;
-        char        str[681];
+        char        str[QOS_BLOCK_LEN + 1];
         char        addrstr[20];
         char        tmstr[20];
         size_t      rxqlen = 0;
-- 
2.17.1


Other related posts:

  • » [PATCH] ipcpd: Fix RIB output for dt component - Dimitri Staessens