[mrtg] MRTG uses an IPv6 address even if w/o EnableIPv6 or with explicit EnableIPv6: no?

笹山 / SASAYAMA sasayama at otsl.jp
Fri Sep 30 07:35:43 CEST 2011


I am not new to MRTG but recently I saw a strange behavior in my
setting. It seems that MRTG 2.16.4 uses IPv6 even if mrtg.cfg contains
no EnableIPv6 or explicit EnableIPv6: no. In my setting, target hosts
are specified by host names which can be resolved to IPv6 addresses.

I investigated why it happens and found SNMP_Session.pm uses
Socket::inet_aton to resolve host names to addresses in IPv4-only
settings. Unfortunately, Socket::inet_aton may return an IPv6 address
when used to resolve host names and MRTG appears to use it without any
checks that it really is an IPv4 address. (Socket::inet_aton appears to
use C inet_aton and gethostbyname, and gethostbyname by nature may
return an IPv6 address.)

I do not know if it should be fixed in Perl-side, but IMO, it is unsafe
to use Socket::inet_aton to resolve host names in IPv4-only settings. I
managed to avoid this behavior by using IPv4-only host names, but it is
not very intuitive and should be handled properly in MRTG.
-- 
仕事用電話 080-7006-9731 <tel:08070069731> (出られないときは私用電話に転
送します)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sasayama.vcf
Type: text/x-vcard
Size: 314 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/mrtg/attachments/20110930/181c858f/attachment.vcf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3826 bytes
Desc: S/MIME 〓〓〓〓〓〓〓〓〓〓〓〓
Url : http://lists.oetiker.ch/pipermail/mrtg/attachments/20110930/181c858f/attachment.bin 


More information about the mrtg mailing list