Merge pull request #457 from adamdunkels/push/uip6-bugfixes

IPv6 bugfixes
This commit is contained in:
Nicolas Tsiftes 2013-12-12 05:02:39 -08:00
commit a8a9b66eff
2 changed files with 28 additions and 6 deletions

View File

@ -1832,8 +1832,12 @@ uip_process(uint8_t flag)
UIP_TCP_BUF->seqno[2] != uip_connr->rcv_nxt[2] ||
UIP_TCP_BUF->seqno[3] != uip_connr->rcv_nxt[3])) {
if(UIP_TCP_BUF->flags & TCP_SYN) {
goto tcp_send_synack;
if((UIP_TCP_BUF->flags & TCP_SYN)) {
if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_RCVD) {
goto tcp_send_synack;
} else if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_SENT) {
goto tcp_send_syn;
}
}
goto tcp_send_ack;
}
@ -2315,12 +2319,23 @@ uip_send(const void *data, int len)
{
int copylen;
#define MIN(a,b) ((a) < (b)? (a): (b))
copylen = MIN(len, UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN -
(int)((char *)uip_sappdata - (char *)&uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN]));
if(uip_sappdata != NULL) {
copylen = MIN(len, UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN -
(int)((char *)uip_sappdata -
(char *)&uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN]));
} else {
copylen = MIN(len, UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN);
}
if(copylen > 0) {
uip_slen = copylen;
if(data != uip_sappdata) {
memcpy(uip_sappdata, (data), uip_slen);
if(uip_sappdata == NULL) {
memcpy((char *)&uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN],
(data), uip_slen);
} else {
memcpy(uip_sappdata, (data), uip_slen);
}
}
}
}

View File

@ -144,7 +144,11 @@
*
* This should normally not be changed.
*/
#ifdef UIP_CONF_TTL
#define UIP_TTL UIP_CONF_TTL
#else /* UIP_CONF_TTL */
#define UIP_TTL 64
#endif /* UIP_CONF_TTL */
/**
* The maximum time an IP fragment should wait in the reassembly
@ -378,7 +382,10 @@
* UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
*/
#ifdef UIP_CONF_TCP_MSS
#define UIP_TCP_MSS (UIP_CONF_TCP_MSS)
#if UIP_CONF_TCP_MSS < (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
#error UIP_CONF_TCP_MSS is too large for the current UIP_BUFSIZE
#endif /* UIP_CONF_TCP_MSS < (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN) */
#define UIP_TCP_MSS (UIP_CONF_TCP_MSS)
#else
#define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
#endif