Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPP sync mode support #22

Open
sorz opened this issue Mar 30, 2017 · 8 comments
Open

PPP sync mode support #22

sorz opened this issue Mar 30, 2017 · 8 comments

Comments

@sorz
Copy link
Owner

sorz commented Mar 30, 2017

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.

@deba12
Copy link
Contributor

deba12 commented Mar 30, 2017

@sorz
Copy link
Owner Author

sorz commented Mar 30, 2017

@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.

@deba12
Copy link
Contributor

deba12 commented Mar 30, 2017

i think you should read atleast 1500 bytes not 1401 :) or mtu/mru size configured in sstp.options

@sorz
Copy link
Owner Author

sorz commented Mar 31, 2017 via email

@deba12
Copy link
Contributor

deba12 commented Mar 31, 2017

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.

@deba12
Copy link
Contributor

deba12 commented Mar 31, 2017

what about making escape and unescape functions in pure C?

@deba12
Copy link
Contributor

deba12 commented Jun 29, 2017

any news on this? 😀
it wil be interesting to see how it will works with python3 implementation

@sorz
Copy link
Owner Author

sorz commented Jul 6, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants