pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/pkgsrc-2017Q3]: pkgsrc/sysutils/zabbix Pullup ticket #5650 - requeste...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/08142dd28243
branches:  pkgsrc-2017Q3
changeset: 408615:08142dd28243
user:      bsiegert <bsiegert%pkgsrc.org@localhost>
date:      Sat Nov 25 09:04:18 2017 +0000

description:
Pullup ticket #5650 - requested by he
sysutils/zabbix: bugfix

Revisions pulled up:
- sysutils/zabbix/Makefile                                      1.4+patch
- sysutils/zabbix/distinfo                                      1.4+patch
- sysutils/zabbix/patches/patch-src_libs_zbxsysinfo_common_net.c 1.1+patch

---
   Module Name: pkgsrc
   Committed By:        he
   Date:                Thu Nov 16 11:01:12 UTC 2017

   Modified Files:
        pkgsrc/sysutils/zabbix: Makefile distinfo
   Added Files:
        pkgsrc/sysutils/zabbix/patches: patch-src_libs_zbxsysinfo_common_net.c

   Log Message:
   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 c318783cf1e2 -r 08142dd28243 sysutils/zabbix/Makefile
--- a/sysutils/zabbix/Makefile  Sat Nov 25 08:52:07 2017 +0000
+++ b/sysutils/zabbix/Makefile  Sat Nov 25 09:04:18 2017 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.3 2017/09/18 09:53:35 maya Exp $
+# $NetBSD: Makefile,v 1.3.4.1 2017/11/25 09:04:18 bsiegert Exp $
 
-PKGREVISION= 2
+PKGREVISION= 4
 .include "Makefile.common"
 
 COMMENT=       Enterprise-class Monitoring Solution for Everyone
diff -r c318783cf1e2 -r 08142dd28243 sysutils/zabbix/distinfo
--- a/sysutils/zabbix/distinfo  Sat Nov 25 08:52:07 2017 +0000
+++ b/sysutils/zabbix/distinfo  Sat Nov 25 09:04:18 2017 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.3 2017/07/26 08:24:06 adam Exp $
+$NetBSD: distinfo,v 1.3.4.1 2017/11/25 09:04:18 bsiegert 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) = 29d0d81b100eb65ea6e96dde08f930e3b834fb3c
 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 c318783cf1e2 -r 08142dd28243 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    Sat Nov 25 09:04:18 2017 +0000
@@ -0,0 +1,75 @@
+$NetBSD: patch-src_libs_zbxsysinfo_common_net.c,v 1.2.2.2 2017/11/25 09:04:18 bsiegert 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_ndestroy(&res_state);
+ 
+       hp = (HEADER *)answer.buffer;
+ 



Home | Main Index | Thread Index | Old Index