[mrtg] cfgmaker_ip bug with duplicate names

Alan J. Flavell flavell at a5.ph.gla.ac.uk
Tue Aug 3 14:37:48 MEST 1999

The existing script performs reverse DNS lookups on the interface's IP
addresses, and uses the results as the Target[name]s for the generated
config file.  But there is no check for duplicates, so, if the IP
addresses of two different interfaces yield the same DNS name, the
generated configuration will then contain two sets of configuration
entries for the same [name]; when this cfg file is processed by MRTG
it produces an error report.  This has actually happened to me (and,
as I explained in the other mail just sent, I'm in no position to
force anyone to change those DNS entries).

It is easily corrected by setting up a hash of names as they are
used, and checking each new Target[name] against the ones that have
been previously used.  Something as dumb as

+     while ( $nameuse{$name} ) { $name = $name . 'x' }
+     $nameuse{$name} = 1;

will fix the problem, although one could think of more-attractive
approaches to resolving the conflict ;-)

best regards

* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg

More information about the mrtg mailing list