Can't send data if two netifs (wifi + gsm modem)

DannyBackx
Posts: 33
Joined: Wed Sep 19, 2018 7:17 pm

Can't send data if two netifs (wifi + gsm modem)

Postby DannyBackx » Wed Apr 17, 2024 6:56 pm

I'm using a small sample application to figure out how I can have two network interfaces active : wifi when all is well, but fallback to cell phone otherwise.
The demo app works with one network interface (either) but not when both are started.
Even the initial communication (a simple web query) fails, because the app can't seem to get DNS replies.

Log for the failed app shows (almost) no "dns_recv" calls :

Code: Select all

victus: {411} fgrep -a dns_ typescript.03
D (17:53:43.695) lwip: dns_init: initializing
D (19:53:51.358) lwip: dns_enqueue: "ntp.jimmobile.be": use DNS entry 0
D (19:53:51.377) lwip: dns_enqueue: "ntp.jimmobile.be": use DNS pcb 0
D (19:53:51.383) lwip: dns_send: dns_servers[0] "ntp.jimmobile.be": request
D (19:53:51.739) lwip: dns_recv: "ntp.jimmobile.be": response = 
D (19:53:52.508) lwip: dns_tmr: dns_check_entries
D (19:53:53.508) lwip: dns_tmr: dns_check_entries
D (19:53:54.508) lwip: dns_tmr: dns_check_entries
D (19:53:55.508) lwip: dns_tmr: dns_check_entries
D (19:53:56.508) lwip: dns_tmr: dns_check_entries
D (19:53:57.508) lwip: dns_tmr: dns_check_entries
D (19:53:58.508) lwip: dns_tmr: dns_check_entries
D (19:53:59.573) lwip: dns_tmr: dns_check_entries
D (19:54:00.578) lwip: dns_tmr: dns_check_entries
D (19:54:01.578) lwip: dns_tmr: dns_check_entries
D (19:54:02.626) lwip: dns_tmr: dns_check_entries
D (19:54:03.628) lwip: dns_tmr: dns_check_entries
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:04.499) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbf318 type=0
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:04.526) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbf318 type=1
D (19:54:04.628) lwip: dns_tmr: dns_check_entries
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:04.686) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbf318 type=0
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:04.714) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbf318 type=1
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:04.741) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbf318 type=2
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:04.774) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbaba4 type=0
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:04.802) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbaba4 type=1
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:04.829) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbaba4 type=2
0x42057a94: esp_netif_set_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1895
D (19:54:04.856) esp_netif_lwip: esp_netif_set_dns_info: if=0x3fcbaba4 type=0 dns=18282c3
0x42057a94: esp_netif_set_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1895
D (19:54:04.878) esp_netif_lwip: esp_netif_set_dns_info: if=0x3fcbaba4 type=1 dns=18382c3
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:04.905) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbf318 type=0
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:04.932) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbf318 type=1
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:04.960) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbf318 type=2
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:04.993) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbaba4 type=0
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:05.020) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbaba4 type=1
0x42057b38: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (19:54:05.047) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcbaba4 type=2
D (19:54:05.101) lwip: dns_enqueue: "ipv4.cloudns.net": use DNS entry 1
D (19:54:05.130) lwip: dns_enqueue: "ipv4.cloudns.net": use DNS pcb 0
D (19:54:05.137) lwip: dns_send: dns_servers[0] "ipv4.cloudns.net": request
D (19:54:05.630) lwip: dns_tmr: dns_check_entries
D (19:54:05.635) lwip: dns_send: dns_servers[0] "ipv4.cloudns.net": request
D (19:54:06.758) lwip: dns_tmr: dns_check_entries
D (19:54:06.759) lwip: dns_send: dns_servers[0] "ipv4.cloudns.net": request
D (19:54:06.893) lwip: dns_enqueue: "pool.ntp.org": use DNS entry 2
D (19:54:06.922) lwip: dns_enqueue: "pool.ntp.org": use DNS pcb 1
D (19:54:06.928) lwip: dns_send: dns_servers[0] "pool.ntp.org": request
D (19:54:07.878) lwip: dns_tmr: dns_check_entries
D (19:54:07.879) lwip: dns_send: dns_servers[0] "pool.ntp.org": request
D (19:54:08.998) lwip: dns_tmr: dns_check_entries
D (19:54:08.999) lwip: dns_send: dns_servers[0] "ipv4.cloudns.net": request
D (19:54:09.122) lwip: dns_send: dns_servers[0] "pool.ntp.org": request
D (19:54:10.260) lwip: dns_tmr: dns_check_entries
D (19:54:11.258) lwip: dns_tmr: dns_check_entries
D (19:54:11.259) lwip: dns_send: dns_servers[0] "pool.ntp.org": request
D (19:54:12.378) lwip: dns_tmr: dns_check_entries
D (19:54:12.379) lwip: dns_send: dns_servers[1] "ipv4.cloudns.net": request
D (19:54:13.498) lwip: dns_tmr: dns_check_entries
D (19:54:13.498) lwip: dns_send: dns_servers[1] "ipv4.cloudns.net": request
D (19:54:14.618) lwip: dns_tmr: dns_check_entries
D (19:54:14.618) lwip: dns_send: dns_servers[1] "ipv4.cloudns.net": request
D (19:54:14.742) lwip: dns_send: dns_servers[1] "pool.ntp.org": request
D (19:54:15.868) lwip: dns_tmr: dns_check_entries
D (19:54:15.869) lwip: dns_send: dns_servers[1] "pool.ntp.org": request
D (19:54:16.988) lwip: dns_tmr: dns_check_entries
D (19:54:16.989) lwip: dns_send: dns_servers[1] "ipv4.cloudns.net": request
D (19:54:17.112) lwip: dns_send: dns_servers[1] "pool.ntp.org": request
D (19:54:18.238) lwip: dns_tmr: dns_check_entries
D (19:54:19.238) lwip: dns_tmr: dns_check_entries
D (19:54:19.239) lwip: dns_send: dns_servers[1] "pool.ntp.org": request
D (19:54:20.358) lwip: dns_tmr: dns_check_entries
D (19:54:20.358) lwip: dns_check_entry: "ipv4.cloudns.net": timeout
D (19:54:21.358) lwip: dns_tmr: dns_check_entries
D (19:54:22.358) lwip: dns_tmr: dns_check_entries
D (19:54:22.359) lwip: dns_check_entry: "pool.ntp.org": timeout
D (19:54:22.359) lwip: dns_enqueue: "pool.ntp.org": duplicate request
D (19:54:23.358) lwip: dns_tmr: dns_check_entries
D (19:54:24.358) lwip: dns_tmr: dns_check_entries
[..]
D (19:54:53.538) lwip: dns_tmr: dns_check_entries
D (19:54:53.538) lwip: dns_check_entry: "ntp.jimmobile.be": flush
while a working log shows a nicer pattern :

Code: Select all

victus: {412} fgrep -a dns_ typescript.04
D (00:00:26.241) lwip: dns_init: initializing
0x4204a83c: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (01:00:31.882) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcb9854 type=0
0x4204a83c: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (01:00:31.909) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcb9854 type=1
0x4204a83c: esp_netif_get_dns_info_api at /home/danny/src/github/esp32/esp-idf-v5.2.1/components/esp_netif/lwip/esp_netif_lwip.c:1948
D (01:00:31.936) esp_netif_lwip: esp_netif_get_dns_info: esp_netif=0x3fcb9854 type=2
D (01:00:32.556) lwip: dns_enqueue: "ipv4.cloudns.net": use DNS entry 0
D (01:00:32.585) lwip: dns_enqueue: "ipv4.cloudns.net": use DNS pcb 0
D (01:00:32.592) lwip: dns_send: dns_servers[0] "ipv4.cloudns.net": request
D (01:00:33.049) lwip: dns_recv: "ipv4.cloudns.net": response = 
D (01:00:33.713) lwip: dns_tmr: dns_check_entries
D (01:00:34.760) lwip: dns_tmr: dns_check_entries
D (01:00:35.815) lwip: dns_tmr: dns_check_entries
D (01:00:36.234) lwip: dns_enqueue: "ntp.jimmobile.be": use DNS entry 1
D (01:00:36.257) lwip: dns_enqueue: "ntp.jimmobile.be": use DNS pcb 0
D (01:00:36.263) lwip: dns_send: dns_servers[0] "ntp.jimmobile.be": request
D (01:00:36.632) lwip: dns_recv: "ntp.jimmobile.be": response = 
D (01:00:36.989) lwip: dns_tmr: dns_check_entries
D (01:00:37.993) lwip: dns_tmr: dns_check_entries
[...]
D (01:00:51.263) lwip: dns_tmr: dns_check_entries
D (01:00:51.795) lwip: dns_enqueue: "pool.ntp.org": use DNS entry 2
D (01:00:51.823) lwip: dns_enqueue: "pool.ntp.org": use DNS pcb 0
D (01:00:51.830) lwip: dns_send: dns_servers[0] "pool.ntp.org": request
D (01:00:52.401) lwip: dns_tmr: dns_check_entries
D (01:00:52.406) lwip: dns_send: dns_servers[0] "pool.ntp.org": request
D (01:00:52.758) lwip: dns_recv: "pool.ntp.org": response = 
D (20:29:12.293) lwip: dns_tmr: dns_check_entries
D (20:29:13.288) lwip: dns_tmr: dns_check_entries
There are also different patterns of packets received on port 53 :

Code: Select all

victus: {417} fgrep -a -e dns_recv -e "lwip: |        53     " typescript.03
D (19:53:51.659) lwip: |        53     |     60982     | (src port, dest port)
D (19:53:51.739) lwip: dns_recv: "ntp.jimmobile.be": response = 
D (19:54:05.534) lwip: |        53     |     55132     | (src port, dest port)
D (19:54:05.887) lwip: |        53     |     55132     | (src port, dest port)
D (19:54:07.169) lwip: |        53     |     55132     | (src port, dest port)
D (19:54:07.405) lwip: |        53     |     47547     | (src port, dest port)
D (19:54:08.119) lwip: |        53     |     47547     | (src port, dest port)
D (19:54:09.362) lwip: |        53     |     55132     | (src port, dest port)
D (19:54:09.586) lwip: |        53     |     47547     | (src port, dest port)
D (19:54:11.498) lwip: |        53     |     47547     | (src port, dest port)
D (19:54:12.802) lwip: |        53     |     55132     | (src port, dest port)
D (19:54:13.744) lwip: |        53     |     55132     | (src port, dest port)
D (19:54:14.994) lwip: |        53     |     55132     | (src port, dest port)
D (19:54:15.218) lwip: |        53     |     47547     | (src port, dest port)
D (19:54:16.118) lwip: |        53     |     47547     | (src port, dest port)
D (19:54:17.352) lwip: |        53     |     55132     | (src port, dest port)
D (19:54:17.576) lwip: |        53     |     47547     | (src port, dest port)
D (19:54:19.816) lwip: |        53     |     47547     | (src port, dest port)
victus: {418} fgrep -a -e dns_recv -e "lwip: |        53     " typescript.04
D (01:00:32.969) lwip: |        53     |     57395     | (src port, dest port)
D (01:00:33.049) lwip: dns_recv: "ipv4.cloudns.net": response = 
D (01:00:36.536) lwip: |        53     |     36505     | (src port, dest port)
D (01:00:36.632) lwip: dns_recv: "ntp.jimmobile.be": response = 
D (01:00:52.646) lwip: |        53     |     19793     | (src port, dest port)
D (01:00:52.758) lwip: dns_recv: "pool.ntp.org": response = 
D (01:00:53.215) lwip: |        53     |     19793     | (src port, dest port)
A bit more detail on the first two in typescript.03 - so a succeeded and a failed call :

Code: Select all

D (19:53:51.638) lwip: ip4_input: p->len 126 p->tot_len 126^M^M
D (19:53:51.644) lwip: udp_input: received datagram of length 106^M^M
D (19:53:51.650) lwip: UDP header:^M^M
D (19:53:51.654) lwip: +-------------------------------+^M^M
D (19:53:51.659) lwip: |        53     |     60982     | (src port, dest port)^M^M
D (19:53:51.667) lwip: +-------------------------------+^M^M
D (19:53:51.673) lwip: |       106     |     0x9bb4    | (len, chksum)^M^M
D (19:53:51.679) lwip: +-------------------------------+^M^M
D (19:53:51.685) lwip: udp (^[[0m^M^M
D (19:53:51.688) lwip: 192.168.0.203^[[0m^M^M
D (19:53:51.692) lwip: , 60982) <-- (^[[0m^M^M
D (19:53:51.695) lwip: 195.130.130.1^[[0m^M^M
D (19:53:51.699) lwip: , 53)^M^M
D (19:53:51.702) lwip: pcb (^[[0m^M^M
D (19:53:51.705) lwip: 0.0.0.0^[[0m^M^M
D (19:53:51.708) lwip: , 60982) <-- (^[[0m^M^M
D (19:53:51.712) lwip: 0.0.0.0^[[0m^M^M
D (19:53:51.715) lwip: , 0)^M^M
D (19:53:51.718) lwip: pcb (^[[0m^M^M
D (19:53:51.721) lwip: 0.0.0.0^[[0m^M^M
D (19:53:51.724) lwip: , 68) <-- (^[[0m^M^M
D (19:53:51.728) lwip: 0.0.0.0^[[0m^M^M
D (19:53:51.731) lwip: , 67)^M^M
D (19:53:51.734) lwip: udp_input: calculating checksum^M^M
D (19:53:51.739) lwip: dns_recv: "ntp.jimmobile.be": response = ^[[0m^M^M
D (19:53:51.745) lwip: 18.239.208.57^[[0m^M^M
D (19:53:51.749) lwip: ^M^M

[...]
D (19:54:05.513) lwip: ip4_input: p->len 94 p->tot_len 94^M^M
D (19:54:05.519) lwip: udp_input: received datagram of length 74^M^M
D (19:54:05.525) lwip: UDP header:^M^M
D (19:54:05.529) lwip: +-------------------------------+^M^M
D (19:54:05.534) lwip: |        53     |     55132     | (src port, dest port)^M^M
D (19:54:05.542) lwip: +-------------------------------+^M^M
D (19:54:05.547) lwip: |        74     |     0x18d7    | (len, chksum)^M^M
D (19:54:05.554) lwip: +-------------------------------+^M^M
D (19:54:05.559) lwip: udp (^[[0m^M^M
D (19:54:05.562) lwip: 192.168.0.203^[[0m^M^M
D (19:54:05.566) lwip: , 55132) <-- (^[[0m^M^M
D (19:54:05.570) lwip: 195.130.130.1^[[0m^M^M
D (19:54:05.573) lwip: , 53)^M^M
D (19:54:05.577) lwip: pcb (^[[0m^M^M
D (19:54:05.580) lwip: 0.0.0.0^[[0m^M^M
D (19:54:05.583) lwip: , 55132) <-- (^[[0m^M^M
D (19:54:05.586) lwip: 0.0.0.0^[[0m^M^M
D (19:54:05.590) lwip: , 0)^M^M
D (19:54:05.593) lwip: pcb (^[[0m^M^M
D (19:54:05.596) lwip: 0.0.0.0^[[0m^M^M
D (19:54:05.599) lwip: , 64662) <-- (^[[0m^M^M
D (19:54:05.602) lwip: 0.0.0.0^[[0m^M^M
D (19:54:05.606) lwip: , 0)^M^M
D (19:54:05.609) lwip: pcb (^[[0m^M^M
D (19:54:05.611) lwip: 0.0.0.0^[[0m^M^M
D (19:54:05.615) lwip: , 68) <-- (^[[0m^M^M
D (19:54:05.618) lwip: 0.0.0.0^[[0m^M^M
D (19:54:05.621) lwip: , 67)^M^M
D (19:54:05.624) lwip: udp_input: calculating checksum^M^M
D (19:54:05.630) lwip: dns_tmr: dns_check_entries^M^M
D (19:54:05.635) lwip: dns_send: dns_servers[0] "ipv4.cloudns.net": request^M^M
D (19:54:05.642) lwip: sending DNS request ID 4414 for name "ipv4.cloudns.net" to server 0^M^M^M
D (19:54:05.650) lwip: udp_send^M^M
D (19:54:05.654) lwip: udp_send: added header in given pbuf 0x3fcc38d8^M^M
Does anyone see what's wrong here ?

Code at https://sourceforge.net/p/lilygo-t-sim- ... webserver/

Who is online

Users browsing this forum: Corand and 95 guests