summaryrefslogtreecommitdiff
path: root/util/idiscover.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/idiscover.c')
-rw-r--r--util/idiscover.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/util/idiscover.c b/util/idiscover.c
index 57471e3..6dd0225 100644
--- a/util/idiscover.c
+++ b/util/idiscover.c
@@ -117,10 +117,14 @@ static char frawok = 0; /*raw not working in Solaris*/
#define RAW_DOMAIN AF_INET
#define RAW_PROTO IPPROTO_RAW
static char frawok = 0; /*raw not working in FreeBSD*/
+#elif HPUX
+#define RAW_DOMAIN AF_INET
+#define RAW_PROTO IPPROTO_RAW
+static char frawok = 0; /*raw not working in HPUX*/
#elif MACOS
#define RAW_DOMAIN AF_INET
#define RAW_PROTO IPPROTO_RAW
-static char frawok = 0; /*raw not working in FreeBSD*/
+static char frawok = 0; /*raw not working in MacOS*/
#elif WIN32
#define RAW_DOMAIN AF_INET
#define RAW_PROTO IPPROTO_ICMP
@@ -153,7 +157,7 @@ int GetFirstIP(uchar *ipaddr, uchar *macadr, char *ipname, char fdb); /*ilan.c*/
/*
* Global variables
*/
-static char * progver = "1.9";
+static char * progver = "1.10";
static char * progname = "idiscover";
static char fdebug = 0;
static char fping = 1;
@@ -387,7 +391,7 @@ int inet_aton(const char *cp, struct in_addr *inp)
else rv = 1; /*success*/
return(rv);
}
-#elif defined(SOLARIS)
+#elif defined(SOLARIS) || defined(HPUX)
int find_ifname(char *ifname)
{ return(-1); }
#else
@@ -398,15 +402,15 @@ int find_ifname(char *ifname)
int rv = -1;
if (getifaddrs(&ifaddr) == -1) return(rv);
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
- if (ifa->ifa_addr == NULL) continue;
- if ((ifa->ifa_addr->sa_family != AF_INET) &&
- (ifa->ifa_addr->sa_family != AF_INET6)) continue;
- if (strcmp(ifa->ifa_name,"lo") == 0) continue;
- /* if here, we have a valid ifname */
- strcpy(ifname,ifa->ifa_name);
- if (fdebug) printf("find_ifname: found %s\n",ifname);
- rv = 0;
- break;
+ if (ifa->ifa_addr == NULL) continue;
+ if ((ifa->ifa_addr->sa_family != AF_INET) &&
+ (ifa->ifa_addr->sa_family != AF_INET6)) continue;
+ if (strcmp(ifa->ifa_name,"lo") == 0) continue;
+ /* if here, we have a valid ifname */
+ strcpy(ifname,ifa->ifa_name);
+ if (fdebug) printf("find_ifname: found %s\n",ifname);
+ rv = 0;
+ break;
}
freeifaddrs(ifaddr);
return(rv);
@@ -483,7 +487,7 @@ int sock_init( char *_interface, char *_startIP, char *_endIP)
n = find_ifname(devname);
if (n >= 0) {
_interface = devname;
- findif = 0;
+ findif = 0; /*found, do not find again below */
}
}
if (findif)
@@ -630,10 +634,10 @@ void *receiveThread(void *p)
if ((g_sockraw = socket(RAW_DOMAIN, SOCK_RAW,RAW_PROTO)) == SockInvalid)
{
printerr("raw socket: %s\n", showlasterr());
- fraw = 0;
+ fraw = 0;
} else {
- sockrecv = g_sockraw;
- if (fdebug) printf("g_sockraw = %d\n",g_sockraw);
+ sockrecv = g_sockraw;
+ if (fdebug) printf("g_sockraw = %d\n",g_sockraw);
}
}
@@ -1011,7 +1015,7 @@ main(int argc, char **argv)
#endif
if (fraw == 1) {
if (frawok == 0) {
- printf("Warning: SOCK_RAW not yet implemented on this OS\n");
+ printf("Warning: SOCK_RAW not yet implemented on this OS\n");
}
#ifdef LINUX
else {