Module: xenomai-gch
Branch: stable-3.0.x
Commit: 2c6378b91a2073b4bb4ef66b8bec8852f65f2766

Author: Matti Suominen <>
Date:   Wed Jun 15 10:49:17 2016 +0200

rtnet: various fixes

First. Original tcp flag enumeration didn't work at all in this
case. This was verified by using Wireshark to track communication
which didn't show me any flags in tcp packets. This was solved by
replacing flags assigning TCP_FLAG_ prefixed enums with TCPHDR_
prefixed defines from <net/tcp.h> in stack/ipv4/tcp/tcp.c file. The
original code only works in case of little endian machine, as
rt_tcp_set_flags function places assumption that flags are located
in the least-significant 8bits of the 32bit flag variable. This
approach is similar to what regular TCP is using:

Second. Server was able to receive messages from client but was
unable to reply messages. I was able to trace function calls by
adding debug prints to tcp.c functions and noticed that accepted
socket wasn't signaled for "ready to send" at all and server was
unable to reply messages. This seems to work properly if the send
signal is posted in the end of the accept function, which also would
seem the logical way to initialize it once connection has been

Third. In our case we have regular Linux tcp sockets and rtnet tcp
sockets working parallel, serving different services. Referred to
this I noticed that *rt_tcp_dest_socket() may cause problem when
real time stack processes a message targeted to a regular Linux
socket and does not find a rttcp socket for it. The rttcp stack then
tries to send RST|ACK to client to terminate the connection. We avoid
this by forwarding such packets to the rtnetproxy when it is enabled.

Note that RTnet TCP is still disabled as we need to fix the "accept"
syscall to be able to create sockets without switching to primary


 kernel/drivers/net/stack/ipv4/icmp.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/kernel/drivers/net/stack/ipv4/icmp.c 
index 58d97cd..f5c1ec6 100644
--- a/kernel/drivers/net/stack/ipv4/icmp.c
+++ b/kernel/drivers/net/stack/ipv4/icmp.c
@@ -37,6 +37,7 @@
 #include <ipv4/icmp.h>
 #include <ipv4/ip_fragment.h>
 #include <ipv4/ip_output.h>
+#include <ipv4/ip_input.h>
 #include <ipv4/protocol.h>
 #include <ipv4/route.h>
@@ -144,10 +145,16 @@ void rt_icmp_cleanup_echo_requests(void)
 static void rt_icmp_discard(struct rtskb *skb)
+    if (rt_ip_fallback_handler) {
+        /* If a fallback handler for IP protocol has been installed,
+         * call it. */
+       __rtskb_push(skb, skb->nh.iph->ihl*4 + sizeof(struct icmphdr));
+        rt_ip_fallback_handler(skb);
+    }
 static int rt_icmp_glue_reply_bits(const void *p, unsigned char *to,
                                   unsigned int offset, unsigned int fraglen)
@@ -446,6 +453,9 @@ static struct rt_icmp_control 
rt_icmp_pointers[NR_ICMP_TYPES+1] =
 struct rtsocket *rt_icmp_dest_socket(struct rtskb *skb)
+    if (list_empty(&echo_calls))
+       return NULL;
     return icmp_socket;

Xenomai-git mailing list

Reply via email to