PPP sync mode support
sorz opened this issue · 8 comments
Current sstp-server using async ppp, it requires escaping & unescaping every frames it
send and receive (and the pppd also have to do that). If we can use sync mode, lots of
CPU time will be save from these meaningless escaping & unescaping .
I tried to support sync mode on 15f66b3.
It seem work at the beginning, but once I fire a iperf, things go wrong: some frames that
read from pppd (via pty) are "broken".
Normally, the data stream are something like:
…[frame #5][frame #6][frame #7]…
But when the traffic increase, it comes like
…[frame #5][first 40 bytes of frame #6][frame #6][frame #7]…
(the number "40" is just a example, may more or less)
In the other word, it received a duplicated, partial frame, inserted just before the normal
complete frame.
Since in sync mode the boundary of frames does not exist, I don't know how to handle this.
And I don't know why this happen either.
I don't know if will help:
https://technet.microsoft.com/en-us/library/cc957975.aspx
and byte stuffing
https://web.cs.wpi.edu/~rek/Grad_Nets/Spring2006/BitByteStuff06.pdf
@deba12 thanks.
By radomly Google, I found this:
4.4 Synchronous PPP
[...] correct operation in this mode relies on pppoe reading exactly one frame at a time from standard input.
Then I digged into to rp-pppoe's source code, which call read()
with maximum frame size.
So I patched Twisted on 20051b4 to read in the same way.
Now I can do iperf without lost the connection. But there is some packet loss on downloading (client's perspective), and very poor upload speed.
I will check detail on another day.
i think you should read atleast 1500 bytes not 1401 :) or mtu/mru size configured in sstp.options
okay but keep in mind
The maximum size of a PPP frame, known as the maximum receive unit (MRU), is determined during the negotiation of the logical link. The default MRU is 1,500 bytes. If negotiated lower, a PPP host must still have the ability to receive 1,500-byte frames in the event of link synchronization failure.
what about making escape and unescape functions in pure C?
any news on this? 😀
it wil be interesting to see how it will works with python3 implementation
I'm still confused on it.
The key is probably on lower level like system call or something.
I guess the new py3 implementation won't help.