about "GRE: xmit failed from decaps_hdlc: No buffer space available"

Maximiliano Curia <[email protected]> Sat, 24 Nov 2012 19:54:12 +0100
Newsgroups gmane.network.poptop
Message-ID <[email protected]>
Hi,

Some time ago there was a report in this list about the
"GRE: xmit failed from decaps_hdlc: No buffer space available" [1]
message, which seems to cause the connections to be closed. Probably related
to ENOBUFS.

In the Debian bug tracker the report can be found:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692129

I made a small patch to avoid the coonection to be closed, by returning 0 in
encaps_gre if the write failed with ENOBUFS (the same that mpd-5.6 [2] seems to be
doing).

Sadly, I don't have a setup to test this bug, and, anyway I would rather to
have your input in this patch.

----
diff -ru pptpd-1.3.4/pptpgre.c pptpd-1.3.4.changed/pptpgre.c
--- pptpd-1.3.4/pptpgre.c	2012-11-24 18:07:08.000000000 +0100
+++ pptpd-1.3.4.changed/pptpgre.c	2012-11-24 18:02:34.498283284 +0100
@@ -443,6 +443,7 @@
 		unsigned char buffer[PACKET_MAX + sizeof(struct pptp_gre_header)];
 	} u;
 	unsigned header_len;
+	ssize_t status;
 #ifdef HAVE_WRITEV
 	struct iovec iovec[2];
 #endif
@@ -493,12 +494,18 @@
 	iovec[0].iov_len = header_len;
 	iovec[1].iov_base = pack;
 	iovec[1].iov_len = len;
-	return writev(fd, iovec, 2);
+	status = writev(fd, iovec, 2); 
 #else
 	/* copy payload into buffer */
 	memcpy(u.buffer + header_len, pack, len);
 	/* record and increment sequence numbers */
 	/* write this baby out to the net */
-	return write(fd, u.buffer, header_len + len);
+	status = write(fd, u.buffer, header_len + len);
 #endif
+	if ((status >= 0) || (errno != ENOBUFS)) {
+		return status;
+	}
+	// if ENOBUFS, do not close the connection
+	gre.seq_sent--;
+	return 0;
 }
----

[1] :
http://sourceforge.net/mailarchive/forum.php?thread_name=20100308083157.GI26854%40us.netrek.org&forum_name=poptop-server
[2] :
http://sourceforge.net/projects/mpd/files/Mpd5/Mpd-5.6/
-- 
Saludos,
Maxy


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov