net/: add NET_ICMP[v6]_NO_STACK for usrsock case

This commit is contained in:
Xiang Xiao 2018-11-09 11:25:57 -06:00 committed by Gregory Nutt
parent 26ae4176f0
commit 44bcd2c44d
8 changed files with 37 additions and 13 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -51,12 +51,14 @@
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>
#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 */

View File

@ -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

View File

@ -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

View File

@ -52,12 +52,14 @@
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>
#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 */