Issues installing openvpn client on sierra wireless wp7611

I am trying to install an openvpn client on sierra wireless wp7611.
but I see a weird error.

Device info:

# uname -a
Linux swi-mdm9x28-wp 3.18.140 #1 PREEMPT Thu Dec 7 09:52:21 UTC 2023 armv7l GNU/Linux

This is my client config file, which is creating a good conection on my X86_64 pc:

# cat /etc/openvpn/my_client.conf 
client
dev tun0
port 1194
proto tcp

remote my.server.com 1194
resolv-retry infinite

user nobody
group nogroup

persist-key
persist-tun

key /etc/openvpn/pki/my_client/my.key
ca /etc/openvpn/pki/my_client/ca.crt
cert /etc/openvpn/pki/my_client/my.crt

remote-cert-tls server
cipher AES-256-CBC

verb 4

I am trying to use it on the wp but with no success. Tried both on opevvpn ver 2.3.18 and 2.4.4.

On openvpn version 2.3.18 I see the following:

OpenVPN info:

# openvpn --version
OpenVPN 2.3.18 arm-poky-linux-gnueabi [SSL (OpenSSL)] [LZO] [EPOLL] [MH] [IPv6] built on Dec 12 2023
library versions: OpenSSL 1.0.2p  14 Aug 2018, LZO 2.10
Originally developed by James Yonan
Copyright (C) 2002-2017 OpenVPN Technologies, Inc. <sales@openvpn.net>
Compile time defines: enable_crypto=yes enable_crypto_ofb_cfb=yes enable_debug=yes enable_def_auth=yes enable_dependency_tracking=no enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown enable_fast_install=yes enable_fragment=yes enable_http_proxy=yes enable_iproute2=yes enable_libtool_lock=yes enable_lzo=yes enable_lzo_stub=no enable_management=yes enable_multi=yes enable_multihome=yes enable_pam_dlopen=no enable_pedantic=no enable_pf=yes enable_pkcs11=no enable_plugin_auth_pam=no enable_plugin_down_root=yes enable_plugins=yes enable_port_share=yes enable_selinux=no enable_server=yes enable_shared=yes enable_shared_with_static_runtimes=no enable_silent_rules=no enable_small=no enable_socks=yes enable_ssl=yes enable_static=no enable_strict=no enable_strict_options=no enable_systemd=no enable_win32_dll=yes enable_x509_alt_username=no with_aix_soname=aix with_broken_putenv=no with_crypto_library=openssl with_gnu_ld=yes with_libtool_sysroot=/home/notraffic-jig/dev/wpb/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/openvpn/2.3.18-r0/recipe-sysroot with_mem_check=no with_plugindir='$(libdir)/openvpn/plugins'

After a while the service prints the following error indefinitely:

Tue Dec 12 20:06:02 2023 us=531010 read TCPv4_CLIENT: Invalid argument (code=22)

Added strace info for this error:

poll([{fd=3, events=POLLIN|POLLPRI}], 1, 1237) = 1 ([{fd=3, revents=POLLIN}])
gettimeofday({tv_sec=1702404362, tv_usec=528240}, NULL) = 0
recv(3, 0x7f620120, 1563, MSG_NOSIGNAL) = -1 EINVAL (Invalid argument)
gettimeofday({tv_sec=1702404362, tv_usec=531010}, NULL) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=121, ...}) = 0
write(1, "Tue Dec 12 20:06:02 2023 us=5310"..., 81Tue Dec 12 20:06:02 2023 us=531010 read TCPv4_CLIENT: Invalid argument (code=22)
) = 81

Added ltrace info for this error:

fflush(0xb6cc9d98)                                                                                                            = 0
free(0x7f62f3f0)                                                                                                              = <void>
free(0x7f62eee8)                                                                                                              = <void>
free(0x7f62e9e0)                                                                                                              = <void>
free(0x7f61b148)                                                                                                              = <void>
ERR_clear_error(0, 0xbed8fa50, 0x7f5ded8c, 0xaa861f00)                                                                        = 0
time(nil)                                                                                                                     = 1702406446
memcmp(0x7f60adc4, 0x7f5f54c4, 8, 0x7f5f4a40)                                                                                 = 96
time(nil)                                                                                                                     = 1702406446
BIO_read(0x7f60d868, 0x7f60e7a0, 2048, 0x7f60e7a0)                                                                            = -1
BIO_test_flags(0x7f60d868, 8, 0, 0)                                                                                           = 8
time(nil)                                                                                                                     = 1702406446
time(nil)                                                                                                                     = 1702406446
time(nil)                                                                                                                     = 1702406446
poll(0x7f6096a8, 1, 1094, 6057)                                                                                               = 1
time(nil)                                                                                                                     = 1702406446
recv(3, 0x7f6200c8, 1563, 0x4000)                                                                                             = -1
__errno_location()                                                                                                            = 0xb6f17920
__errno_location()                                                                                                            = 0xb6f17920
malloc(260)                                                                                                                   = 0x7f61b148
strerror(22)                                                                                                                  = "Invalid argument"
__vsnprintf_chk(0x7f61b14c, 256, 1, -1)                                                                                       = 16
strlen("Invalid argument")                                                                                                    = 16
__errno_location()                                                                                                            = 0xb6f17920
malloc(1284)                                                                                                                  = 0x7f62e9e0
malloc(1284)                                                                                                                  = 0x7f62eee8
__vsnprintf_chk(0x7f62e9e4, 1280, 1, -1)                                                                                      = 45
malloc(68)                                                                                                                    = 0x7f62f3f0
gettimeofday(0xbed8f18c, nil)                                                                                                 = 0
ctime(0xbed8f184)                                                                                                             = "Tue Dec 12 20:40:46 2023\n"
__vsnprintf_chk(0x7f62f3f4, 64, 1, -1)                                                                                        = 25
strlen("Tue Dec 12 20:40:46 2023\n")                                                                                          = 25
__vsnprintf_chk(0x7f62f40c, 40, 1, -1)                                                                                        = 10
strlen(" us=866956")                                                                                                          = 10
__fprintf_chk(0xb6cc9d98, 1, 0x7f5c3990, 0x7f62f3f4Tue Dec 12 20:40:46 2023 us=866956 read TCPv4_CLIENT: Invalid argument (code=22)

On openvpn version 2.4.4 I see a very similar pattern:

OpenVPN info:

# openvpn --version
OpenVPN 2.4.4 arm-poky-linux-gnueabi [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD] built on Dec 17 2023
library versions: OpenSSL 1.0.2p  14 Aug 2018, LZO 2.10
Originally developed by James Yonan
Copyright (C) 2002-2017 OpenVPN Technologies, Inc. <sales@openvpn.net>
Compile time defines: enable_async_push=no enable_comp_stub=no enable_crypto=yes enable_crypto_ofb_cfb=yes enable_debug=yes enable_def_auth=yes enable_dependency_tracking=no enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown enable_fast_install=yes enable_fragment=yes enable_iproute2=yes enable_libtool_lock=yes enable_lz4=yes enable_lzo=yes enable_management=yes enable_multihome=yes enable_pam_dlopen=no enable_pedantic=no enable_pf=yes enable_pkcs11=no enable_plugin_auth_pam=no enable_plugin_down_root=yes enable_plugins=yes enable_port_share=yes enable_selinux=no enable_server=yes enable_shared=yes enable_shared_with_static_runtimes=no enable_silent_rules=no enable_small=no enable_static=no enable_strict=no enable_strict_options=no enable_systemd=no enable_werror=no enable_win32_dll=yes enable_x509_alt_username=no with_aix_soname=aix with_broken_putenv=no with_crypto_library=openssl with_gnu_ld=yes with_libtool_sysroot=/home/notraffic-jig/dev/wpb/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/openvpn/2.4.4-r0/recipe-sysroot with_mem_check=no

After a while the service prints the following error indefinitely:

Sun Dec 17 14:42:20 2023 us=593690 read TCP_CLIENT: Invalid argument (code=22)

Added strace info for this error:

gettimeofday({tv_sec=1702816940, tv_usec=651993}, NULL) = 0
gettimeofday({tv_sec=1702816940, tv_usec=652647}, NULL) = 0
gettimeofday({tv_sec=1702816940, tv_usec=653174}, NULL) = 0
gettimeofday({tv_sec=1702816940, tv_usec=653929}, NULL) = 0
gettimeofday({tv_sec=1702816940, tv_usec=654123}, NULL) = 0
gettimeofday({tv_sec=1702816940, tv_usec=654625}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLPRI}], 1, 1129) = 1 ([{fd=3, revents=POLLIN}])
gettimeofday({tv_sec=1702816940, tv_usec=655093}, NULL) = 0
recv(3, 0x7f63ac24, 1626, MSG_NOSIGNAL) = -1 EINVAL (Invalid argument)
gettimeofday({tv_sec=1702816940, tv_usec=656162}, NULL) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=121, ...}) = 0
write(1, "Sun Dec 17 14:42:20 2023 us=6561"..., 79Sun Dec 17 14:42:20 2023 us=656162 read TCP_CLIENT: Invalid argument (code=22)

Added ltrace info for this error:

fflush(0xb6d3dd98)                                                                                                            = 0
free(0x7f64a028)                                                                                                              = <void>
free(0x7f649b20)                                                                                                              = <void>
free(0x7f649618)                                                                                                              = <void>
ERR_clear_error(0xbec5a17c, 0, 0xbec5a12c, 0x6d56200)                                                                         = 0
time(nil)                                                                                                                     = 1702817068
memcmp(0x7f620db4, 0x7f60d59c, 8, 0x7f60c9e4)                                                                                 = 82
time(nil)                                                                                                                     = 1702817068
BIO_read(0x7f61e850, 0x7f61f9f0, 2048, 0x7f61f9f0)                                                                            = -1
BIO_test_flags(0x7f61e850, 8, 0, 0)                                                                                           = 8
time(nil)                                                                                                                     = 1702817068
time(nil)                                                                                                                     = 1702817068
time(nil)                                                                                                                     = 1702817068
poll(0x7f627440, 1, 1175, 0x2bf0)                                                                                             = 1
time(nil)                                                                                                                     = 1702817068
recv(3, 0x7f63ac24, 1626, 0x4000)                                                                                             = -1
__errno_location()                                                                                                            = 0xb6f8b920
__errno_location()                                                                                                            = 0xb6f8b920
strerror(22)                                                                                                                  = "Invalid argument"
__errno_location()                                                                                                            = 0xb6f8b920
malloc(1284)                                                                                                                  = 0x7f649618
malloc(1284)                                                                                                                  = 0x7f649b20
__vsnprintf_chk(0x7f64961c, 1280, 1, -1)                                                                                      = 43
malloc(68)                                                                                                                    = 0x7f64a028
gettimeofday(0xbec5a0cc, nil)                                                                                                 = 0
ctime(0xbec5a0c4)                                                                                                             = "Sun Dec 17 14:44:28 2023\n"
__vsnprintf_chk(0x7f64a02c, 64, 1, -1)                                                                                        = 25
strlen("Sun Dec 17 14:44:28 2023\n")                                                                                          = 25
__vsnprintf_chk(0x7f64a044, 40, 1, -1)                                                                                        = 10
strlen(" us=614117")                                                                                                          = 10
__fprintf_chk(0xb6d3dd98, 1, 0x7f5d91fc, 0x7f64a02cSun Dec 17 14:44:28 2023 us=614117 read TCP_CLIENT: Invalid argument (code=22)
)                                                                          = 79

To my understanding from looking at the strace and ltrace output the problem is that the process is trying to receive a message from a socket but for some reason it passes invalid arguments.
I am not sure how to proceed.

I am compiling openvpn as part of a yocto project using the following .bb file:
https://github.com/legatoproject/meta-o … n_2.4.4.bb

any help fixing/debugging would be appreciated.
thanks,

Update:
I tried to connect to a diffrent openvpn server which uses UDP instead of TCP, whiile using openvpn ver 2.4.4 on the WP7611 and I have a solid working conection.

So seems like the issue is only present for openvpn over TCP.

Creating a diffrent openvpn server using UDP only for the WP7611, is not a good option for me business wise.

Did you check the log on server?

I came across this StackOverflow issue and those probably aren’t related, eventhough the error messages look similar.
In the StackOverflow one it’s probably config mismatch between the server and client, while in my setup it’s not since the same config is working on my pc.

I looked at the server logs and there is nothing special, I can see the begging of conection establishment , I see that the server recieves the WP7611 client config, but probably afterward the WP7611 wasn’t able to finish the OpenVPN handshake because of thie Invalid argument error.

It will take me a few days to re-create the scenario in order to fetch the server logs, but I don’t think there is anything intresting there.

What has been returned wrongly in the handshake?
I think you should go to openvpn forum to get more clue

IMO from looking at the strace and ltrace output my openvpn client is trying to receive a message from a socket but for some reason it passes invalid arguments.
So thats why the connection between the client and server is not established.

This error is not suppose to happen, and probably not a user error.
I suspect that the MSG_NOSIGNAL flag used here (on the strace output):

recv(3, 0x7f63ac24, 1626, MSG_NOSIGNAL) = -1 EINVAL (Invalid argument)

has the wrong value, which suggests that maybe openVPN wasn’t compiled correctly. Using wrong version of gcc or some similar error.

So if I am correct assessing the issue, it’s either some bug need fixing, or I have something wrongly configured in my environment which I need assistance pinpointing

For your ok case to use udp, is it using MSG_NOSIGNAL when recv()?

Maybe similar to this one:

I just have a trial on WP7608 R16.3 to use recv() with MSG_NOSIGNAL, it will keep on returning a value less than zero even server is not sending anything to it.
I doubt if we can use this MSG_NOSIGNAL in FW R16.3…

Are you using R16.3 with WP7611?
If yes, are you able to change the source code of openvpn? (maybe put a zero in that paramter)
e.g.
recv(sock , server_reply , 2000 , 0)

On the other hand, I have also tested WP7605 with R17, this time it is OK for recv() with MSG_NOSIGNAL.
So it might work for openvpn in R17.
You can have some test on R17 with WP7611.
(bear in mind that it cannot downgrade to R16 anymore once upgrading to R17)
(in addition, you need to upgrade to R16.3 as intermediate firmware before upgrading to R17)