344 |
(seg == NULL || |
(seg == NULL || |
345 |
ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len > wnd)) { |
ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len > wnd)) { |
346 |
pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW); |
pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW); |
347 |
p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_RAM); |
p = pbuf_alloc(PBUF_IP, TCP_HLEN, PBUF_RAM); |
348 |
if(p == NULL) { |
if(p == NULL) { |
349 |
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output: (ACK) could not allocate pbuf\n")); |
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output: (ACK) could not allocate pbuf\n")); |
350 |
return ERR_BUF; |
return ERR_BUF; |
351 |
} |
} |
352 |
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output: sending ACK for %lu\n", pcb->rcv_nxt)); |
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output: sending ACK for %lu\n", pcb->rcv_nxt)); |
|
if(pbuf_header(p, TCP_HLEN)) { |
|
|
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output: (ACK) no room for TCP header in pbuf.\n")); |
|
|
|
|
|
#ifdef TCP_STATS |
|
|
++lwip_stats.tcp.err; |
|
|
#endif /* TCP_STATS */ |
|
|
pbuf_free(p); |
|
|
return ERR_BUF; |
|
|
} |
|
353 |
|
|
354 |
tcphdr = p->payload; |
tcphdr = p->payload; |
355 |
tcphdr->src = htons(pcb->local_port); |
tcphdr->src = htons(pcb->local_port); |
500 |
{ |
{ |
501 |
struct pbuf *p; |
struct pbuf *p; |
502 |
struct tcp_hdr *tcphdr; |
struct tcp_hdr *tcphdr; |
503 |
p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_RAM); |
p = pbuf_alloc(PBUF_IP, TCP_HLEN, PBUF_RAM); |
504 |
if(p == NULL) { |
if(p == NULL) { |
|
if(p == NULL) { |
|
505 |
DEBUGF(TCP_DEBUG, ("tcp_rst: could not allocate memory for pbuf\n")); |
DEBUGF(TCP_DEBUG, ("tcp_rst: could not allocate memory for pbuf\n")); |
506 |
return; |
return; |
|
} |
|
|
} |
|
|
if(pbuf_header(p, TCP_HLEN)) { |
|
|
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_rst: no room for TCP header in pbuf.\n")); |
|
|
|
|
|
#ifdef TCP_STATS |
|
|
++lwip_stats.tcp.err; |
|
|
#endif /* TCP_STATS */ |
|
|
return; |
|
507 |
} |
} |
508 |
|
|
509 |
tcphdr = p->payload; |
tcphdr = p->payload; |