[ZBX-19476] zabbix agent2 won't start when the ListenIP contains an IPv6 address Created: 2021 May 28  Updated: 2024 Apr 10  Resolved: 2021 Jul 17

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 5.4.0
Fix Version/s: 5.0.14rc1, 5.4.3rc1, 6.0.0alpha1, 6.0 (plan)

Type: Problem report Priority: Trivial
Reporter: Dave Assignee: Michael Veksler
Resolution: Fixed Votes: 1
Labels: agent
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

CentOS 7.9
zabbix-agent2-5.4.0-8.el7


Attachments: File zabbix_agent2.conf    
Team: Team B
Sprint: Sprint 78 (Jul 2021)
Story Points: 1

 Description   

 

When using an IPv6 address as the ListenIP - zabbix_agent2 throws an error and will not start up.

 

ListenIP=fc0f:f850:1:218::52

{{}}

ERROR: cannot start server listener: Listen failed: listen tcp: address fc0f:f850:1:218::52:10050: too many colons in address 

{{}}

 

ListenIP=[fc0f:f850:1:218::52]

{{}}

ERROR: cannot parse "ListenIP" parameter: incorrect value of ListenIP: "[fc0f:f850:1:218::52]" 

{{}}

 

 

Steps to reproduce:

  1. Set the ListenIP to an IPv6 address in /etc/zabbix/zabbix_agent2.conf
  2. service zabbix_agent2 start

 

Result:

Log for ListenIP=fc0f:f850:1:218::52

2021/05/28 07:38:55.375000 Starting Zabbix Agent 2 (5.4.0)
2021/05/28 07:38:55.375238 OpenSSL library (OpenSSL 1.0.1e-fips 11 Feb 2013) initialized
2021/05/28 07:38:55.375255 default context ciphersuites: PSK-AES128-CBC-SHA
2021/05/28 07:38:55.375260 psk context ciphersuites: PSK-AES128-CBC-SHA
2021/05/28 07:38:55.375283 using configuration file: /etc/zabbix/zabbix_agent2.conf
2021/05/28 07:38:55.376011 using plugin 'Agent' providing following interfaces: exporter
2021/05/28 07:38:55.376019 using plugin 'Ceph' providing following interfaces: exporter, runner, configurator
2021/05/28 07:38:55.376026 using plugin 'Cpu' providing following interfaces: exporter, collector, runner
2021/05/28 07:38:55.376031 using plugin 'Docker' providing following interfaces: exporter, configurator
2021/05/28 07:38:55.376040 using plugin 'File' providing following interfaces: exporter, configurator
2021/05/28 07:38:55.376050 using plugin 'Kernel' providing following interfaces: exporter
2021/05/28 07:38:55.376055 using plugin 'Log' providing following interfaces: exporter, configurator
2021/05/28 07:38:55.376061 using plugin 'MQTT' providing following interfaces: watcher, configurator
2021/05/28 07:38:55.376065 using plugin 'Memcached' providing following interfaces: exporter, runner, configurator
2021/05/28 07:38:55.376070 using plugin 'Memory' providing following interfaces: exporter
2021/05/28 07:38:55.376075 using plugin 'Modbus' providing following interfaces: exporter, configurator
2021/05/28 07:38:55.376080 using plugin 'Mongo' providing following interfaces: exporter, runner, configurator
2021/05/28 07:38:55.376089 using plugin 'Mysql' providing following interfaces: exporter, runner, configurator
2021/05/28 07:38:55.376099 using plugin 'NetIf' providing following interfaces: exporter
2021/05/28 07:38:55.376103 using plugin 'Oracle' providing following interfaces: exporter, runner, configurator
2021/05/28 07:38:55.376109 using plugin 'Postgres' providing following interfaces: exporter, runner, configurator
2021/05/28 07:38:55.376123 using plugin 'Proc' providing following interfaces: exporter, collector
2021/05/28 07:38:55.376128 using plugin 'ProcExporter' providing following interfaces: exporter
2021/05/28 07:38:55.376133 using plugin 'Redis' providing following interfaces: exporter, runner, configurator
2021/05/28 07:38:55.376138 using plugin 'Smart' providing following interfaces: exporter, configurator
2021/05/28 07:38:55.376143 using plugin 'Sw' providing following interfaces: exporter, configurator
2021/05/28 07:38:55.376147 using plugin 'Swap' providing following interfaces: exporter
2021/05/28 07:38:55.376154 using plugin 'SystemRun' providing following interfaces: exporter, configurator
2021/05/28 07:38:55.376158 using plugin 'Systemd' providing following interfaces: exporter
2021/05/28 07:38:55.376164 using plugin 'TCP' providing following interfaces: exporter, configurator
2021/05/28 07:38:55.376170 using plugin 'UDP' providing following interfaces: exporter, configurator
2021/05/28 07:38:55.376175 using plugin 'Uname' providing following interfaces: exporter
2021/05/28 07:38:55.376180 using plugin 'Uptime' providing following interfaces: exporter
2021/05/28 07:38:55.376184 using plugin 'UserParameter' providing following interfaces: exporter
2021/05/28 07:38:55.376192 using plugin 'Users' providing following interfaces: exporter, configurator
2021/05/28 07:38:55.376197 using plugin 'VFSDev' providing following interfaces: exporter, collector
2021/05/28 07:38:55.376202 using plugin 'VfsFs' providing following interfaces: exporter
2021/05/28 07:38:55.376207 using plugin 'Web' providing following interfaces: exporter, configurator
2021/05/28 07:38:55.376211 using plugin 'ZabbixAsync' providing following interfaces: exporter
2021/05/28 07:38:55.376231 using plugin 'ZabbixStats' providing following interfaces: exporter, configurator
2021/05/28 07:38:55.376236 using plugin 'ZabbixSync' providing following interfaces: exporter
2021/05/28 07:38:55.376279 [Modbus] Config is valid
2021/05/28 07:38:55.376639 Zabbix Agent2 hostname: [xxxx.xxxxxxxx.com]
2021/05/28 07:38:55.376679 cannot start server listener: Listen failed: listen tcp: address fc0f:f850:1:218::52:10050: too many colons in address

 

Log file for ListenIP=[fc0f:f850:1:218::52]

2021/05/28 07:41:41.546179 Starting Zabbix Agent 2 (5.4.0)
2021/05/28 07:41:41.546437 OpenSSL library (OpenSSL 1.0.1e-fips 11 Feb 2013) initialized
2021/05/28 07:41:41.546455 default context ciphersuites: PSK-AES128-CBC-SHA
2021/05/28 07:41:41.546461 psk context ciphersuites: PSK-AES128-CBC-SHA
2021/05/28 07:41:41.546486 using configuration file: /etc/zabbix/zabbix_agent2.conf
2021/05/28 07:41:41.547308 using plugin 'Agent' providing following interfaces: exporter
2021/05/28 07:41:41.547319 using plugin 'Ceph' providing following interfaces: exporter, runner, configurator
2021/05/28 07:41:41.547327 using plugin 'Cpu' providing following interfaces: exporter, collector, runner
2021/05/28 07:41:41.547341 using plugin 'Docker' providing following interfaces: exporter, configurator
2021/05/28 07:41:41.547348 using plugin 'File' providing following interfaces: exporter, configurator
2021/05/28 07:41:41.547358 using plugin 'Kernel' providing following interfaces: exporter
2021/05/28 07:41:41.547364 using plugin 'Log' providing following interfaces: exporter, configurator
2021/05/28 07:41:41.547369 using plugin 'MQTT' providing following interfaces: watcher, configurator
2021/05/28 07:41:41.547375 using plugin 'Memcached' providing following interfaces: exporter, runner, configurator
2021/05/28 07:41:41.547380 using plugin 'Memory' providing following interfaces: exporter
2021/05/28 07:41:41.547385 using plugin 'Modbus' providing following interfaces: exporter, configurator
2021/05/28 07:41:41.547390 using plugin 'Mongo' providing following interfaces: exporter, runner, configurator
2021/05/28 07:41:41.547400 using plugin 'Mysql' providing following interfaces: exporter, runner, configurator
2021/05/28 07:41:41.547409 using plugin 'NetIf' providing following interfaces: exporter
2021/05/28 07:41:41.547415 using plugin 'Oracle' providing following interfaces: exporter, runner, configurator
2021/05/28 07:41:41.547426 using plugin 'Postgres' providing following interfaces: exporter, runner, configurator
2021/05/28 07:41:41.547443 using plugin 'Proc' providing following interfaces: exporter, collector
2021/05/28 07:41:41.547449 using plugin 'ProcExporter' providing following interfaces: exporter
2021/05/28 07:41:41.547454 using plugin 'Redis' providing following interfaces: exporter, runner, configurator
2021/05/28 07:41:41.547459 using plugin 'Smart' providing following interfaces: exporter, configurator
2021/05/28 07:41:41.547465 using plugin 'Sw' providing following interfaces: exporter, configurator
2021/05/28 07:41:41.547472 using plugin 'Swap' providing following interfaces: exporter
2021/05/28 07:41:41.547478 using plugin 'SystemRun' providing following interfaces: exporter, configurator
2021/05/28 07:41:41.547483 using plugin 'Systemd' providing following interfaces: exporter
2021/05/28 07:41:41.547489 using plugin 'TCP' providing following interfaces: exporter, configurator
2021/05/28 07:41:41.547495 using plugin 'UDP' providing following interfaces: exporter, configurator
2021/05/28 07:41:41.547500 using plugin 'Uname' providing following interfaces: exporter
2021/05/28 07:41:41.547506 using plugin 'Uptime' providing following interfaces: exporter
2021/05/28 07:41:41.547511 using plugin 'UserParameter' providing following interfaces: exporter
2021/05/28 07:41:41.547520 using plugin 'Users' providing following interfaces: exporter, configurator
2021/05/28 07:41:41.547526 using plugin 'VFSDev' providing following interfaces: exporter, collector
2021/05/28 07:41:41.547532 using plugin 'VfsFs' providing following interfaces: exporter
2021/05/28 07:41:41.547537 using plugin 'Web' providing following interfaces: exporter, configurator
2021/05/28 07:41:41.547543 using plugin 'ZabbixAsync' providing following interfaces: exporter
2021/05/28 07:41:41.547563 using plugin 'ZabbixStats' providing following interfaces: exporter, configurator
2021/05/28 07:41:41.547569 using plugin 'ZabbixSync' providing following interfaces: exporter
2021/05/28 07:41:41.547581 [Modbus] Config is valid
2021/05/28 07:41:41.547998 cannot parse "ListenIP" parameter: incorrect value of ListenIP: "[fc0f:f850:1:218::52]"

Expected:

The zabbix-agent2 service should start up and listen on the IPv6 address.

 



 Comments   
Comment by Dmitry Krupornitsky [ 2021 Jun 08 ]

Hello Dave, 

Please enclose the config file for Zabbix agent. 

2021/05/28 07:38:55.376679 cannot start server listener: Listen failed: listen tcp: address fc0f:f850:1:218::52:10050: too many colons in address

Here Zabbix thinks that 10050 is a IPv6 section instead of port, so we need to check this out. Thanks.

Comment by Dave [ 2021 Jun 08 ]

The zabbix_agent2.conf has been attached.

Comment by Dmitry Krupornitsky [ 2021 Jun 09 ]

Most probably I found an issue: when a short ipv6 form (like fc0f:f850:1:218::52 which is actually fc0f:f850:1:218:0:0:0:52) is found in config file, the validateLocalIP() function from serverlistener.go parses it as valid IP (checked) but then there is a line: 

if sl.listener, err = zbxcomms.Listen(fmt.Sprintf("%s:%d", sl.bindIP, sl.options.ListenPort), sl.tlsConfig); err != nil ...

so port and IP address are being concatenated together. While it gets to Listen() func in comms.go, something happens and here it is converted to fc0f:f850:1:218::52:10050: that leads to an error.

Comment by Michael Veksler [ 2021 Jul 08 ]

Available in:

Generated at Mon Apr 28 09:37:16 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.