356 |
struct ip_addr *dst_ip, u16_t dst_port) |
struct ip_addr *dst_ip, u16_t dst_port) |
357 |
{ |
{ |
358 |
err_t err; |
err_t err; |
359 |
|
/* temporary space for current PCB remote address */ |
360 |
struct ip_addr pcb_remote_ip; |
struct ip_addr pcb_remote_ip; |
361 |
u16_t pcb_remote_port; |
u16_t pcb_remote_port; |
362 |
/* remember remote peer address of PCB */ |
/* remember current remote peer address of PCB */ |
363 |
pcb_remote_ip.addr = pcb->remote_ip.addr; |
pcb_remote_ip.addr = pcb->remote_ip.addr; |
364 |
pcb_remote_port = pcb->remote_port; |
pcb_remote_port = pcb->remote_port; |
365 |
/* copy packet destination address to PCB remote peer address */ |
/* copy packet destination address to PCB remote peer address */ |
367 |
pcb->remote_port = dst_port; |
pcb->remote_port = dst_port; |
368 |
/* send to the packet destination address */ |
/* send to the packet destination address */ |
369 |
err = udp_send(pcb, p); |
err = udp_send(pcb, p); |
370 |
/* reset PCB remote peer address */ |
/* restore PCB remote peer address */ |
371 |
pcb->remote_ip.addr = pcb_remote_ip.addr; |
pcb->remote_ip.addr = pcb_remote_ip.addr; |
372 |
pcb->remote_port = pcb_remote_port; |
pcb->remote_port = pcb_remote_port; |
373 |
return err; |
return err; |
434 |
udphdr->chksum = 0x0000; |
udphdr->chksum = 0x0000; |
435 |
|
|
436 |
/* find the outgoing network interface for this packet */ |
/* find the outgoing network interface for this packet */ |
437 |
if ((netif = ip_route(&(pcb->remote_ip))) == NULL) { |
netif = ip_route(&(pcb->remote_ip)); |
438 |
|
/* no outgoing network interface could be found? */ |
439 |
|
if (netif == NULL) { |
440 |
LWIP_DEBUGF(UDP_DEBUG | 1, ("udp_send: No route to 0x%lx\n", pcb->remote_ip.addr)); |
LWIP_DEBUGF(UDP_DEBUG | 1, ("udp_send: No route to 0x%lx\n", pcb->remote_ip.addr)); |
441 |
UDP_STATS_INC(udp.rterr); |
UDP_STATS_INC(udp.rterr); |
442 |
return ERR_RTE; |
return ERR_RTE; |