[Date Prev]   [Date Next] [Thread Prev]   [Thread Next] [Date Index]   [Thread Index]

 

     [snips-users] portmon bug causing wrong notifications

(Just joined the list, so I dunno if anyone else has seen/fixed this.)

I found a problem in portmon that was causing the wrong
host to appear to be down.

I'm using 1.1 on Solaris 2.8, and the problem was this:

When portmon went through it's array of hosts, and opened sockets
for them, the down host would fail - but the socket number and
other info would remain in the arrays.  The next socket
opened would then get the same socket descriptor number.

(There are 2 arrays, correlated by index - an array of socket
descriptor ids and an array of host info structs.)

When the sockets were processed, the first (bad) connection
would correlate to an opened socket (for the susequently opened
connection) - so I'd get paged on the host listed directly
_after_ the host that was actually down (and, the last host
listed wouldn't get polled at all).

Here's a diff - I just added an array to indicate if the
connection failed initially, and skip processing of those
sockets.

root at poker 62->diff portmon.c portmon.c.FCS 
57d56
<   int closed[MAXSIMULCONNECTS];
77d75
<       closed[i] = 0;
95d92
<         closed[i] = 1;
156d152
<         if (closed[i]) continue;

-- 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marc MacIntyre
marcmac at marcmac com

They turned the country up on its side, and everything loose
fell into California.
-attrib. Frank Lloyd Wright, 1869-?

Zyrion Traverse Network Monitoring & Network Management Software