This function only set PPP to initialize phase, and it is only called at
the very beginning of functions where it is called. It means we could
as well set the initialize phase before calling those functions in the
PPP core.
PPP is currently in initialize phase until authentication is started
or until we start IPCP negotiation.
It works, because PPP states are mostly used for user information, most
state are actually useless for PPP itself. Being in initialize state
while PPP is started is not very consistent, switch to establish phase
before starting LCP.
sc->sc_ethif can't be NULL, it is set definitively in pppoe_create.
PPPoE can't by anything else than PADI sent in pppoe_send_padi, it
is only called when this is true.
PPPoE state can't be anything else than initial state in
pppoe_connect, this function is called from PPP core only when PPP
is in the dead phase, if PPP is in the dead phase it means the link
protocol is dead as well.
PPPoE can't be anything else than data phase in pppoe_disconnect
this function is only called by PPP core only when PPP session is up,
if PPP session is UP it means the link protocol is UP as well.
PPPoE can't by anything else than PADR sent in pppoe_send_padr, it
is only called when this is true.
PPPoE can't by anything else than PADO sent in pppoe_send_pado, it
is only called when this is true.
PPPoE can't by anything else than PADO sent in pppoe_send_pads, it
is only called when this is true.
PPPoE can't be anything else than session phase in pppoe_xmit,
function is only called by pppoe_write and pppoe_netif_output
which are both called by PPP core only when PPP session is up, if
PPP session is UP it means the link protocol is UP as well.
L2TP state can't be anything else than initial state in
pppol2tp_connect, this function is called from PPP core only when PPP
is in the dead phase, if PPP is in the dead phase it means the link
protocol is dead as well.
L2TP can't be anything else than data phase in pppol2tp_xmit, this
function is only called by pppol2tp_write and pppol2tp_netif_output
which are both called by PPP core only when PPP session is up, if
PPP session is UP it means the link protocol is UP as well.
L2TP can't be anything else than data phase in pppol2tp_disconnect,
this function is only called by PPP core only when PPP session is up,
if PPP session is UP it means the link protocol is UP as well.
When we are disconnecting, we should switch to PPP dead phase at the
very end, because this is our final disconnection phase allowing
reconnect, therefore we should switch to dead phase after the link
protocol finished disconnecting.
We are currently switching to dead phase when LCP detected that the link
is down, this is obviously wrong. Fix this flaw by continuing in
disconnect phase until ppp_link_end is called from link protocol.
In the BSD socket API world, IP_HDRINCL is a socket option for "raw"
sockets that indicates whether sent packets already include an IP
header. Within lwIP, "IP_HDRINCL" is redefined as a special value
that indicates to lwIP-internal functions that an IP header is already
included. While somewhat related, the two meanings are different and,
on platforms that define the IP_HDRINCL socket option, this results in
a conflict. This patch renames the lwIP one to "LWIP_IP_HDRINCL",
thus resolving the conflict.