This function does not clear anything anymore. What it is now is an
optional way to notify PPP that link layer is started, changing the
PPP state from "dead" to "initialize". Rename it accordingly to what
the function really is.
What we really need here is to cleanup the PPP environment before
starting LCP, we don't care about the PPP state before LCP is
started. Move cleanups from ppp_clear to ppp_start to clean them
just before we need them cleaned.
What protocols init functions are meant to is to be called once to set
the default configuration before user specific configuration is set.
Until now, we reset to the default configuration just before
reconnecting, thus without allowing any time frame to let users change
it. That was fine until one user asked to be able to do that.
This change move protocols init functions calls from ppp_clear to
ppp_new, meaning user configuration is not overwritten anymore.
Our previous way of doing it was to clear everything except a small part
of the ppp_pcb structure and then populate the structure with default
values using protocols init functions.
But it means the user is currently not allowed to change the default
configuration except the few flags and values that are currently
available in the ppp_settings structure.
Instead of adding more and more fields to the ppp_settings structure,
actually making them duplicate of already existing structure members
of ppp_pcb, but unfortunately cleaned, we carefully checked that
everything is properly cleaned during protocol lowerdown/close and
replaced our giant memset to selective memset of the few ppp_pcb
members that are not properly cleaned.
ccp_init() is meant to be called once, providing default configuration
before user specific configuration is applied. In pppd user configuration
is set just after all protocol init functions are called, in lwIP we
use protocol reset functions to do that, which is more or less the same.
Therefore, be consistent and move CCP user configuration from ccp_init
to ccp_resetci.
Since allowing input validation to trip the ASSERT handler is bad,
let's just drop the packets instead if validation fails.
Signed-off-by: sg <goldsimon@gmx.de>
Use LWIP_ARRAYSIZE to simplify the code.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Sylvain Rochet <gradator@gradator.net>
[Sylvain Rochet <gradator@gradator.net>: added missing casts]
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
dhcp_discover_request_options is u8_t array, so the result is the same.
But use LWIP_ARRAYSIZE to get the number of array entries is better
because it works for all types.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Only "lwip/arch.h" is expected to include "arch/cc.h". This is the same
spirit than "lwip/opt.h" for "lwipopts.h" and "lwip/sys.h" for
"arch/sys_arch.h".
PPP users can now choose to use an external mbed TLS copy instead of using
our internal old version (but released under a BSDish license) PolarSSL copy.
In order to welcome mbed TLS, we need to ease the switch to:
- embedded PolarSSL 0.10.1-bsd copy
or - external PolarSSL
or - external mbed TLS
This change cleanup all our previously used LWIP_INCLUDED_POLARSSL_* defines,
which were not really useful after all, making them internal build triggers
only, and this change provides a new unique global flag to use an external
PolarSSL copy.
Unfortunately, all functions were renamed when PolarSSL was renamed to
mbed TLS, breaking the API. In order to continue supporting our embedded
PolarSSL copy while allowing our users to use mbed TLS, we need a function
map to deal with the API break.
This commit add a function map for all hashes and ciphers we are currently
using.