Commit graph

102 commits

Author SHA1 Message Date
David Cermak 4b59f7e2c7 mdns: limit the GOT_IP6_EVENT to only known network interfaces 2020-04-01 08:52:54 +02:00
David Cermak ecca39e19f mdns: fixed typos in the variable names and the comments 2020-01-09 12:50:13 +00:00
Angus Gratton f0680b99b3 Merge branch 'bugfix/mdns_netif_local' into 'master'
mdns: fix preset of esp_netif ptr for local interfaces

Closes WIFI-1538

See merge request espressif/esp-idf!7009
2019-12-20 12:53:50 +08:00
David Cermak eaa2f12d67 mdns: fixed crash on event during deinit
mdns library deinitialization destroys internal structures including action queue. if an event (e.g. network update) received
after some essential stucture is destoyed, an unexpected behavour might be introduced (e.g. crash of adding the event notification
to the action queue which was already destroyed

Closes WIFI-1485
2019-12-17 18:18:22 +00:00
David Cermak 09e36f9f33 mdns: fix preset of esp_netif ptr for local interfaces
mdns module store local copy of esp_netif for common interfaces,
but it was correctly initialized only when interface started.
If the event were missed (e.g. mdns_init after interface start)
the local copy wouldn't be initialized. Fixed by restoring the local
copy.

Closes WIFI-1538
2019-12-16 15:39:23 +01:00
David Cermak de17a1487f mdns: respond to discovery with the proper pseudo name _services._dns-sd._udp
Closes https://github.com/espressif/esp-idf/issues/4369
Closes IDFGH-2219
2019-12-04 12:57:09 +00:00
David Cermak d9433ef692 mdns: fixed forgotten merge conflicts in debug code 2019-11-22 10:31:06 +01:00
Ivan Grokhotkov 5884b80908 mdns: add missing include of esp_task.h 2019-11-14 18:02:26 +01:00
Ivan Grokhotkov 503c37e013 Merge branch 'bugfix/mdns_configure_task_params' into 'master'
mdns: add configuration values for task priority, affinity and internal service timeouts

See merge request espressif/esp-idf!6580
2019-11-14 21:30:50 +08:00
David Cermak 7f5cda1b82 tcpip_adapter: updated tcpip_adapter compatablity layer to include all
public API and keep 100% backward compatibility
update build of tcpip adapter when ethernet disabled
2019-11-13 12:36:25 +01:00
David Cermak 19e24fe61e mdns: update mdns to use esp-netif for mdns supported services such as STA, AP, ETH
removes also include dependency on lwip to use esp_netif defined address fields and structures
2019-11-13 12:36:25 +01:00
David Cermak ffe043b1a8 esp_netif: Introduction of esp-netif component as a replacement of tcpip_adpter
- provides object oriented access to network intefaces
- not limited to default netifs
- more generic abstraction to network input output functions
- event handler registration removed from component responsibility
- backward compatibility layer for legacy tcpip_apapter APIs

Closes IDF-39
2019-11-13 12:36:25 +01:00
David Cermak ec9f245dd3 examples: removed ip4addr_ntoa and used prefered IP2STR for displaying IP addresses 2019-11-13 12:36:25 +01:00
David Cermak c6f38f04f8 mdns: add configuration values for task priority, affinity and internal service timeouts
closes https://github.com/espressif/esp-idf/issues/4217
2019-11-08 16:29:40 +01:00
Angus Gratton 055cc251b7 Merge branch 'feature/esp32s2beta_merge' into 'master'
esp32s2beta: Merge support to master

Closes IDF-513, IDF-756, IDF-758, IDF-999, IDF-753, IDF-749, IDF-754, IDF-840, and IDF-755

See merge request espressif/esp-idf!6100
2019-10-29 13:02:01 +08:00
Marius Vikhammer 3d1170031b mdns: fix crash for hostname queries
Receiving TXT, PTR, SDPTR and SRV record type queries would crash the application if the hostname
 was used as instance name.

Closes https://github.com/espressif/esp-idf/issues/4224
2019-10-25 03:56:38 +00:00
Angus Gratton 8675a818f9 Merge branch 'master' into feature/esp32s2beta_merge 2019-10-22 13:51:49 +11:00
David Cermak 7f410a0bcb mdns: fix possible race condition when checking DHCP status on WIFI_EVENT_STA_CONNECTED event.
tcpip_adapter_dhcpc_get_status() returns the actual internal value of dhcp client without any locking or TCP/IP stack context call, so when CONNECTED event fired with default settings it started DHCP client in TCP/IP stack context and at the same time mdns event handler checking actual DHCP state, which could still be INIT (not STARTED). Purpose of this check is to enable PCB if DHCP was stopped before setting network interface up (typically static IP settings), so the solutin is to check against TCPIP_ADAPTER_DHCP_STOPPED state
2019-10-15 07:07:00 +00:00
Angus Gratton 496ede9bcd Merge branch 'master' into feature/esp32s2beta_merge 2019-10-15 14:59:27 +11:00
Ivan Grokhotkov 569ad7545c esp_event, mdns: fixes for CONFIG_ETH_ENABLED=n 2019-10-03 10:52:53 +02:00
David Cermak e5e31c5d01 mdns: use constant size of AAAA answer in mdns packets instead of deriving from lwip struct size, since the struct could contain also zones
closes WIFI-771
2019-09-24 12:12:58 +02:00
Angus Gratton 438d513a95 Merge branch 'master' into feature/esp32s2beta_merge 2019-09-16 16:18:48 +10:00
liu zhifu 003a9872b7 esp_wifi: wifi support new event mechanism
1. WiFi support new event mechanism
2. Update examples to use new event mechanism
2019-08-20 09:39:51 +00:00
Angus Gratton 6990a7cd54 Merge branch 'master' into feature/esp32s2beta_update 2019-08-19 15:03:43 +10:00
David Cermak a001998d52 mdns: fix missing bye packet if services removed with mdns_service_remove_all() or mdns_free()
Closes https://github.com/espressif/esp-idf/issues/3660
2019-08-14 05:54:54 +00:00
Angus Gratton 04ae56806c Merge branch 'master' into feature/esp32s2beta_update 2019-08-08 15:26:58 +10:00
Angus Gratton 24d26fccde Merge branch 'master' into feature/esp32s2beta_update 2019-08-08 13:44:24 +10:00
Michael Zimmermann c2764f6fe8 mdns: mdns_service_remove_all doesn't take an argument
Merges https://github.com/espressif/esp-idf/pull/2937
2019-08-01 16:28:56 +07:00
Anton Maklakov afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
Angus Gratton 1b6010bedf Merge branch 'bugfix/mdns_fix_discard_packet_on_invalid_name' into 'master'
mdns: fix ignoring mdns packet if contained an invalid name entries in question field

See merge request espressif/esp-idf!5307
2019-07-27 17:25:25 +08:00
suda-morris 90c4827bd2 add esp_eth component 2019-06-26 10:19:23 +08:00
Renz Christian Bagaporo 9eccd7c082 components: use new component registration api 2019-06-21 19:53:29 +08:00
Angus Gratton 8aa6fb241d Merge branch 'bugfix/malloc_warnings_mdns' into 'master'
mdns: fix static analysis warnings

See merge request idf/esp-idf!5143
2019-06-21 13:10:06 +08:00
David Cermak 4bd4c7caf3 mdns: fix ignoring mdns packet with some invalid name entries in question field
In case of invalid name entry, only this entry is invalidated and parsing continues as other query entries could contain questions to be responded to
2019-06-20 14:25:12 +02:00
David Cermak e6801912c5 mdns: added initial suite of api unit tests 2019-06-12 08:18:25 +02:00
suda-morris 84b2f9f14d build and link hello-world for esp32s2beta 2019-06-11 13:07:37 +08:00
David Cermak c34de4cba6 mdns: fix static analysis warnings 2019-06-10 13:21:07 +00:00
David Cermak 38d15cbd63 mdns tests: adapt mdns fuzzer test to compile with event loop library 2019-05-27 16:31:25 +02:00
David Cermak af48977f21 mdns: fixed mdns crashing on reception of txt packet without a corresponding service
closes #2866
2019-05-03 16:37:43 +02:00
David Cermak c050a75616 mdns: use const char* for mdns txt items types to remove warning when assigning 2019-05-03 16:31:32 +02:00
David Cermak a851aac255 mdns: updated doxygen comments documenting mdns api
Closes https://github.com/espressif/esp-idf/issues/1718
2019-05-03 16:29:12 +02:00
David Cermak eddd5c4f2c mdns: update mdns_out_question_s to be in line with mdns_parsed_question_s struct
Closes  https://github.com/espressif/esp-idf/issues/1568
2019-05-03 14:54:59 +02:00
Ivan Grokhotkov a2d59525e5 mdns: use esp_event library to handle events 2019-04-11 12:04:58 +08:00
David Cermak bc60bbbeaf fuzzer tests: update of mdns and lwip host compilation for fuzzer testing
Closes IDF-540
2019-03-22 11:37:26 +01:00
David Cermak 265e983a45 mdns: fix possible crash when probing on particular interface with duplicated service instances due to naming conflicts on network
Issue: MDNS server initially sends probing packets to resolve naming confilicts with already registered service instances. In case of a conflict, instance name is altered and probing restarts. Original instance however wasnnot removed from the structure and upon service removal only one entry was removed and a dangling service might have been kept in the structure to bring about a crash.
Resolution: Keep only one instance of a service in the probing structure.

Closes IDF-498
2019-03-13 10:22:41 +01:00
David Cermak c87f0cb6ca mdns: enable pcbs before starting service thread to avoid updating pcb's internal variables from concurent tasks
possible race condition: user task runs mdns_init, which enables pcbs while mdns-task already created could execute enable/disable of the same pcbs if an appropriate system event received
2019-03-13 10:22:41 +01:00
David Cermak 48b5501c25 mdns: fix possible deadlock on mdns deinit calling mdns_free()
mnds_free() initiates stop and delete timer tasks, which after locking the mutex could lead to a dead lock in case timer task executed before deleting the task, as it would wait indefinitelly for unlocking the mutex. This condition is fixed by calling _mdns_stop_timer without locking the mutex, because there's no need to protect any data when stopping and deleting the timer task

Closes https://github.com/espressif/esp-idf/issues/1696
2019-03-13 10:22:41 +01:00
David Cermak 021dc5d453 mdsn: fix race condition in updating packet data from user task when failed to allocate or queue a new service
Issue: mdns_service_add API allocates and queues an action to be processed in mdns task context; when allocation or queueing fails, allocated structure needs to be freed. Function _mdns_free_service did not only fee all the structures, but also updates packet data.
Resolution: Moved removal of packet data outside of _mdns_free_service function.
2019-03-13 10:22:41 +01:00
David Cermak 67051a286b mdns: fix possible crash when packet scheduled to transmit contained service which might have been already removed
packets scheduled to transmit are pushed to action queue and removed from tx_queue_head structure, which is searched for all remaining services and while service is removed, then service questions/asnwers are also removed from this structure. This update fixes possible crash when packet is pushed to action queue, and when service is removed, its answers are removed from tx_queue_head, but not from action queue. this could lead to a crash when the packet is poped from action queue containing questions/answers to already removed (freed) service

Closes IDF-504
2019-03-13 10:22:41 +01:00
Ivan Grokhotkov eef0b5090a mdns: use binary semaphore instead of mutex when searching
mdns_search_once_t::lock is used to synchronize tasks (taken by one
task and given by the other) so it should not be a mutex.
Convert to semaphore, and rename to indicate its purpose.
2019-03-12 09:33:06 +01:00