summaryrefslogtreecommitdiffstatsabout
path: root/SylixOS
diff options
context:
space:
mode:
authorHanhui <hanhui@acoinfo.com>2020-08-27 06:52:16 (GMT)
committer Hanhui <hanhui@acoinfo.com>2020-08-27 06:52:16 (GMT)
commit910117c56d5e922f25de6548a71fd0a515f6894b (patch)
treee37ea4388195db66fac1e76d4a16328c688cf06e /SylixOS
parentd014e333e54390e7d7d85fad4afa538a00ddb04e (diff)
downloadlibsylixos-910117c56d5e922f25de6548a71fd0a515f6894b.zip
libsylixos-910117c56d5e922f25de6548a71fd0a515f6894b.tar.gz
libsylixos-910117c56d5e922f25de6548a71fd0a515f6894b.tar.bz2
Cumulative security updates to the network protocol stack.
Diffstat (limited to 'SylixOS')
-rw-r--r--SylixOS/arch/arm/mpcore/armSpinlock.c5
-rw-r--r--SylixOS/config/cpu/cpu_cfg_arm.h6
-rw-r--r--SylixOS/include/network/lwip/pbuf.h1
-rw-r--r--SylixOS/include/network/lwip/priv/tcp_priv.h2
-rw-r--r--SylixOS/include/network/lwip/sockets.h4
-rw-r--r--SylixOS/net/lwip/lwip_shell.c18
-rw-r--r--SylixOS/net/lwip/src/core/init.c3
-rw-r--r--SylixOS/net/lwip/src/core/ipv4/icmp.c4
-rw-r--r--SylixOS/net/lwip/src/core/ipv6/icmp6.c2
-rw-r--r--SylixOS/net/lwip/src/core/ipv6/inet6.c3
-rw-r--r--SylixOS/net/lwip/src/core/ipv6/ip6_frag.c6
-rw-r--r--SylixOS/net/lwip/src/core/pbuf.c59
-rw-r--r--SylixOS/net/lwip/src/core/tcp.c6
-rw-r--r--SylixOS/net/lwip/src/core/tcp_in.c10
-rw-r--r--SylixOS/net/lwip/src/core/tcp_out.c1
-rw-r--r--SylixOS/net/lwip/src/core/udp.c2
-rw-r--r--SylixOS/net/lwip/src/netif/ppp/ccp.c6
-rw-r--r--SylixOS/net/lwip/src/netif/ppp/ppp.c4
-rw-r--r--SylixOS/net/lwip/src/netif/ppp/pppos.c2
-rw-r--r--SylixOS/net/lwip/src/netif/ppp/vj.c8
20 files changed, 102 insertions, 50 deletions
diff --git a/SylixOS/arch/arm/mpcore/armSpinlock.c b/SylixOS/arch/arm/mpcore/armSpinlock.c
index f24e8d2..33b362b 100644
--- a/SylixOS/arch/arm/mpcore/armSpinlock.c
+++ b/SylixOS/arch/arm/mpcore/armSpinlock.c
@@ -18,6 +18,7 @@
**
** 描 述: ARM 体系构架自旋锁驱动.
*********************************************************************************************************/
+#define __SYLIXOS_SMPFMB
#define __SYLIXOS_KERNEL
#include "SylixOS.h"
/*********************************************************************************************************
@@ -71,6 +72,10 @@ static VOID armSpinLock (SPINLOCKTYPE *psld, VOIDFUNCPTR pfuncPoll, PVOID pvA
__asm__ __volatile__(ARM_WFE(""));
}
sldVal.SLD_usSvcNow = LW_ACCESS_ONCE(UINT16, psld->SLD_usSvcNow);
+
+#if LW_CFG_ARM_ACCESS_ONCE_RMB > 0
+ KN_SMP_RMB();
+#endif
}
#endif /* __SYLIXOS_ARM_ARCH__ >= 6 */
}
diff --git a/SylixOS/config/cpu/cpu_cfg_arm.h b/SylixOS/config/cpu/cpu_cfg_arm.h
index d62311a..9473a40 100644
--- a/SylixOS/config/cpu/cpu_cfg_arm.h
+++ b/SylixOS/config/cpu/cpu_cfg_arm.h
@@ -77,6 +77,12 @@
#endif /* Cortex-R, M */
/*********************************************************************************************************
+ Spinlock LW_ACCESS_ONCE() 需要进行 inner shareable 内存同步 (例如: 飞腾 2000 (32bit mode) 需要)
+*********************************************************************************************************/
+
+#define LW_CFG_ARM_ACCESS_ONCE_RMB 1
+
+/*********************************************************************************************************
Cortex-M 特殊配置
*********************************************************************************************************/
diff --git a/SylixOS/include/network/lwip/pbuf.h b/SylixOS/include/network/lwip/pbuf.h
index 84c7f95..5a4fc88 100644
--- a/SylixOS/include/network/lwip/pbuf.h
+++ b/SylixOS/include/network/lwip/pbuf.h
@@ -296,6 +296,7 @@ void pbuf_cat(struct pbuf *head, struct pbuf *tail);
void pbuf_chain(struct pbuf *head, struct pbuf *tail);
struct pbuf *pbuf_dechain(struct pbuf *p);
err_t pbuf_copy(struct pbuf *p_to, const struct pbuf *p_from);
+err_t pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_len, u16_t offset);
u16_t pbuf_copy_partial(const struct pbuf *p, void *dataptr, u16_t len, u16_t offset);
void *pbuf_get_contiguous(const struct pbuf *p, void *buffer, size_t bufsize, u16_t len, u16_t offset);
err_t pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len);
diff --git a/SylixOS/include/network/lwip/priv/tcp_priv.h b/SylixOS/include/network/lwip/priv/tcp_priv.h
index 9965d30..a2f9ec6 100644
--- a/SylixOS/include/network/lwip/priv/tcp_priv.h
+++ b/SylixOS/include/network/lwip/priv/tcp_priv.h
@@ -359,7 +359,7 @@ extern struct tcp_pcb ** const tcp_pcb_lists[NUM_TCP_PCB_LISTS];
for (tcp_tmp_pcb = *(pcbs); \
tcp_tmp_pcb != NULL; \
tcp_tmp_pcb = tcp_tmp_pcb->next) { \
- LWIP_ASSERT("TCP_REG: already registered\n", tcp_tmp_pcb != (npcb)); \
+ LWIP_ASSERT("TCP_REG: already registered", tcp_tmp_pcb != (npcb)); \
} \
LWIP_ASSERT("TCP_REG: pcb->state != CLOSED", ((pcbs) == &tcp_bound_pcbs) || ((npcb)->state != CLOSED)); \
(npcb)->next = *(pcbs); \
diff --git a/SylixOS/include/network/lwip/sockets.h b/SylixOS/include/network/lwip/sockets.h
index 730d105..e01a9f1 100644
--- a/SylixOS/include/network/lwip/sockets.h
+++ b/SylixOS/include/network/lwip/sockets.h
@@ -124,7 +124,6 @@ typedef u32_t socklen_t; /* SylixOS Add some standard defined check */
/* SylixOS Removed IOV_MAX and struct iovec
redefined with SylixOS */
-
struct msghdr {
void *msg_name;
socklen_t msg_namelen;
@@ -343,13 +342,12 @@ struct tcp_md5sig {
#endif /* SYLIXOS */
#endif /* LWIP_TCP */
-#if LWIP_IPV6
+/* SylixOS Removed #if LWIP_IPV6 */
/*
* Options for level IPPROTO_IPV6
*/
#define IPV6_CHECKSUM 7 /* RFC3542: calculate and insert the ICMPv6 checksum for raw sockets. */
#define IPV6_V6ONLY 27 /* RFC3493: boolean control to restrict AF_INET6 sockets to IPv6 communications only. */
-#endif /* LWIP_IPV6 */
#if LWIP_UDP && LWIP_UDPLITE
/*
diff --git a/SylixOS/net/lwip/lwip_shell.c b/SylixOS/net/lwip/lwip_shell.c
index acfb921..2271ce6 100644
--- a/SylixOS/net/lwip/lwip_shell.c
+++ b/SylixOS/net/lwip/lwip_shell.c
@@ -1100,7 +1100,6 @@ static INT __tshellLoginBl (INT iArgC, PCHAR *ppcArgV)
{
struct sockaddr addr;
struct sockaddr_in *pinaddr = (struct sockaddr_in *)&addr;
- struct sockaddr_in6 *pin6addr = (struct sockaddr_in6 *)&addr;
if (iArgC == 1) {
API_LoginBlShow();
@@ -1114,6 +1113,9 @@ static INT __tshellLoginBl (INT iArgC, PCHAR *ppcArgV)
pinaddr->sin_addr.s_addr = inet_addr(ppcArgV[2]);
if (pinaddr->sin_addr.s_addr == INADDR_NONE) {
+#if LWIP_IPV6
+ struct sockaddr_in6 *pin6addr = (struct sockaddr_in6 *)&addr;
+
if (inet6_aton(ppcArgV[2], &pin6addr->sin6_addr) == 0) {
fprintf(stderr, "ipaddr error!\n");
return (-ERROR_TSHELL_EPARAM);
@@ -1122,6 +1124,10 @@ static INT __tshellLoginBl (INT iArgC, PCHAR *ppcArgV)
pin6addr->sin6_len = sizeof(struct sockaddr_in6);
pin6addr->sin6_family = AF_INET6;
}
+#else
+ fprintf(stderr, "ipaddr error!\n");
+ return (-ERROR_TSHELL_EPARAM);
+#endif
} else {
pinaddr->sin_len = sizeof(struct sockaddr_in);
@@ -1154,7 +1160,6 @@ static INT __tshellLoginWl (INT iArgC, PCHAR *ppcArgV)
{
struct sockaddr addr;
struct sockaddr_in *pinaddr = (struct sockaddr_in *)&addr;
- struct sockaddr_in6 *pin6addr = (struct sockaddr_in6 *)&addr;
if (iArgC == 1) {
API_LoginWlShow();
@@ -1168,6 +1173,9 @@ static INT __tshellLoginWl (INT iArgC, PCHAR *ppcArgV)
pinaddr->sin_addr.s_addr = inet_addr(ppcArgV[2]);
if (pinaddr->sin_addr.s_addr == INADDR_NONE) {
+#if LWIP_IPV6
+ struct sockaddr_in6 *pin6addr = (struct sockaddr_in6 *)&addr;
+
if (inet6_aton(ppcArgV[2], &pin6addr->sin6_addr) == 0) {
fprintf(stderr, "ipaddr error!\n");
return (-ERROR_TSHELL_EPARAM);
@@ -1176,7 +1184,11 @@ static INT __tshellLoginWl (INT iArgC, PCHAR *ppcArgV)
pin6addr->sin6_len = sizeof(struct sockaddr_in6);
pin6addr->sin6_family = AF_INET6;
}
-
+#else
+ fprintf(stderr, "ipaddr error!\n");
+ return (-ERROR_TSHELL_EPARAM);
+#endif
+
} else {
pinaddr->sin_len = sizeof(struct sockaddr_in);
pinaddr->sin_family = AF_INET;
diff --git a/SylixOS/net/lwip/src/core/init.c b/SylixOS/net/lwip/src/core/init.c
index 504f1ba..de247f4 100644
--- a/SylixOS/net/lwip/src/core/init.c
+++ b/SylixOS/net/lwip/src/core/init.c
@@ -220,6 +220,9 @@ PACK_STRUCT_END
#if PPP_SUPPORT && PPP_IPV6_SUPPORT && !LWIP_IPV6
#error "PPP_IPV6_SUPPORT needs LWIP_IPV6 turned on"
#endif
+#if PPP_SUPPORT && CCP_SUPPORT && !MPPE_SUPPORT
+#error "CCP_SUPPORT needs MPPE_SUPPORT turned on"
+#endif
#if !LWIP_ETHERNET && (LWIP_ARP || PPPOE_SUPPORT)
#error "LWIP_ETHERNET needs to be turned on for LWIP_ARP or PPPOE_SUPPORT"
#endif
diff --git a/SylixOS/net/lwip/src/core/ipv4/icmp.c b/SylixOS/net/lwip/src/core/ipv4/icmp.c
index de6d1e8..cee48c5 100644
--- a/SylixOS/net/lwip/src/core/ipv4/icmp.c
+++ b/SylixOS/net/lwip/src/core/ipv4/icmp.c
@@ -179,7 +179,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
MEMCPY(r->payload, iphdr_in, hlen);
/* switch r->payload back to icmp header (cannot fail) */
if (pbuf_remove_header(r, hlen)) {
- LWIP_ASSERT("icmp_input: moving r->payload to icmp header failed\n", 0);
+ LWIP_ASSERT("icmp_input: moving r->payload to icmp header failed", 0);
pbuf_free(r);
goto icmperr;
}
@@ -196,7 +196,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
} else {
/* restore p->payload to point to icmp header (cannot fail) */
if (pbuf_remove_header(p, hlen + PBUF_LINK_HLEN + PBUF_LINK_ENCAPSULATION_HLEN)) {
- LWIP_ASSERT("icmp_input: restoring original p->payload failed\n", 0);
+ LWIP_ASSERT("icmp_input: restoring original p->payload failed", 0);
goto icmperr;
}
}
diff --git a/SylixOS/net/lwip/src/core/ipv6/icmp6.c b/SylixOS/net/lwip/src/core/ipv6/icmp6.c
index f236971..ed0bd7b 100644
--- a/SylixOS/net/lwip/src/core/ipv6/icmp6.c
+++ b/SylixOS/net/lwip/src/core/ipv6/icmp6.c
@@ -406,7 +406,7 @@ icmp6_send_response_with_addrs_and_netif(struct pbuf *p, u8_t code, u32_t data,
icmp6hdr->data = lwip_htonl(data);
/* copy fields from original packet */
- pbuf_take_at(q, p->payload, datalen, sizeof(struct icmp6_hdr));
+ pbuf_copy_partial_pbuf(q, p, datalen, sizeof(struct icmp6_hdr));
/* calculate checksum */
icmp6hdr->chksum = 0;
diff --git a/SylixOS/net/lwip/src/core/ipv6/inet6.c b/SylixOS/net/lwip/src/core/ipv6/inet6.c
index d9a992c..6434f2c 100644
--- a/SylixOS/net/lwip/src/core/ipv6/inet6.c
+++ b/SylixOS/net/lwip/src/core/ipv6/inet6.c
@@ -41,7 +41,8 @@
#include "lwip/opt.h"
-#if LWIP_IPV6 && LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */
+/* SylixOS Remove LWIP_IPV6 */
+#if /* LWIP_IPV6 && */ LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */
#include "lwip/def.h"
#include "lwip/inet.h"
diff --git a/SylixOS/net/lwip/src/core/ipv6/ip6_frag.c b/SylixOS/net/lwip/src/core/ipv6/ip6_frag.c
index d6c5d22..6617e0d 100644
--- a/SylixOS/net/lwip/src/core/ipv6/ip6_frag.c
+++ b/SylixOS/net/lwip/src/core/ipv6/ip6_frag.c
@@ -166,7 +166,7 @@ ip6_reass_free_complete_datagram(struct ip6_reassdata *ipr)
/* Then, move back to the original ipv6 header (we are now pointing to Fragment header).
This cannot fail since we already checked when receiving this fragment. */
if (pbuf_header_force(p, (s16_t)((u8_t*)p->payload - (u8_t*)ipr->iphdr))) {
- LWIP_ASSERT("ip6_reass_free: moving p->payload to ip6 header failed\n", 0);
+ LWIP_ASSERT("ip6_reass_free: moving p->payload to ip6 header failed", 0);
}
else {
/* Reconstruct the zoned source and destination addresses, so that we do
@@ -652,7 +652,7 @@ ip6_reass(struct pbuf *p)
/* Move pbuf back to IPv6 header. This should never fail. */
if (pbuf_header_force(p, (s16_t)((u8_t*)p->payload - (u8_t*)iphdr_ptr))) {
- LWIP_ASSERT("ip6_reass: moving p->payload to ip6 header failed\n", 0);
+ LWIP_ASSERT("ip6_reass: moving p->payload to ip6 header failed", 0);
pbuf_free(p);
return NULL;
}
@@ -781,7 +781,7 @@ ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
return ERR_MEM;
}
LWIP_ASSERT("this needs a pbuf in one piece!",
- (p->len >= (IP6_HLEN)));
+ (rambuf->len >= (IP6_HLEN)));
SMEMCPY(rambuf->payload, original_ip6hdr, IP6_HLEN);
ip6hdr = (struct ip6_hdr *)rambuf->payload;
frag_hdr = (struct ip6_frag_hdr *)((u8_t*)rambuf->payload + IP6_HLEN);
diff --git a/SylixOS/net/lwip/src/core/pbuf.c b/SylixOS/net/lwip/src/core/pbuf.c
index 88929a3..d26826b 100644
--- a/SylixOS/net/lwip/src/core/pbuf.c
+++ b/SylixOS/net/lwip/src/core/pbuf.c
@@ -977,12 +977,7 @@ pbuf_dechain(struct pbuf *p)
/**
* @ingroup pbuf
- * Create PBUF_RAM copies of pbufs.
- *
- * Used to queue packets on behalf of the lwIP stack, such as
- * ARP based queueing.
- *
- * @note You MUST explicitly use p = pbuf_take(p);
+ * Copy the contents of one packet buffer into another.
*
* @note Only one packet is copied, no packet queue!
*
@@ -992,18 +987,49 @@ pbuf_dechain(struct pbuf *p)
* @return ERR_OK if pbuf was copied
* ERR_ARG if one of the pbufs is NULL or p_to is not big
* enough to hold p_from
+ * ERR_VAL if any of the pbufs are part of a queue
*/
err_t
pbuf_copy(struct pbuf *p_to, const struct pbuf *p_from)
{
- size_t offset_to = 0, offset_from = 0, len;
-
LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_copy(%p, %p)\n",
(const void *)p_to, (const void *)p_from));
+ LWIP_ERROR("pbuf_copy: invalid source", p_from != NULL, return ERR_ARG;);
+ return pbuf_copy_partial_pbuf(p_to, p_from, p_from->tot_len, 0);
+}
+
+/**
+ * @ingroup pbuf
+ * Copy part or all of one packet buffer into another, to a specified offset.
+ *
+ * @note Only data in one packet is copied, no packet queue!
+ * @note Argument order is shared with pbuf_copy, but different than pbuf_copy_partial.
+ *
+ * @param p_to pbuf destination of the copy
+ * @param p_from pbuf source of the copy
+ * @param copy_len number of bytes to copy
+ * @param offset offset in destination pbuf where to copy to
+ *
+ * @return ERR_OK if copy_len bytes were copied
+ * ERR_ARG if one of the pbufs is NULL or p_from is shorter than copy_len
+ * or p_to is not big enough to hold copy_len at offset
+ * ERR_VAL if any of the pbufs are part of a queue
+ */
+err_t
+pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_len, u16_t offset)
+{
+ size_t offset_to = offset, offset_from = 0, len;
+
+ LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_copy_partial_pbuf(%p, %p, %"U16_F", %"U16_F")\n",
+ (const void *)p_to, (const void *)p_from, copy_len, offset));
+
+ /* is the copy_len in range? */
+ LWIP_ERROR("pbuf_copy_partial_pbuf: copy_len bigger than source", ((p_from != NULL) &&
+ (p_from->tot_len >= copy_len)), return ERR_ARG;);
/* is the target big enough to hold the source? */
- LWIP_ERROR("pbuf_copy: target not big enough to hold source", ((p_to != NULL) &&
- (p_from != NULL) && (p_to->tot_len >= p_from->tot_len)), return ERR_ARG;);
+ LWIP_ERROR("pbuf_copy_partial_pbuf: target not big enough", ((p_to != NULL) &&
+ (p_to->tot_len >= (offset + copy_len))), return ERR_ARG;);
/* iterate through pbuf chain */
do {
@@ -1015,35 +1041,38 @@ pbuf_copy(struct pbuf *p_to, const struct pbuf *p_from)
/* current p_from does not fit into current p_to */
len = p_to->len - offset_to;
}
+ len = LWIP_MIN(copy_len, len);
MEMCPY((u8_t *)p_to->payload + offset_to, (u8_t *)p_from->payload + offset_from, len);
offset_to += len;
offset_from += len;
+ copy_len -= len;
LWIP_ASSERT("offset_to <= p_to->len", offset_to <= p_to->len);
LWIP_ASSERT("offset_from <= p_from->len", offset_from <= p_from->len);
if (offset_from >= p_from->len) {
/* on to next p_from (if any) */
offset_from = 0;
p_from = p_from->next;
+ LWIP_ERROR("p_from != NULL", (p_from != NULL) || (copy_len == 0), return ERR_ARG;);
}
if (offset_to == p_to->len) {
/* on to next p_to (if any) */
offset_to = 0;
p_to = p_to->next;
- LWIP_ERROR("p_to != NULL", (p_to != NULL) || (p_from == NULL), return ERR_ARG;);
+ LWIP_ERROR("p_to != NULL", (p_to != NULL) || (copy_len == 0), return ERR_ARG;);
}
if ((p_from != NULL) && (p_from->len == p_from->tot_len)) {
/* don't copy more than one packet! */
- LWIP_ERROR("pbuf_copy() does not allow packet queues!",
+ LWIP_ERROR("pbuf_copy_partial_pbuf() does not allow packet queues!",
(p_from->next == NULL), return ERR_VAL;);
}
if ((p_to != NULL) && (p_to->len == p_to->tot_len)) {
/* don't copy more than one packet! */
- LWIP_ERROR("pbuf_copy() does not allow packet queues!",
+ LWIP_ERROR("pbuf_copy_partial_pbuf() does not allow packet queues!",
(p_to->next == NULL), return ERR_VAL;);
}
- } while (p_from);
- LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_copy: end of chain reached.\n"));
+ } while (copy_len);
+ LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_copy_partial_pbuf: copy complete.\n"));
return ERR_OK;
}
diff --git a/SylixOS/net/lwip/src/core/tcp.c b/SylixOS/net/lwip/src/core/tcp.c
index 6a43efb..b90b519 100644
--- a/SylixOS/net/lwip/src/core/tcp.c
+++ b/SylixOS/net/lwip/src/core/tcp.c
@@ -1319,9 +1319,9 @@ tcp_slowtmr_start:
}
while (pcb != NULL) {
LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: processing active pcb\n"));
- LWIP_ASSERT("tcp_slowtmr: active pcb->state != CLOSED\n", pcb->state != CLOSED);
- LWIP_ASSERT("tcp_slowtmr: active pcb->state != LISTEN\n", pcb->state != LISTEN);
- LWIP_ASSERT("tcp_slowtmr: active pcb->state != TIME-WAIT\n", pcb->state != TIME_WAIT);
+ LWIP_ASSERT("tcp_slowtmr: active pcb->state != CLOSED", pcb->state != CLOSED);
+ LWIP_ASSERT("tcp_slowtmr: active pcb->state != LISTEN", pcb->state != LISTEN);
+ LWIP_ASSERT("tcp_slowtmr: active pcb->state != TIME-WAIT", pcb->state != TIME_WAIT);
if (pcb->last_timer == tcp_timer_ctr) {
/* skip this pcb, we have already processed it */
prev = pcb;
diff --git a/SylixOS/net/lwip/src/core/tcp_in.c b/SylixOS/net/lwip/src/core/tcp_in.c
index 5993d73..8082d7a 100644
--- a/SylixOS/net/lwip/src/core/tcp_in.c
+++ b/SylixOS/net/lwip/src/core/tcp_in.c
@@ -1599,7 +1599,7 @@ tcp_receive(struct tcp_pcb *pcb)
}
pbuf_realloc(inseg.p, inseg.len);
tcplen = TCP_TCPLEN(&inseg);
- LWIP_ASSERT("tcp_receive: segment not trimmed correctly to rcv_wnd\n",
+ LWIP_ASSERT("tcp_receive: segment not trimmed correctly to rcv_wnd",
(seqno + tcplen) == (pcb->rcv_nxt + pcb->rcv_wnd));
}
#if TCP_QUEUE_OOSEQ
@@ -1648,7 +1648,7 @@ tcp_receive(struct tcp_pcb *pcb)
}
pbuf_realloc(inseg.p, inseg.len);
tcplen = TCP_TCPLEN(&inseg);
- LWIP_ASSERT("tcp_receive: segment not trimmed correctly to ooseq queue\n",
+ LWIP_ASSERT("tcp_receive: segment not trimmed correctly to ooseq queue",
(seqno + tcplen) == next->tcphdr->seqno);
}
pcb->ooseq = next;
@@ -1659,7 +1659,7 @@ tcp_receive(struct tcp_pcb *pcb)
pcb->rcv_nxt = seqno + tcplen;
/* Update the receiver's (our) window. */
- LWIP_ASSERT("tcp_receive: tcplen > rcv_wnd\n", pcb->rcv_wnd >= tcplen);
+ LWIP_ASSERT("tcp_receive: tcplen > rcv_wnd", pcb->rcv_wnd >= tcplen);
pcb->rcv_wnd -= tcplen;
tcp_update_rcv_ann_wnd(pcb);
@@ -1695,7 +1695,7 @@ tcp_receive(struct tcp_pcb *pcb)
seqno = pcb->ooseq->tcphdr->seqno;
pcb->rcv_nxt += TCP_TCPLEN(cseg);
- LWIP_ASSERT("tcp_receive: ooseq tcplen > rcv_wnd\n",
+ LWIP_ASSERT("tcp_receive: ooseq tcplen > rcv_wnd",
pcb->rcv_wnd >= TCP_TCPLEN(cseg));
pcb->rcv_wnd -= TCP_TCPLEN(cseg);
@@ -1919,7 +1919,7 @@ tcp_receive(struct tcp_pcb *pcb)
next->next->len = (u16_t)(pcb->rcv_nxt + pcb->rcv_wnd - seqno);
pbuf_realloc(next->next->p, next->next->len);
tcplen = TCP_TCPLEN(next->next);
- LWIP_ASSERT("tcp_receive: segment not trimmed correctly to rcv_wnd\n",
+ LWIP_ASSERT("tcp_receive: segment not trimmed correctly to rcv_wnd",
(seqno + tcplen) == (pcb->rcv_nxt + pcb->rcv_wnd));
}
}
diff --git a/SylixOS/net/lwip/src/core/tcp_out.c b/SylixOS/net/lwip/src/core/tcp_out.c
index f53ee1e..31721db 100644
--- a/SylixOS/net/lwip/src/core/tcp_out.c
+++ b/SylixOS/net/lwip/src/core/tcp_out.c
@@ -913,6 +913,7 @@ tcp_split_unsent_seg(struct tcp_pcb *pcb, u16_t split)
seg = tcp_create_segment(pcb, p, remainder_flags, lwip_ntohl(useg->tcphdr->seqno) + split, optflags);
if (seg == NULL) {
+ p = NULL; /* Freed by tcp_create_segment */
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
("tcp_split_unsent_seg: could not create new TCP segment\n"));
goto memerr;
diff --git a/SylixOS/net/lwip/src/core/udp.c b/SylixOS/net/lwip/src/core/udp.c
index 103b2ff..5c08de6 100644
--- a/SylixOS/net/lwip/src/core/udp.c
+++ b/SylixOS/net/lwip/src/core/udp.c
@@ -393,7 +393,7 @@ udp_input(struct pbuf *p, struct netif *inp)
#endif /* CHECKSUM_CHECK_UDP */
if (pbuf_remove_header(p, UDP_HLEN)) {
/* Can we cope with this failing? Just assert for now */
- LWIP_ASSERT("pbuf_remove_header failed\n", 0);
+ LWIP_ASSERT("pbuf_remove_header failed", 0);
UDP_STATS_INC(udp.drop);
MIB2_STATS_INC(mib2.udpinerrors);
pbuf_free(p);
diff --git a/SylixOS/net/lwip/src/netif/ppp/ccp.c b/SylixOS/net/lwip/src/netif/ppp/ccp.c
index 8f615fb..6c2dadc 100644
--- a/SylixOS/net/lwip/src/netif/ppp/ccp.c
+++ b/SylixOS/net/lwip/src/netif/ppp/ccp.c
@@ -246,7 +246,6 @@ static const fsm_callbacks ccp_callbacks = {
* Do we want / did we get any compression?
*/
static int ccp_anycompress(ccp_options *opt) {
- LWIP_UNUSED_ARG(opt);
return (0
#if DEFLATE_SUPPORT
|| (opt)->deflate
@@ -744,7 +743,6 @@ static void ccp_resetci(fsm *f) {
static int ccp_cilen(fsm *f) {
ppp_pcb *pcb = f->pcb;
ccp_options *go = &pcb->ccp_gotoptions;
- LWIP_UNUSED_ARG(go);
return 0
#if BSDCOMPRESS_SUPPORT
@@ -840,8 +838,6 @@ static int ccp_ackci(fsm *f, u_char *p, int len) {
#if BSDCOMPRESS_SUPPORT || PREDICTOR_SUPPORT
u_char *p0 = p;
#endif /* BSDCOMPRESS_SUPPORT || PREDICTOR_SUPPORT */
- LWIP_UNUSED_ARG(p);
- LWIP_UNUSED_ARG(go);
#if MPPE_SUPPORT
if (go->mppe) {
@@ -1026,7 +1022,6 @@ static int ccp_rejci(fsm *f, u_char *p, int len) {
ppp_pcb *pcb = f->pcb;
ccp_options *go = &pcb->ccp_gotoptions;
ccp_options try_; /* options to request next time */
- LWIP_UNUSED_ARG(p);
try_ = *go;
@@ -1122,7 +1117,6 @@ static int ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) {
u8_t rej_for_ci_mppe = 1; /* Are we rejecting based on a bad/missing */
/* CI_MPPE, or due to other options? */
#endif /* MPPE_SUPPORT */
- LWIP_UNUSED_ARG(ao);
ret = CONFACK;
retp = p0 = p;
diff --git a/SylixOS/net/lwip/src/netif/ppp/ppp.c b/SylixOS/net/lwip/src/netif/ppp/ppp.c
index 89b12a7..4555d89 100644
--- a/SylixOS/net/lwip/src/netif/ppp/ppp.c
+++ b/SylixOS/net/lwip/src/netif/ppp/ppp.c
@@ -473,7 +473,6 @@ static err_t ppp_netif_init_cb(struct netif *netif) {
#if PPP_IPV6_SUPPORT
netif->output_ip6 = ppp_netif_output_ip6;
#endif /* PPP_IPV6_SUPPORT */
- netif->flags = NETIF_FLAG_UP;
#if LWIP_NETIF_HOSTNAME
/* @todo: Initialize interface hostname */
/* netif_set_hostname(netif, "lwip"); */
@@ -707,6 +706,9 @@ ppp_pcb *ppp_new(struct netif *pppif, const struct link_callbacks *callbacks, vo
PPPDEBUG(LOG_ERR, ("ppp_new: netif_add failed\n"));
return NULL;
}
+ /* FIXME: user application should be responsible to call netif_set_up(),
+ * remove it for next release with allowed behavior break */
+ netif_set_up(pcb->netif);
pcb->link_cb = callbacks;
pcb->link_ctx_cb = link_ctx_cb;
diff --git a/SylixOS/net/lwip/src/netif/ppp/pppos.c b/SylixOS/net/lwip/src/netif/ppp/pppos.c
index 896b43a..57a4cf5 100644
--- a/SylixOS/net/lwip/src/netif/ppp/pppos.c
+++ b/SylixOS/net/lwip/src/netif/ppp/pppos.c
@@ -719,7 +719,7 @@ static void pppos_input_callback(void *arg) {
ppp = ((struct pppos_input_header*)pb->payload)->ppp;
if(pbuf_remove_header(pb, sizeof(struct pppos_input_header))) {
- LWIP_ASSERT("pbuf_remove_header failed\n", 0);
+ LWIP_ASSERT("pbuf_remove_header failed", 0);
goto drop;
}
diff --git a/SylixOS/net/lwip/src/netif/ppp/vj.c b/SylixOS/net/lwip/src/netif/ppp/vj.c
index b322ee4..11df6f9 100644
--- a/SylixOS/net/lwip/src/netif/ppp/vj.c
+++ b/SylixOS/net/lwip/src/netif/ppp/vj.c
@@ -409,7 +409,7 @@ vj_compress_tcp(struct vjcompress *comp, struct pbuf **pb)
hlen -= deltaS + 4;
if (pbuf_remove_header(np, hlen)){
/* Can we cope with this failing? Just assert for now */
- LWIP_ASSERT("pbuf_remove_header failed\n", 0);
+ LWIP_ASSERT("pbuf_remove_header failed", 0);
}
cp = (u8_t*)np->payload;
*cp++ = (u8_t)(changes | NEW_C);
@@ -418,7 +418,7 @@ vj_compress_tcp(struct vjcompress *comp, struct pbuf **pb)
hlen -= deltaS + 3;
if (pbuf_remove_header(np, hlen)) {
/* Can we cope with this failing? Just assert for now */
- LWIP_ASSERT("pbuf_remove_header failed\n", 0);
+ LWIP_ASSERT("pbuf_remove_header failed", 0);
}
cp = (u8_t*)np->payload;
*cp++ = (u8_t)changes;
@@ -621,7 +621,7 @@ vj_uncompress_tcp(struct pbuf **nb, struct vjcompress *comp)
/* Remove the compressed header and prepend the uncompressed header. */
if (pbuf_remove_header(n0, vjlen)) {
/* Can we cope with this failing? Just assert for now */
- LWIP_ASSERT("pbuf_remove_header failed\n", 0);
+ LWIP_ASSERT("pbuf_remove_header failed", 0);
goto bad;
}
@@ -644,7 +644,7 @@ vj_uncompress_tcp(struct pbuf **nb, struct vjcompress *comp)
if (pbuf_remove_header(np, cs->cs_hlen)) {
/* Can we cope with this failing? Just assert for now */
- LWIP_ASSERT("pbuf_remove_header failed\n", 0);
+ LWIP_ASSERT("pbuf_remove_header failed", 0);
goto bad;
}