WP7607-1 with Legato 21.05, tcp-server not working as expected

I have an old legato app running fine with legato 19.2 and yocto 3.18. Now with new generations of wp7607-1 modules I have to use legato 21.05 and linux 4.14. I was able to compile and install yocto with additional progs (openvpn) as I did with last version of legato dist-source (version 02.37.10.02). I was also able to run mksys which also included my app. The app leaved unchanged therefor.

One function of my app is a tcp-server. It ran without problems with modules using linux 3.18 and legato 19.2. Now the app starts as expected and does not show any error in logread but I can’t connect to the server anymore. I have a running openvpn-connection and I am able to ping to the device. I am also able to create a socat-tcp-server for a test and can connect to it but my app’s tcpserver is not usefull anymore.

I can see the server listening with netstat -a
tcp 0 0 0.0.0.0:xxxx 0.0.0.0:* LISTEN

It is no problem of firewall. The server is also not working with localhost or with all ports opened (iptables -A INPUT -j ACCEPT).

So is this related to particule port number as you said that you can create another tcp server port?

Did you capture wireshark log for investigation?

Does this help?

Hello,

No it is not related to a specific port number. It seems to be a problem with my new compiled app with current legato and / or linux 4.14.

I thought it could be a sandbox-problem but the app is currently not sandboxed.

Did you capture wireshark log for investigation?

Does this application help?

Hello,

I will add tcpdump to my system and try to capture packets.

You can also capture wireshark log on PC side

Btw, you can also try this app

With my older Wp7607-1 everything works fine. Also a server created with socat is responding. The tcp-server of my app does not even recognize a connection!

If the app above works, then you can port the app to your application

I started my apps tcpserver on port 9302 (and it is running):

root 2417 0.0 0.7 3196 1216 pts/0 S 12:37 0:00 ./tcpserver -p 9302 -t 900 start

I connected to a PC and used the local ecm0-interface for testing. I started socat with:

socat -v -d -d TCP-LISTEN:9302,fork TCP:localhost:9300

and opened firewall with:

iptables -A INPUT -j ACCEPT

On pc-side I startet

echo “bla” | nc 192.168.2.2 9300

socat told me:

2025/01/22 12:47:26 socat[3314] N listening on AF=2 0.0.0.0:9300
2025/01/22 12:47:33 socat[3314] N accepting connection from AF=2 192.168.2.3:50126 on AF=2 192.168.2.2:9300
2025/01/22 12:47:33 socat[3314] N forked off child process 3322
2025/01/22 12:47:33 socat[3314] N listening on AF=2 0.0.0.0:9300
2025/01/22 12:47:33 socat[3322] N opening connection to AF=2 127.0.0.1:9302
2025/01/22 12:49:42 socat[3322] E connect(5, AF=2 127.0.0.1:9302, 16): Connection timed out
2025/01/22 12:49:42 socat[3322] N exit(1)
2025/01/22 12:49:42 socat[3314] N childdied(): handling signal 17

loread tells me:

Jan 22 12:33:57 swi-mdm9x28-wp user.info Legato: INFO | tcpserver[2107]/tcpServer T=main | tcpserver.c _tcpServer_COMPONENT_INIT() 375 | TCP-Server
Jan 22 12:35:05 swi-mdm9x28-wp user.info Legato: INFO | tcpserver[2201]/tcpServer T=main | tcpserver.c _tcpServer_COMPONENT_INIT() 375 | TCP-Server
Jan 22 12:36:46 swi-mdm9x28-wp user.warn Legato: -WRN- | configTree[1238]/framework T=main | safeRef.c le_ref_CreateRef() 546 | Safe reference map maximum exceeded for refPathIteratorMap, new size 42
Jan 22 12:37:10 swi-mdm9x28-wp user.info Legato: INFO | tcpserver[2387]/tcpServer T=main | tcpserver.c _tcpServer_COMPONENT_INIT() 375 | TCP-Server
Jan 22 12:37:25 swi-mdm9x28-wp user.info Legato: INFO | tcpserver[2402]/tcpServer T=main | tcpserver.c _tcpServer_COMPONENT_INIT() 375 | TCP-Server
Jan 22 12:37:25 swi-mdm9x28-wp user.info Legato: INFO | tcpserver[2402]/tcpServer T=main | tcpserver.c Command() 329 | start server
Jan 22 12:37:25 swi-mdm9x28-wp user.info Legato: INFO | tcpserver[2402]/tcpServer T=main | tcpserver.c Command() 343 | Starte Server
Jan 22 12:37:25 swi-mdm9x28-wp user.info Legato: INFO | tcpserver[2402]/tcpServer T=main | tcpserver.c Command() 365 | TCP-Server is monitoring port 9302
Jan 22 12:37:31 swi-mdm9x28-wp user.info Legato: INFO | tcpserver[2417]/tcpServer T=main | tcpserver.c _tcpServer_COMPONENT_INIT() 375 | TCP-Server
Jan 22 12:37:31 swi-mdm9x28-wp user.info Legato: INFO | tcpserver[2417]/tcpServer T=main | tcpserver.c Command() 329 | start server
Jan 22 12:37:31 swi-mdm9x28-wp user.info Legato: INFO | tcpserver[2417]/tcpServer T=main | tcpserver.c Command() 343 | Starte Server
Jan 22 12:37:31 swi-mdm9x28-wp user.info Legato: INFO | tcpserver[2417]/tcpServer T=main | tcpserver.c Command() 365 | TCP-Server is monitoring port 9302
Jan 22 12:40:00 swi-mdm9x28-wp user.info kernel: [ 562.110601] device lo entered promiscuous mode
Jan 22 12:41:40 swi-mdm9x28-wp user.info kernel: [ 662.442168] device lo left promiscuous mode
Jan 22 12:42:24 swi-mdm9x28-wp user.info kernel: [ 706.100613] device lo entered promiscuous mode
Jan 22 12:42:30 swi-mdm9x28-wp user.info kernel: [ 711.946706] TCP: request_sock_TCP: Possible SYN flooding on port 9302. Dropping request. Check SNMP counters.
Jan 22 12:42:37 swi-mdm9x28-wp user.info kernel: [ 719.587200] device lo left promiscuous mode

I compiled and installed your app fwdownloader. It runs as expected. I can connect local with nc and see the echo of my messages.

Now i compared your server with mine:

I used
socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
you use
socket(AF_INET, SOCK_STREAM, 0)

I used
if (listen(fd,0) < 0) …
you use
if (listen(fd,1) < 0) …

I changed the 2 lines. Additionally I had to remove the build-Directory to recompile all code. After that my server worked as expected.