From f4c9e27b32e419ffdbe4e89df6741fe102f7a3d3 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 31 Aug 2022 23:59:32 -0700 Subject: [PATCH] zabbix: Upgrade to 6.2.2 Fix build on musl while here Signed-off-by: Khem Raj --- .../0001-initialize-msghdr-portably.patch | 52 +++++++++++++++++++ .../{zabbix_6.2.1.bb => zabbix_6.2.2.bb} | 4 +- 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 meta-oe/recipes-connectivity/zabbix/zabbix/0001-initialize-msghdr-portably.patch rename meta-oe/recipes-connectivity/zabbix/{zabbix_6.2.1.bb => zabbix_6.2.2.bb} (95%) diff --git a/meta-oe/recipes-connectivity/zabbix/zabbix/0001-initialize-msghdr-portably.patch b/meta-oe/recipes-connectivity/zabbix/zabbix/0001-initialize-msghdr-portably.patch new file mode 100644 index 0000000000..a7a1dc1986 --- /dev/null +++ b/meta-oe/recipes-connectivity/zabbix/zabbix/0001-initialize-msghdr-portably.patch @@ -0,0 +1,52 @@ +From 37b662cf44e14b33e93759d4b129d23095b41372 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 31 Aug 2022 23:55:02 -0700 +Subject: [PATCH] initialize msghdr portably + +on linux we have musl as an option for system C library and current +initialization assumes the structure to be same as glibc, therefore +initialize the elements of structure instead, so it can work on both +glibc and musl. + +Fixes +net.c:115:79: error: incompatible pointer to integer conversion initializing 'int' with an expression of type 'void *' [-Wint-conversion] + struct msghdr s_msg = { (void *)&s_sa, sizeof(struct sockaddr_nl), s_io, 1, NULL, 0, 0}; + ^~~~ + +Upstream-Status: Submitted [https://github.com/zabbix/zabbix/pull/77] +Signed-off-by: Khem Raj +--- + src/libs/zbxsysinfo/linux/net.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/libs/zbxsysinfo/linux/net.c b/src/libs/zbxsysinfo/linux/net.c +index 1425a3604d..98f03de0dd 100644 +--- a/src/libs/zbxsysinfo/linux/net.c ++++ b/src/libs/zbxsysinfo/linux/net.c +@@ -114,13 +114,21 @@ static int find_tcp_port_by_state_nl(unsigned short port, int state, int *found) + + struct sockaddr_nl s_sa = { AF_NETLINK, 0, 0, 0 }; + struct iovec s_io[1] = { { &request, sizeof(request) } }; +- struct msghdr s_msg = { (void *)&s_sa, sizeof(struct sockaddr_nl), s_io, 1, NULL, 0, 0}; ++ struct msghdr s_msg = { 0 }; ++ s_msg.msg_name = (void *)&s_sa; ++ s_msg.msg_namelen = sizeof(struct sockaddr_nl); ++ s_msg.msg_iov = s_io; ++ s_msg.msg_iovlen = 1; + + char buffer[BUFSIZ] = { 0 }; + + struct sockaddr_nl r_sa = { AF_NETLINK, 0, 0, 0 }; + struct iovec r_io[1] = { { buffer, BUFSIZ } }; +- struct msghdr r_msg = { (void *)&r_sa, sizeof(struct sockaddr_nl), r_io, 1, NULL, 0, 0}; ++ struct msghdr r_msg = { 0 }; ++ r_msg.msg_name = (void *)&r_sa; ++ r_msg.msg_namelen = sizeof(struct sockaddr_nl); ++ r_msg.msg_iov = r_io; ++ r_msg.msg_iovlen = 1; + + struct nlmsghdr *r_hdr; + +-- +2.37.3 + diff --git a/meta-oe/recipes-connectivity/zabbix/zabbix_6.2.1.bb b/meta-oe/recipes-connectivity/zabbix/zabbix_6.2.2.bb similarity index 95% rename from meta-oe/recipes-connectivity/zabbix/zabbix_6.2.1.bb rename to meta-oe/recipes-connectivity/zabbix/zabbix_6.2.2.bb index 9949bd81f1..58ec461745 100644 --- a/meta-oe/recipes-connectivity/zabbix/zabbix_6.2.1.bb +++ b/meta-oe/recipes-connectivity/zabbix/zabbix_6.2.2.bb @@ -25,10 +25,10 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" SRC_URI = "https://cdn.zabbix.com/zabbix/sources/stable/6.2/${BPN}-${PV}.tar.gz \ file://0001-Fix-configure.ac.patch \ + file://0001-initialize-msghdr-portably.patch \ file://zabbix-agent.service \ " - -SRC_URI[sha256sum] = "f3d6b7cf4e67d820ce7d28cd54ac67724f7453f261f668877e6410cd21ab9ea1" +SRC_URI[sha256sum] = "f0e7a9abb0f65d700f531253b91c31165077a9c94769cc8d238a423ada852773" inherit autotools-brokensep linux-kernel-base pkgconfig systemd useradd