sthen 0038f57c90 Add a fix from Sergey Ryazanov <ryazanov.s.a / gmail.com> to handle
fragmented ppp frames while reading from pty. From Sergey's mail:

=====
xl2tpd could not correctly handle fragmented ppp frame while read it
from pty if one of consequent read operation return an error.
That's happening because xl2tpd too often cleans the buffer and
assumes that each read frame operation is performed for new frame,
since xl2tpd uses single buffer for pty and for socket read operations.

The attached patch moves all pty related buffers into _call_ context
and corrects calculation of buffer position, what fixes issue with
handling of fragmented frames. Now we can use MTU > 1000. I tested
these changes with load (L2TP tunnel without IPSec) and all seems work
normally. No more "Protocol-Reject" frames.
=====

Performance is still poor (Sergey was seeing ~2Mb/s, I am seeing less
despite low cpu use) but the tunnel now seems reliable.
2015-06-19 16:34:41 +00:00

14 lines
589 B
Plaintext

--- call.h.orig Tue Jun 16 02:19:52 2015
+++ call.h Tue Jun 16 02:20:33 2015
@@ -70,6 +70,10 @@ struct call
*/
struct tunnel *container; /* Tunnel we belong to */
int fd; /* File descriptor for pty */
+ unsigned char rbuf[MAX_RECV_SIZE]; /* pty read buffer */
+ int rbuf_pos; /* Read buffer position */
+ int rbuf_max; /* Read buffer data length */
+ struct buffer *ppp_buf; /* Packet read from pty */
struct termios *oldptyconf;
int die;
int nego; /* Show negotiation? */