/[lwip]/lwip/src/core/ipv4/ip.c
ViewVC logotype

Diff of /lwip/src/core/ipv4/ip.c

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

revision 1.9 by likewise, Wed Jan 8 10:09:42 2003 UTC revision 1.10 by likewise, Tue Jan 28 18:24:25 2003 UTC
# Line 312  ip_input(struct pbuf *p, struct netif *i Line 312  ip_input(struct pbuf *p, struct netif *i
312                        netif->ip_addr.addr & netif->netmask.addr,                        netif->ip_addr.addr & netif->netmask.addr,
313                        iphdr->dest.addr & ~(netif->netmask.addr)));                        iphdr->dest.addr & ~(netif->netmask.addr)));
314    
315      /* interface unconfigured? */      /* interface configured? */
316      if(ip_addr_isany(&(netif->ip_addr)) ||      if(!ip_addr_isany(&(netif->ip_addr)))
317         /* or unicast to this interface address? */      {
318         ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr)) ||        /* unicast to this interface address? */
319         /* or broadcast on this interface network address ? */        if(ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr)) ||
320         (ip_addr_isbroadcast(&(iphdr->dest), &(netif->netmask)) &&          /* or broadcast on this interface network address ? */
321          ip_addr_maskcmp(&(iphdr->dest), &(netif->ip_addr), &(netif->netmask))) ||          (ip_addr_isbroadcast(&(iphdr->dest), &(netif->netmask)) &&
322         /* or restricted broadcast? */           ip_addr_maskcmp(&(iphdr->dest), &(netif->ip_addr), &(netif->netmask))) ||
323         ip_addr_cmp(&(iphdr->dest), IP_ADDR_BROADCAST)) {           /* or restricted broadcast? */
324        break;           ip_addr_cmp(&(iphdr->dest), IP_ADDR_BROADCAST)) {
325             /* break out of for loop */
326             break;
327          }
328      }      }
   }  
   
329  #if LWIP_DHCP  #if LWIP_DHCP
330    /* If a DHCP packet has arrived on the interface, we pass it up the    /* Pass DHCP messages in case of an unconfigured (0.0.0.0) interface, regardless
331       stack regardless of destination IP address. The reason is that       of destination address. (DHCP replies are sent to the IP address-to-be. This
332       DHCP replies are sent to the IP adress that will be given to this       is according to RFC 1542 section 3.1.1, referred by RFC 2131). */
333       node (as recommended by RFC 1542 section 3.1.1, referred by RFC  
334       2131). */      /* interface unconfigured (0.0.0.0) */
335    if(IPH_PROTO(iphdr) == IP_PROTO_UDP &&      else {
336       ((struct udp_hdr *)((u8_t *)iphdr + IPH_HL(iphdr) * 4))->src ==        /* remote port is DHCP server? */
337       DHCP_SERVER_PORT) {        if(IPH_PROTO(iphdr) == IP_PROTO_UDP &&
338      netif = inp;         ((struct udp_hdr *)((u8_t *)iphdr + IPH_HL(iphdr) * 4))->src == DHCP_SERVER_PORT) {
339    }             netif = inp;
340             /* break out of for loop */
341             break;
342          }
343        }
344  #endif /* LWIP_DHCP */  #endif /* LWIP_DHCP */
345      }
346    
347                        
348    if(netif == NULL) {    if(netif == NULL) {
349      /* packet not for us, route or discard */      /* packet not for us, route or discard */

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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