ConnectivityFoundry / AwaLWM2M

Awa LWM2M is an implementation of the OMA Lightweight M2M protocol in C.
BSD 3-Clause "New" or "Revised" License
102 stars 66 forks source link

awa_clientd DTLS does not send packets #243

Closed SirFerdek closed 8 years ago

SirFerdek commented 8 years ago

GnuTLS, preshared key inserted from command line client does not communicate with server (no UDP packets coming to server from client, verified with tcpdump)

coap (unsecured) works fine

You don't need lwm2m server to verify this, just tcpdump :) Affects master HEAD ad624b5f2659c20f7073c7cef6a5c037eeb5b5b9 ` [DEBUG] [coap_abstraction_erbium.c:302] resolve address from Uri: coaps://10.89.15.1:5684 [DEBUG] [network_abstraction_linux.c:349] Address add: coaps://10.89.15.1:5684 [DEBUG] [network_abstraction_linux.c:304] Address free: coaps://10.89.15.1:5684 [DEBUG] [lwm2m_server_object.c:116] Creating server object instance [DEBUG] [lwm2m_registration.c:268] Registration update for ServerID 0 scheduled [DEBUG] [lwm2m_bootstrap.c:99] Lwm2m_BootstrapFromSmartCard [DEBUG] [lwm2m_bootstrap.c:105] Lwm2m_BootstrapFromFactory: True [DEBUG] [lwm2m_registration.c:135] Registration: POST coaps://10.89.15.1:5684 /rd ?ep=RPI&lt=30&b=U </>;ct=1543,</1/0>,</2/0>,</2/1>,</2/2>,</2/3>,</3/0>,</4/0>,,</5/0>,</6/0> [INFO] [lwm2m_registration.c:137] Register with coaps://10.89.15.1:5684 [DEBUG] [lwm2m_registration.c:139] Register: POST coaps://10.89.15.1:5684/rd?ep=RPI&lt=30&b=U [DEBUG] [network_abstraction_linux.c:349] Address add: coaps://10.89.15.1:5684 [INFO] [coap_abstraction_erbium.c:375] Coap request: coaps://10.89.15.1:5684/rd?ep=RPI&lt=30&b=U

[ERROR] [lwm2m_registration.c:309] Registration attempt timed out. [DEBUG] [lwm2m_registration.c:135] Registration: POST coaps://10.89.15.1:5684 /rd ?ep=RPI&lt=30&b=U </>;ct=1543,</1/0>,</2/0>,</2/1>,</2/2>,</2/3>,</3/0>,</4/0>,,</5/0>,</6/0> [INFO] [lwm2m_registration.c:137] Register with coaps://10.89.15.1:5684 [DEBUG] [lwm2m_registration.c:139] Register: POST coaps://10.89.15.1:5684/rd?ep=RPI&lt=30&b=U [INFO] [coap_abstraction_erbium.c:375] Coap request: coaps://10.89.15.1:5684/rd?ep=RPI&lt=30&b=U

[ERROR] [lwm2m_registration.c:309] Registration attempt timed out. [DEBUG] [lwm2m_registration.c:135] Registration: POST coaps://10.89.15.1:5684 /rd ?ep=RPI&lt=30&b=U </>;ct=1543,</1/0>,</2/0>,</2/1>,</2/2>,</2/3>,</3/0>,</4/0>,,</5/0>,</6/0> [INFO] [lwm2m_registration.c:137] Register with coaps://10.89.15.1:5684 [DEBUG] [lwm2m_registration.c:139] Register: POST coaps://10.89.15.1:5684/rd?ep=RPI&lt=30&b=U [INFO] [coap_abstraction_erbium.c:375] Coap request: coaps://10.89.15.1:5684/rd?ep=RPI&lt=30&b=U

[ERROR] [lwm2m_registration.c:309] Registration attempt timed out. `

delmet commented 8 years ago

Sorry unable to reproduce (capturing udp port 5684 or udp port 6000 see traffic and it successfully connects to server)

Can you confirm you built for GnuTLS using command line like below

make CMAKE_OPTIONS="-DWITH_GNUTLS=ON"

Also can you provide details of Platform/Distro you are using and GnuTLS version

SirFerdek commented 8 years ago

Platform/Distro was Raspberry Pi 2/Raspbian (latest)

It seems we both are right - when compiled on x86 (for instance on Ubuntu Xenial) it works indeed. So is it dependency problem? Old version of libraries available on Raspbian?

I get no warnings/errors/anything when compiling on RPi

UPDATE: I ran compilation on ArchLinux ARM for Raspberry Pi - communication works as expected. It clearly is dependency versioning issue. Any thoughts on this?

delmet commented 8 years ago

What version of GnuTLS does it have ?

ghost commented 8 years ago

Hi, experiencing similar issue:

Platform:

Distributor ID: Ubuntu Description: Ubuntu 14.04.4 LTS Release: 14.04 Codename: trusty

GnuTLS version:

libgnutls-dev: Installed: 2.12.23-12ubuntu2.5 Candidate: 2.12.23-12ubuntu2.5

Log:

 [INFO] Awa LWM2M Client, version 0.2.3
 [INFO]   Process ID     : 3135
 [INFO]   Endpoint name  : 'client'
 [INFO]   DTLS library   : GnuTLS
 [INFO]   CoAP library   : Erbium
 [INFO]   CoAP port      : 6000
 [INFO]   IPC port       : 12345
 [INFO]   Address family : IPv4
 [INFO] Bind port: 6000
 [INFO] Try existing server entries
 [INFO] No servers are defined
 [INFO] Hold Off expired - attempt client-initiated bootstrap
 [INFO] Bootstrap with coaps://deviceserver.flowcloud.systems:15684/bs?ep=client
 [INFO] Coap request: coaps://deviceserver.flowcloud.systems:15684/bs?ep=client
 [ERROR] No response to client initiated bootstrap
 [WARN] HoldOff Expired - Re-attempt bootstrap
 [INFO] Try existing server entries
 [INFO] No servers are defined
 [INFO] Hold Off expired - attempt client-initiated bootstrap
 [INFO] Bootstrap with coaps://deviceserver.flowcloud.systems:15684/bs?ep=client
 [INFO] Coap request: coaps://deviceserver.flowcloud.systems:15684/bs?ep=client
 [ERROR] No response to client initiated bootstrap
 [WARN] HoldOff Expired - Re-attempt bootstrap
 [INFO] Try existing server entries
 [INFO] No servers are defined
 [INFO] Hold Off expired - attempt client-initiated bootstrap
 [INFO] Bootstrap with coaps://deviceserver.flowcloud.systems:15684/bs?ep=client
 [INFO] Coap request: coaps://deviceserver.flowcloud.systems:15684/bs?ep=client
 [WARN] Canceled previous transaction [0]: 0x11e9830
 [INFO] Close port: 
 [INFO] Client exiting

Update:

I was able to successfully, establish the connection between the device server and the AWA client, on Ubuntu Mate 16.04.1 LTS, using libgnutls-dev 3.4.10.

BR, Hugo.

SirFerdek commented 8 years ago

I tried to find the version of library that caused the problem. But since I was in hury and had no time to debug this, I did scratch install on my RPi with Arch Linux, where the problem does not exist.

Now, possible candidates of libgnutls-dev version that was installed is as follows: libgnutls28-dev_3.0.20-3_armhf.deb libgnutls28-dev_3.3.8-6+deb8u3_armhf.deb libgnutls28-dev_3.4.14-1_armhf.deb

Given that Arch Linux runs on 3.4.14, Hugo's post and what I recall from the memory - it most probably was 3.3.8-6 that was installed (I somehow recall this strange deb8u3 suffix...)

delmet commented 8 years ago

I have had a look at change log for GnuTLS seems DTLS support was added in version 2.99.0 (released 2011-04-09) but I doubt this is a common version of the library as soon after version 3.0.0 (2011-07-29) was released.

I also know a lot of Distros were stuck on 2.12.* and just back porting security fixes etc.

BTW I have considered adding a compilation error if you don't have greater than 3.0.0

delmet commented 8 years ago

Hi SirFerdek

Can I close this issue ?

SirFerdek commented 8 years ago

Seems like you can close this, as we are currently unable to find the root cause anyway...