1
0

debian-692129_pptpd-1.3.4_manage-enobufs.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. Description: Fix PPTP connections drop
  2. Origin: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692129#22
  3. Author: Maximiliano Curia <maxy@debian.org>
  4. Forwarded: http://sourceforge.net/mailarchive/forum.php?thread_name=1360193901%40msgid.manchmal.in-ulm.de&forum_name=poptop-server
  5. Bug-Debian: http://bugs.debian.org/692129
  6. --- a/pptpgre.c
  7. +++ b/pptpgre.c
  8. @@ -443,6 +443,7 @@
  9. unsigned char buffer[PACKET_MAX + sizeof(struct pptp_gre_header)];
  10. } u;
  11. unsigned header_len;
  12. + ssize_t status;
  13. #ifdef HAVE_WRITEV
  14. struct iovec iovec[2];
  15. #endif
  16. @@ -493,12 +494,18 @@
  17. iovec[0].iov_len = header_len;
  18. iovec[1].iov_base = pack;
  19. iovec[1].iov_len = len;
  20. - return writev(fd, iovec, 2);
  21. + status = writev(fd, iovec, 2);
  22. #else
  23. /* copy payload into buffer */
  24. memcpy(u.buffer + header_len, pack, len);
  25. /* record and increment sequence numbers */
  26. /* write this baby out to the net */
  27. - return write(fd, u.buffer, header_len + len);
  28. + status = write(fd, u.buffer, header_len + len);
  29. #endif
  30. + if ((status >= 0) || (errno != ENOBUFS)) {
  31. + return status;
  32. + }
  33. + // if ENOBUFS, do not close the connection
  34. + gre.seq_sent--;
  35. + return 0;
  36. }