diff --git a/net/devif/ipv4_input.c b/net/devif/ipv4_input.c index 08232d8088c..bcda50cd5f4 100644 --- a/net/devif/ipv4_input.c +++ b/net/devif/ipv4_input.c @@ -548,7 +548,7 @@ int ipv4_input(FAR struct net_driver_s *dev) break; #endif -#ifdef CONFIG_NET_ICMP +#ifdef NET_ICMP_HAVE_STACK /* Check for ICMP input */ case IP_PROTO_ICMP: /* ICMP input */ diff --git a/net/devif/ipv6_input.c b/net/devif/ipv6_input.c index 795ed43ce63..a4eb77630b0 100644 --- a/net/devif/ipv6_input.c +++ b/net/devif/ipv6_input.c @@ -512,9 +512,9 @@ int ipv6_input(FAR struct net_driver_s *dev) break; #endif -#ifdef CONFIG_NET_ICMPv6 /* Check for ICMP input */ +#ifdef NET_ICMPv6_HAVE_STACK case IP_PROTO_ICMP6: /* ICMP6 input */ /* Forward the ICMPv6 packet */ @@ -546,7 +546,7 @@ int ipv6_input(FAR struct net_driver_s *dev) } #endif /* CONFIG_NET_6LOWPAN */ break; -#endif /* CONFIG_NET_ICMPv6 */ +#endif /* NET_ICMPv6_HAVE_STACK */ default: /* Unrecognized/unsupported protocol */ nwarn("WARNING: Unrecognized IP protocol: %04x\n", ipv6->proto); diff --git a/net/icmp/Kconfig b/net/icmp/Kconfig index 9e541f7f5f9..f691a560111 100644 --- a/net/icmp/Kconfig +++ b/net/icmp/Kconfig @@ -13,7 +13,14 @@ config NET_ICMP Enable minimal ICMP support. Includes built-in support for sending replies to received ECHO (ping) requests. -if NET_ICMP +config NET_ICMP_NO_STACK + bool "Disable ICMP stack" + default n + select NET_ICMP + ---help--- + Build without ICMP stack even if ICMP networking support enabled. + +if NET_ICMP && !NET_ICMP_NO_STACK config NET_ICMP_SOCKET bool "IPPROTO_ICMP socket support" @@ -31,6 +38,6 @@ config NET_ICMP_NCONNS depends on MM_IOB endif # NET_ICMP_SOCKET -endif # NET_ICMP +endif # NET_ICMP && !NET_ICMP_NO_STACK endmenu # ICMP Networking Support endif # NET_IPv4 diff --git a/net/icmp/Make.defs b/net/icmp/Make.defs index be92772e070..f714c40f6a1 100644 --- a/net/icmp/Make.defs +++ b/net/icmp/Make.defs @@ -34,6 +34,7 @@ ############################################################################ ifeq ($(CONFIG_NET_ICMP),y) +ifneq ($(CONFIG_NET_ICMP_NO_STACK),y) # ICMP source files @@ -51,4 +52,6 @@ endif DEPPATH += --dep-path icmp VPATH += :icmp -endif + +endif # !CONFIG_NET_ICMP_NO_STACK +endif # CONFIG_NET_ICMP diff --git a/net/icmp/icmp.h b/net/icmp/icmp.h index 26e2570dd7e..fca3d240178 100644 --- a/net/icmp/icmp.h +++ b/net/icmp/icmp.h @@ -51,12 +51,14 @@ #include #include -#ifdef CONFIG_NET_ICMP +#if defined(CONFIG_NET_ICMP) && !defined(CONFIG_NET_ICMP_NO_STACK) /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +#define NET_ICMP_HAVE_STACK 1 + /* Allocate/free an ICMP data callback */ #define icmp_callback_alloc(dev) devif_callback_alloc(dev, &(dev)->d_conncb) @@ -360,5 +362,5 @@ int icmp_pollteardown(FAR struct socket *psock, FAR struct pollfd *fds); } #endif -#endif /* CONFIG_NET_ICMP */ +#endif /* CONFIG_NET_ICMP && !CONFIG_NET_ICMP_NO_STACK */ #endif /* __NET_ICMP_ICMP_H */ diff --git a/net/icmpv6/Kconfig b/net/icmpv6/Kconfig index d7c1c6f547a..3c7afc34422 100644 --- a/net/icmpv6/Kconfig +++ b/net/icmpv6/Kconfig @@ -14,7 +14,14 @@ config NET_ICMPv6 Enable minimal ICMPv6 support. Includes built-in support for sending replies to received ECHO (ping) requests. -if NET_ICMPv6 +config NET_ICMPv6_NO_STACK + bool "Disable ICMPv6 stack" + default n + select NET_ICMPv6 + ---help--- + Build without ICMPv6 stack even if ICMPv6 networking support enabled. + +if NET_ICMPv6 && !NET_ICMPv6_NO_STACK config NET_ICMPv6_SOCKET bool "IPPROTO_ICMP6 socket support" @@ -200,6 +207,6 @@ config NET_ICMPv6_NCONNS endif # NET_ICMPv6_SOCKET -endif # NET_ICMPv6 +endif # NET_ICMPv6 && !NET_ICMPv6_NO_STACK endmenu # ICMPv6 Networking Support endif # NET_IPv6 diff --git a/net/icmpv6/Make.defs b/net/icmpv6/Make.defs index b25acbe3503..2ffc2d878df 100644 --- a/net/icmpv6/Make.defs +++ b/net/icmpv6/Make.defs @@ -34,6 +34,7 @@ ############################################################################ ifeq ($(CONFIG_NET_ICMPv6),y) +ifneq ($(CONFIG_NET_ICMPv6_NO_STACK),y) # ICMPv6 source files @@ -70,4 +71,5 @@ endif DEPPATH += --dep-path icmpv6 VPATH += :icmpv6 -endif +endif # !CONFIG_NET_ICMPv6_NO_STACK +endif # CONFIG_NET_ICMPv6 \ No newline at end of file diff --git a/net/icmpv6/icmpv6.h b/net/icmpv6/icmpv6.h index 5c61d8ebd7d..f9e3c4a8748 100644 --- a/net/icmpv6/icmpv6.h +++ b/net/icmpv6/icmpv6.h @@ -52,12 +52,14 @@ #include #include -#ifdef CONFIG_NET_ICMPv6 +#if defined(CONFIG_NET_ICMPv6) && !defined(CONFIG_NET_ICMPv6_NO_STACK) /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + #define NET_ICMPv6_HAVE_STACK 1 + /* Allocate a new ICMPv6 data callback */ #define icmpv6_callback_alloc(dev) \ @@ -706,5 +708,6 @@ int icmpv6_pollteardown(FAR struct socket *psock, FAR struct pollfd *fds); } #endif -#endif /* CONFIG_NET_ICMPv6 */ +#endif /* CONFIG_NET_ICMPv6 && !CONFIG_NET_ICMPv6_NO_STACK */ #endif /* __NET_ICMPv6_ICMPv6_H */ +