It might be difficult to investigate the reason of dropped packets when
there is no debug notification of what is happening, thus, add error
debug messages for dropped packets due to missing transmit or receive
CCP method.
Signed-off-by: Stephan Linz <linz@li-pro.net>
[gradator@gradator.net: improved messages]
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
ppp_free() calls the low level protocol destroy function, pppol2tp_destroy()
here, which freed the l2tp pcb, followed by pppol2tp_create which also freed
the pcb.
Fixing it by reordering the L2TP init so we don't have to call ppp_free()
anymore.
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
When I create a new PPP connection, I am seeing a hardfault (segfault)
coming from pbuf_free.
I traced the problem to an invalid in_head field of the pppos_pcb structure.
The field is invalid because the memory is never cleared to zero after the
pppos_pcb structure is created in pppos_create().
I was able to fix the issue by adding a memset after the memp_malloc call.
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
When the port has LWIP_CHECKSUM_ON_COPY enabled and provides
a definition of LWIP_CHKSUM_COPY, the existing logic left
LWIP_CHKSUM_COPY_ALGORITHM undefined
In this case we want it to be defined to 0 since none of the copy
checksum algorithms provided are being used
This commit also introduces indentation matching LWIP_CHKSUM to
improve the readability of the code
This function was returning values from snmp_err_t but wasn't
upgraded to using the typedef after commit babce70
This resulted in compilation failure on MSVC 2013
CCP might negotiate to not compress if peers cannot agree on a
compressor, therefore if the null compressor is chosen we must pass
packets as is instead of dropping them.
Reported-by: Stephan Linz <linz@li-pro.net>
Fixes: 987f6237c4 "PPP, MPPE, drop input/output packets if we couldn't find the chosen decompressor/compressor"
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
IP6_HLEN is only defined when LWIP_IPV6, IP_HLEN is only defined when LWIP_IPV4.
This fixes build error in !LWIP_IPV4 || !LWIP_IPV6 cases.
Fixes: f2c7e9c939 ("raw: Remove unnecessary #if guard around PCB_ISIPV6() calls")
Reported-by: Erik Ekman
Signed-off-by: Axel Lin <axel.lin@ingics.com>
In case of IP_REASS_FREE_OLDEST==0, the argument clen of
ip_reass_enqueue_new_datagram() will not used and leads
the compiler to a warning.
Signed-off-by: Stephan Linz <linz@li-pro.net>
- include new SNMP header
- add missing pointer type casting
- add missing default cases
- use const for all ip address types
- distinguish between IPv4 and IPv6 address types
Signed-off-by: Stephan Linz <linz@li-pro.net>
PCB_ISIPV6() macro is well defined for all cases (LWIP_IPV4 && LWIP_IPV6,
LWIP_IPV4 only and LWIP_IPV6 only), thus remove the unnecessary #if guard
around PCB_ISIPV6() calls.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
This makes the code simpler with better readability.
Also make memp_names static because it's only referenced by stats.c.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
We don't really care the order of overflow/underflow checking because if
any checking fails we got assertion.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
This fixes a bug in close when LWIP_SO_SNDTIMEO is enabled, but
the option is not in use on the socket
A simple mis-typed comparison against zero would cause the close_timeout
to get set to zero if conn->send_timeout was 0
The intended check was to over-ride the default close timeout if a
send timeout had been specified via SO_SNDTIMEO
+ Minor compile fix from me
Patch makes the code a tiny bit less lightweight (add a parameter in dns_gethostbyname which is then not used in dns_gethostbyname_addrtype) but it makes the code more readable.
No port specified means to use a random port.
udp_new_port() returns a new (free) local UDP port number on success.
So in this case we don't need iterating all lists to test if the port
number is used, udp_new_port() alreay ensures the port is not used.
Move the code checking for double bind and rebind of the same pcb earlier,
as this checking is necessary in all cases.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
The code for #if SO_REUSE case does not match the comment.
By default, we don't allow to bind to a port that any other udp
PCB is already bound to, unless *all* PCBs with that port have tha
REUSEADDR flag set.
Which means we want to omit checking for the same port if both pcbs
have REUSEADDR set. Fix the logic accordingly.
Fixes: d0348e0c60 ("task #6995: Implement SO_REUSEADDR (correctly)")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
No port specified means to use a random port.
tcp_new_port() returns a new (free) local TCP port number on success.
So in this case we don't need iterating all lists to test if the port
number is used, tcp_new_port() alreay ensures the port is not used.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Current code does not correctly detect port conflict if no port specified
because it checks ipcb->local_port == port before udp_new_port().
Fix it by allocating a random port earlier.
Signed-off-by: Axel Lin <axel.lin@ingics.com>