changeset 5007:a5d64cd4b391 draft

dhcpcd: When route socket overflows, report how large it is. Of course Linux likes to double it, so cater for this.
author Roy Marples <roy@marples.name>
date Sun, 26 Jan 2020 15:46:41 +0000
parents 8f08888b3c0f
children 28209b094c6c
files src/dhcpcd.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/dhcpcd.c	Sun Jan 26 15:46:16 2020 +0000
+++ b/src/dhcpcd.c	Sun Jan 26 15:46:41 2020 +0000
@@ -1116,11 +1116,23 @@
 void
 dhcpcd_linkoverflow(struct dhcpcd_ctx *ctx)
 {
+	socklen_t socklen;
+	int rcvbuflen;
 	struct if_head *ifaces;
 	struct ifaddrs *ifaddrs;
 	struct interface *ifp, *ifn, *ifp1;
 
-	logerrx("route socket overflowed - learning interface state");
+	socklen = sizeof(rcvbuflen);
+	if (getsockopt(ctx->link_fd, SOL_SOCKET,
+	    SO_RCVBUF, &rcvbuflen, &socklen) == -1)
+		rcvbuflen = 0;
+#ifdef __linux__
+	else
+		rcvbuflen /= 2;
+#endif
+
+	logerrx("route socket overflowed (rcvbuflen %d)"
+	    " - learning interface state", rcvbuflen);
 
 	/* Close the existing socket and open a new one.
 	 * This is easier than draining the kernel buffer of an