check_ircd: IPv6 support (#1995)
commit93cd51bc6221ffc846c69135f2746120683b44c5
authoralvar <8402811+oxzi@users.noreply.github.com>
Mon, 18 Mar 2024 09:05:04 +0000 (18 09:05 +0000)
committerGitHub <noreply@github.com>
Mon, 18 Mar 2024 09:05:04 +0000 (18 10:05 +0100)
treed05cdd253f1d5621c605c52413091bb8406af3c1
parent0488426c7e8018d77734fb0e46328182de28f76a
check_ircd: IPv6 support (#1995)

The prior bindRemote function was restricted to IPv4 by explicitly using
address family specific functions as pack_sockaddr_in or unparametrized
gethostbyname. Since Perl 5.14, released in early 2013, there is
IO::Socket::IP, which supports lookups and connects for a dual stacked
network.

By switching the connection establishment code, the plugin is now able
to establish connections to IPv6-only hosts. Furthermore, additional -4
and -6 flags were introduced to enforce a specific address family.

> $ netstat -p tcp -ln | grep 6667
> tcp6         0      0  *.6667                 *.*                    LISTEN
> $ ./plugins-scripts/check_ircd -H localhost
> IRCD ok - Current Local Users: 4
> $ ./plugins-scripts/check_ircd -H localhost -4
> IRCD UNKNOWN: Could not start socket (Connection refused)
> $ ./plugins-scripts/check_ircd -H localhost -6
> IRCD ok - Current Local Users: 4
plugins-scripts/check_ircd.pl