mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-25 15:42:56 +00:00
More precise comments on address change.
This commit is contained in:
parent
734400cafa
commit
829744dfe6
@ -180,15 +180,16 @@ netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
|
|||||||
struct tcp_pcb *pcb;
|
struct tcp_pcb *pcb;
|
||||||
struct tcp_pcb_listen *lpcb;
|
struct tcp_pcb_listen *lpcb;
|
||||||
|
|
||||||
/* address has changed? */
|
/* address is actually being changed? */
|
||||||
if ((ip_addr_cmp(ipaddr, &(netif->ip_addr))) == 0)
|
if ((ip_addr_cmp(ipaddr, &(netif->ip_addr))) == 0)
|
||||||
{
|
{
|
||||||
extern struct tcp_pcb *tcp_active_pcbs;
|
extern struct tcp_pcb *tcp_active_pcbs;
|
||||||
DEBUGF(NETIF_DEBUG | 1, ("netif_set_ipaddr: netif address changed\n"));
|
DEBUGF(NETIF_DEBUG | 1, ("netif_set_ipaddr: netif address being changed\n"));
|
||||||
pcb = tcp_active_pcbs;
|
pcb = tcp_active_pcbs;
|
||||||
while (pcb != NULL) {
|
while (pcb != NULL) {
|
||||||
|
/* PCB bound to current local interface address? */
|
||||||
if (ip_addr_cmp(&(pcb->local_ip), &(netif->ip_addr))) {
|
if (ip_addr_cmp(&(pcb->local_ip), &(netif->ip_addr))) {
|
||||||
/* The PCB is connected using the old ipaddr and must be aborted */
|
/* this connection must be aborted */
|
||||||
struct tcp_pcb *next = pcb->next;
|
struct tcp_pcb *next = pcb->next;
|
||||||
DEBUGF(NETIF_DEBUG | 1, ("netif_set_ipaddr: aborting pcb %p\n", (void *)pcb));
|
DEBUGF(NETIF_DEBUG | 1, ("netif_set_ipaddr: aborting pcb %p\n", (void *)pcb));
|
||||||
tcp_abort(pcb);
|
tcp_abort(pcb);
|
||||||
@ -198,9 +199,11 @@ netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (lpcb = tcp_listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
for (lpcb = tcp_listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
||||||
|
/* PCB bound to current local interface address? */
|
||||||
if (ip_addr_cmp(&(lpcb->local_ip), &(netif->ip_addr))) {
|
if (ip_addr_cmp(&(lpcb->local_ip), &(netif->ip_addr))) {
|
||||||
/* The PCB is listening to the old ipaddr and
|
/* The PCB is listening to the old ipaddr and
|
||||||
* is set to listen to the new one instead */
|
* is set to listen to the new one instead */
|
||||||
|
* TODO: how do we know it is _listening_? */
|
||||||
ip_addr_set(&(lpcb->local_ip), ipaddr);
|
ip_addr_set(&(lpcb->local_ip), ipaddr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user