diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c48b45..a363e3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.1.0](https://github.com/rdkcentral/time-utils/compare/1.0.0...1.1.0) + +- RDKEMW-15246: Chrony Enhancements [`#10`](https://github.com/rdkcentral/time-utils/pull/10) +- Merge tag '1.0.0' into develop [`7b147d9`](https://github.com/rdkcentral/time-utils/commit/7b147d92d98dfc8a1e8736a7c29a516f1b011eb5) + #### 1.0.0 +> 22 May 2026 + - RDKEMW-15249 : Implement Chrony control library [`#2`](https://github.com/rdkcentral/time-utils/pull/2) - Create cla.yml [`#1`](https://github.com/rdkcentral/time-utils/pull/1) +- 1.0.0 release changelog updates [`b36fea6`](https://github.com/rdkcentral/time-utils/commit/b36fea68c3aa20d4001ecd602fa2236a8d5f9f50) - Initial commit [`dfc84fa`](https://github.com/rdkcentral/time-utils/commit/dfc84fa09a0d27cea85fad5b6ebe6edaf2f1ea4d) diff --git a/libchronyctl/libchronyctl.c b/libchronyctl/libchronyctl.c index 06b8cb3..24391e3 100644 --- a/libchronyctl/libchronyctl.c +++ b/libchronyctl/libchronyctl.c @@ -669,12 +669,31 @@ int chronyctl_get_source_count(int *count) { RPY_N_Sources n_rpy; ret = receive_reply(sockfd, RPY_N_SOURCES, &n_rpy, offsetof(RPY_N_Sources, EOR)); - if (ret == CHRONYCTL_SUCCESS) - *count = (int)ntohl(n_rpy.source_count); + if (ret != CHRONYCTL_SUCCESS) { + close(sockfd); cleanup_local_socket(); + return ret; + } + + uint32_t total = ntohl(n_rpy.source_count); + int resolved_count = 0; + for (uint32_t i = 0; i < total; i++) { + REQ_Source_Data sd_req; + memset(&sd_req, 0, sizeof(sd_req)); + sd_req.index = htonl(i); + if (send_request(sockfd, REQ_SOURCE_DATA, &sd_req, sizeof(sd_req)) != 0) + continue; + RPY_Source_Data sd_rpy; + if (receive_reply(sockfd, RPY_SOURCE_DATA, &sd_rpy, offsetof(RPY_Source_Data, EOR)) != CHRONYCTL_SUCCESS) + continue; + uint16_t fam = ntohs(sd_rpy.ip_address.family); + if (fam == IPADDR_INET4 || fam == IPADDR_INET6) + resolved_count++; + } + *count = resolved_count; close(sockfd); cleanup_local_socket(); - return ret; + return CHRONYCTL_SUCCESS; } int chronyctl_waitsync(int max_tries, int interval_sec) {