Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack Smashing detected on Zabbix Agent after trying to load module #16

Closed
crypticg opened this issue Nov 16, 2017 · 7 comments
Closed

Comments

@crypticg
Copy link

Running
Ubuntu 14.04
Zabbix Agent 3.0.13
Latest unifi_proxy.

After compiling the latest unifi_proxy, when trying to load it with the zabbix_agent, the zabbix_agent crashes with *** stack smashing detected ***

@zbx-sadman
Copy link
Owner

Show to me link to file that you compile for Agent v3.0.13.

@crypticg
Copy link
Author

I am using this one

https://github.com/zbx-sadman/unifi_proxy/blob/master/src/modules/zbx_unifi_Zabbix_3_0/unifi.c

with the Zabbix Agent 3.0.13 source.

@zbx-sadman
Copy link
Owner

Debian 7.11

A little problem with compilation ("... error: ‘MAX_ZBX_DNSNAME_LEN’ undeclared here (not in a function)") exists, but after quick fix and making .so i see no any problem with module:

24527:20171116:203457.514 Starting Zabbix Agent [Zabbix server]. Zabbix 3.0.13 (revision 74336).
 24527:20171116:203457.514 **** Enabled features ****
 24527:20171116:203457.514 IPv6 support:           NO
 24527:20171116:203457.514 TLS support:            NO
 24527:20171116:203457.514 **************************
 24527:20171116:203457.514 using configuration file: /usr/local/etc/zabbix_agentd.conf
 24527:20171116:203457.514 In load_modules()
 24527:20171116:203457.514 loading module "/usr/local/sbin/zabbix/unifi.so"
 24527:20171116:203457.514 unifi.so: init module stage
 24527:20171116:203457.514 unifi.so: load & parse config stage. Config file is /usr/local/sbin/zabbix/unifi.conf
 24527:20171116:203457.514 unifi.so: UniFi Proxy host is 'localhost:8448'
 24527:20171116:203457.514 In register_module()
 24527:20171116:203457.514 End of register_module():SUCCEED
 24527:20171116:203457.514 loaded modules: unifi.so
 24527:20171116:203457.514 End of load_modules():SUCCEED
 24527:20171116:203457.515 In init_collector_data()
 24527:20171116:203457.515 In zbx_dshm_create() proj_id:112 size:0

@crypticg
Copy link
Author

I had that issue too but was able to fix it. Upon compiling, I also get the following output but it still compiles it

unifi.c: In function ‘zbx_module_unifi_proxy’:
unifi.c:106:13: warning: null argument where non-null required (argument 2) [-Wnonnull]
strcat(send_buf, get_rparam(request, i));

@zbx-sadman
Copy link
Owner

zbx-sadman commented Nov 16, 2017

I can't explain it at this time, because I have no errors:

root@keeper:/home/test/zabbix-3.0.13/src/modules/unifi# make
gcc -fPIC -shared -o unifi.so unifi.c -I ../../../include
In file included from unifi.c:3:0:
../../../include/comms.h:101:15: error: ‘MAX_ZBX_DNSNAME_LEN’ undeclared here (not in a function)
make: *** [unifi] Error 1
root@keeper:/home/test/zabbix-3.0.13/src/modules/unifi# make
gcc -fPIC -shared -o unifi.so unifi.c -I ../../../include
root@keeper:/home/test/zabbix-3.0.13/src/modules/unifi# ls -la unifi.so
-rwxr-xr-x 1 root root 11729 Nov 16 20:51 unifi.so

@zbx-sadman
Copy link
Owner

zbx-sadman commented Dec 15, 2017

Refer to answer for issue #18

@zbx-sadman
Copy link
Owner

zbx-sadman commented Dec 21, 2017

Try to use updated code of loadble module: https://github.com/zbx-sadman/unifi_proxy/tree/master/src/modules/zbx_unifi_Zabbix_3_0

# /usr/sbin/zabbix_agentd -V
zabbix_agentd (daemon) (Zabbix) 3.0.13
Revision 74336 7 November 2017, compilation time: Nov 23 2017 16:14:06

# /usr/sbin/zabbix_agentd -t unifi.proxy[discovery,wlan]
unifi.proxy[discovery,wlan]                   [s|{"data":[{"{#SITENAME}":"default",...{#SITEDESC}":"South"}]}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants