Compare commits

..

7 Commits

Author SHA1 Message Date
4394f845fc Merge pull request #728 from david-cermak/bump/mdns_1.4.3
[mdns]: bump: 1.4.2 -> 1.4.3
2025-01-08 10:24:01 +01:00
9b0ba6060f bump(mdns): 1.4.2 -> 1.4.3
1.4.3
Features
- support zero item when update subtype (5bd82c01)
2025-01-08 09:42:38 +01:00
7c6a3098af Merge pull request #726 from zwx1995esp/feature/support_update_zero_item_of_subtype_for_mdns
feat(mdns): support zero item when update subtype (IDFGH-14369)
2025-01-07 18:40:25 +01:00
f3f3e23bec Merge pull request #727 from david-cermak/fix/sockutls_gai_error
fix(sockutls): Fix gai_strerror() impl to return const string
2025-01-07 15:59:24 +01:00
9ed835ba3f bump(sockutls): 0.2.1 -> 0.2.2
0.2.2
Bug Fixes
- Fix gai_strerror() impl to return const string (f12a2056)
2025-01-07 14:06:42 +01:00
f12a205657 fix(sockutls): Fix gai_strerror() impl to return const string
Previous gai_strerror() returned numeric representation of the code,
but used TLS storage, which might cause issues with stack sizes on all
tasks in the system. Alternatively we can leave the storage to static
only (which wouldn't be thread-safe) or we could one-time allocate and
never free (which is wrong).
This option uses hardcoded strings for common error codes used in lwip.
The disadvantage is that we might need to update the impl in the future
when lwip adds more codes.
2025-01-07 14:06:00 +01:00
zwx
5bd82c01a5 feat(mdns): support zero item when update subtype 2025-01-07 10:28:02 +08:00
10 changed files with 54 additions and 19 deletions

View File

@ -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.4.2
version: 1.4.3
version_files:
- idf_component.yml

View File

@ -1,5 +1,11 @@
# Changelog
## [1.4.3](https://github.com/espressif/esp-protocols/commits/mdns-v1.4.3)
### Features
- support zero item when update subtype ([5bd82c01](https://github.com/espressif/esp-protocols/commit/5bd82c01))
## [1.4.2](https://github.com/espressif/esp-protocols/commits/mdns-v1.4.2)
### Features

View File

@ -1,4 +1,4 @@
version: "1.4.2"
version: "1.4.3"
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"

View File

@ -615,6 +615,8 @@ esp_err_t mdns_service_subtype_add_multiple_items_for_host(const char *instance_
* @param subtype the pointer of subtype array to add.
* @param num_items number of items in subtype array
*
* @note If `num_items` is 0, then remove all subtypes.
*
* @return
* - ESP_OK success
* - ESP_ERR_INVALID_ARG Parameter error

View File

@ -6429,8 +6429,8 @@ esp_err_t mdns_service_subtype_update_multiple_items_for_host(const char *instan
MDNS_SERVICE_LOCK();
esp_err_t ret = ESP_OK;
int cur_index = 0;
ESP_GOTO_ON_FALSE(_mdns_server && _mdns_server->services && !_str_null_or_empty(service_type) && !_str_null_or_empty(proto) &&
(num_items > 0), ESP_ERR_INVALID_ARG, err, TAG, "Invalid state or arguments");
ESP_GOTO_ON_FALSE(_mdns_server && _mdns_server->services && !_str_null_or_empty(service_type) && !_str_null_or_empty(proto),
ESP_ERR_INVALID_ARG, err, TAG, "Invalid state or arguments");
mdns_srv_item_t *s = _mdns_get_service_item_instance(instance_name, service_type, proto, hostname);
ESP_GOTO_ON_FALSE(s, ESP_ERR_NOT_FOUND, err, TAG, "Service doesn't exist");
@ -6450,8 +6450,9 @@ esp_err_t mdns_service_subtype_update_multiple_items_for_host(const char *instan
goto exit;
}
}
_mdns_announce_all_pcbs(&s, 1, false);
if (num_items) {
_mdns_announce_all_pcbs(&s, 1, false);
}
err:
if (ret == ESP_ERR_NO_MEM) {
for (int idx = 0; idx < cur_index; idx++) {

View File

@ -3,6 +3,6 @@ commitizen:
bump_message: 'bump(sockutls): $current_version -> $new_version'
pre_bump_hooks: python ../../ci/changelog.py sock_utils
tag_format: sock_utils-v$version
version: 0.2.1
version: 0.2.2
version_files:
- idf_component.yml

View File

@ -1,5 +1,11 @@
# Changelog
## [0.2.2](https://github.com/espressif/esp-protocols/commits/sock_utils-v0.2.2)
### Bug Fixes
- Fix gai_strerror() impl to return const string ([f12a2056](https://github.com/espressif/esp-protocols/commit/f12a2056))
## [0.2.1](https://github.com/espressif/esp-protocols/commits/sock_utils-v0.2.1)
### Bug Fixes

View File

@ -1,4 +1,4 @@
version: 0.2.1
version: 0.2.2
description: The component provides helper implementation of common system/socket utilities
url: https://github.com/espressif/esp-protocols/tree/master/components/sock_utils
dependencies:

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -18,13 +18,14 @@ extern "C" {
#endif
/**
* @brief Returns a numeric string representing of `getaddrinfo()` error code.
* @brief Returns a string representing of `getaddrinfo()` error code.
*
* @param[in] ecode Error code returned by `getaddrinfo()`.
* @param[in] errcode Error code returned by `getaddrinfo()`.
*
* @return A pointer to a string describing the error.
* @return A pointer to a string containing the error code, for example "EAI_NONAME"
* for EAI_NONAME error type.
*/
const char *gai_strerror(int ecode);
const char *gai_strerror(int errcode);
#ifdef __cplusplus
}

View File

@ -1,17 +1,36 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdio.h>
#include "gai_strerror.h"
#include "lwip/netdb.h"
_Thread_local char gai_strerror_string[32];
#define HANDLE_GAI_ERROR(code) \
case code: return #code;
const char *gai_strerror(int ecode)
const char *gai_strerror(int errcode)
{
if (snprintf(gai_strerror_string, sizeof(gai_strerror_string), "EAI error:%d", ecode) < 0) {
return "gai_strerror() failed";
switch (errcode) {
/* lwip defined DNS codes */
HANDLE_GAI_ERROR(EAI_BADFLAGS)
HANDLE_GAI_ERROR(EAI_FAIL)
HANDLE_GAI_ERROR(EAI_FAMILY)
HANDLE_GAI_ERROR(EAI_MEMORY)
HANDLE_GAI_ERROR(EAI_NONAME)
HANDLE_GAI_ERROR(EAI_SERVICE)
/* other error codes optionally defined in platform/newlib or toolchain */
#ifdef EAI_AGAIN
HANDLE_GAI_ERROR(EAI_AGAIN)
#endif
#ifdef EAI_SOCKTYPE
HANDLE_GAI_ERROR(EAI_SOCKTYPE)
#endif
#ifdef EAI_SYSTEM
HANDLE_GAI_ERROR(EAI_SYSTEM)
#endif
default:
return "Unknown error";
}
return gai_strerror_string;
}