From 33863c7866848d3c22a56567a709896604f49d4e Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Wed, 3 Nov 2021 10:40:15 -0400 Subject: [PATCH] import libell-0.41-4.el9 --- .gitignore | 1 + .libell.metadata | 1 + .../0001-examples-avoid-using-inet_ntoa.patch | 33 +++ SOURCES/0002-ell-avoid-using-inet_ntoa.patch | 269 ++++++++++++++++++ SOURCES/acd-client-nodebug.patch | 12 + SPECS/libell.spec | 195 +++++++++++++ 6 files changed, 511 insertions(+) create mode 100644 .gitignore create mode 100644 .libell.metadata create mode 100644 SOURCES/0001-examples-avoid-using-inet_ntoa.patch create mode 100644 SOURCES/0002-ell-avoid-using-inet_ntoa.patch create mode 100644 SOURCES/acd-client-nodebug.patch create mode 100644 SPECS/libell.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4b30097 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/ell-0.41.tar.xz diff --git a/.libell.metadata b/.libell.metadata new file mode 100644 index 0000000..be7de00 --- /dev/null +++ b/.libell.metadata @@ -0,0 +1 @@ +e551e9576123b2519b547ad31e305c710ab2fa63 SOURCES/ell-0.41.tar.xz diff --git a/SOURCES/0001-examples-avoid-using-inet_ntoa.patch b/SOURCES/0001-examples-avoid-using-inet_ntoa.patch new file mode 100644 index 0000000..df947fa --- /dev/null +++ b/SOURCES/0001-examples-avoid-using-inet_ntoa.patch @@ -0,0 +1,33 @@ +From 4097c1b862eb59f7110d097df7f719d00869191d Mon Sep 17 00:00:00 2001 +Message-Id: <4097c1b862eb59f7110d097df7f719d00869191d.1624267112.git.davide.caratti@gmail.com> +From: Davide Caratti +Date: Wed, 16 Jun 2021 21:22:15 +0200 +Subject: [PATCH 1/2] examples: avoid using inet_ntoa() + +--- + examples/https-server-test.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/examples/https-server-test.c b/examples/https-server-test.c +index 6362722..b626fd2 100644 +--- a/examples/https-server-test.c ++++ b/examples/https-server-test.c +@@ -199,12 +199,13 @@ int main(int argc, char *argv[]) + https_tls_ready, https_tls_disconnected, NULL); + + if (getenv("TLS_DEBUG")) { ++ char buf[INET_ADDRSTRLEN]; + char *str; + + l_tls_set_debug(tls, https_tls_debug_cb, NULL, NULL); + +- str = l_strdup_printf("/tmp/ell-certchain-%s.pem", +- inet_ntoa(client_addr.sin_addr)); ++ inet_ntop(AF_INET,&client_addr.sin_addr, buf, INET_ADDRSTRLEN); ++ str = l_strdup_printf("/tmp/ell-certchain-%s.pem", buf); + l_tls_set_cert_dump_path(tls, str); + l_free(str); + } +-- +2.31.1 + diff --git a/SOURCES/0002-ell-avoid-using-inet_ntoa.patch b/SOURCES/0002-ell-avoid-using-inet_ntoa.patch new file mode 100644 index 0000000..415f0f8 --- /dev/null +++ b/SOURCES/0002-ell-avoid-using-inet_ntoa.patch @@ -0,0 +1,269 @@ +From e2fa5ae4d6eec61d7ca80e07269f86235cef8d60 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <4097c1b862eb59f7110d097df7f719d00869191d.1624267112.git.davide.caratti@gmail.com> +References: <4097c1b862eb59f7110d097df7f719d00869191d.1624267112.git.davide.caratti@gmail.com> +From: Davide Caratti +Date: Wed, 16 Jun 2021 21:22:14 +0200 +Subject: [PATCH 2/2] ell: avoid using inet_ntoa() + +static checkers (like rpminspect) complain about use of inet_ntoa(), as +it relies on a static buffer. Fix this as follows: + + - use inet_ntop() with a buffer of size INET_ADDRSTRLEN allocated in + the stack, similarly to what it is already done for IPv6 addresses + - convert IP_STR() to use NIPQUAD() / NIPQUAD_FMT, similarly to what + is done with MAC addresses +--- + ell/acd.c | 28 +++++++++++++--------------- + ell/dhcp-lease.c | 3 ++- + ell/dhcp-server.c | 37 ++++++++++++++++++------------------- + ell/dhcp.c | 6 ++++-- + ell/rtnl.c | 7 +++++-- + 5 files changed, 42 insertions(+), 39 deletions(-) + +diff --git a/ell/acd.c b/ell/acd.c +index 6989f82..4216898 100644 +--- a/ell/acd.c ++++ b/ell/acd.c +@@ -55,14 +55,11 @@ + #define MAC "%02x:%02x:%02x:%02x:%02x:%02x" + #define MAC_STR(a) a[0], a[1], a[2], a[3], a[4], a[5] + +-#define IP_STR(uint_ip) \ +-({ \ +- struct in_addr _in; \ +- char *_out; \ +- _in.s_addr = uint_ip; \ +- _out = inet_ntoa(_in); \ +- _out; \ +-}) ++#define NIPQUAD_FMT "%u.%u.%u.%u" ++#define NIPQUAD(u32_ip) ((unsigned char *) &u32_ip)[0], \ ++ ((unsigned char *) &u32_ip)[1], \ ++ ((unsigned char *) &u32_ip)[2], \ ++ ((unsigned char *) &u32_ip)[3] + + #define ACD_DEBUG(fmt, args...) \ + l_util_debug(acd->debug_handler, acd->debug_data, \ +@@ -146,7 +143,8 @@ static int acd_send_packet(struct l_acd *acd, uint32_t source_ip) + p.arp_pln = 4; + p.arp_op = htons(ARPOP_REQUEST); + +- ACD_DEBUG("sending packet with target IP %s", IP_STR(acd->ip)); ++ ACD_DEBUG("sending packet with target IP "NIPQUAD_FMT, ++ NIPQUAD(acd->ip)); + + memcpy(&p.arp_sha, acd->mac, ETH_ALEN); + memcpy(&p.arp_spa, &source_ip, sizeof(p.arp_spa)); +@@ -165,8 +163,8 @@ static void announce_wait_timeout(struct l_timeout *timeout, void *user_data) + struct l_acd *acd = user_data; + + if (acd->state == ACD_STATE_PROBE) { +- ACD_DEBUG("No conflicts found for %s, announcing address", +- IP_STR(acd->ip)); ++ ACD_DEBUG("No conflicts found for "NIPQUAD_FMT ", announcing address", ++ NIPQUAD(acd->ip)); + + acd->state = ACD_STATE_ANNOUNCED; + +@@ -284,17 +282,17 @@ static bool acd_read_handler(struct l_io *io, void *user_data) + !memcmp(arp.arp_tpa, &acd->ip, sizeof(uint32_t)); + + if (!source_conflict && !target_conflict) { +- ACD_DEBUG("No target or source conflict detected for %s", +- IP_STR(acd->ip)); ++ ACD_DEBUG("No target or source conflict detected for "NIPQUAD_FMT, ++ NIPQUAD(acd->ip)); + return true; + } + + switch (acd->state) { + case ACD_STATE_PROBE: + /* No reason to continue probing */ +- ACD_DEBUG("%s conflict detected for %s", ++ ACD_DEBUG("%s conflict detected for "NIPQUAD_FMT, + target_conflict ? "Target" : "Source", +- IP_STR(acd->ip)); ++ NIPQUAD(acd->ip)); + + if (acd->event_func) + acd->event_func(L_ACD_EVENT_CONFLICT, acd->user_data); +diff --git a/ell/dhcp-lease.c b/ell/dhcp-lease.c +index 44c815f..94b67b4 100644 +--- a/ell/dhcp-lease.c ++++ b/ell/dhcp-lease.c +@@ -178,12 +178,13 @@ error: + static inline char *get_ip(uint32_t ip) + { + struct in_addr addr; ++ char buf[INET_ADDRSTRLEN]; + + if (ip == 0) + return NULL; + + addr.s_addr = ip; +- return l_strdup(inet_ntoa(addr)); ++ return l_strdup(inet_ntop(AF_INET, &addr, buf, INET_ADDRSTRLEN)); + } + + LIB_EXPORT char *l_dhcp_lease_get_address(const struct l_dhcp_lease *lease) +diff --git a/ell/dhcp-server.c b/ell/dhcp-server.c +index 34512ae..4a6b3f6 100644 +--- a/ell/dhcp-server.c ++++ b/ell/dhcp-server.c +@@ -92,14 +92,11 @@ struct l_dhcp_server { + #define MAC "%02x:%02x:%02x:%02x:%02x:%02x" + #define MAC_STR(a) a[0], a[1], a[2], a[3], a[4], a[5] + +-#define IP_STR(uint_ip) \ +-({ \ +- struct in_addr _in; \ +- char *_out; \ +- _in.s_addr = uint_ip; \ +- _out = inet_ntoa(_in); \ +- _out; \ +-}) ++#define NIPQUAD_FMT "%u.%u.%u.%u" ++#define NIPQUAD(u32_ip) ((unsigned char *) &u32_ip)[0], \ ++ ((unsigned char *) &u32_ip)[1], \ ++ ((unsigned char *) &u32_ip)[2], \ ++ ((unsigned char *) &u32_ip)[3] + + #define SERVER_DEBUG(fmt, args...) \ + l_util_debug(server->debug_handler, server->debug_data, \ +@@ -286,8 +283,8 @@ static struct l_dhcp_lease *add_lease(struct l_dhcp_server *server, + l_queue_push_head(server->lease_list, lease); + } + +- SERVER_DEBUG("added lease IP %s for "MAC " lifetime=%u", +- IP_STR(yiaddr), MAC_STR(chaddr), ++ SERVER_DEBUG("added lease IP "NIPQUAD_FMT " for "MAC " lifetime=%u", ++ NIPQUAD(yiaddr), MAC_STR(chaddr), + server->lease_seconds); + + return lease; +@@ -477,8 +474,8 @@ static void send_offer(struct l_dhcp_server *server, + + _dhcp_message_builder_finalize(&builder, &len); + +- SERVER_DEBUG("Sending OFFER of %s to "MAC, IP_STR(reply->yiaddr), +- MAC_STR(reply->chaddr)); ++ SERVER_DEBUG("Sending OFFER of "NIPQUAD_FMT " to "MAC, ++ NIPQUAD(reply->yiaddr), MAC_STR(reply->chaddr)); + + if (server->transport->l2_send(server->transport, server->address, + DHCP_PORT_SERVER, +@@ -561,7 +558,7 @@ static void send_ack(struct l_dhcp_server *server, + + _dhcp_message_builder_finalize(&builder, &len); + +- SERVER_DEBUG("Sending ACK to %s", IP_STR(reply->yiaddr)); ++ SERVER_DEBUG("Sending ACK to "NIPQUAD_FMT, NIPQUAD(reply->yiaddr)); + + if (server->transport->l2_send(server->transport, server->address, + DHCP_PORT_SERVER, reply->ciaddr, +@@ -628,15 +625,15 @@ static void listener_event(const void *data, size_t len, void *user_data) + + switch (type) { + case DHCP_MESSAGE_TYPE_DISCOVER: +- SERVER_DEBUG("Received DISCOVER, requested IP %s", +- IP_STR(requested_ip_opt)); ++ SERVER_DEBUG("Received DISCOVER, requested IP "NIPQUAD_FMT, ++ NIPQUAD(requested_ip_opt)); + + send_offer(server, message, lease, requested_ip_opt); + + break; + case DHCP_MESSAGE_TYPE_REQUEST: +- SERVER_DEBUG("Received REQUEST, requested IP %s", +- IP_STR(requested_ip_opt)); ++ SERVER_DEBUG("Received REQUEST, requested IP "NIPQUAD_FMT, ++ NIPQUAD(requested_ip_opt)); + + if (requested_ip_opt == 0) { + requested_ip_opt = message->ciaddr; +@@ -760,6 +757,7 @@ LIB_EXPORT void l_dhcp_server_destroy(struct l_dhcp_server *server) + + LIB_EXPORT bool l_dhcp_server_start(struct l_dhcp_server *server) + { ++ char buf[INET_ADDRSTRLEN]; + struct in_addr ia; + + if (unlikely(!server)) +@@ -846,11 +844,12 @@ LIB_EXPORT bool l_dhcp_server_start(struct l_dhcp_server *server) + l_acd_set_defend_policy(server->acd, L_ACD_DEFEND_POLICY_INFINITE); + + ia.s_addr = server->address; ++ inet_ntop(AF_INET, &ia, buf, INET_ADDRSTRLEN); + + /* In case of unit testing we don't want this to be a fatal error */ +- if (!l_acd_start(server->acd, inet_ntoa(ia))) { ++ if (!l_acd_start(server->acd, buf)) { + SERVER_DEBUG("Failed to start ACD on %s, continuing without", +- IP_STR(server->address)); ++ buf); + + l_acd_destroy(server->acd); + server->acd = NULL; +diff --git a/ell/dhcp.c b/ell/dhcp.c +index fff1645..bd346cc 100644 +--- a/ell/dhcp.c ++++ b/ell/dhcp.c +@@ -778,6 +778,7 @@ static void dhcp_client_rx_message(const void *data, size_t len, void *userdata) + struct l_dhcp_client *client = userdata; + const struct dhcp_message *message = data; + struct dhcp_message_iter iter; ++ char buf[INET_ADDRSTRLEN]; + uint8_t msg_type = 0; + uint8_t t, l; + const void *v; +@@ -911,11 +912,12 @@ static void dhcp_client_rx_message(const void *data, size_t len, void *userdata) + l_acd_set_skip_probes(client->acd, true); + + ia.s_addr = client->lease->address; ++ inet_ntop(AF_INET, &ia, buf, INET_ADDRSTRLEN); + + /* For unit testing we don't want this to be a fatal error */ +- if (!l_acd_start(client->acd, inet_ntoa(ia))) { ++ if (!l_acd_start(client->acd, buf)) { + CLIENT_DEBUG("Failed to start ACD on %s, continuing", +- inet_ntoa(ia)); ++ buf); + l_acd_destroy(client->acd); + client->acd = NULL; + } +diff --git a/ell/rtnl.c b/ell/rtnl.c +index 957e749..2983013 100644 +--- a/ell/rtnl.c ++++ b/ell/rtnl.c +@@ -752,6 +752,7 @@ LIB_EXPORT uint32_t l_rtnl_set_powered(struct l_netlink *rtnl, int ifindex, + LIB_EXPORT void l_rtnl_ifaddr4_extract(const struct ifaddrmsg *ifa, int bytes, + char **label, char **ip, char **broadcast) + { ++ char buf[INET_ADDRSTRLEN]; + struct in_addr in_addr; + struct rtattr *attr; + +@@ -763,7 +764,8 @@ LIB_EXPORT void l_rtnl_ifaddr4_extract(const struct ifaddrmsg *ifa, int bytes, + break; + + in_addr = *((struct in_addr *) RTA_DATA(attr)); +- *ip = l_strdup(inet_ntoa(in_addr)); ++ *ip = l_strdup(inet_ntop(AF_INET, &in_addr, buf, ++ INET_ADDRSTRLEN)); + + break; + case IFA_BROADCAST: +@@ -771,7 +773,8 @@ LIB_EXPORT void l_rtnl_ifaddr4_extract(const struct ifaddrmsg *ifa, int bytes, + break; + + in_addr = *((struct in_addr *) RTA_DATA(attr)); +- *broadcast = l_strdup(inet_ntoa(in_addr)); ++ *broadcast = l_strdup(inet_ntop(AF_INET, &in_addr, buf, ++ INET_ADDRSTRLEN)); + + break; + case IFA_LABEL: +-- +2.31.1 + diff --git a/SOURCES/acd-client-nodebug.patch b/SOURCES/acd-client-nodebug.patch new file mode 100644 index 0000000..687ff02 --- /dev/null +++ b/SOURCES/acd-client-nodebug.patch @@ -0,0 +1,12 @@ +diff --git a/examples/acd-client.c b/examples/acd-client.c +index e737288..71e14ef 100644 +--- a/examples/acd-client.c ++++ b/examples/acd-client.c +@@ -107,7 +107,6 @@ int main(int argc, char *argv[]) + bool no_probe = false; + + l_log_set_stderr(); +- l_debug_enable("*"); + + if (argc < 3) { + usage(); diff --git a/SPECS/libell.spec b/SPECS/libell.spec new file mode 100644 index 0000000..a97ad18 --- /dev/null +++ b/SPECS/libell.spec @@ -0,0 +1,195 @@ +Name: libell +Version: 0.41 +Release: 4%{?dist} +Summary: Embedded Linux library +License: LGPLv2+ +URL: https://01.org/ell +Source0: https://www.kernel.org/pub/linux/libs/ell/ell-%{version}.tar.xz + +Patch0: acd-client-nodebug.patch +Patch1: 0001-examples-avoid-using-inet_ntoa.patch +Patch2: 0002-ell-avoid-using-inet_ntoa.patch + +BuildRequires: gcc +BuildRequires: make + +%description +The Embedded Linux* Library (ELL) provides core, low-level functionality for +system daemons. It typically has no dependencies other than the Linux kernel, C +standard library, and libdl (for dynamic linking). While ELL is designed to be +efficient and compact enough for use on embedded Linux platforms, it is not +limited to resource-constrained systems. + + +%package devel +Summary: Embedded Linux library development files +Requires: %{name}%{?_isa} = %{version}-%{release} + + +%description devel +Headers for developing against libell. + + +%prep +%autosetup -p1 -n ell-%{version} + + +%build +%configure +%make_build V=1 + + +%install +%make_install +find %{buildroot} -type f -name "*.la" -delete + + +%ldconfig_scriptlets + + +%files +%license COPYING +%doc AUTHORS ChangeLog +%{_libdir}/libell.so.* + + +%files devel +%{_includedir}/ell +%{_libdir}/libell.so +%{_libdir}/pkgconfig/ell.pc + + +%changelog +* Mon Aug 09 2021 Mohan Boddu - 0.41-4 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Thu Jun 24 2021 Davide Caratti - 0.41-3 +- bump NVR to trigger CI + +* Thu Jun 24 2021 Davide Caratti - 0.41-2 +- add gating test that uses acd-client.c. Related: rhbz#1973511 +- drop tests dependency on libell-devel. Related: rhbz#1973511 + +* Mon Jun 21 2021 Davide Caratti - 0.41-1 +- Avoid use of inet_ntoa(). Related: rhbz#1967524 +- Update to 0.41. Related: rhbz#1967524 + +* Fri Apr 16 2021 Mohan Boddu - 0.39-2 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Tue Mar 30 2021 Peter Robinson - 0.39-1 +- Update to 0.39 + +* Thu Feb 18 2021 Peter Robinson - 0.38-1 +- Update to 0.38 + +* Tue Jan 26 2021 Fedora Release Engineering - 0.36-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Mon Jan 11 2021 Peter Robinson - 0.36-1 +- Update to 0.36 + +* Tue Dec 1 2020 Peter Robinson - 0.35-1 +- Update to 0.35 + +* Sun Sep 06 2020 Peter Robinson - 0.33-1 +- Update to 0.33 + +* Sat Aug 01 2020 Fedora Release Engineering - 0.32-3 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 0.32-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jun 15 2020 Peter Robinson - 0.32-1 +- Update to 0.32 + +* Wed Mar 25 2020 Peter Robinson - 0.30-1 +- Update to 0.30 release + +* Sun Feb 9 2020 Peter Robinson 0.28-1 +- Update to 0.28 release + +* Wed Jan 29 2020 Fedora Release Engineering - 0.27-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Sat Dec 14 2019 Peter Robinson 0.27-1 +- Update to 0.27 release + +* Wed Oct 30 2019 Lubomir Rintel - 0.26-1 +- Update to 0.26 release + +* Fri Oct 25 2019 Peter Robinson - 0.25-1 +- Update to 0.25 release + +* Fri Oct 11 2019 Peter Robinson 0.24-1 +- Update to 0.24 release + +* Fri Sep 20 2019 Peter Robinson 0.23-1 +- Update to 0.23 release + +* Thu Aug 29 2019 Peter Robinson 0.22-1 +- Update to 0.22 release + +* Mon Aug 05 2019 Lubomir Rintel - 0.21-1 +- Update to 0.21 release + +* Thu Jul 25 2019 Fedora Release Engineering - 0.20-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sun May 12 2019 Peter Robinson 0.20-1 +- Update to 0.20 release + +* Mon Apr 15 2019 Peter Robinson 0.19-1 +- Update to 0.19 release + +* Thu Apr 4 2019 Peter Robinson 0.18-1 +- Update to 0.18 release + +* Fri Feb 01 2019 Fedora Release Engineering - 0.17-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Jan 17 2019 Peter Robinson 0.17-1 +- Update to 0.17 release + +* Wed Dec 12 2018 Peter Robinson 0.16-1 +- Update to 0.16 release + +* Fri Nov 16 2018 Peter Robinson 0.15-1 +- Update to 0.15 release + +* Sat Nov 10 2018 Peter Robinson 0.14-1 +- Update to 0.14 release + +* Sat Oct 6 2018 Peter Robinson 0.11-1 +- Update to 0.11 release + +* Mon Sep 24 2018 Lubomir Rintel - 0.9-1 +- Update to 0.9 release + +* Sat Aug 11 2018 Lubomir Rintel - 0.8-1 +- Update to 0.8 release + +* Fri Jul 13 2018 Fedora Release Engineering - 0.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Mon May 14 2018 Lubomir Rintel - 0.5-1 +- Update to 0.5 release + +* Wed Feb 07 2018 Fedora Release Engineering - 0.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Oct 26 2017 Lubomir Rintel - 0.2-2 +- Renamed to libell to fix a naming conflict +- Addressed review issues (Igor Gnatenko, #1505237): +- Added BR gcc +- Made build verbose +- Moved pkgconfig file to devel subpackage +- Fixed license tag +- Dropped Group tag +- Packaged changelog + +* Sun Oct 22 2017 Lubomir Rintel - 0.2-1 +- Initial packaging