/[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.12 by davidhaas, Thu Feb 6 22:18:56 2003 UTC revision 1.12.2.1 by likewise, Mon Feb 10 20:16:11 2003 UTC
# Line 55  Line 55 
55    
56  #include "arch/perf.h"  #include "arch/perf.h"
57    
58  #if LWIP_SNMP > 0  #include "snmp.h"
 #  include "snmp.h"  
 #endif  
59  #if LWIP_DHCP  #if LWIP_DHCP
60  #include "lwip/dhcp.h"  #include "lwip/dhcp.h"
61  #endif /* LWIP_DHCP */  #endif /* LWIP_DHCP */
# Line 169  ip_forward(struct pbuf *p, struct ip_hdr Line 167  ip_forward(struct pbuf *p, struct ip_hdr
167    if(netif == NULL) {    if(netif == NULL) {
168      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",
169                        iphdr->dest.addr));                        iphdr->dest.addr));
 #if LWIP_SNMP > 0  
170      snmp_inc_ipnoroutes();      snmp_inc_ipnoroutes();
 #endif  
171      return;      return;
172    }    }
173    /* Do not forward packets onto the same network interface on which    /* Do not forward packets onto the same network interface on which
174       they arrived. */       they arrived. */
175    if(netif == inp) {    if(netif == inp) {
176      DEBUGF(IP_DEBUG, ("ip_forward: not bouncing packets back on incoming interface.\n"));      DEBUGF(IP_DEBUG, ("ip_forward: not bouncing packets back on incoming interface.\n"));
 #if LWIP_SNMP > 0  
177      snmp_inc_ipnoroutes();      snmp_inc_ipnoroutes();
 #endif  
178      return;      return;
179    }    }
180        
# Line 191  ip_forward(struct pbuf *p, struct ip_hdr Line 185  ip_forward(struct pbuf *p, struct ip_hdr
185      /* Don't send ICMP messages in response to ICMP messages */      /* Don't send ICMP messages in response to ICMP messages */
186      if(IPH_PROTO(iphdr) != IP_PROTO_ICMP) {      if(IPH_PROTO(iphdr) != IP_PROTO_ICMP) {
187        icmp_time_exceeded(p, ICMP_TE_TTL);        icmp_time_exceeded(p, ICMP_TE_TTL);
 #if LWIP_SNMP > 0  
188        snmp_inc_icmpouttimeexcds();        snmp_inc_icmpouttimeexcds();
 #endif  
189      }      }
190      return;            return;      
191    }    }
# Line 212  ip_forward(struct pbuf *p, struct ip_hdr Line 204  ip_forward(struct pbuf *p, struct ip_hdr
204    ++lwip_stats.ip.fw;    ++lwip_stats.ip.fw;
205    ++lwip_stats.ip.xmit;    ++lwip_stats.ip.xmit;
206  #endif /* IP_STATS */  #endif /* IP_STATS */
 #if LWIP_SNMP > 0  
207      snmp_inc_ipforwdatagrams();      snmp_inc_ipforwdatagrams();
 #endif  
208    
209    PERF_STOP("ip_forward");    PERF_STOP("ip_forward");
210    /* transmit pbuf on chosen interface */    /* transmit pbuf on chosen interface */
# Line 242  ip_input(struct pbuf *p, struct netif *i Line 232  ip_input(struct pbuf *p, struct netif *i
232  #ifdef IP_STATS  #ifdef IP_STATS
233    ++lwip_stats.ip.recv;    ++lwip_stats.ip.recv;
234  #endif /* IP_STATS */  #endif /* IP_STATS */
235  #if LWIP_SNMP > 0    snmp_inc_ipinreceives();
     snmp_inc_ipinreceives();  
 #endif  
236    
237    /* identify the IP header */    /* identify the IP header */
238    iphdr = p->payload;    iphdr = p->payload;
# Line 258  ip_input(struct pbuf *p, struct netif *i Line 246  ip_input(struct pbuf *p, struct netif *i
246      ++lwip_stats.ip.err;      ++lwip_stats.ip.err;
247      ++lwip_stats.ip.drop;      ++lwip_stats.ip.drop;
248  #endif /* IP_STATS */  #endif /* IP_STATS */
 #if LWIP_SNMP > 0  
249      snmp_inc_ipunknownprotos();      snmp_inc_ipunknownprotos();
 #endif  
250      return ERR_OK;      return ERR_OK;
251    }    }
252    /* obtain IP header length in number of 32-bit words */    /* obtain IP header length in number of 32-bit words */
# Line 278  ip_input(struct pbuf *p, struct netif *i Line 264  ip_input(struct pbuf *p, struct netif *i
264      ++lwip_stats.ip.lenerr;      ++lwip_stats.ip.lenerr;
265      ++lwip_stats.ip.drop;      ++lwip_stats.ip.drop;
266  #endif /* IP_STATS */  #endif /* IP_STATS */
 #if LWIP_SNMP > 0  
267      snmp_inc_ipindiscards();      snmp_inc_ipindiscards();
 #endif  
268      return ERR_OK;      return ERR_OK;
269    }    }
270    
# Line 296  ip_input(struct pbuf *p, struct netif *i Line 280  ip_input(struct pbuf *p, struct netif *i
280      ++lwip_stats.ip.chkerr;      ++lwip_stats.ip.chkerr;
281      ++lwip_stats.ip.drop;      ++lwip_stats.ip.drop;
282  #endif /* IP_STATS */  #endif /* IP_STATS */
 #if LWIP_SNMP > 0  
283      snmp_inc_ipindiscards();      snmp_inc_ipindiscards();
 #endif  
284      return ERR_OK;      return ERR_OK;
285    }    }
286        
# Line 361  ip_input(struct pbuf *p, struct netif *i Line 343  ip_input(struct pbuf *p, struct netif *i
343      else      else
344  #endif /* IP_FORWARD */  #endif /* IP_FORWARD */
345      {      {
 #if LWIP_SNMP > 0  
346        snmp_inc_ipindiscards();        snmp_inc_ipindiscards();
 #endif  
347      }      }
348      pbuf_free(p);      pbuf_free(p);
349      return ERR_OK;      return ERR_OK;
# Line 387  ip_input(struct pbuf *p, struct netif *i Line 367  ip_input(struct pbuf *p, struct netif *i
367      ++lwip_stats.ip.opterr;      ++lwip_stats.ip.opterr;
368      ++lwip_stats.ip.drop;      ++lwip_stats.ip.drop;
369  #endif /* IP_STATS */  #endif /* IP_STATS */
 #if LWIP_SNMP > 0  
370      snmp_inc_ipunknownprotos();      snmp_inc_ipunknownprotos();
 #endif  
371      return ERR_OK;      return ERR_OK;
372    }    }
373  #endif /* IP_REASSEMBLY */  #endif /* IP_REASSEMBLY */
# Line 402  ip_input(struct pbuf *p, struct netif *i Line 380  ip_input(struct pbuf *p, struct netif *i
380      ++lwip_stats.ip.opterr;      ++lwip_stats.ip.opterr;
381      ++lwip_stats.ip.drop;      ++lwip_stats.ip.drop;
382  #endif /* IP_STATS */  #endif /* IP_STATS */
 #if LWIP_SNMP > 0  
383      snmp_inc_ipunknownprotos();      snmp_inc_ipunknownprotos();
 #endif  
384      return ERR_OK;      return ERR_OK;
385    }      }  
386  #endif /* IP_OPTIONS == 0 */  #endif /* IP_OPTIONS == 0 */
# Line 419  ip_input(struct pbuf *p, struct netif *i Line 395  ip_input(struct pbuf *p, struct netif *i
395    switch(IPH_PROTO(iphdr)) {    switch(IPH_PROTO(iphdr)) {
396  #if LWIP_UDP > 0      #if LWIP_UDP > 0    
397    case IP_PROTO_UDP:    case IP_PROTO_UDP:
 #if LWIP_SNMP > 0  
398      snmp_inc_ipindelivers();      snmp_inc_ipindelivers();
 #endif  
399      udp_input(p, inp);      udp_input(p, inp);
400      break;      break;
401  #endif /* LWIP_UDP */  #endif /* LWIP_UDP */
402  #if LWIP_TCP > 0      #if LWIP_TCP > 0    
403    case IP_PROTO_TCP:    case IP_PROTO_TCP:
 #if LWIP_SNMP > 0  
404      snmp_inc_ipindelivers();      snmp_inc_ipindelivers();
 #endif  
405      tcp_input(p, inp);      tcp_input(p, inp);
406      break;      break;
407  #endif /* LWIP_TCP */  #endif /* LWIP_TCP */
408    case IP_PROTO_ICMP:    case IP_PROTO_ICMP:
 #if LWIP_SNMP > 0  
409      snmp_inc_ipindelivers();      snmp_inc_ipindelivers();
 #endif  
410      icmp_input(p, inp);      icmp_input(p, inp);
411      break;      break;
412    default:    default:
# Line 454  ip_input(struct pbuf *p, struct netif *i Line 424  ip_input(struct pbuf *p, struct netif *i
424      ++lwip_stats.ip.proterr;      ++lwip_stats.ip.proterr;
425      ++lwip_stats.ip.drop;      ++lwip_stats.ip.drop;
426  #endif /* IP_STATS */  #endif /* IP_STATS */
 #if LWIP_SNMP > 0  
427      snmp_inc_ipunknownprotos();      snmp_inc_ipunknownprotos();
 #endif  
428    
429    }    }
430    return ERR_OK;    return ERR_OK;
# Line 479  ip_output_if(struct pbuf *p, struct ip_a Line 447  ip_output_if(struct pbuf *p, struct ip_a
447    static struct ip_hdr *iphdr;    static struct ip_hdr *iphdr;
448    static u16_t ip_id = 0;    static u16_t ip_id = 0;
449    
450        snmp_inc_ipoutrequests();
 #if LWIP_SNMP > 0  
     snmp_inc_ipoutrequests();  
 #endif  
451        
452    if(dest != IP_HDRINCL) {    if(dest != IP_HDRINCL) {
453      if(pbuf_header(p, IP_HLEN)) {      if(pbuf_header(p, IP_HLEN)) {
# Line 491  ip_output_if(struct pbuf *p, struct ip_a Line 456  ip_output_if(struct pbuf *p, struct ip_a
456  #ifdef IP_STATS  #ifdef IP_STATS
457        ++lwip_stats.ip.err;        ++lwip_stats.ip.err;
458  #endif /* IP_STATS */  #endif /* IP_STATS */
459  #if LWIP_SNMP > 0        snmp_inc_ipoutdiscards();
     snmp_inc_ipoutdiscards();  
 #endif  
460        return ERR_BUF;        return ERR_BUF;
461      }      }
462            
# Line 560  ip_output(struct pbuf *p, struct ip_addr Line 523  ip_output(struct pbuf *p, struct ip_addr
523  #ifdef IP_STATS  #ifdef IP_STATS
524      ++lwip_stats.ip.rterr;      ++lwip_stats.ip.rterr;
525  #endif /* IP_STATS */  #endif /* IP_STATS */
 #if LWIP_SNMP > 0  
526      snmp_inc_ipoutdiscards();      snmp_inc_ipoutdiscards();
 #endif  
527      return ERR_RTE;      return ERR_RTE;
528    }    }
529    

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.12.2.1

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