summaryrefslogtreecommitdiff
path: root/accel-pppd/ppp/ppp_fsm.c
AgeCommit message (Collapse)Author
2018-11-27ppp: use random LCP (and NCP) identifiersGuillaume Nault
In DSL setups, it's common to have an intermediate equipment, potentially managed by a different operator, between the two PPP endpoints. In such setups, the client establishes a PPPoE or L2TP session with the intermediate equipment. They perform LCP negotiation and eventually get to the authentication phase. Based on the client's username, the intermediate equipment then establishes another L2TP session with the final PPP endpoint (accel-ppp). At this point, the intermediate equipment forwards any PPP frame received on one side to the other side, so that it becomes transparent to PPP frames. Then accel-ppp starts an LCP negotiation again, performs authentication, negotiates NCPs and finally forwards IP packets to and from the client. +--------+ +--------------+ +-----------+ | Client |------------------------| Intermediate |--------------------| accel-ppp | | | | equipment | | | +--------+ +--------------+ +-----------+ <-- First hop PPPoE --> <-- Second hop --> or L2TP session L2TP session <----------------- End to end PPP session -----------------> Therefore, from the client point of view, two LCP negotiations occur. LCP re-negotiation is explicitly handled by RFC 1661 and even non-conforming PPP clients generally cope with this situation well enough (as long as LCP re-negotiation occurs before the authentication phase completes). However, accel-ppp always starts its LCP negotiation with an identifier set to 1. If the previous LCP negotiation also used identifier 1, then some clients (at least MikroTik products) consider that the Configure-Request sent by accel-ppp is part of the previous LCP negotiation and refuse to return to link establishment phase as mandated by section 3.4 of RFC 1661. We can easily work around this problem by using random identifiers. This maximises the chances that accel-ppp picks a different identifier than the intermediate equipment and avoids falling into the MikroTik problem. In case of bad luck and the chosen identifier is the same as the one used for the original LCP negotiation, then PPP establishment fails and the client tries to reconnect until the intermediate equipment and accel-ppp pick up different numbers. So the connection eventually succeeds. The identifier is set in ppp_fsm_init(), so it also affects NCPs. Therefore, IPCP and IPv6CP now also use random identifiers. We need to define 'id' and 'recv_id' in struct ppp_fsm_t as uint8_t, otherwise they could be chosen larger than 255 and comparing their value with the 8-bits values found in received packets would fail (this was generally not a problem when id was initially set to 1 and wouldn't grow much). Also, let's seed random() at startup, so that we don't end up with the same sequences across restarts. This also benefits other users of random(), like LCP magic numbers. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2014-11-22remove trailing whitespacesDmitry Kozlov
2014-09-09ppp: fsm: do not reinitialize restart counter after Configure-Ack (fixes ↵Dmitry Kozlov
some infinite configure loops)
2012-06-19general preparation for IPoE integrationKozlov Dmitry
2011-08-26ppp: fix infinit layer_down loopKozlov Dmitry
2011-08-24ppp: reworked layer startup procedureKozlov Dmitry
ppp: make IPCP and IPV6CP optional depends on configuration
2011-08-16ppp: improved CCP/IPCP handlingKozlov Dmitry
2011-06-10ppp: implemented passive CCPKozlov Dmitry
2011-05-30rewrited initialization procedure (fix gcc-4.6 builds)Kozlov Dmitry
2011-05-16ppp: discard packets with invalid id before passing it to fsmKozlov Dmitry
ppp: default fsm timeout increased to 3 sec. ppp: accept LCP TermReq/TermAck packets in terminating phase
2011-04-28various ppp and mppe improvementsKozlov Dmitry
2011-01-05rename accel-pptp to accel-pppDmitry Kozlov