[opennms-devel] ICMP/Root

"AMT" <[email protected]> Wed, 18 Mar 2009 18:47:01 -0000
Newsgroups gmane.network.opennms.bugs,gmane.network.opennms.devel
Message-ID <53B389DBF10C48CC86CE9726852319D7@EdithPC>
This is a multi-part message in MIME format.

--===============7123265307540749417==
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_00B1_01C9A7F9.ECAB62C0"

This is a multi-part message in MIME format.

------=_NextPart_000_00B1_01C9A7F9.ECAB62C0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I just saw an archived message from Jonathan Sartin regarding root and =
ICMP from August of last year.

I hit this problem many years ago and the solution we developed was to =
create a separate executable that had root privilege.  So there was a =
Java class, a native code .so/.dll and the root executable.  When Java =
opened up an ICMP socket, the native code would fork the executable =
which would open the raw socket and pass the descriptors back to the =
native code running within the Java VM.

This has the advantage over fping in that you are not running an =
executable every time you want to ping.  The executable is run once to =
open the socket.  Unless I am misunderstanding the use of fping.

The code was written over ten years ago and at the time there was a bug =
in Solaris with raw sockets.  If I remember correctly, closing a socket =
and opening a new socket but getting the same fd caused problems.  So we =
had to preallocate a chunk of sockets at the beginning.

One thing I added a few years ago is the sizing of the socket buffers to =
be able to handle X number of concurrent pings.  I was getting errors in =
Linux trying to do 255 concurrent pings but the socket buffer only being =
big enough to handle a few at a time.

I am no C developer and just the thought of caring for this code and =
porting it to other platforms gives me a headache.  But I am more than =
happy to contribute it as a starting point for someone else to run with. =
 It currently is compiled for Solaris/Intel, Redhat Linux/Intel and =
Windows/Intel.  The Windows code is different in that it does not =
require the separate executable.  It just opens the sockets.

Bob Kostes
www.altmantech.com
------=_NextPart_000_00B1_01C9A7F9.ECAB62C0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6001.18203" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>I just saw an archived message from =
Jonathan Sartin=20
regarding root and ICMP from August of last year.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I hit this problem many years ago and =
the solution=20
we developed was to create a separate executable that had root =
privilege.&nbsp;=20
So there was a Java class, a native code .so/.dll and the root =
executable.&nbsp;=20
When Java opened up an ICMP socket, the native code would fork the =
executable=20
which would open the raw socket and pass the descriptors back to the =
native code=20
running within the Java VM.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>This has the advantage over fping in =
that you are=20
not running an executable every time you want to ping.&nbsp; The =
executable is=20
run once to open the socket.&nbsp; Unless I am misunderstanding the use =
of=20
fping.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The code was written over ten years ago =
and at the=20
time there was a bug in Solaris with raw sockets.&nbsp; If I remember =
correctly,=20
closing a socket and opening a new socket but getting the same fd caused =

problems.&nbsp; So we had to preallocate a chunk of sockets at the=20
beginning.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>One thing I added&nbsp;a few&nbsp;years =
ago&nbsp;is=20
the sizing of the socket buffers to be able to handle X number of =
concurrent=20
pings.&nbsp; I was getting errors in Linux trying to do 255 concurrent =
pings but=20
the socket buffer only being big enough to handle a few at a =
time.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I am no C developer and just the =
thought of caring=20
for this code and porting it to other platforms gives me a =
headache.&nbsp; But I=20
am more than happy to contribute it as a starting point for someone else =
to run=20
with.&nbsp; It currently is compiled for Solaris/Intel, Redhat =
Linux/Intel and=20
Windows/Intel.&nbsp; The Windows code is different in that it does not =
require=20
the separate executable.&nbsp; It just opens the sockets.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Bob Kostes</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"mhtml:{56D713B0-16BA-4F8F-B695-747A253F6AF4}mid://00000170/!x-usc=
:http://www.altmantech.com/">www.altmantech.com</A></FONT></DIV></FONT></=
DIV></BODY></HTML>

------=_NextPart_000_00B1_01C9A7F9.ECAB62C0--



--===============7123265307540749417==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
--===============7123265307540749417==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel
--===============7123265307540749417==--