Compare commits
13 Commits
STABLE-1_4
...
STABLE-1_4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b8b5d459e | ||
|
|
6d8dee6d68 | ||
|
|
3db149b42e | ||
|
|
03fb581252 | ||
|
|
5e224aba6d | ||
|
|
6b3179fbbf | ||
|
|
d0a25c2574 | ||
|
|
45e142af55 | ||
|
|
3eccdf65aa | ||
|
|
2b9933eb1e | ||
|
|
fe7bbae8a7 | ||
|
|
d77b354377 | ||
|
|
ca30f4b02e |
33
CHANGELOG
33
CHANGELOG
@@ -6,6 +6,10 @@ HISTORY
|
||||
|
||||
++ New features:
|
||||
|
||||
2012-03-25: Simon Goldschmidt (idea by Mason)
|
||||
* posix/*: added posix-compatibility include files posix/netdb.h and posix/sys/socket.h
|
||||
which are a simple wrapper to the correct lwIP include files.
|
||||
|
||||
2012-01-16: Simon Goldschmidt
|
||||
* opt.h, icmp.c: Added option CHECKSUM_GEN_ICMP
|
||||
|
||||
@@ -62,6 +66,35 @@ HISTORY
|
||||
|
||||
++ Bugfixes:
|
||||
|
||||
2012-09-26: Simon Goldschmidt
|
||||
* api_msg.c: fixed bug #37405 'err_tcp()' uses already freed 'netconn' object
|
||||
|
||||
2012-09-26: patch by Henrik Persson
|
||||
* dhcp.c: patch #7843 Fix corner case with dhcp timeouts
|
||||
|
||||
2012-09-26: patch by Henrik Persson
|
||||
* dhcp.c: patch #7840 Segfault in dhcp_parse_reply if no end marker in dhcp packet
|
||||
|
||||
2012-08-22: Simon Goldschmidt
|
||||
* memp.c: fixed bug #37166: memp_sanity check loops itself
|
||||
|
||||
2012-05-08: Simon Goldschmidt
|
||||
* tcp_out.c: fixed bug: #36380 unsent_oversize mismatch in 1.4.1RC1 (this was
|
||||
a debug-check issue only)
|
||||
|
||||
2012-03-27: Simon Goldschmidt
|
||||
* vj.c: fixed bug #35756 header length calculation problem in ppp/vj.c
|
||||
|
||||
2012-03-27: Simon Goldschmidt (patch by Mason)
|
||||
* tcp_out.c: fixed bug #35945: SYN packet should provide the recv MSS not the
|
||||
send MSS
|
||||
|
||||
2012-03-22: Simon Goldschmidt
|
||||
* ip4.c: fixed bug #35927: missing refragmentaion in ip_forward
|
||||
|
||||
2012-03-20: Simon Goldschmidt (patch by Mason)
|
||||
* netdb.c: fixed bug #35907: lwip_gethostbyname_r returns an invalid h_addr_list
|
||||
|
||||
2012-03-12: Simon Goldschmidt (patch by Bostjan Meglic)
|
||||
* ppp.c: fixed bug #35809: PPP GetMask(): Compiler warning on big endian,
|
||||
possible bug on little endian system
|
||||
|
||||
@@ -456,6 +456,14 @@ accept_function(void *arg, struct tcp_pcb *newpcb, err_t err)
|
||||
if (sys_mbox_trypost(&conn->acceptmbox, newconn) != ERR_OK) {
|
||||
/* When returning != ERR_OK, the pcb is aborted in tcp_process(),
|
||||
so do nothing here! */
|
||||
/* remove all references to this netconn from the pcb */
|
||||
struct tcp_pcb* pcb = newconn->pcb.tcp;
|
||||
tcp_arg(pcb, NULL);
|
||||
tcp_recv(pcb, NULL);
|
||||
tcp_sent(pcb, NULL);
|
||||
tcp_poll(pcb, NULL, 4);
|
||||
tcp_err(pcb, NULL);
|
||||
/* remove reference from to the pcb from this netconn */
|
||||
newconn->pcb.tcp = NULL;
|
||||
/* no need to drain since we know the recvmbox is empty. */
|
||||
sys_mbox_free(&newconn->recvmbox);
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
/** helper struct for gethostbyname_r to access the char* buffer */
|
||||
struct gethostbyname_r_helper {
|
||||
ip_addr_t *addrs;
|
||||
ip_addr_t *addr_list[2];
|
||||
ip_addr_t addr;
|
||||
char *aliases;
|
||||
};
|
||||
@@ -180,7 +180,7 @@ lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
|
||||
}
|
||||
/* first thing to do: set *result to nothing */
|
||||
*result = NULL;
|
||||
if ((name == NULL) || (ret == NULL) || (buf == 0)) {
|
||||
if ((name == NULL) || (ret == NULL) || (buf == NULL)) {
|
||||
/* not all arguments given */
|
||||
*h_errnop = EINVAL;
|
||||
return -1;
|
||||
@@ -197,7 +197,7 @@ lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
|
||||
hostname = ((char*)h) + sizeof(struct gethostbyname_r_helper);
|
||||
|
||||
/* query host IP address */
|
||||
err = netconn_gethostbyname(name, &(h->addr));
|
||||
err = netconn_gethostbyname(name, &h->addr);
|
||||
if (err != ERR_OK) {
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("lwip_gethostbyname(%s) failed, err=%d\n", name, err));
|
||||
*h_errnop = HOST_NOT_FOUND;
|
||||
@@ -209,13 +209,14 @@ lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
|
||||
hostname[namelen] = 0;
|
||||
|
||||
/* fill hostent */
|
||||
h->addrs = &(h->addr);
|
||||
h->addr_list[0] = &h->addr;
|
||||
h->addr_list[1] = NULL;
|
||||
h->aliases = NULL;
|
||||
ret->h_name = (char*)hostname;
|
||||
ret->h_aliases = &(h->aliases);
|
||||
ret->h_name = hostname;
|
||||
ret->h_aliases = &h->aliases;
|
||||
ret->h_addrtype = AF_INET;
|
||||
ret->h_length = sizeof(ip_addr_t);
|
||||
ret->h_addr_list = (char**)&(h->addrs);
|
||||
ret->h_addr_list = (char**)&h->addr_list;
|
||||
|
||||
/* set result != NULL */
|
||||
*result = ret;
|
||||
|
||||
@@ -962,6 +962,11 @@ dhcp_bind(struct netif *netif)
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_bind(): set request timeout %"U32_F" msecs\n", dhcp->offered_t2_rebind*1000));
|
||||
}
|
||||
|
||||
/* If we have sub 1 minute lease, t2 and t1 will kick in at the same time. */
|
||||
if ((dhcp->t1_timeout >= dhcp->t2_timeout) && (dhcp->t2_timeout > 0)) {
|
||||
dhcp->t1_timeout = 0;
|
||||
}
|
||||
|
||||
if (dhcp->subnet_mask_given) {
|
||||
/* copy offered network mask */
|
||||
ip_addr_copy(sn_mask, dhcp->offered_sn_mask);
|
||||
@@ -1471,8 +1476,14 @@ decode_next:
|
||||
if (offset >= q->len) {
|
||||
offset -= q->len;
|
||||
offset_max -= q->len;
|
||||
q = q->next;
|
||||
options = (u8_t*)q->payload;
|
||||
if ((offset < offset_max) && offset_max) {
|
||||
q = q->next;
|
||||
LWIP_ASSERT("next pbuf was null", q);
|
||||
options = (u8_t*)q->payload;
|
||||
} else {
|
||||
// We've run out of bytes, probably no end marker. Don't proceed.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* is this an overloaded message? */
|
||||
|
||||
@@ -223,6 +223,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
||||
LWIP_DEBUGF(IP_DEBUG, ("ip_forward: no forwarding route for %"U16_F".%"U16_F".%"U16_F".%"U16_F" found\n",
|
||||
ip4_addr1_16(¤t_iphdr_dest), ip4_addr2_16(¤t_iphdr_dest),
|
||||
ip4_addr3_16(¤t_iphdr_dest), ip4_addr4_16(¤t_iphdr_dest)));
|
||||
/* @todo: send ICMP_DUR_NET? */
|
||||
goto return_noroute;
|
||||
}
|
||||
#if !IP_FORWARD_ALLOW_TX_ON_RX_NETIF
|
||||
@@ -264,6 +265,20 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
||||
snmp_inc_ipforwdatagrams();
|
||||
|
||||
PERF_STOP("ip_forward");
|
||||
/* don't fragment if interface has mtu set to 0 [loopif] */
|
||||
if (netif->mtu && (p->tot_len > netif->mtu)) {
|
||||
if ((IPH_OFFSET(iphdr) & PP_NTOHS(IP_DF)) == 0) {
|
||||
#if IP_FRAG
|
||||
ip_frag(p, netif, ip_current_dest_addr());
|
||||
#else /* IP_FRAG */
|
||||
/* @todo: send ICMP Destination Unreacheable code 13 "Communication administratively prohibited"? */
|
||||
#endif /* IP_FRAG */
|
||||
} else {
|
||||
/* send ICMP Destination Unreacheable code 4: "Fragmentation Needed and DF Set" */
|
||||
icmp_dest_unreach(p, ICMP_DUR_FRAG);
|
||||
}
|
||||
return;
|
||||
}
|
||||
/* transmit pbuf on chosen interface */
|
||||
netif->output(netif, p, ¤t_iphdr_dest);
|
||||
return;
|
||||
|
||||
@@ -176,19 +176,20 @@ static u8_t memp_memory[MEM_ALIGNMENT - 1
|
||||
|
||||
#if MEMP_SANITY_CHECK
|
||||
/**
|
||||
* Check that memp-lists don't form a circle
|
||||
* Check that memp-lists don't form a circle, using "Floyd's cycle-finding algorithm".
|
||||
*/
|
||||
static int
|
||||
memp_sanity(void)
|
||||
{
|
||||
s16_t i, c;
|
||||
struct memp *m, *n;
|
||||
s16_t i;
|
||||
struct memp *t, *h;
|
||||
|
||||
for (i = 0; i < MEMP_MAX; i++) {
|
||||
for (m = memp_tab[i]; m != NULL; m = m->next) {
|
||||
c = 1;
|
||||
for (n = memp_tab[i]; n != NULL; n = n->next) {
|
||||
if (n == m && --c < 0) {
|
||||
t = memp_tab[i];
|
||||
if(t != NULL) {
|
||||
for (h = t->next; (t != NULL) && (h != NULL); t = t->next,
|
||||
h = (((h->next != NULL) && (h->next->next != NULL)) ? h->next->next : NULL)) {
|
||||
if (t == h) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
goto memerr;
|
||||
}
|
||||
#if TCP_OVERSIZE_DBGCHECK
|
||||
last_unsent->oversize_left = oversize;
|
||||
last_unsent->oversize_left += oversize;
|
||||
#endif /* TCP_OVERSIZE_DBGCHECK */
|
||||
TCP_DATA_COPY2(concat_p->payload, (u8_t*)arg + pos, seglen, &concat_chksum, &concat_chksum_swapped);
|
||||
#if TCP_CHECKSUM_ON_COPY
|
||||
@@ -635,6 +635,8 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
}
|
||||
last_unsent->len += oversize_used;
|
||||
#if TCP_OVERSIZE_DBGCHECK
|
||||
LWIP_ASSERT("last_unsent->oversize_left >= oversize_used",
|
||||
last_unsent->oversize_left >= oversize_used);
|
||||
last_unsent->oversize_left -= oversize_used;
|
||||
#endif /* TCP_OVERSIZE_DBGCHECK */
|
||||
}
|
||||
@@ -1066,7 +1068,13 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
|
||||
packets, so ignore it here */
|
||||
opts = (u32_t *)(void *)(seg->tcphdr + 1);
|
||||
if (seg->flags & TF_SEG_OPTS_MSS) {
|
||||
*opts = TCP_BUILD_MSS_OPTION(pcb->mss);
|
||||
u16_t mss;
|
||||
#if TCP_CALCULATE_EFF_SEND_MSS
|
||||
mss = tcp_eff_send_mss(TCP_MSS, &pcb->remote_ip);
|
||||
#else /* TCP_CALCULATE_EFF_SEND_MSS */
|
||||
mss = TCP_MSS;
|
||||
#endif /* TCP_CALCULATE_EFF_SEND_MSS */
|
||||
*opts = TCP_BUILD_MSS_OPTION(mss);
|
||||
opts += 1;
|
||||
}
|
||||
#if LWIP_TCP_TIMESTAMPS
|
||||
|
||||
@@ -171,11 +171,9 @@ PACK_STRUCT_END
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
|
||||
#define TCPH_OFFSET(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 8)
|
||||
#define TCPH_HDRLEN(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 12)
|
||||
#define TCPH_FLAGS(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) & TCP_FLAGS)
|
||||
|
||||
#define TCPH_OFFSET_SET(phdr, offset) (phdr)->_hdrlen_rsvd_flags = htons(((offset) << 8) | TCPH_FLAGS(phdr))
|
||||
#define TCPH_HDRLEN_SET(phdr, len) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | TCPH_FLAGS(phdr))
|
||||
#define TCPH_FLAGS_SET(phdr, flags) (phdr)->_hdrlen_rsvd_flags = (((phdr)->_hdrlen_rsvd_flags & PP_HTONS((u16_t)(~(u16_t)(TCP_FLAGS)))) | htons(flags))
|
||||
#define TCPH_HDRLEN_FLAGS_SET(phdr, len, flags) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | (flags))
|
||||
|
||||
33
src/include/posix/netdb.h
Normal file
33
src/include/posix/netdb.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @file
|
||||
* This file is a posix wrapper for lwip/netdb.h.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/netdb.h"
|
||||
33
src/include/posix/sys/socket.h
Normal file
33
src/include/posix/sys/socket.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @file
|
||||
* This file is a posix wrapper for lwip/sockets.h.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/sockets.h"
|
||||
@@ -213,7 +213,7 @@ vj_compress_tcp(struct vjcompress *comp, struct pbuf *pb)
|
||||
*/
|
||||
INCR(vjs_misses);
|
||||
comp->last_cs = lcs;
|
||||
hlen += TCPH_OFFSET(th);
|
||||
hlen += TCPH_HDRLEN(th);
|
||||
hlen <<= 2;
|
||||
/* Check that the IP/TCP headers are contained in the first buffer. */
|
||||
if (hlen > pb->len) {
|
||||
@@ -236,7 +236,7 @@ vj_compress_tcp(struct vjcompress *comp, struct pbuf *pb)
|
||||
|
||||
oth = (struct tcp_hdr *)&((long *)&cs->cs_ip)[hlen];
|
||||
deltaS = hlen;
|
||||
hlen += TCPH_OFFSET(th);
|
||||
hlen += TCPH_HDRLEN(th);
|
||||
hlen <<= 2;
|
||||
/* Check that the IP/TCP headers are contained in the first buffer. */
|
||||
if (hlen > pb->len) {
|
||||
@@ -258,9 +258,9 @@ vj_compress_tcp(struct vjcompress *comp, struct pbuf *pb)
|
||||
if (((u_short *)ip)[0] != ((u_short *)&cs->cs_ip)[0]
|
||||
|| ((u_short *)ip)[3] != ((u_short *)&cs->cs_ip)[3]
|
||||
|| ((u_short *)ip)[4] != ((u_short *)&cs->cs_ip)[4]
|
||||
|| TCPH_OFFSET(th) != TCPH_OFFSET(oth)
|
||||
|| TCPH_HDRLEN(th) != TCPH_HDRLEN(oth)
|
||||
|| (deltaS > 5 && BCMP(ip + 1, &cs->cs_ip + 1, (deltaS - 5) << 2))
|
||||
|| (TCPH_OFFSET(th) > 5 && BCMP(th + 1, oth + 1, (TCPH_OFFSET(th) - 5) << 2))) {
|
||||
|| (TCPH_HDRLEN(th) > 5 && BCMP(th + 1, oth + 1, (TCPH_HDRLEN(th) - 5) << 2))) {
|
||||
goto uncompressed;
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ vj_uncompress_uncomp(struct pbuf *nb, struct vjcompress *comp)
|
||||
hlen = IPH_HL(ip) << 2;
|
||||
if (IPH_PROTO(ip) >= MAX_SLOTS
|
||||
|| hlen + sizeof(struct tcp_hdr) > nb->len
|
||||
|| (hlen += TCPH_OFFSET(((struct tcp_hdr *)&((char *)ip)[hlen])) << 2)
|
||||
|| (hlen += TCPH_HDRLEN(((struct tcp_hdr *)&((char *)ip)[hlen])) << 2)
|
||||
> nb->len
|
||||
|| hlen > MAX_HDR) {
|
||||
PPPDEBUG(LOG_INFO, ("vj_uncompress_uncomp: bad cid=%d, hlen=%d buflen=%d\n",
|
||||
|
||||
Reference in New Issue
Block a user