]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
Integrate "task #7272 : LWIP_ICMP option". The new option LWIP_ICMP enable/disable...
authorfbernon <fbernon>
Wed, 5 Sep 2007 17:20:45 +0000 (17:20 +0000)
committerfbernon <fbernon>
Wed, 5 Sep 2007 17:20:45 +0000 (17:20 +0000)
CHANGELOG
src/core/ipv4/icmp.c
src/core/ipv4/ip.c
src/core/ipv6/icmp6.c
src/core/ipv6/ip6.c
src/core/udp.c
src/include/ipv4/lwip/icmp.h
src/include/ipv6/lwip/icmp.h
src/include/lwip/opt.h

index 58bf30f087322ca86e30e184f3f5727166d78c0a..7288bcc7d010527714f54d287209b760efd9f49f 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -19,6 +19,13 @@ HISTORY
 
   ++ New features:
 
+  2007-09-05 Frédéric Bernon
+  * udp.c, ipv4/icmp.c, ipv4/ip.c, ipv6/icmp.c, ipv6/ip6.c, ipv4/icmp.h,
+    ipv6/icmp.h, opt.h: Integrate "task #7272 : LWIP_ICMP option". The new option
+    LWIP_ICMP enable/disable ICMP module inside the IP stack (enable per default).
+    Be careful, disabling ICMP make your product non-compliant to RFC1122, but
+    help to reduce footprint, and to reduce "visibility" on the Internet.
+
   2007-09-05 Frédéric Bernon, Bill Florac
   * opt.h, sys.h, tcpip.c, slipif.c, ppp.c, sys_arch.txt: Change parameters list
     for sys_thread_new (see "task #7252 : Create sys_thread_new_ex()"). Two new
index 49273ae171c4c23932e547071d0e7cdc102e05b4..6163132b62198a13d5372bdfecf5dde077fefaa1 100644 (file)
@@ -49,6 +49,8 @@
 #include "lwip/stats.h"
 #include "lwip/snmp.h"
 
+#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */
+
 /**
  * Processes ICMP input packets, called from ip_input().
  *
@@ -298,3 +300,5 @@ icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
 }
 
 #endif /* IP_FORWARD */
+
+#endif /* LWIP_ICMP */
index 9a065380b14979c94b3fb32805da1a5ba597e059..c2117e97a7547b0d4c3d6c4057e3bf8788d3973b 100644 (file)
@@ -144,10 +144,12 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
   /* send ICMP if TTL == 0 */
   if (IPH_TTL(iphdr) == 0) {
     snmp_inc_ipinhdrerrors();
+#if LWIP_ICMP
     /* Don't send ICMP messages in response to ICMP messages */
     if (IPH_PROTO(iphdr) != IP_PROTO_ICMP) {
       icmp_time_exceeded(p, ICMP_TE_TTL);
     }
+#endif /* LWIP_ICMP */
     return (struct netif *)NULL;
   }
 
@@ -384,22 +386,26 @@ ip_input(struct pbuf *p, struct netif *inp) {
     tcp_input(p, inp);
     break;
 #endif /* LWIP_TCP */
+#if LWIP_ICMP
   case IP_PROTO_ICMP:
     snmp_inc_ipindelivers();
     icmp_input(p, inp);
     break;
+#endif /* LWIP_ICMP */
 #if LWIP_IGMP
   case IP_PROTO_IGMP:
     igmp_input(p,inp,&(iphdr->dest));
     break;
 #endif /* LWIP_IGMP */
   default:
+#if LWIP_ICMP
     /* send ICMP destination protocol unreachable unless is was a broadcast */
     if (!ip_addr_isbroadcast(&(iphdr->dest), inp) &&
         !ip_addr_ismulticast(&(iphdr->dest))) {
       p->payload = iphdr;
       icmp_dest_unreach(p, ICMP_DUR_PROTO);
     }
+#endif /* LWIP_ICMP */
     pbuf_free(p);
 
     LWIP_DEBUGF(IP_DEBUG | 2, ("Unsupported transport protocol %"U16_F"\n", IPH_PROTO(iphdr)));
index 5d2c3a9f7b287f86eba8fdcb11a96b0c5c4a56c2..ec5d2adb59e03560c33de4679c592c569501c691 100644 (file)
@@ -42,6 +42,7 @@
 
 #include "lwip/stats.h"
 
+#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */
 
 void
 icmp_input(struct pbuf *p, struct netif *inp)
@@ -192,10 +193,4 @@ icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
   pbuf_free(q);
 }
 
-
-
-
-
-
-
-
+#endif /* LWIP_ICMP */
index 06035a15f9c0056444a5419ab051aa6c4756fee4..5caa1583c1531513b5629487700e9fb138cccaf2 100644 (file)
@@ -111,10 +111,12 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
   }
   /* Decrement TTL and send ICMP if ttl == 0. */
   if (--iphdr->hoplim == 0) {
+#if LWIP_ICMP
     /* Don't send ICMP messages in response to ICMP messages */
     if (iphdr->nexthdr != IP_PROTO_ICMP) {
       icmp_time_exceeded(p, ICMP_TE_TTL);
     }
+#endif /* LWIP_ICMP */
     pbuf_free(p);
     return;
   }
@@ -232,12 +234,16 @@ ip_input(struct pbuf *p, struct netif *inp) {
   case IP_PROTO_TCP:
     tcp_input(p, inp);
     break;
+#if LWIP_ICMP
   case IP_PROTO_ICMP:
     icmp_input(p, inp);
     break;
+#endif /* LWIP_ICMP */
   default:
+#if LWIP_ICMP
     /* send ICMP destination protocol unreachable */
     icmp_dest_unreach(p, ICMP_DUR_PROTO);
+#endif /* LWIP_ICMP */
     pbuf_free(p);
     LWIP_DEBUGF(IP_DEBUG, ("Unsupported transport protocol %"U16_F"\n",
           iphdr->nexthdr));
@@ -382,4 +388,3 @@ ip_debug_print(struct pbuf *p)
   LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
 }
 #endif /* IP_DEBUG */
-
index 7e23881d4d44574f56bda98b70ba7c0954f278d0..95dda50c7f78b1ff8fc75370c4918331454cc46c 100644 (file)
@@ -256,6 +256,7 @@ udp_input(struct pbuf *p, struct netif *inp)
     } else {
       LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE, ("udp_input: not for us.\n"));
 
+#if LWIP_ICMP
       /* No match was found, send ICMP destination port unreachable unless
          destination address was broadcast/multicast. */
       if (!ip_addr_isbroadcast(&iphdr->dest, inp) &&
@@ -265,6 +266,7 @@ udp_input(struct pbuf *p, struct netif *inp)
         LWIP_ASSERT("p->payload == iphdr", (p->payload == iphdr));
         icmp_dest_unreach(p, ICMP_DUR_PORT);
       }
+#endif /* LWIP_ICMP */
       UDP_STATS_INC(udp.proterr);
       UDP_STATS_INC(udp.drop);
       snmp_inc_udpnoports();
index d3cc153d5972bf588d6b680fdf364e486d382ad0..072e17e4d7f5d2f83267bc36be3a985356a22d42 100644 (file)
@@ -40,6 +40,8 @@
 #include "lwip/ip_addr.h"
 #include "lwip/netif.h"
 
+#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -116,5 +118,6 @@ PACK_STRUCT_END
 }
 #endif
 
+#endif /* LWIP_ICMP */
+
 #endif /* __LWIP_ICMP_H__ */
-    
index 0df99344e5aa21aa40e123636044078a20b6c73d..987e3eb379f66fe9ec7178d35d6091a41e045884 100644 (file)
@@ -39,6 +39,8 @@
 
 #include "lwip/netif.h"
 
+#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -94,5 +96,7 @@ struct icmp_te_hdr {
 }
 #endif
 
+#endif /* LWIP_ICMP */
+
 #endif /* __LWIP_ICMP_H__ */
-    
+
index 2d1c964a3879a0b4b3ca959079bc24ea50e5cb5d..734baa323222abab6f4f7cce9f833572d0427f85 100644 (file)
    ---------- ICMP options ----------
    ----------------------------------
 */
+/**
+ * LWIP_ICMP==1: Enable ICMP module inside the IP stack.
+ * Be careful, disable that make your product non-compliant to RFC1122
+ */
+#ifndef LWIP_ICMP
+#define LWIP_ICMP                       1
+#endif
+
 /**
  * ICMP_TTL: Default value for Time-To-Live used by ICMP packets.
  */