diff --git a/components/mdns/.cz.yaml b/components/mdns/.cz.yaml index 2b6a74492..af0294cac 100644 --- a/components/mdns/.cz.yaml +++ b/components/mdns/.cz.yaml @@ -3,6 +3,6 @@ commitizen: bump_message: 'bump(mdns): $current_version -> $new_version' pre_bump_hooks: python ../../ci/changelog.py mdns tag_format: mdns-v$version - version: 1.8.2 + version: 1.9.0 version_files: - idf_component.yml diff --git a/components/mdns/CHANGELOG.md b/components/mdns/CHANGELOG.md index 75a81db10..d252397ac 100644 --- a/components/mdns/CHANGELOG.md +++ b/components/mdns/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## [1.9.0](https://github.com/espressif/esp-protocols/commits/mdns-v1.9.0) + +### Features + +- support null value for boolean txt records ([fa96de3b](https://github.com/espressif/esp-protocols/commit/fa96de3b)) + +### Bug Fixes + +- Add test case for bool/NULL txt handling ([5068f221](https://github.com/espressif/esp-protocols/commit/5068f221)) +- Temporary fix for build issues on IDF master ([0197c994](https://github.com/espressif/esp-protocols/commit/0197c994)) +- Add tests for delegated answers ([487a746d](https://github.com/espressif/esp-protocols/commit/487a746d)) +- Add fuzzing into mdns CI ([af6bb1b5](https://github.com/espressif/esp-protocols/commit/af6bb1b5)) +- Host test to use hw_support include dir ([8bba3a97](https://github.com/espressif/esp-protocols/commit/8bba3a97)) +- Fixes case where we create our own malloc/free allocators, therefore we need to call mdns_mem_free and not free ([63bf7091](https://github.com/espressif/esp-protocols/commit/63bf7091)) +- put srv/txt records in additional section for ptr queries ([b7b8c5db](https://github.com/espressif/esp-protocols/commit/b7b8c5db)) + +### Updated + +- ci(common): Update test component dir for IDFv6.0 ([18418c83](https://github.com/espressif/esp-protocols/commit/18418c83)) + ## [1.8.2](https://github.com/espressif/esp-protocols/commits/mdns-v1.8.2) ### Bug Fixes diff --git a/components/mdns/idf_component.yml b/components/mdns/idf_component.yml index d331c24f5..27d43558d 100644 --- a/components/mdns/idf_component.yml +++ b/components/mdns/idf_component.yml @@ -1,4 +1,4 @@ -version: "1.8.2" +version: "1.9.0" description: "Multicast UDP service used to provide local network service and host discovery." url: "https://github.com/espressif/esp-protocols/tree/master/components/mdns" issues: "https://github.com/espressif/esp-protocols/issues" diff --git a/components/mdns/tests/unit_test/main/test_mdns.c b/components/mdns/tests/unit_test/main/test_mdns.c index 6b9bfbe1d..6ad72d652 100644 --- a/components/mdns/tests/unit_test/main/test_mdns.c +++ b/components/mdns/tests/unit_test/main/test_mdns.c @@ -61,6 +61,45 @@ TEST(mdns, init_deinit) esp_event_loop_delete_default(); } +TEST(mdns, boolean_txt_null_value) +{ + mdns_result_t *results = NULL; + test_case_uses_tcpip(); + TEST_ASSERT_EQUAL(ESP_OK, esp_event_loop_create_default()); + TEST_ASSERT_EQUAL(ESP_OK, mdns_init()); + TEST_ASSERT_EQUAL(ESP_OK, mdns_hostname_set(MDNS_HOSTNAME)); + + TEST_ASSERT_EQUAL(ESP_OK, mdns_service_add(MDNS_INSTANCE, MDNS_SERVICE_NAME, MDNS_SERVICE_PROTO, MDNS_SERVICE_PORT, NULL, 0)); + + mdns_txt_item_t txt_data[] = { + {"bool", NULL}, + {"key", "value"}, + }; + const size_t txt_data_count = sizeof(txt_data) / sizeof(txt_data[0]); + TEST_ASSERT_EQUAL(ESP_OK, mdns_service_txt_set(MDNS_SERVICE_NAME, MDNS_SERVICE_PROTO, txt_data, txt_data_count)); + yield_to_all_priorities(); + + TEST_ASSERT_EQUAL(ESP_OK, mdns_lookup_selfhosted_service(NULL, MDNS_SERVICE_NAME, MDNS_SERVICE_PROTO, 1, &results)); + TEST_ASSERT_NOT_EQUAL(NULL, results); + TEST_ASSERT_NOT_EQUAL(NULL, results->txt); + TEST_ASSERT_EQUAL(txt_data_count, results->txt_count); + + bool found_bool = false; + for (size_t i = 0; i < results->txt_count; ++i) { + if (strcmp(results->txt[i].key, "bool") == 0) { + TEST_ASSERT_NOT_EQUAL(NULL, results->txt_value_len); + TEST_ASSERT_EQUAL_UINT8(0, results->txt_value_len[i]); + found_bool = true; + } + } + TEST_ASSERT_TRUE(found_bool); + mdns_query_results_free(results); + + TEST_ASSERT_EQUAL(ESP_OK, mdns_service_remove(MDNS_SERVICE_NAME, MDNS_SERVICE_PROTO)); + mdns_free(); + esp_event_loop_delete_default(); +} + TEST(mdns, api_fails_with_expected_err) { mdns_txt_item_t serviceTxtData[CONFIG_MDNS_MAX_SERVICES] = { {NULL, NULL}, @@ -290,6 +329,7 @@ TEST_GROUP_RUNNER(mdns) RUN_TEST_CASE(mdns, init_deinit) RUN_TEST_CASE(mdns, add_remove_service) RUN_TEST_CASE(mdns, add_remove_deleg_service) + RUN_TEST_CASE(mdns, boolean_txt_null_value) }