summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-07-05 18:36:25 +0200
committerSander Vrijders <sander@ouroboros.rocks>2026-07-08 11:02:24 +0200
commit73394044b300c90548fa92f57748996df324a180 (patch)
tree3a85b094899e5a53f274c0eb423f469d186268af
parent11d3d58a8f60a16485e89582c1c12a224e11152b (diff)
downloadouroboros-73394044b300c90548fa92f57748996df324a180.tar.gz
ouroboros-73394044b300c90548fa92f57748996df324a180.zip
ipcpd: Report eth socket egress queue in RIB
Add the raw socket's SIOCOUTQ egress backlog to the eth RIB and relabel the existing FIONREAD RIB entry as ingress. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r--src/ipcpd/eth/eth.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c
index efb1b61e..2d3bd249 100644
--- a/src/ipcpd/eth/eth.c
+++ b/src/ipcpd/eth/eth.c
@@ -83,6 +83,7 @@
#include <linux/if_ether.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
+#include <linux/sockios.h>
#endif
#ifdef __FreeBSD__
@@ -437,6 +438,7 @@ static int eth_rib_read(const char * path,
int queued = 0;
socklen_t optlen = sizeof(rcvbuf);
# if defined(__linux__)
+ int outq = 0;
struct tpacket_stats tp_stats;
socklen_t tp_len = sizeof(tp_stats);
# endif
@@ -448,6 +450,7 @@ static int eth_rib_read(const char * path,
SO_SNDBUF, &sndbuf, &optlen);
ioctl(eth_data.s_fd, FIONREAD, &queued);
# if defined(__linux__)
+ ioctl(eth_data.s_fd, SIOCOUTQ, &outq);
if (getsockopt(eth_data.s_fd, SOL_PACKET,
PACKET_STATISTICS,
&tp_stats, &tp_len) == 0) {
@@ -483,12 +486,14 @@ static int eth_rib_read(const char * path,
n += sprintf(buf + n,
"Socket rcvbuf (bytes): %20d\n"
"Socket sndbuf (bytes): %20d\n"
- "Socket queued (bytes): %20d\n",
+ "Socket ingress (bytes): %20d\n",
rcvbuf, sndbuf, queued);
# if defined(__linux__)
n += sprintf(buf + n,
+ "Socket egress (bytes): %20d\n"
"Kernel frames received: %20zu\n"
"Kernel frames dropped: %20zu\n",
+ outq,
LOAD_RELAXED(&eth_data.stat.kern_rcv),
LOAD_RELAXED(&eth_data.stat.kern_drp));
# endif
@@ -576,6 +581,7 @@ static int eth_rib_readdir(char *** buf)
fail_entry:
while (idx-- > 0)
free((*buf)[idx]);
+
free(*buf);
fail_entries:
pthread_rwlock_unlock(&eth_data.flows_lock);