Websockets over NB-IOT : No auto-started network interface

Hi,

I would like to test a websocket connection over NB-IOT with the nRF9151DK. I started with the websocket_client example but I have those warnings and errors at startup : 

[00:00:00.380,798] <dbg> net_tcp: net_tcp_init: (0x2000cf38): Workq started. Thread ID: 0x2000cc30
*** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***
[00:00:00.398,681] <wrn> net_config: No auto-started network interface - network-bound app initialization skipped.
[00:00:00.409,606] <err> net_websocket_client_sample: Failed to create IPv4 HTTP socket (-23)
[00:00:00.418,670] <err> net_websocket_client_sample: Cannot create HTTP connection.

Here is the prj.conf, same as the example but with LTE/NB-IOT feature added : 

# NBIOT Usage
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_NETWORK_MODE_NBIOT=y
CONFIG_LTE_LINK_CONTROL_LOG_LEVEL_DBG=y

# Réseau
CONFIG_NETWORKING=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=n
CONFIG_NET_TCP=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POLL_MAX=4
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_NEED_IPV4=y
CONFIG_NET_CONFIG_NEED_IPV6=n
CONFIG_NET_CONNECTION_MANAGER=y
CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=1024

# Websocket / HTTP
CONFIG_HTTP_CLIENT=y
CONFIG_WEBSOCKET_CLIENT=y

# Logging
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_NET_LOG=y
CONFIG_NET_SOCKETS_LOG_LEVEL_DBG=y
CONFIG_NET_HTTP_LOG_LEVEL_DBG=y
CONFIG_NET_WEBSOCKET_LOG_LEVEL_DBG=y
CONFIG_NET_CONTEXT_LOG_LEVEL_DBG=y
CONFIG_NET_TCP_LOG_LEVEL_DBG=y

# Stack/mémoire
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_HEAP_MEM_POOL_SIZE=4096

# TLS/crypto
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_SHA1_C=y

# UART console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_PRINTK=y

Any help is welcomed.

Best regards,

Mallory.

Parents
  • My guess is that it is somehow trying to use the Zephyr network stack instead of the modem library to do socket operations. Unfortunately I have not had time to test this, but I will try to do that soon.

  • Hi Hakon,

    By adding this to prj.conf, it seems that you are right : 

    CONFIG_NET_NATIVE=y
    CONFIG_NET_SOCKETS_OFFLOAD=n

    The logs are differents : 

    [00:00:00.272,888] <dbg> net_tcp: net_tcp_init: (0x2000d418): Workq started. Thread ID: 0x2000d198
    [00:00:00.282,165] <err> net_if: There is no network interface to work with!
    *** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
    *** Using Zephyr OS v3.6.99-100befc70c74 ***
    [00:00:00.298,339] <wrn> net_config: No auto-started network interface - network-bound app initialization skipped.
    [00:00:00.309,265] <wrn> net_if: No default interface found!
    [00:00:00.315,643] <dbg> net_tcp: tcp_conn_ref: (0x2000d418): conn: 0x20013ddc, ref_count: 1
    [00:00:00.324,401] <dbg> net_tcp: tcp_conn_alloc: (0x2000d418): conn: 0x20013ddc
    [00:00:00.332,550] <dbg> net_sock: zsock_socket_internal: (0x2000d418): socket: ctx=0x2000d828, fd=3
    [00:00:00.342,010] <dbg> net_tcp: net_tcp_recv: (0x2000d418): context: 0x2000d828, cb: 0xbabd, user_data: 0
    [00:00:00.352,478] <wrn> net_if: No default interface found!
    [00:00:00.358,703] <err> net_ctx: Cannot bind to 0.0.0.0
    [00:00:00.364,654] <err> net_websocket_client_sample: Cannot connect to IPv4 remote (-125)
    [00:00:00.374,206] <dbg> net_http_client: http_flush_data: Data to send
                                              47 45 54 20 2f 72 61 77  20 48 54 54 50 2f 31 2e |GET /raw  HTTP/1.
                                              31 0d 0a 48 6f 73 74 3a  20 33 34 2e 31 39 34 2e |1..Host:  34.194.
                                              31 39 31 2e 32 31 36 0d  0a 4f 72 69 67 69 6e 3a |191.216. .Origin:
                                              20 68 74 74 70 3a 2f 2f  66 6f 6f 62 61 72 0d 0a | http:// foobar..
                                              53 65 63 2d 57 65 62 53  6f 63 6b 65 74 2d 4b 65 |Sec-WebS ocket-Ke
                                              79 3a 20 34 4f 49 2f 75  7a 6a 59 32 46 37 54 4a |y: 4OI/u zjY2F7TJ
                                              5a 46 33 41 31 4d 34 67  67 3d 3d 0d 0a 55 70 67 |ZF3A1M4g g==..Upg
                                              72 61 64 65 3a 20 77 65  62 73 6f 63 6b 65 74 0d |rade: we bsocket.
                                              0a 43 6f 6e 6e 65 63 74  69 6f 6e 3a 20 55 70 67 |.Connect ion: Upg
                                              72 61 64 65 0d 0a 53 65  63 2d 57 65 62 53 6f 63 |rade..Se c-WebSoc
                                              6b 65 74 2d 56 65 72 73  69 6f 6e 3a 20 31 33 0d |ket-Vers ion: 13.
                                              0a 0d 0a                                         |...              
    [00:00:00.495,819] <dbg> net_tcp: net_tcp_recv: (0x2000d418): context: 0x2000d828, cb: 0xbabd, user_data: 0
    [00:00:00.505,920] <dbg> net_websocket: websocket_connect: (0x2000d418): [0x2000d240] Cannot connect to Websocket host 34.194.191.216
    [00:00:00.518,188] <err> net_websocket_client_sample: Cannot connect to 34.194.191.216:443
    [00:00:00.527,069] <dbg> net_tcp: net_tcp_recv: (0x2000d418): context: 0x2000d828, cb: 0, user_data: 0
    [00:00:00.536,743] <dbg> net_tcp: net_tcp_put: (0x2000d418):  [LISTEN Seq=0 Ack=0]
    [00:00:00.544,616] <dbg> net_tcp: net_tcp_put: (0x2000d418): context 0x2000d828 IDLE
    [00:00:00.552,703] <dbg> net_tcp: tcp_conn_unref: (0x2000d418): conn: 0x20013ddc, ref_count=1
    [00:00:00.561,645] <dbg> net_ctx: net_context_unref: (0x2000d418): Context 0x2000d828 released
    [00:00:00.570,556] <err> net_websocket_client_sample: No IPv4 or IPv6 connectivity

    But there is still a network interface problem.

    Best regards,

    Mallory.

  • So here is what you can try;

    Comment out or remove

    # CONFIG_NET_SOCKETS_POLL_MAX=4
    # CONFIG_NET_CONFIG_SETTINGS=y
    # CONFIG_NET_CONFIG_NEED_IPV4=y
    # CONFIG_NET_CONFIG_NEED_IPV6=n
    # CONFIG_NET_CONNECTION_MANAGER=y
    # CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=1024

    And add these lines

    CONFIG_NET_NATIVE=n
    CONFIG_NET_SOCKETS_OFFLOAD=y
    CONFIG_POSIX_API=y

    MalloryLP said:
    By adding this to prj.conf, it seems that you are right : 

    Maybe, but with these in your build you can't use the nrf91 modem lib. And I assume that is what you want.

  • Ok, understood. Here are the logs with your recommandations applied : 

    *** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
    *** Using Zephyr OS v3.6.99-100befc70c74 ***
    [00:00:00.382,507] <err> net_websocket_client_sample: Failed to create IPv4 HTTP socket (-23)
    [00:00:00.391,601] <err> net_websocket_client_sample: Cannot create HTTP connection.

Reply
  • Ok, understood. Here are the logs with your recommandations applied : 

    *** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
    *** Using Zephyr OS v3.6.99-100befc70c74 ***
    [00:00:00.382,507] <err> net_websocket_client_sample: Failed to create IPv4 HTTP socket (-23)
    [00:00:00.391,601] <err> net_websocket_client_sample: Cannot create HTTP connection.

Children
No Data
Related