++ 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
#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().
*
}
#endif /* IP_FORWARD */
+
+#endif /* LWIP_ICMP */
/* 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;
}
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)));
#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)
pbuf_free(q);
}
-
-
-
-
-
-
-
+#endif /* LWIP_ICMP */
}
/* 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;
}
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));
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
}
#endif /* IP_DEBUG */
-
} 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) &&
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();
#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
}
#endif
+#endif /* LWIP_ICMP */
+
#endif /* __LWIP_ICMP_H__ */
-
#include "lwip/netif.h"
+#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */
+
#ifdef __cplusplus
extern "C" {
#endif
}
#endif
+#endif /* LWIP_ICMP */
+
#endif /* __LWIP_ICMP_H__ */
-
+
---------- 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.
*/