/[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.2 by likewise, Mon Nov 11 14:49:17 2002 UTC revision 1.3 by likewise, Thu Nov 21 10:32:39 2002 UTC
# Line 54  Line 54 
54    
55  #include "arch/perf.h"  #include "arch/perf.h"
56    
57    #if LWIP_SNMP > 0
58    #  include "snmp.h"
59    #endif
60  #if LWIP_DHCP  #if LWIP_DHCP
61  #include "lwip/dhcp.h"  #include "lwip/dhcp.h"
62  #endif /* LWIP_DHCP */  #endif /* LWIP_DHCP */
# Line 163  ip_forward(struct pbuf *p, struct ip_hdr Line 166  ip_forward(struct pbuf *p, struct ip_hdr
166      DEBUGF(IP_DEBUG, ("ip_forward: no forwarding route for 0x%lx found\n",      DEBUGF(IP_DEBUG, ("ip_forward: no forwarding route for 0x%lx found\n",
167                        iphdr->dest.addr));                        iphdr->dest.addr));
168    
169    #if LWIP_SNMP > 0
170        snmp_inc_ipnoroutes();
171    #endif
172      return;      return;
173    }    }
174    
# Line 171  ip_forward(struct pbuf *p, struct ip_hdr Line 177  ip_forward(struct pbuf *p, struct ip_hdr
177    if(netif == inp) {    if(netif == inp) {
178      DEBUGF(IP_DEBUG, ("ip_forward: not forward packets back on incoming interface.\n"));      DEBUGF(IP_DEBUG, ("ip_forward: not forward packets back on incoming interface.\n"));
179    
180    #if LWIP_SNMP > 0
181        snmp_inc_ipnoroutes();
182    #endif
183      return;      return;
184    }    }
185        
# Line 180  ip_forward(struct pbuf *p, struct ip_hdr Line 189  ip_forward(struct pbuf *p, struct ip_hdr
189      /* Don't send ICMP messages in response to ICMP messages */      /* Don't send ICMP messages in response to ICMP messages */
190      if(IPH_PROTO(iphdr) != IP_PROTO_ICMP) {      if(IPH_PROTO(iphdr) != IP_PROTO_ICMP) {
191        icmp_time_exceeded(p, ICMP_TE_TTL);        icmp_time_exceeded(p, ICMP_TE_TTL);
192    #if LWIP_SNMP > 0
193          snmp_inc_icmpouttimeexcds();
194    #endif
195      }      }
196      return;            return;      
197    }    }
# Line 198  ip_forward(struct pbuf *p, struct ip_hdr Line 210  ip_forward(struct pbuf *p, struct ip_hdr
210    ++stats.ip.fw;    ++stats.ip.fw;
211    ++stats.ip.xmit;    ++stats.ip.xmit;
212  #endif /* IP_STATS */  #endif /* IP_STATS */
213    #if LWIP_SNMP > 0
214        snmp_inc_ipforwdatagrams();
215    #endif
216    
217    PERF_STOP("ip_forward");    PERF_STOP("ip_forward");
218        
# Line 389  ip_input(struct pbuf *p, struct netif *i Line 404  ip_input(struct pbuf *p, struct netif *i
404  #ifdef IP_STATS  #ifdef IP_STATS
405    ++stats.ip.recv;    ++stats.ip.recv;
406  #endif /* IP_STATS */  #endif /* IP_STATS */
407    #if LWIP_SNMP > 0
408        snmp_inc_ipinreceives();
409    #endif
410    
411    /* identify the IP header */    /* identify the IP header */
412    iphdr = p->payload;    iphdr = p->payload;
# Line 402  ip_input(struct pbuf *p, struct netif *i Line 420  ip_input(struct pbuf *p, struct netif *i
420      ++stats.ip.err;      ++stats.ip.err;
421      ++stats.ip.drop;      ++stats.ip.drop;
422  #endif /* IP_STATS */  #endif /* IP_STATS */
423    #if LWIP_SNMP > 0
424        snmp_inc_ipunknownprotos();
425    #endif
426      return ERR_OK;      return ERR_OK;
427    }    }
428        
# Line 415  ip_input(struct pbuf *p, struct netif *i Line 436  ip_input(struct pbuf *p, struct netif *i
436      ++stats.ip.lenerr;      ++stats.ip.lenerr;
437      ++stats.ip.drop;      ++stats.ip.drop;
438  #endif /* IP_STATS */  #endif /* IP_STATS */
439    #if LWIP_SNMP > 0
440        snmp_inc_ipindiscards();
441    #endif
442      return ERR_OK;      return ERR_OK;
443    }    }
444    
# Line 430  ip_input(struct pbuf *p, struct netif *i Line 454  ip_input(struct pbuf *p, struct netif *i
454      ++stats.ip.chkerr;      ++stats.ip.chkerr;
455      ++stats.ip.drop;      ++stats.ip.drop;
456  #endif /* IP_STATS */  #endif /* IP_STATS */
457    #if LWIP_SNMP > 0
458        snmp_inc_ipindiscards();
459    #endif
460      return ERR_OK;      return ERR_OK;
461    }    }
462        
# Line 475  ip_input(struct pbuf *p, struct netif *i Line 502  ip_input(struct pbuf *p, struct netif *i
502      if(!ip_addr_isbroadcast(&(iphdr->dest), &(inp->netmask))) {      if(!ip_addr_isbroadcast(&(iphdr->dest), &(inp->netmask))) {
503        ip_forward(p, iphdr, inp);        ip_forward(p, iphdr, inp);
504      }      }
505        else
506  #endif /* IP_FORWARD */  #endif /* IP_FORWARD */
507        {
508    #if LWIP_SNMP > 0
509          snmp_inc_ipindiscards();
510    #endif
511        }
512      pbuf_free(p);      pbuf_free(p);
513      return ERR_OK;      return ERR_OK;
514    }    }
# Line 497  ip_input(struct pbuf *p, struct netif *i Line 530  ip_input(struct pbuf *p, struct netif *i
530      ++stats.ip.opterr;      ++stats.ip.opterr;
531      ++stats.ip.drop;      ++stats.ip.drop;
532  #endif /* IP_STATS */  #endif /* IP_STATS */
533    #if LWIP_SNMP > 0
534        snmp_inc_ipunknownprotos();
535    #endif
536      return ERR_OK;      return ERR_OK;
537    }    }
538  #endif /* IP_REASSEMBLY */  #endif /* IP_REASSEMBLY */
# Line 510  ip_input(struct pbuf *p, struct netif *i Line 546  ip_input(struct pbuf *p, struct netif *i
546      ++stats.ip.opterr;      ++stats.ip.opterr;
547      ++stats.ip.drop;      ++stats.ip.drop;
548  #endif /* IP_STATS */  #endif /* IP_STATS */
549    #if LWIP_SNMP > 0
550        snmp_inc_ipunknownprotos();
551    #endif
552      return ERR_OK;      return ERR_OK;
553    }      }  
554  #endif /* IP_OPTIONS == 0 */  #endif /* IP_OPTIONS == 0 */
# Line 525  ip_input(struct pbuf *p, struct netif *i Line 564  ip_input(struct pbuf *p, struct netif *i
564    switch(IPH_PROTO(iphdr)) {    switch(IPH_PROTO(iphdr)) {
565  #if LWIP_UDP > 0      #if LWIP_UDP > 0    
566    case IP_PROTO_UDP:    case IP_PROTO_UDP:
567    #if LWIP_SNMP > 0
568        snmp_inc_ipindelivers();
569    #endif
570      udp_input(p, inp);      udp_input(p, inp);
571      break;      break;
572  #endif /* LWIP_UDP */  #endif /* LWIP_UDP */
573  #if LWIP_TCP > 0      #if LWIP_TCP > 0    
574    case IP_PROTO_TCP:    case IP_PROTO_TCP:
575    #if LWIP_SNMP > 0
576        snmp_inc_ipindelivers();
577    #endif
578      tcp_input(p, inp);      tcp_input(p, inp);
579      break;      break;
580  #endif /* LWIP_TCP */  #endif /* LWIP_TCP */
581    case IP_PROTO_ICMP:    case IP_PROTO_ICMP:
582    #if LWIP_SNMP > 0
583        snmp_inc_ipindelivers();
584    #endif
585      icmp_input(p, inp);      icmp_input(p, inp);
586      break;      break;
587    default:    default:
# Line 551  ip_input(struct pbuf *p, struct netif *i Line 599  ip_input(struct pbuf *p, struct netif *i
599      ++stats.ip.proterr;      ++stats.ip.proterr;
600      ++stats.ip.drop;      ++stats.ip.drop;
601  #endif /* IP_STATS */  #endif /* IP_STATS */
602    #if LWIP_SNMP > 0
603        snmp_inc_ipunknownprotos();
604    #endif
605    
606    }    }
607    return ERR_OK;    return ERR_OK;
# Line 574  ip_output_if(struct pbuf *p, struct ip_a Line 625  ip_output_if(struct pbuf *p, struct ip_a
625    static u16_t ip_id = 0;    static u16_t ip_id = 0;
626    
627        
628    #if LWIP_SNMP > 0
629        snmp_inc_ipoutrequests();
630    #endif
631        
632    if(dest != IP_HDRINCL) {    if(dest != IP_HDRINCL) {
633      if(pbuf_header(p, IP_HLEN)) {      if(pbuf_header(p, IP_HLEN)) {
# Line 582  ip_output_if(struct pbuf *p, struct ip_a Line 636  ip_output_if(struct pbuf *p, struct ip_a
636  #ifdef IP_STATS  #ifdef IP_STATS
637        ++stats.ip.err;        ++stats.ip.err;
638  #endif /* IP_STATS */  #endif /* IP_STATS */
639    #if LWIP_SNMP > 0
640        snmp_inc_ipoutdiscards();
641    #endif
642        return ERR_BUF;        return ERR_BUF;
643      }      }
644            
# Line 619  ip_output_if(struct pbuf *p, struct ip_a Line 676  ip_output_if(struct pbuf *p, struct ip_a
676    ip_debug_print(p);    ip_debug_print(p);
677  #endif /* IP_DEBUG */  #endif /* IP_DEBUG */
678    
679       DEBUGF(IP_DEBUG, ("netif->output()"));
680    
681    return netif->output(netif, p, dest);      return netif->output(netif, p, dest);  
682  }  }
# Line 642  ip_output(struct pbuf *p, struct ip_addr Line 700  ip_output(struct pbuf *p, struct ip_addr
700  #ifdef IP_STATS  #ifdef IP_STATS
701      ++stats.ip.rterr;      ++stats.ip.rterr;
702  #endif /* IP_STATS */  #endif /* IP_STATS */
703    #if LWIP_SNMP > 0
704        snmp_inc_ipoutdiscards();
705    #endif
706      return ERR_RTE;      return ERR_RTE;
707    }    }
708    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

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