mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
Merge from DEVEL. Includes important UDP fix for bug #6601.
This commit is contained in:
parent
7d58c0c2be
commit
fa9b1ba947
@ -450,7 +450,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
q = p;
|
q = p;
|
||||||
LWIP_DEBUGF(UDP_DEBUG, ("udp_send: added header in given pbuf %p\n", (void *)p));
|
LWIP_DEBUGF(UDP_DEBUG, ("udp_send: added header in given pbuf %p\n", (void *)p));
|
||||||
}
|
}
|
||||||
|
/* { q now represents the packet to be sent */
|
||||||
udphdr = q->payload;
|
udphdr = q->payload;
|
||||||
udphdr->src = htons(pcb->local_port);
|
udphdr->src = htons(pcb->local_port);
|
||||||
udphdr->dest = htons(pcb->remote_port);
|
udphdr->dest = htons(pcb->remote_port);
|
||||||
@ -483,7 +483,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
/* chksum zero must become 0xffff, as zero means 'no checksum' */
|
/* chksum zero must become 0xffff, as zero means 'no checksum' */
|
||||||
if (udphdr->chksum == 0x0000) udphdr->chksum = 0xffff;
|
if (udphdr->chksum == 0x0000) udphdr->chksum = 0xffff;
|
||||||
/* output to IP */
|
/* output to IP */
|
||||||
err = ip_output_if (p, src_ip, &pcb->remote_ip, pcb->ttl, pcb->tos, IP_PROTO_UDPLITE, netif);
|
err = ip_output_if (q, src_ip, &pcb->remote_ip, pcb->ttl, pcb->tos, IP_PROTO_UDPLITE, netif);
|
||||||
snmp_inc_udpoutdatagrams();
|
snmp_inc_udpoutdatagrams();
|
||||||
} else {
|
} else {
|
||||||
LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP packet length %u\n", q->tot_len));
|
LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP packet length %u\n", q->tot_len));
|
||||||
@ -498,12 +498,13 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
snmp_inc_udpoutdatagrams();
|
snmp_inc_udpoutdatagrams();
|
||||||
LWIP_DEBUGF(UDP_DEBUG, ("udp_send: ip_output_if (,,,,IP_PROTO_UDP,)\n"));
|
LWIP_DEBUGF(UDP_DEBUG, ("udp_send: ip_output_if (,,,,IP_PROTO_UDP,)\n"));
|
||||||
/* output to IP */
|
/* output to IP */
|
||||||
err = ip_output_if(p, src_ip, &pcb->remote_ip, pcb->ttl, pcb->tos, IP_PROTO_UDP, netif);
|
err = ip_output_if(q, src_ip, &pcb->remote_ip, pcb->ttl, pcb->tos, IP_PROTO_UDP, netif);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* did we chain a header earlier? */
|
/* did we chain a header earlier? */
|
||||||
if (q != p) {
|
if (q != p) {
|
||||||
/* free the header */
|
/* free the header */
|
||||||
|
/* p is also still referenced by the caller, and will live on */
|
||||||
pbuf_free(q);
|
pbuf_free(q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user