Added UDP lite support for sockets

This commit is contained in:
goldsimon
2007-06-11 18:43:16 +00:00
parent 2f293d53ba
commit 046a270156
5 changed files with 117 additions and 5 deletions

View File

@@ -414,7 +414,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
u16_t chklen;
LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP LITE packet length %"U16_F"\n", q->tot_len));
/* set UDP message length in UDP header */
chklen = pcb->chksum_len;
chklen = pcb->chksum_len_tx;
if (chklen < sizeof(struct udp_hdr)) {
if (chklen != 0) {
LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP LITE pcb->chksum_len is illegal: %"U16_F"\n", chklen));
@@ -431,7 +431,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
/* calculate checksum */
#if CHECKSUM_GEN_UDP
udphdr->chksum = inet_chksum_pseudo(q, src_ip, &(pcb->remote_ip),
IP_PROTO_UDP, pcb->chksum_len);
IP_PROTO_UDP, chklen);
/* chksum zero must become 0xffff, as zero means 'no checksum' */
if (udphdr->chksum == 0x0000)
udphdr->chksum = 0xffff;