This patch allows to disable the RTnet IPv4 ICMP support, which might
be useful when using the RTnet-Proxy add-on. ICMP will then be handled
by the Linux network stack. ICMP support in RTnet is enabled by default
and it can be disabled with the configure option "--disable-icmp" or
the Kconfig option CONFIG_RTNET_RTIPV4_ICMP.
Note: this patch requires running "scripts/autogen.sh"
Signed-off-by: Wolfang Grandegger <[EMAIL PROTECTED]>
Index: rtnet/stack/ipv4/af_inet.c
===================================================================
--- rtnet.orig/stack/ipv4/af_inet.c
+++ rtnet/stack/ipv4/af_inet.c
@@ -79,6 +79,7 @@ static void cleanup_route_solicit(void *
+#ifdef CONFIG_RTNET_RTIPV4_ICMP
static int ping_handler(struct rt_proc_call *call)
{
struct ipv4_cmd *cmd;
@@ -114,6 +115,7 @@ static void ping_complete_handler(struct
usr_cmd->args.ping.ip_addr = cmd->args.ping.ip_addr;
usr_cmd->args.ping.rtt = cmd->args.ping.rtt;
}
+#endif /* CONFIG_RTNET_RTIPV4_ICMP */
@@ -186,6 +188,7 @@ static int ipv4_ioctl(struct rtnet_devic
break;
#endif /* CONFIG_RTNET_RTIPV4_NETROUTING */
+#ifdef CONFIG_RTNET_RTIPV4_ICMP
case IOC_RT_PING:
ret = rtpc_dispatch_call(ping_handler, cmd.args.ping.timeout, &cmd,
sizeof(cmd), ping_complete_handler, NULL);
@@ -196,6 +199,7 @@ static int ipv4_ioctl(struct rtnet_devic
if (ret < 0)
rt_icmp_cleanup_echo_requests();
break;
+#endif /* CONFIG_RTNET_RTIPV4_ICMP */
default:
ret = -ENOTTY;
Index: rtnet/configure.ac
===================================================================
--- rtnet.orig/configure.ac
+++ rtnet/configure.ac
@@ -1023,6 +1023,19 @@ if test "$CONFIG_RTNET_RTIPV4" = "y"; th
AC_DEFINE(CONFIG_RTNET_RTIPV4,1,[Real-Time IPv4 support])
fi
+AC_MSG_CHECKING([whether to enable real-time IPv4 ICMP support])
+AC_ARG_ENABLE(icmp,
+ AS_HELP_STRING([--enable-icmp], [enable real-time IPv4 ICMP support
@<:@default=yes@:>@]),
+ [case "$enableval" in
+ y | yes) CONFIG_RTNET_RTIPV4_ICMP=y ;;
+ *) CONFIG_RTNET_RTIPV4_ICMP=n ;;
+ esac])
+AC_MSG_RESULT([${CONFIG_RTNET_RTIPV4_ICMP:-n}])
+AM_CONDITIONAL(CONFIG_RTNET_RTIPV4_ICMP,[test "$CONFIG_RTNET_RTIPV4_ICMP" =
"y"])
+if test "$CONFIG_RTNET_RTIPV4_ICMP" = "y"; then
+ AC_DEFINE(CONFIG_RTNET_RTIPV4_ICMP,1,[Real-Time IPv4 ICMP support])
+fi
+
AC_MSG_CHECKING([whether to enable source IP routing])
AC_ARG_ENABLE(route-src,
AS_HELP_STRING([--enable-route-src], [enable source IP routing
@<:@default=no@:>@]),
Index: rtnet/defconfig
===================================================================
--- rtnet.orig/defconfig
+++ rtnet/defconfig
@@ -33,6 +33,7 @@ CONFIG_RTNET_RX_FIFO_SIZE=32
# Protocols
#
CONFIG_RTNET_RTIPV4=y
+CONFIG_RTNET_RTIPV4_ICMP=y
# CONFIG_RTNET_RTIPV4_ROUTE_SRC is not set
# CONFIG_RTNET_RTIPV4_NETROUTING is not set
# CONFIG_RTNET_RTIPV4_ROUTER is not set
Index: rtnet/stack/ipv4/GNUmakefile.am
===================================================================
--- rtnet.orig/stack/ipv4/GNUmakefile.am
+++ rtnet/stack/ipv4/GNUmakefile.am
@@ -16,10 +16,13 @@ libkernel_ipv4_a_SOURCES = \
ip_input.c \
ip_sock.c \
udp.c \
- icmp.c \
ip_output.c \
ip_fragment.c
+if CONFIG_RTNET_RTIPV4_ICMP
+libkernel_ipv4_a_SOURCES += icmp.c
+endif
+
OBJS = rtipv4$(modext)
rtipv4.o: libkernel_ipv4.a
Index: rtnet/stack/ipv4/Kconfig
===================================================================
--- rtnet.orig/stack/ipv4/Kconfig
+++ rtnet/stack/ipv4/Kconfig
@@ -10,6 +10,15 @@ config RTNET_RTIPV4
For further information see also Documentation/README.routing and
Documentation/README.ipfragmentation.
+config RTNET_RTIPV4_ICMP
+ bool "ICMP support"
+ depends on RTNET_RTIPV4
+ default y
+ ---help---
+ Enables ICMP support of the RTnet Real-Time IPv4 protocol. Disabling it
+ might be useful when using the RTnet-Proxy add-on. ICMP will then be
+ handled by the Linux network stack.
+
config RTNET_RTIPV4_ROUTE_SRC
bool "Consider source IP for output routing"
depends on RTNET_RTIPV4
Index: rtnet/stack/include/ipv4/icmp.h
===================================================================
--- rtnet.orig/stack/include/ipv4/icmp.h
+++ rtnet/stack/include/ipv4/icmp.h
@@ -44,8 +44,13 @@ void rt_icmp_dequeue_echo_request(struct
void rt_icmp_cleanup_echo_requests(void);
int rt_icmp_send_echo(u32 daddr, u16 id, u16 sequence, size_t msg_size);
+#ifdef CONFIG_RTNET_RTIPV4_ICMP
void __init rt_icmp_init(void);
void rt_icmp_release(void);
+#else /* !CONFIG_RTNET_RTIPV4_ICMP */
+#define rt_icmp_init() do {} while (0)
+#define rt_icmp_release() do {} while (0)
+#endif /* CONFIG_RTNET_RTIPV4_ICMP */
#endif /* __RTNET_ICMP_H_ */
--
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
RTnet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rtnet-users