pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/sysutils/zabbix Zabbix_agentd is a threaded program, a...
details: https://anonhg.NetBSD.org/pkgsrc/rev/51cbe4b89721
branches: trunk
changeset: 371650:51cbe4b89721
user: he <he%pkgsrc.org@localhost>
date: Thu Nov 16 11:01:12 2017 +0000
description:
Zabbix_agentd is a threaded program, and it tries to muck with the
global `_res' variable. That's not supported on NetBSD, and IME
causes the zabbix agent daemon to exit shortly after having been started.
Convert to instead using res_ninit(), res_nsend(), and res_nclose().
Bump PKGREVISION.
diffstat:
sysutils/zabbix/Makefile | 4 +-
sysutils/zabbix/distinfo | 3 +-
sysutils/zabbix/patches/patch-src_libs_zbxsysinfo_common_net.c | 75 ++++++++++
3 files changed, 79 insertions(+), 3 deletions(-)
diffs (108 lines):
diff -r baf1368c189b -r 51cbe4b89721 sysutils/zabbix/Makefile
--- a/sysutils/zabbix/Makefile Thu Nov 16 10:32:36 2017 +0000
+++ b/sysutils/zabbix/Makefile Thu Nov 16 11:01:12 2017 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.3 2017/09/18 09:53:35 maya Exp $
+# $NetBSD: Makefile,v 1.4 2017/11/16 11:01:12 he Exp $
-PKGREVISION= 2
+PKGREVISION= 3
.include "Makefile.common"
COMMENT= Enterprise-class Monitoring Solution for Everyone
diff -r baf1368c189b -r 51cbe4b89721 sysutils/zabbix/distinfo
--- a/sysutils/zabbix/distinfo Thu Nov 16 10:32:36 2017 +0000
+++ b/sysutils/zabbix/distinfo Thu Nov 16 11:01:12 2017 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.3 2017/07/26 08:24:06 adam Exp $
+$NetBSD: distinfo,v 1.4 2017/11/16 11:01:12 he Exp $
SHA1 (zabbix-3.2.7.tar.gz) = eb5bd34e1ad3dd75c54ed072f0799d55d0939d49
RMD160 (zabbix-3.2.7.tar.gz) = 7997a7a1419d8d543ba0f8e961a247a04272c438
@@ -6,6 +6,7 @@
Size (zabbix-3.2.7.tar.gz) = 16016367 bytes
SHA1 (patch-frontends_php_locale_add__new__language.sh) = c187e2b4ae8dd9e409f5c32469cb7b0f02647d8b
SHA1 (patch-frontends_php_locale_make__mo.sh) = 2f0aaa63e80fcd5d4fa8c507fd764f80070b7864
+SHA1 (patch-src_libs_zbxsysinfo_common_net.c) = 235abaa1c93e6a2953fdec765f01de846ee4572b
SHA1 (patch-src_zabbix__agent_Makefile.in) = a591c3e831eb34dc10cb5b1078891b5cad53b756
SHA1 (patch-src_zabbix__proxy_Makefile.in) = 535eccd707a8947903fbec41028b127a3bbbeffc
SHA1 (patch-src_zabbix__server_Makefile.in) = d297b8c4a940867d0a3eaff7bcb3b178a87dfd49
diff -r baf1368c189b -r 51cbe4b89721 sysutils/zabbix/patches/patch-src_libs_zbxsysinfo_common_net.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/zabbix/patches/patch-src_libs_zbxsysinfo_common_net.c Thu Nov 16 11:01:12 2017 +0000
@@ -0,0 +1,75 @@
+$NetBSD: patch-src_libs_zbxsysinfo_common_net.c,v 1.1 2017/11/16 11:01:12 he Exp $
+
+Can't portably use _res in a threaded program(!)
+Convert to using res_nsend().
+
+--- src/libs/zbxsysinfo/common/net.c.orig 2017-07-18 10:41:07.000000000 +0000
++++ src/libs/zbxsysinfo/common/net.c
+@@ -236,6 +236,7 @@ static int dns_query(AGENT_REQUEST *requ
+ struct servent *s;
+ HEADER *hp;
+ struct protoent *pr;
++ struct __res_state res_state;
+ #if PACKETSZ > 1024
+ unsigned char buf[PACKETSZ];
+ #else
+@@ -465,13 +466,14 @@ static int dns_query(AGENT_REQUEST *requ
+ pDnsRecord = pDnsRecord->pNext;
+ }
+ #else /* not _WINDOWS */
+- if (-1 == res_init()) /* initialize always, settings might have changed */
++ memset(&res_state, 0, sizeof(res_state));
++ if (-1 == res_ninit(&res_state)) /* initialize always, settings might have changed */
+ {
+ SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Cannot initialize DNS subsystem: %s", zbx_strerror(errno)));
+ return SYSINFO_RET_FAIL;
+ }
+
+- if (-1 == (res = res_mkquery(QUERY, zone, C_IN, type, NULL, 0, NULL, buf, sizeof(buf))))
++ if (-1 == (res = res_nmkquery(&res_state, QUERY, zone, C_IN, type, NULL, 0, NULL, buf, sizeof(buf))))
+ {
+ SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Cannot create DNS query: %s", zbx_strerror(errno)));
+ return SYSINFO_RET_FAIL;
+@@ -488,33 +490,20 @@ static int dns_query(AGENT_REQUEST *requ
+ memcpy(&saved_ns, &(_res.nsaddr_list[0]), sizeof(struct sockaddr_in));
+ saved_nscount = _res.nscount;
+
+- _res.nsaddr_list[0].sin_addr = inaddr;
+- _res.nsaddr_list[0].sin_family = AF_INET;
+- _res.nsaddr_list[0].sin_port = htons(ZBX_DEFAULT_DNS_PORT);
+- _res.nscount = 1;
++ res_state.nsaddr_list[0].sin_addr = inaddr;
++ res_state.nsaddr_list[0].sin_family = AF_INET;
++ res_state.nsaddr_list[0].sin_port = htons(ZBX_DEFAULT_DNS_PORT);
++ res_state.nscount = 1;
+ }
+
+- saved_options = _res.options;
+- saved_retrans = _res.retrans;
+- saved_retry = _res.retry;
+-
+ if (0 != use_tcp)
+- _res.options |= RES_USEVC;
+-
+- _res.retrans = retrans;
+- _res.retry = retry;
+-
+- res = res_send(buf, res, answer.buffer, sizeof(answer.buffer));
++ res_state.options |= RES_USEVC;
+
+- _res.options = saved_options;
+- _res.retrans = saved_retrans;
+- _res.retry = saved_retry;
++ res_state.retrans = retrans;
++ res_state.retry = retry;
+
+- if (NULL != ip && '\0' != *ip)
+- {
+- memcpy(&(_res.nsaddr_list[0]), &saved_ns, sizeof(struct sockaddr_in));
+- _res.nscount = saved_nscount;
+- }
++ res = res_nsend(&res_state, buf, res, answer.buffer, sizeof(answer.buffer));
++ res_nclose(&res_state);
+
+ hp = (HEADER *)answer.buffer;
+
Home |
Main Index |
Thread Index |
Old Index