Just, after some searching, found http://theory.cs.uni-bonn.de/ppp/rfc/rfc1662.txt . It's the first I actually find that explains the PPP escape sequence properly(like SLIP's escaping, but using a XOR'ed value on bit 5 instead of the escaped value). That should be easy to implement, although I'll have to dig deeper into the protocol for proper PPP to/from Ethernet II frame conversion(if required).
So 0x7E is PPP_END essentially, while PPP_ESC is 0x7D. And following PPP_ESC IS (val XOR 0x20), both used for encoding and decoding.
Edit: Just implemented said functionality as a ppp protocol in UniPCemu's server git repository. The only issue with it is that atm I don't know how to move the PPP packets to(inject) and extract them from the ethernet II packets. Anyone knows more about that?
In effect that means that it will atm just discard and not send or receive any PPP packets on the ethernet side of things(the client just doesn't receive any packets(received packets are discarded by the filter), while packets that are sent are simply gobbled up(from their TCP receive buffers, although parsed) and discarded(no sending functionality for them yet)).
Edit: Hmmm... https://sites.google.com/site/amitsciscozone/ … p-over-ethernet
So EtherType 0x8863 for some discovery packets and EtherType 0x8864. But how to know which of the two to use when sending/receiving packets? Receiving has them already(ready made because it's a received packet), so just send encoded to the client without distinction?
But what about sent packets from the client? How would it know which of the two EtherTypes to use for such a packet?
Edit: Hmmmm...
https://tools.ietf.org/html/rfc2516
Is the discovery part done by the client or is the server supposed to do that when a client connects/disconnects?
Edit: So probably, the server is supposed to do the 4-step channel request and termination handling(after authentication in text mode).
But what about the PPP packets themselves? UniPCemu now decodes and encodes them(parsing the escapes into the send buffer/receive buffer to/from the client).
Are the packets in the Ethernet II frame(type 0x8864) decoded ones or encoded ones? Does it need to re-encode them for putting them inside the type 0x8864 packet(and the reverse for receiving)? Or is it supposed to send the raw unencoded ones one by one?
Edit: Just finished implementing it, with unencoded packets being sent/received over the PPPOE type 0x8864 frames.
Edit: I've just added some missing functionality:
- Implemented sending the PADT packet when the client is disconnected on the TCP connection.
- Implemented unencoded transfers over the PPP connection(previously it was decoding it on receive before passing it through to the ethernet layer instead of keeping it in the same form). The reverse applied when sending packets from the Ethernet to the client.
- Added checks and protection against sending/receiving 2+ following PPP END characters(the 0x7E ones), preventing 0x7E7E from appearing in the data stream to/from the client to the PPPOE server.
- Improved handling of all PAD packets to not propogate through all clients(causing e.g. multiple clients to accept the same Session_ID when simultaneously waiting for their PADS packets).
- Implemented automatic reconnecting using a PADT packet(and the following packets until PADS) when a client is still connected, has received a PADT packet(the PPPOE server requesting a termination of the connection) and the client tries to start to send a new packet.
- Added a modemconnect.ppp.scp file (and renamed the old file to modemconnect.slip.scp) for connecting using the new PPP connection support.
Edit: Just a tiny bugfix: don't send the IPaddress information text(specifying an IP address to use for the client) when using the PPP protocol, as the PPP protocol will do that itself. 🤣