mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 12:32:37 +00:00
If a udp_pcb has a local_ip set, check if it is the same as the one of the netif used for sending to prevent sending from old addresses after a netif address gets changed (partly fixes bug #3168).
This commit is contained in:
parent
a27dc1e908
commit
2740a81103
@ -158,6 +158,11 @@ HISTORY
|
|||||||
|
|
||||||
++ Bug fixes:
|
++ Bug fixes:
|
||||||
|
|
||||||
|
2007-05-16 Simon Goldschmidt
|
||||||
|
* api_msg.c, udp.c: If a udp_pcb has a local_ip set, check if it is the same
|
||||||
|
as the one of the netif used for sending to prevent sending from old
|
||||||
|
addresses after a netif address gets changed (partly fixes bug #3168).
|
||||||
|
|
||||||
2007-05-16 Frédéric Bernon
|
2007-05-16 Frédéric Bernon
|
||||||
* tcpip.c, igmp.h, igmp.c: Fixed bug "#19800 : IGMP: igmp_tick() will not work
|
* tcpip.c, igmp.h, igmp.c: Fixed bug "#19800 : IGMP: igmp_tick() will not work
|
||||||
with NO_SYS=1". Note that igmp_init is always in tcpip_thread (and not in
|
with NO_SYS=1". Note that igmp_init is always in tcpip_thread (and not in
|
||||||
|
@ -582,9 +582,9 @@ do_send(struct api_msg_msg *msg)
|
|||||||
#if LWIP_RAW
|
#if LWIP_RAW
|
||||||
case NETCONN_RAW:
|
case NETCONN_RAW:
|
||||||
if (msg->msg.b->addr==NULL) {
|
if (msg->msg.b->addr==NULL) {
|
||||||
raw_send(msg->conn->pcb.raw, msg->msg.b->p);
|
msg->conn->err = raw_send(msg->conn->pcb.raw, msg->msg.b->p);
|
||||||
} else {
|
} else {
|
||||||
raw_sendto(msg->conn->pcb.raw, msg->msg.b->p, msg->msg.b->addr);
|
msg->conn->err = raw_sendto(msg->conn->pcb.raw, msg->msg.b->p, msg->msg.b->addr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@ -595,9 +595,9 @@ do_send(struct api_msg_msg *msg)
|
|||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case NETCONN_UDP:
|
case NETCONN_UDP:
|
||||||
if (msg->msg.b->addr==NULL) {
|
if (msg->msg.b->addr==NULL) {
|
||||||
udp_send(msg->conn->pcb.udp, msg->msg.b->p);
|
msg->conn->err = udp_send(msg->conn->pcb.udp, msg->msg.b->p);
|
||||||
} else {
|
} else {
|
||||||
udp_sendto(msg->conn->pcb.udp, msg->msg.b->p, msg->msg.b->addr, msg->msg.b->port);
|
msg->conn->err = udp_sendto(msg->conn->pcb.udp, msg->msg.b->p, msg->msg.b->addr, msg->msg.b->port);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* LWIP_UDP */
|
#endif /* LWIP_UDP */
|
||||||
|
@ -355,6 +355,16 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
/* use outgoing network interface IP address as source address */
|
/* use outgoing network interface IP address as source address */
|
||||||
src_ip = &(netif->ip_addr);
|
src_ip = &(netif->ip_addr);
|
||||||
} else {
|
} else {
|
||||||
|
/* check if UDP PCB local IP address is correct */
|
||||||
|
if (!ip_addr_cmp(&(pcb->local_ip), &(netif->ip_addr))) {
|
||||||
|
if (q != p) {
|
||||||
|
/* free the header pbuf */
|
||||||
|
pbuf_free(q);
|
||||||
|
q = NULL;
|
||||||
|
/* p is still referenced by the caller, and will live on */
|
||||||
|
}
|
||||||
|
return ERR_VAL;
|
||||||
|
}
|
||||||
/* use UDP PCB local IP address as source address */
|
/* use UDP PCB local IP address as source address */
|
||||||
src_ip = &(pcb->local_ip);
|
src_ip = &(pcb->local_ip);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user