/[lwip]/lwip/src/core/netif.c
ViewVC logotype

Diff of /lwip/src/core/netif.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by likewise, Thu Apr 3 12:09:39 2003 UTC revision 1.17 by likewise, Tue Apr 8 12:19:02 2003 UTC
# Line 177  netif_find(char *name) Line 177  netif_find(char *name)
177  void  void
178  netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)  netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
179  {  {
180      /* TODO: Handling of obsolete pcbs */
181      /* See:  http://mail.gnu.org/archive/html/lwip-users/2003-03/msg00118.html */
182    #if 0
183      struct tcp_pcb *pcb;
184      struct tcp_pcb_listen *lpcb;
185    
186      /* address has changed? */
187      if ((ip_addr_cmp(&(pcb->local_ip), &(netif->ip_addr))) == 0)
188      {
189      pcb = tcp_active_pcbs;
190      while (pcb != NULL) {
191        if (ip_addr_cmp(&(pcb->local_ip), &(netif->ip_addr))) {
192          /* The PCB is connected using the old ipaddr and must be aborted */
193          struct tcp_pcb *next = pcb->next;
194          tcp_abort(pcb);
195          pcb = next;
196        } else {
197          pcb=pcb->next;
198        }
199      }
200      for (lpcb = tcp_listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
201        if (ip_addr_cmp(&(lpcb->local_ip), &(netif->ip_addr))) {
202          /* The PCB is listening to the old ipaddr and
203           * is set to listen to the  new one instead */
204          ip_addr_set(&(lpcb->local_ip), ipaddr);
205        }
206      }
207      }
208    #endif
209    DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE, ("netif: setting IP address of interface %c%c%u to %u.%u.%u.%u\n",    DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE, ("netif: setting IP address of interface %c%c%u to %u.%u.%u.%u\n",
210                         netif->name[0], netif->name[1], netif->num,      netif->name[0], netif->name[1], netif->num,
211                         (u8_t)(ntohl(ipaddr->addr) >> 24 & 0xff),      (u8_t)(ntohl(ipaddr->addr) >> 24 & 0xff),
212                         (u8_t)(ntohl(ipaddr->addr) >> 16 & 0xff),      (u8_t)(ntohl(ipaddr->addr) >> 16 & 0xff),
213                         (u8_t)(ntohl(ipaddr->addr) >> 8 & 0xff),      (u8_t)(ntohl(ipaddr->addr) >> 8 & 0xff),
214                         (u8_t)(ntohl(ipaddr->addr) & 0xff)));      (u8_t)(ntohl(ipaddr->addr) & 0xff)));
215    ip_addr_set(&(netif->ip_addr), ipaddr);    ip_addr_set(&(netif->ip_addr), ipaddr);
216  }  }
217  /*-----------------------------------------------------------------------------------*/  /*-----------------------------------------------------------------------------------*/

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26