diff --git a/net/ipfilter/ipfilter.c b/net/ipfilter/ipfilter.c index 56b67bcaca..8e6ef01c07 100644 --- a/net/ipfilter/ipfilter.c +++ b/net/ipfilter/ipfilter.c @@ -498,8 +498,9 @@ int ipv4_filter_in(FAR struct net_driver_s *dev) if (ret == IPFILTER_TARGET_REJECT) { /* TODO: Support more --reject-with types later. */ - +#if defined(CONFIG_NET_ICMP) && !defined(CONFIG_NET_ICMP_NO_STACK) icmp_reply(dev, ICMP_DEST_UNREACHABLE, ICMP_NET_UNREACH); +#endif } return ret; @@ -567,7 +568,9 @@ void ipfilter_out(FAR struct net_driver_s *dev) if (ret == IPFILTER_TARGET_REJECT) { +#if defined(CONFIG_NET_ICMP) && !defined(CONFIG_NET_ICMP_NO_STACK) icmp_reply(dev, ICMP_DEST_UNREACHABLE, ICMP_NET_UNREACH); +#endif } } #endif diff --git a/net/ipforward/ipv4_forward.c b/net/ipforward/ipv4_forward.c index 2930defa44..b3333d7bf2 100644 --- a/net/ipforward/ipv4_forward.c +++ b/net/ipforward/ipv4_forward.c @@ -459,7 +459,7 @@ int ipv4_forward(FAR struct net_driver_s *dev, FAR struct ipv4_hdr_s *ipv4) in_addr_t srcipaddr; FAR struct net_driver_s *fwddev; int ret; -#ifdef CONFIG_NET_ICMP +#if defined(CONFIG_NET_ICMP) && !defined(CONFIG_NET_ICMP_NO_STACK) int icmp_reply_type; int icmp_reply_code; #endif /* CONFIG_NET_ICMP */ @@ -526,7 +526,7 @@ int ipv4_forward(FAR struct net_driver_s *dev, FAR struct ipv4_hdr_s *ipv4) drop: ipv4_dropstats(ipv4); -#ifdef CONFIG_NET_ICMP +#if defined(CONFIG_NET_ICMP) && !defined(CONFIG_NET_ICMP_NO_STACK) /* Reply ICMP to the sender for particular errors. */ switch (ret) @@ -554,7 +554,7 @@ drop: dev->d_len = 0; return ret; -#ifdef CONFIG_NET_ICMP +#if defined(CONFIG_NET_ICMP) && !defined(CONFIG_NET_ICMP_NO_STACK) reply: # ifdef CONFIG_NET_NAT44 /* Before we reply ICMP, call NAT outbound to try to translate destination