At 01:41 AM 3/8/02 +0800, Doug Rice wrote:
> >
> > which version of perl and which version of mon?
> >
>perl 5.6.1, compiled with Solaris memory management per the 5.6.1 Solaris
>read me
>mon 0.99.2
>
>Essentially, the perl process calls brk repeatedly until the segmentation
>fault occurs.
That's odd. If you can reproduce reliably, let us know.
>Also discovered that inet_aton, used by send_trap, returns 0 if it can't
>resolve the target mon hostname. Results in sending the trap to
>localhost, which by definition has the group/service defined, which
>results in another trap being sent, and so on. Makes for a good system
>stress test.
That's definitely a bug. A patch to Client.pm (untested by me) is attached,
which causes send_trap to err out if inet_aton cannot resolve the host.
Please test and verify that it works. If it does, it will go in 0.12.
>Lessons learned: 1) use only properly formed IPs in trap alert
>definitions, or 2) check name resolution before sending a trap.
3) Find a bug that is sufficiently annoying yet easy to fix so someone
fixes it :)
--- Client.pm.orig Thu Mar 14 23:28:34 2002
+++ Client.pm Thu Mar 14 23:32:04 2002
@@ -1861,7 +1861,13 @@
my $port = $self->{"PORT"};
- my $paddr = sockaddr_in ($port, inet_aton ($self->{"HOST"}));
+ my $iaddr = "";
+ if (!defined ($iaddr = inet_aton ($self->{"HOST"}))) {
+ $self->{"ERROR"} = "could not send trap to ".$self->{"HOST"}.": could not
+resolve host\n";
+ return undef;
+ }
+
+ my $paddr = sockaddr_in ($port, $iaddr);
if (!defined (send (TRAP, $pkt, 0, $paddr)))
{