The check for link up was missing, meaning valid LCP echo request/reply
packets are filtered whatever the PPP state is, despite what the comment
says.
Fix it by checking the PPP state as we would like to have done when it
was written.
During documentation updated LWIP_MEMPOOL_PROTOTYPE was moved inside
"#if MEMP_MEM_MALLOC" which cause ppp build to break. This patch fix that
issue.
ref commit-id: 2f950a7dcc
Signed-off-by: Ajay Bhargav <contact@rickeyworld.info>
VJ packets, Compressed packets, IPv4 and IPv6 packets are useless in
the PPP packet dump. We properly filtered IPv4 and IPv6 packets but
we forgot filtering VJ and Compressed packets.
Improve the filtering rule to filter packets which are not auth
protocol (< 0xC000) and which are not control protocol (0x8000 bit
not set).
I have below code in my cc.h:
#ifdef MYSDK_LWIP_DEBUG
#define LWIP_PLATFORM_ASSERT(x) MYSDK_ASSERTION_FAIL_ACTION()
#else
#define LWIP_PLATFORM_ASSERT(x)
#endif /* ifdef MYSDK_LWIP_DEBUG */
I got below error when in non-debug build:
src/include/lwip/debug.h:76:32: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
LWIP_PLATFORM_ASSERT(message); } while(0)
^
Fix the build error by adding braces around empty body in an 'if' statement.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: sg <goldsimon@gmx.de>
If LCP is not started yet, we are only closing the link protocol, in
this case we have to set the disconnect state ourself because PPP
is not actually started yet.
Include stdlib.h to fix below build warnings when MEM_LIBC_MALLOC is set:
src/core/mem.c:119:3: warning: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
void* ret = mem_clib_malloc(size + MEM_LIBC_STATSHELPER_SIZE);
^
src/core/mem.c:96:25: warning: incompatible implicit declaration of built-in function 'malloc'
#define mem_clib_malloc malloc
^
src/core/mem.c:119:15: note: in expansion of macro 'mem_clib_malloc'
void* ret = mem_clib_malloc(size + MEM_LIBC_STATSHELPER_SIZE);
^
src/core/mem.c: In function 'mem_free':
src/core/mem.c:146:3: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]
mem_clib_free(rmem);
^
src/core/mem.c:93:23: warning: incompatible implicit declaration of built-in function 'free'
#define mem_clib_free free
^
src/core/mem.c:146:3: note: in expansion of macro 'mem_clib_free'
mem_clib_free(rmem);
^
Signed-off-by: Axel Lin <axel.lin@ingics.com>
pppoe_softc_list is always not null when pppoe_find_softc_by_session is
called, furthermore pppoe_softc_list being null here does not hurt.
session is still checked whatsoever in pppoe_find_softc_by_session,
prechecking the session value for a value which can't really happen
except for forged frames does not add any value.
Remove unnecessary cleanup at the end of session, cleanup as much as
possible in the connect callback instead. It follows what PPPoE is
currently doing and it makes everything simpler to read.
Instead of relying on cleanup at the end of session, cleanup as much as
possible in the connect callback. It removes duplicated code and make
everything simpler to read.
While we are at it, remove useless initialization code from create
and connect functions.
ppp_close might try to close LCP even if LCP is not started, it happens
because because the PPP session might be waiting for the link protocol
to come up and we do not check that.
We say in the PPP documentation that ppp_close() can be called anytime,
so, if link protocol is currently trying to connect, we must cancel
the link connection.
Fix it by calling the link protocol disconnect callback if LCP is not
started yet.
Disconnect callback does not currently support a disconnect event while
initiation is in progress. Retry timer is not stopped and PADT frame is
sent whatever the current state is. PADT frame can only be sent if we
received a PADS frame, otherwise sc_session is 0 and sending a PADT
frame is meaningless.
Fix both issues to allow calling the disconnect callback whatever the
PPPoE state is.
We say in the PPP documentation that ppp_close() can be called anytime,
as of today, this is not entirely true, there are still conditions that
are not handled properly.
If PPP is already disconnecting, ppp_close() must do nothing and returns
ERR_INPROGRESS instead of messing up the PPP disconnection state.
Master state is almost exactly the same thing as dead state, move it
next to dead state. Holdoff state is actually the state just before
initialize, move it before initialize.
The goal is to be able to use > running or => terminate condition to
check a currently running disconnection phase, which is not possible
today without excluding master and holdoff states.
PPP_PHASE_MASTER state is only used if multilink mode is enabled. Since
we don't support multilink mode checking for this state only add some
code for no value added at all.
Build-out PPP_PHASE_MASTER state check if multilink mode is disabled.
Van Jacobson TCP header compression only apply if TCP is enabled,
therefore we need to disable VJ compression if TCP is disabled.
We already have conditions to enforce VJ disabling if IPv4 is disabled
or if PPPoS is disabled, add TCP to those conditions and remove
unecessary VJ_SUPPORT && LWIP_TCP conditions.