[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Lwip 1.1.0 upd_send
From: |
Paul C |
Subject: |
[lwip-users] Lwip 1.1.0 upd_send |
Date: |
Tue, 04 Jan 2005 13:46:15 +1030 |
Hi List,
I use
err = udp_connect( Shout, IP_ADDR_ANY, A_PORT);
err = udp_send(Shout, pcb);
With LWIP 1.1.0 release the udp is sent to 0.0.0.0 I have this patch
in udp.c to make it use the network address (which is what I want).
Am I using udp_connect/ udp_send wrongly or is this a patch
that should be in lwip? Should I really use IP_ADDR_BROADCAST here
instead?
Thanks
Paul Clarke
@@ -448,16 +448,22 @@ udp_send(struct udp_pcb *pcb, struct pbu
/* PCB local address is IP_ANY_ADDR? */
if (ip_addr_isany(&pcb->local_ip)) {
/* use outgoing network interface IP address as source address */
src_ip = &(netif->ip_addr);
} else {
/* use UDP PCB local IP address as source address */
src_ip = &(pcb->local_ip);
}
+ /* PCB remote address is IP_ANY_ADDR? */
+ if (ip_addr_isany(&pcb->remote_ip)) {
+ /* use outgoing network interface network address as destination
address */
+ pcb->remote_ip.addr = netif->ip_addr.addr & netif->netmask.addr
+ | (0xFFFFFFFFUL & (unsigned long)~netif->netmask.addr);
+ }
LWIP_DEBUGF(UDP_DEBUG, ("udp_send: sending datagram of length %u\n",
q->tot_l
en));
/* UDP Lite protocol? */
if (pcb->flags & UDP_FLAGS_UDPLITE) {
LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP LITE packet length %u\n",
q->tot_len
));
/* set UDP message length in UDP header */
udphdr->len = htons(pcb->chksum_len);
- [lwip-users] Lwip 1.1.0 upd_send,
Paul C <=