66 |
|
|
67 |
static struct udp_pcb *pcb_cache = NULL; |
static struct udp_pcb *pcb_cache = NULL; |
68 |
|
|
|
|
|
69 |
void |
void |
70 |
udp_init(void) |
udp_init(void) |
71 |
{ |
{ |
409 |
return err; |
return err; |
410 |
} |
} |
411 |
} |
} |
412 |
|
/* find the outgoing network interface for this packet */ |
413 |
|
netif = ip_route(&(pcb->remote_ip)); |
414 |
|
/* no outgoing network interface could be found? */ |
415 |
|
if (netif == NULL) { |
416 |
|
LWIP_DEBUGF(UDP_DEBUG | 1, ("udp_send: No route to 0x%lx\n", pcb->remote_ip.addr)); |
417 |
|
UDP_STATS_INC(udp.rterr); |
418 |
|
return ERR_RTE; |
419 |
|
} |
420 |
|
|
421 |
/* not enough space to add an UDP header to first pbuf in given p chain? */ |
/* not enough space to add an UDP header to first pbuf in given p chain? */ |
422 |
if (pbuf_header(p, UDP_HLEN)) { |
if (pbuf_header(p, UDP_HLEN)) { |
444 |
/* in UDP, 0 checksum means 'no checksum' */ |
/* in UDP, 0 checksum means 'no checksum' */ |
445 |
udphdr->chksum = 0x0000; |
udphdr->chksum = 0x0000; |
446 |
|
|
|
/* find the outgoing network interface for this packet */ |
|
|
netif = ip_route(&(pcb->remote_ip)); |
|
|
/* no outgoing network interface could be found? */ |
|
|
if (netif == NULL) { |
|
|
LWIP_DEBUGF(UDP_DEBUG | 1, ("udp_send: No route to 0x%lx\n", pcb->remote_ip.addr)); |
|
|
UDP_STATS_INC(udp.rterr); |
|
|
return ERR_RTE; |
|
|
} |
|
447 |
/* PCB local address is IP_ANY_ADDR? */ |
/* PCB local address is IP_ANY_ADDR? */ |
448 |
if (ip_addr_isany(&pcb->local_ip)) { |
if (ip_addr_isany(&pcb->local_ip)) { |
449 |
/* use outgoing network interface IP address as source address */ |
/* use outgoing network interface IP address as source address */ |