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) {
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,15 +2319,26 @@ uip_send(const void *data, int len)
{
int copylen;
#define MIN(a,b) ((a) < (b)? (a): (b))
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]));
(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) {
if(uip_sappdata == NULL) {
memcpy((char *)&uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN],
(data), uip_slen);
} else {
memcpy(uip_sappdata, (data), uip_slen);
}
}
}
}
/*---------------------------------------------------------------------------*/
/** @} */
#endif /* UIP_CONF_IPV6 */

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,6 +382,9 @@
* UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
*/
#ifdef 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)