Fixed
Details
Assignee
Benjamin ReedBenjamin ReedReporter
Alfred ReibenschuhAlfred ReibenschuhComponents
Fix versions
Affects versions
Priority
Blocker
Details
Details
Assignee
Benjamin Reed
Benjamin ReedReporter
Alfred Reibenschuh
Alfred ReibenschuhComponents
Fix versions
Affects versions
Priority
PagerDuty
PagerDuty
PagerDuty
Created December 20, 2007 at 7:55 AM
Updated January 27, 2017 at 4:31 PM
Resolved September 6, 2010 at 4:34 PM
Error with precompiled 1.0.5-win32 and self-compiled 1.0.6 and svn-trunk:
[DEBUG] System property 'opennms.library.jicmp' set to 'H:_workspace_/icmp_monitor/jicmp.dll. Attempting to load jicmp library from this location.
[INFO] Successfully loaded jicmp library.
Exception in thread "main" java.net.SocketException: Could not get protocol entry for 'icmp'. The getprotobyname("icmp") system call returned NULL.
at org.opennms.protocols.icmp.IcmpSocket.initSocket(Native Method)
at org.opennms.protocols.icmp.IcmpSocket.<init>(IcmpSocket.java:107)
at org.opennms.netmgt.ping.Pinger.initialize(Pinger.java:111)
at org.opennms.netmgt.ping.Pinger.<init>(Pinger.java:105)
at planetng.daemon.monitor.icmp.IcmpDaemon.init(IcmpDaemon.java:45)
at planetng.daemon.monitor.icmp.IcmpDaemon.init(IcmpDaemon.java:50)
at planetng.daemon.monitor.icmp.IcmpDaemon.main(IcmpDaemon.java:136)
i looked thru the code and found a small shortcoming that is required on win32:
JNIEXPORT void JNICALL
Java_org_opennms_protocols_icmp_IcmpSocket_initSocket (JNIEnv *env, jobject instance)
{
#ifdef _WIN32_
WSADATA info;
WSAStartup(MAKEWORD(1,1), &info);
int icmp_fd = socket(AF_INET, SOCK_RAW, 1);
#else
struct protoent *proto;
proto = getprotobyname("icmp");
if (proto == (struct protoent *) NULL) {
char errBuf[128]; /* for exceptions */
jclass ioException = (*env)->FindClass(env, "java/net/SocketException");
if(ioException != NULL)
{
sprintf(errBuf, "Could not get protocol entry for 'icmp'. The getprotobyname(\"icmp\") system call returned NULL.");
(*env)->ThrowNew(env, ioException, (char *)errBuf);
}
return;
}
int icmp_fd = socket(AF_INET, SOCK_RAW, proto->p_proto);
#endif
...
this fix has been tested with 1.0.6 and svn source under msys/mingw32/gcc-3.4.5