-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mdns query with custom netif (IDFGH-13551) #641
Comments
Hi @archef2000 You'd have to register the interface and enable it for specific IP protocols v4, v6 or both: esp-protocols/components/mdns/examples/query_advertise/main/mdns_example_main.c Lines 326 to 334 in 73c4830
If you're also advertizing, you'd also need to send announcements:
(not necessary if you're just querying) |
Thanks for the quick answer when running the code (Added on line 335 in capture.c) I get the following error when adding the events for IP6 & IP4: 103 ESP_ERR_INVALID_STATE |
What's the number of configured interfaces in mdns Kconifg?
This is 3 by default, but also 3 predefined interfaces are enabled, so there's probably no space for a another one by default. |
Oh thanks I disabled the default interfaces to solve the invalid state error. Here is the new log where after 2-3 Query attempts it stops to send out packets and lwip is just doing some minimal packet handeling after that. LogI (606) aw�l: mac: 80:65:99:c7:ae:98
I (606) awdl core: switch channel to 6 (slot 0)
psf�time� int�rval us: 112640
E (616) wifi:failed to post WiFi eve�t=40 ret=259
� (626) awdl: (aw�l_cr�ate) creati�g awdl driver
aw�l_post_attach
a�dl_n�tif_init
E (636) awdl: mdns_query_task�igmp_joingroup_netif: attempt to join on non-IGMP netif
I (646) main_task: Returned from app_main()
D (646) lwip: pbuf_alloc(length=32)
D (646) lwip: pbuf_alloc(length=32) == 0x3fca4034
D (656) lwip: pbuf_remove_header: old 0x3fca407c new 0x3fca4084 (8)
D (656) lwip: pbuf_add_header: old 0x3fca4084 new 0x3fca407c (8)
D (666) lwip: pbuf_add_header: old 0x3fca407c new 0x3fca4054 (40)
D (666) lwip: ip6_output_if: ow1
D (676) lwip: IPv6 header:
D (676) lwip: +-------------------------------+
D (676) lwip: | 6 | 0 | 0 | (ver, class, flow)
D (686) lwip: +-------------------------------+
D (696) lwip: | 32 | 0 | 1 | (plen, nexth, hopl)
D (696) lwip: +-------------------------------+
D (706) lwip: | 0 | 0 | 0 | 0 | (src)
D (706) lwip: | 0 | 0 | 0 | 0 |
D (716) lwip: +-------------------------------+
D (716) lwip: | ff02 | 0 | 0 | 0 | (dest)
D (726) lwip: | 0 | 0 | 0 | fb |
D (726) lwip: +-------------------------------+
D (726) lwip: netif->output_ip6()
awdl_output ->linkoutput; q->len=72
60 00 00 00 00 20 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 fb 3a 00 05 02 00 00 01 00 83 00 7c b1 00 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 fb
awdl_netif_linkoutput -> esp_netif_transmit -> driver->transmit (awdl_transmit)
awdl_transmit
60 00 00 00 00 20 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 fb 3a 00 05 02 00 00 01 00 83 00 7c b1 00 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 fb
D (776) lwip: pbuf_free(0x3fca4034)
D (786) lwip: pbuf_free: deallocating 0x3fca4034
D (786) lwip: udp_bind(ipaddr =
D (796) lwip: 0.0.0.0
D (796) lwip: , port = 5353)
D (796) lwip: udp_bind: bound to
D (796) lwip: 0.0.0.0
D (806) lwip: , port 5353)
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[390]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (836) lwip: pbuf_alloc(length=37)
D (836) lwip: pbuf_alloc(length=37) == 0x3fca40d0
D (836) lwip: pbuf_free(0x3fca40d0)
D (846) lwip: pbuf_free: deallocating 0x3fca40d0
D (886) lwip: pbuf_alloc(length=32)
D (886) lwip: pbuf_alloc(length=32) == 0x3fca4088
D (886) lwip: pbuf_remove_header: old 0x3fca40d0 new 0x3fca40d8 (8)
D (886) lwip: pbuf_add_header: old 0x3fca40d8 new 0x3fca40d0 (8)
D (886) lwip: pbuf_add_header: old 0x3fca40d0 new 0x3fca40a8 (40)
D (896) lwip: ip6_output_if: ow1
D (896) lwip: IPv6 header:
D (906) lwip: +-------------------------------+
D (906) lwip: | 6 | 0 | 0 | (ver, class, flow)
D (916) lwip: +-------------------------------+
D (916) lwip: | 32 | 0 | 1 | (plen, nexth, hopl)
D (926) lwip: +-------------------------------+
D (926) lwip: | 0 | 0 | 0 | 0 | (src)
D (936) lwip: | 0 | 0 | 0 | 0 |
D (936) lwip: +-------------------------------+
D (946) lwip: | ff02 | 0 | 0 | 0 | (dest)
D (946) lwip: | 0 | 0 | 0 | fb |
D (956) lwip: +-------------------------------+
D (956) lwip: netif->output_ip6()
awdl_output ->linkoutput; q->len=72
60 00 00 00 00 20 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 fb 3a 00 05 02 00 00 01 00 83 00 7c b1 00 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 fb
awdl_netif_linkoutput -> esp_netif_transmit -> driver->transmit (awdl_transmit)
awdl_transmit
60 00 00 00 00 20 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 fb 3a 00 05 02 00 00 01 00 83 00 7c b1 00 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 fb
D (1006) lwip: pbuf_free(0x3fca4088)
D (1006) lwip: pbuf_free: deallocating 0x3fca4088
D (1466) lwip: etharp_timer
D (1466) lwip: dhcp_coarse_tmr()
D (1466) lwip: pbuf_alloc(length=16)
D (1466) lwip: pbuf_alloc(length=16) == 0x3fca4088
D (1466) lwip: pbuf_add_header: old 0x3fca40d0 new 0x3fca40a8 (40)
D (1476) lwip: ip6_output_if: lo0
D (1476) lwip: IPv6 header:
D (1476) lwip: +-------------------------------+
D (1486) lwip: | 6 | 0 | 0 | (ver, class, flow)
D (1486) lwip: +-------------------------------+
D (1496) lwip: | 16 | 58 | 255 | (plen, nexth, hopl)
D (1496) lwip: +-------------------------------+
D (1506) lwip: | 0 | 0 | 0 | 0 | (src)
D (1506) lwip: | 0 | 0 | 0 | 1 |
D (1516) lwip: +-------------------------------+
D (1516) lwip: | ff02 | 0 | 0 | 0 | (dest)
D (1526) lwip: | 0 | 0 | 0 | 2 |
D (1526) lwip: +-------------------------------+
D (1536) lwip: netif->output_ip6()
D (1536) lwip: pbuf_alloc(length=56)
D (1536) lwip: pbuf_alloc(length=56) == 0x3fca40e4
D (1546) lwip: pbuf_copy(0x3fca40e4, 0x3fca4088)
D (1546) lwip: pbuf_copy_partial_pbuf(0x3fca40e4, 0x3fca4088, 56, 0)
D (1556) lwip: pbuf_copy_partial_pbuf: copy complete.
D (1556) lwip: pbuf_free(0x3fca4088)
D (1566) lwip: pbuf_free: deallocating 0x3fca4088
is multicast 1
multicast address ff020000 0 0 2
iflocal: 0
linklocal: 0
mld6 group 0
D (1576) lwip: ip6_input: packet not for us.
D (1576) lwip: pbuf_free(0x3fca40e4)
D (1586) lwip: pbuf_free: deallocating 0x3fca40e4
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[1490]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (1936) lwip: pbuf_alloc(length=37)
D (1936) lwip: pbuf_alloc(length=37) == 0x3fca40a8
D (1936) lwip: pbuf_free(0x3fca40a8)
D (1946) lwip: pbuf_free: deallocating 0x3fca40a8
D (2466) lwip: etharp_timer
D (2466) lwip: dhcp_coarse_tmr()
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[2590]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (3036) lwip: pbuf_alloc(length=37)
D (3036) lwip: pbuf_alloc(length=37) == 0x3fca40a8
D (3036) lwip: pbuf_free(0x3fca40a8)
D (3046) lwip: pbuf_free: deallocating 0x3fca40a8
D (3466) lwip: etharp_timer
D (3466) lwip: dhcp_coarse_tmr()
W (3736) custom_netif_example: No results found!
D (4466) lwip: etharp_timer
D (4466) lwip: dhcp_coarse_tmr()
E (4736) awdl: mdns_query_task
I (4736) custom_netif_example: Query PTR: _airdrop._tcp.local
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[4390]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (4836) lwip: pbuf_alloc(length=37)
D (4836) lwip: pbuf_alloc(length=37) == 0x3fca40a8
D (4836) lwip: pbuf_free(0x3fca40a8)
D (4846) lwip: pbuf_free: deallocating 0x3fca40a8
D (5466) lwip: etharp_timer
D (5466) lwip: dhcp_coarse_tmr()
D (5466) lwip: pbuf_alloc(length=16)
D (5466) lwip: pbuf_alloc(length=16) == 0x3fca4088
D (5466) lwip: pbuf_add_header: old 0x3fca40d0 new 0x3fca40a8 (40)
D (5476) lwip: ip6_output_if: lo0
D (5476) lwip: IPv6 header:
D (5476) lwip: +-------------------------------+
D (5486) lwip: | 6 | 0 | 0 | (ver, class, flow)
D (5486) lwip: +-------------------------------+
D (5496) lwip: | 16 | 58 | 255 | (plen, nexth, hopl)
D (5496) lwip: +-------------------------------+
D (5506) lwip: | 0 | 0 | 0 | 0 | (src)
D (5506) lwip: | 0 | 0 | 0 | 1 |
D (5516) lwip: +-------------------------------+
D (5516) lwip: | ff02 | 0 | 0 | 0 | (dest)
D (5526) lwip: | 0 | 0 | 0 | 2 |
D (5526) lwip: +-------------------------------+
D (5536) lwip: netif->output_ip6()
D (5536) lwip: pbuf_alloc(length=56)
D (5536) lwip: pbuf_alloc(length=56) == 0x3fca40e4
D (5546) lwip: pbuf_copy(0x3fca40e4, 0x3fca4088)
D (5546) lwip: pbuf_copy_partial_pbuf(0x3fca40e4, 0x3fca4088, 56, 0)
D (5556) lwip: pbuf_copy_partial_pbuf: copy complete.
D (5556) lwip: pbuf_free(0x3fca4088)
D (5566) lwip: pbuf_free: deallocating 0x3fca4088
is multicast 1
multicast address ff020000 0 0 2
iflocal: 0
linklocal: 0
mld6 group 0
D (5576) lwip: ip6_input: packet not for us.
D (5576) lwip: pbuf_free(0x3fca40e4)
D (5586) lwip: pbuf_free: deallocating 0x3fca40e4
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[5490]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (5936) lwip: pbuf_alloc(length=37)
D (5936) lwip: pbuf_alloc(length=37) == 0x3fca40d0
D (5936) lwip: pbuf_free(0x3fca40d0)
D (5946) lwip: pbuf_free: deallocating 0x3fca40d0
D (6466) lwip: etharp_timer
D (6466) lwip: dhcp_coarse_tmr()
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[6590]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (7036) lwip: pbuf_alloc(length=37)
D (7036) lwip: pbuf_alloc(length=37) == 0x3fca40d0
D (7036) lwip: pbuf_free(0x3fca40d0)
D (7046) lwip: pbuf_free: deallocating 0x3fca40d0
D (7466) lwip: etharp_timer
D (7466) lwip: dhcp_coarse_tmr()
W (7836) custom_netif_example: No results found!
D (8466) lwip: etharp_timer
D (8466) lwip: dhcp_coarse_tmr()
E (8836) awdl: mdns_query_task
I (8836) custom_netif_example: Query PTR: _airdrop._tcp.local
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[8490]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (8936) lwip: pbuf_alloc(length=37)
D (8936) lwip: pbuf_alloc(length=37) == 0x3fca40f0
D (8936) lwip: pbuf_free(0x3fca40f0)
D (8946) lwip: pbuf_free: deallocating 0x3fca40f0
D (9466) lwip: etharp_timer
D (9466) lwip: dhcp_coarse_tmr()
D (9466) lwip: pbuf_alloc(length=16)
D (9466) lwip: pbuf_alloc(length=16) == 0x3fca4088
D (9466) lwip: pbuf_add_header: old 0x3fca40d0 new 0x3fca40a8 (40)
D (9476) lwip: ip6_output_if: lo0
D (9476) lwip: IPv6 header:
D (9476) lwip: +-------------------------------+
D (9486) lwip: | 6 | 0 | 0 | (ver, class, flow)
D (9486) lwip: +-------------------------------+
D (9496) lwip: | 16 | 58 | 255 | (plen, nexth, hopl)
D (9496) lwip: +-------------------------------+
D (9506) lwip: | 0 | 0 | 0 | 0 | (src)
D (9506) lwip: | 0 | 0 | 0 | 1 |
D (9516) lwip: +-------------------------------+
D (9516) lwip: | ff02 | 0 | 0 | 0 | (dest)
D (9526) lwip: | 0 | 0 | 0 | 2 |
D (9526) lwip: +-------------------------------+
D (9536) lwip: netif->output_ip6()
D (9536) lwip: pbuf_alloc(length=56)
D (9536) lwip: pbuf_alloc(length=56) == 0x3fca40e4
D (9546) lwip: pbuf_copy(0x3fca40e4, 0x3fca4088)
D (9546) lwip: pbuf_copy_partial_pbuf(0x3fca40e4, 0x3fca4088, 56, 0)
D (9556) lwip: pbuf_copy_partial_pbuf: copy complete.
D (9556) lwip: pbuf_free(0x3fca4088)
D (9566) lwip: pbuf_free: deallocating 0x3fca4088
is multicast 1
multicast address ff020000 0 0 2
iflocal: 0
linklocal: 0
mld6 group 0
D (9576) lwip: ip6_input: packet not for us.
D (9576) lwip: pbuf_free(0x3fca40e4)
D (9586) lwip: pbuf_free: deallocating 0x3fca40e4
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[9590]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (10036) lwip: pbuf_alloc(length=37)
D (10036) lwip: pbuf_alloc(length=37) == 0x3fca4104
D (10036) lwip: pbuf_free(0x3fca4104)
D (10046) lwip: pbuf_free: deallocating 0x3fca4104
D (10466) lwip: etharp_timer
D (10466) lwip: dhcp_coarse_tmr()
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[10690]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (11136) lwip: pbuf_alloc(length=37)
D (11136) lwip: pbuf_alloc(length=37) == 0x3fca4098
D (11136) lwip: pbuf_free(0x3fca4098)
D (11146) lwip: pbuf_free: deallocating 0x3fca4098
D (11466) lwip: etharp_timer
D (11466) lwip: dhcp_coarse_tmr()
W (11936) custom_netif_example: No results found!
D (12466) lwip: etharp_timer
D (12466) lwip: dhcp_coarse_tmr()
E (12936) awdl: mdns_query_task
I (12936) custom_netif_example: Query PTR: _airdrop._tcp.local
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[12590]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (13036) lwip: pbuf_alloc(length=37)
D (13036) lwip: pbuf_alloc(length=37) == 0x3fca40b8
D (13036) lwip: pbuf_free(0x3fca40b8)
D (13046) lwip: pbuf_free: deallocating 0x3fca40b8
D (13466) lwip: etharp_timer
D (13466) lwip: dhcp_coarse_tmr()
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[13690]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (14136) lwip: pbuf_alloc(length=37)
D (14136) lwip: pbuf_alloc(length=37) == 0x3fca42d4
D (14136) lwip: pbuf_free(0x3fca42d4)
D (14146) lwip: pbuf_free: deallocating 0x3fca42d4
D (14466) lwip: etharp_timer
D (14466) lwip: dhcp_coarse_tmr()
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[14790]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (15236) lwip: pbuf_alloc(length=37)
D (15236) lwip: pbuf_alloc(length=37) == 0x3fca4150
D (15236) lwip: pbuf_free(0x3fca4150)
D (15246) lwip: pbuf_free: deallocating 0x3fca4150
D (15466) lwip: etharp_timer
D (15466) lwip: dhcp_coarse_tmr()
W (16036) custom_netif_example: No results found!
D (16466) lwip: etharp_timer
D (16466) lwip: dhcp_coarse_tmr()
E (17036) awdl: mdns_query_task
I (17036) custom_netif_example: Query PTR: _airdrop._tcp.local
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[16690]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (17136) lwip: pbuf_alloc(length=37)
D (17136) lwip: pbuf_alloc(length=37) == 0x3fca4170
D (17136) lwip: pbuf_free(0x3fca4170)
D (17146) lwip: pbuf_free: deallocating 0x3fca4170
D (17466) lwip: etharp_timer
D (17466) lwip: dhcp_coarse_tmr()
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[17790]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (18236) lwip: pbuf_alloc(length=37)
D (18236) lwip: pbuf_alloc(length=37) == 0x3fca4170
D (18236) lwip: pbuf_free(0x3fca4170)
D (18246) lwip: pbuf_free: deallocating 0x3fca4170
D (18466) lwip: etharp_timer
D (18466) lwip: dhcp_coarse_tmr()
TX[0][1]: To: ff02:0000:0000:0000:0000:0000:0000:00fb:5353, Packet[18890]:
Q: *U* ._airdrop._tcp.local. PTR IN
D (19336) lwip: pbuf_alloc(length=37)
D (19336) lwip: pbuf_alloc(length=37) == 0x3fca4180
D (19336) lwip: pbuf_free(0x3fca4180)
D (19346) lwip: pbuf_free: deallocating 0x3fca4180
D (19466) lwip: etharp_timer
D (19466) lwip: dhcp_coarse_tmr()
W (20136) custom_netif_example: No results found! |
@archef2000 How exactly does your netif handle multicasts? I saw that you enabled NETIF_FLAG_MLD6 directly in lwip. Is this lwip issue espressif/esp-lwip#72 related? I would guess some memory corruption is taking place in your netif while processing multicast packets. |
Any update? I think the multicasts are not handled correctly in the netif layers, thus closing the issue. |
Answers checklist.
General issue report
I have created a custom esp netif for Apple wireless direct link. Implementation here
Now I am trying to query for the airdrop service of other iPhones.
After I init the netif and registerd it with mdns i query for airdrop here:
/main/wifi/capture.c#L233
But It does not send any udp packet to the custom inetif and also does not find any records.
What are all the required steps for a netif to be seen ready, valid and etc for mdns to send query packets?
Log
The text was updated successfully, but these errors were encountered: