[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] netif_set_ipaddr

From: Jim Gibbons
Subject: Re: [lwip-users] netif_set_ipaddr
Date: Wed, 27 Jul 2005 18:15:11 -0700
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

This is what I did:

   for (lpcb = tcp_listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
     /* PCB listening to a specific address? - JG - added for DHCP */
     if (! ip_addr_isany(&(lpcb->local_ip))) {
       /* PCB bound to current local interface address? */
       if (ip_addr_cmp(&(lpcb->local_ip), &(netif->ip_addr))) {
         /* The PCB is listening to the old ipaddr and
          * is set to listen to the new one instead
          * TODO: how do we know it is _listening_? */
         ip_addr_set(&(lpcb->local_ip), ipaddr);

It solved the problem that I was concerned about, namely changing a pcb from listening to any IP address to listening to a specific IP address. There may well be situations where this is inappropriate. I hope that a solution satisfactory to all can be found.

Leon Woestenberg wrote:

Hello Jim,

Jim Gibbons wrote:

I haven't checked the CVS head, but in version 1.1.0, there seems to be a problem in the processing of the listening pcb's.

There is a loop that tries to correct these pcb's if their IP address has changed. The problem is that there is no check to see if the listening pcb doesn't care about the address. Normally, this will cause no problems. It takes some pretty elaborate circumstances (involving DHCP on two or more interfaces and listening before the DHCP address is acquired) for this to be an issue. Nevertheless, I think it is wrong in principal to change a pcb from listening on any IP address to listening on a specific one.

Have I missed something?

No, you found a bug. I am not sure for the proper fix though. Should UDP PCBs listening to the former netif IP address be listening to the new netif IP address? And TCP?




lwip-users mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]