diff options
author | he <he@pkgsrc.org> | 2017-11-16 11:01:12 +0000 |
---|---|---|
committer | he <he@pkgsrc.org> | 2017-11-16 11:01:12 +0000 |
commit | 22ac3500817a068021590a721af3f8dac8ba3299 (patch) | |
tree | 12d3cded7eb1f7c0c0448d781336b962760536ed /sysutils | |
parent | 84200d8e79f7d4a2dc050127793074455c003553 (diff) | |
download | pkgsrc-22ac3500817a068021590a721af3f8dac8ba3299.tar.gz |
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 (limited to 'sysutils')
-rw-r--r-- | sysutils/zabbix/Makefile | 4 | ||||
-rw-r--r-- | sysutils/zabbix/distinfo | 3 | ||||
-rw-r--r-- | sysutils/zabbix/patches/patch-src_libs_zbxsysinfo_common_net.c | 75 |
3 files changed, 79 insertions, 3 deletions
diff --git a/sysutils/zabbix/Makefile b/sysutils/zabbix/Makefile index a6775c1df62..b85ef11ea9e 100644 --- a/sysutils/zabbix/Makefile +++ b/sysutils/zabbix/Makefile @@ -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 --git a/sysutils/zabbix/distinfo b/sysutils/zabbix/distinfo index c6a9b204b2b..4bbf4c11cd4 100644 --- a/sysutils/zabbix/distinfo +++ b/sysutils/zabbix/distinfo @@ -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 @@ SHA512 (zabbix-3.2.7.tar.gz) = f60c82829c076a7f8b9d2f0c7dc91f7b65594ac4dcfaa08b1 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 --git a/sysutils/zabbix/patches/patch-src_libs_zbxsysinfo_common_net.c b/sysutils/zabbix/patches/patch-src_libs_zbxsysinfo_common_net.c new file mode 100644 index 00000000000..88365931cfd --- /dev/null +++ b/sysutils/zabbix/patches/patch-src_libs_zbxsysinfo_common_net.c @@ -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; + |