Overnight, beating up my babeld branch... 8k routes is a pretty
"comfortable" figure for everything running... (but all the openwrt
boxes churn madly
on dnsmasq/odhcpd/babel in general).

4k, nothing even blinksor burps now...

odhcpd:

readv(11, [{iov_base="", iov_len=0}, {iov_base="000000 40
0000000000000000000000"..., iov_len=1024}], 2) = 1024

and dnsmasq spins with poll returning every 6ms....

clock_gettime(CLOCK_REALTIME, {tv_sec=1541773935, tv_nsec=446319458}) = 0
poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=6,
events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9,
events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN},
{fd=12, events=POLLIN}, {fd=13, events=POLLIN}, {fd=14,
events=POLLIN}, {fd=15, events=POLLIN}, {fd=16, events=POLLIN},
{fd=17, events=POLLIN}, {fd=18, events=POLLIN}, {fd=19,
events=POLLIN}, {fd=20, events=POLLIN}, {fd=21, events=POLLIN},
{fd=22, events=POLLIN}, {fd=23, events=POLLIN}, {fd=24,
events=POLLIN}, {fd=25, events=POLLIN}, {fd=26, events=POLLIN},
{fd=27, events=POLLIN}, {fd=28, events=POLLIN}, {fd=29,
events=POLLIN}, {fd=30, events=POLLIN}, {fd=31, events=POLLIN},
{fd=32, events=POLLIN}, {fd=33, events=POLLIN}, {fd=34,
events=POLLIN}, {fd=35, events=POLLIN}, ...], 45, -1) = 1 ([{fd=5,
revents=POLLERR}])
clock_gettime(CLOCK_REALTIME, {tv_sec=1541773935, tv_nsec=453018631}) = 0

Even after my 64k routes from yesterday are long gone, dnsmasq keeps
spinning this way. Perhaps that's a bug, or it's hundreds of mb
behind. But I killed and restarted it everywhere...

Anyway...

The attached patch, post-bpf, arbitrarily upping the snd and rcv buf
values, silenced all
the write errors (ENOBUFs) I normally get, and all but one of:

netlink_read: recvmsg(): No buffer space available

I'm not huge on this much buffering on teeny systems,
(the righter answer is to do recv faster)

but perhaps in this modern era, a quick check on how much real memory
is available and upping these would help a bit - or for example,
doubling them when an error happens. I was going to fiddle a bit with
the pacing option, in the case of mcast in particular, and look at
what bird sets for defaults here. I'm out of time this week.


--

Dave Täht
CTO, TekLibre, LLC
http://www.teklibre.com
Tel: 1-831-205-9740
diff --git a/Makefile b/Makefile
index 9b98eb8..2599984 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 PREFIX = /usr/local
 MANDIR = $(PREFIX)/share/man
 
-CDEBUGFLAGS = -Os -g -Wall
+CDEBUGFLAGS = -O2 -g -Wall -msse4.2
 
 DEFINES = $(PLATFORM_DEFINES)
 
diff --git a/kernel_netlink.c b/kernel_netlink.c
index 1f83716..359601c 100644
--- a/kernel_netlink.c
+++ b/kernel_netlink.c
@@ -238,7 +238,7 @@ static int
 netlink_socket(struct netlink *nl, uint32_t groups)
 {
     int rc;
-    int rcvsize = 512 * 1024;
+    int rcvsize = 2048 * 1024;
 
     nl->sock = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
     if(nl->sock < 0)
@@ -273,6 +273,14 @@ netlink_socket(struct netlink *nl, uint32_t groups)
         }
     }
 
+    if(rc < 0) {
+        rc = setsockopt(nl->sock, SOL_SOCKET, SO_SNDBUF,
+                        &rcvsize, sizeof(rcvsize));
+        if(rc < 0) {
+            perror("setsockopt(SO_SNDBUF)");
+        }
+    }
+
     rc = bind(nl->sock, (struct sockaddr *)&nl->sockaddr, nl->socklen);
     if(rc < 0)
         goto fail;
diff --git a/net.c b/net.c
index 5553b0e..0a4f676 100644
--- a/net.c
+++ b/net.c
@@ -46,7 +46,8 @@ babel_socket(int port)
     int s, rc;
     int saved_errno;
     int one = 1, zero = 0;
-    const int ds = 0xc2;        /* CS6 - Network Control + ECN */
+    const int ds = 0x02;        /* ECN */
+    int rcvsize = 2048 * 1024;
 
     s = socket(PF_INET6, SOCK_DGRAM, 0);
     if(s < 0)
@@ -84,6 +85,22 @@ babel_socket(int port)
     if(rc < 0)
         perror("Couldn't set traffic class");
 
+    if(rc < 0) {
+        rc = setsockopt(s, SOL_SOCKET, SO_RCVBUF,
+                        &rcvsize, sizeof(rcvsize));
+        if(rc < 0) {
+            perror("setsockopt(SO_RCVBUF)");
+        }
+    }
+
+    if(rc < 0) {
+        rc = setsockopt(s, SOL_SOCKET, SO_SNDBUF,
+                        &rcvsize, sizeof(rcvsize));
+        if(rc < 0) {
+            perror("setsockopt(SO_SNDBUF)");
+        }
+    }
+
     rc = fcntl(s, F_GETFL, 0);
     if(rc < 0)
         goto fail;
_______________________________________________
Babel-users mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/babel-users

Reply via email to