diff --git a/src/ether.c b/src/ether.c index c54573d..6b377c0 100644 --- a/src/ether.c +++ b/src/ether.c @@ -9,7 +9,7 @@ #include "version.h" -#ifdef USE_DLPI +#if defined(USE_DLPI) #define PKTFILTER 1 #define NIOCSFLAGS SBIOCSFLAGS #endif @@ -34,9 +34,9 @@ #include #include #include -#ifdef USE_DLPI +#if defined(USE_DLPI) #include "dlpidefs.h" -#else +#elif defined(USE_NIT) #include #endif @@ -55,7 +55,7 @@ #endif /* OS4 */ #endif /* PKTFILTER */ -#ifndef USE_DLPI +#if defined(USE_NIT) #include #endif #include @@ -73,7 +73,7 @@ #include "dbprint.h" #include "etherdefs.h" -#ifdef USE_DLPI +#if defined(USE_DLPI) #define NIOCSETF PFIOCSETF #endif @@ -245,7 +245,7 @@ LispPTR ether_suspend(LispPTR args[]) /* The trick here is to install a packet filter */ /* that rejects all packets, I think... */ -#ifdef USE_DLPI +#if defined(USE_DLPI) si.ic_cmd = PFIOCSETF; si.ic_timout = -1; @@ -257,7 +257,7 @@ LispPTR ether_suspend(LispPTR args[]) return (NIL); } -#else +#elif defined(USE_NIT) if (ioctl(ether_fd, NIOCSETF, &nopf) != 0) { perror("ether_suspend: NIOCSETF failed\n"); return (NIL); @@ -291,7 +291,7 @@ LispPTR ether_resume(LispPTR args[]) #else /* PKTFILTER */ /* Install a packet filter that accepts all packets we want */ -#ifdef USE_DLPI +#if defined(USE_DLPI) si.ic_cmd = PFIOCSETF; si.ic_timout = -1; @@ -303,7 +303,7 @@ LispPTR ether_resume(LispPTR args[]) return (NIL); } -#else +#elif defined(USE_NIT) if (ioctl(ether_fd, NIOCSETF, &goodpf) != 0) { perror("ether_resume: NIOCSETF failed\n"); return (NIL); @@ -763,9 +763,9 @@ void init_ifpage_ether() { #ifdef MAIKO_ENABLE_ETHERNET /* this needs to be a global so the name can be set by main() in Ctest */ /* But MAIKO_ENABLE_ETHERNET doesn't support NIT, so dyke it out for MAIKO_ENABLE_ETHERNET */ -#ifndef USE_DLPI +#if defined(USE_NIT) struct sockaddr_nit snit; -#endif /* USE_DLPI */ +#endif /* USE_NIT */ #endif /* MAIKO_ENABLE_ETHERNET */ /************************************************************************/ @@ -793,7 +793,7 @@ void init_ether() { if it's already open here, it was opened by ldeether and all the appropriate stuff was done to it there. */ -#ifdef USE_DLPI +#if defined(USE_DLPI) /* Use DLPI to connect to the ethernet. This code is stolen from NFSWATCH4.3 */ @@ -832,9 +832,7 @@ void init_ether() { } seteuid(getuid()); } -#else -/* N O T D L P I C O D E */ - +#elif defined(USE_NIT) #ifndef OS4 if (getuid() != geteuid()) { if ((ether_fd = socket(AF_NIT, SOCK_RAW, NITPROTO_RAW)) >= 0) { @@ -995,7 +993,7 @@ void init_ether() { /* first and foremost, flush out ether_fd's buffers and filter it */ /* install packetfilter that rejects everything */ -#ifdef USE_DLPI +#if defined(USE_DLPI) si.ic_cmd = PFIOCSETF; si.ic_timout = -1; @@ -1009,7 +1007,7 @@ void init_ether() { return; } -#else +#elif defined(USE_NIT) if (ioctl(ether_fd, NIOCSETF, &nopf) != 0) { perror("init_ether: nopf NIOCSETF failed:\n"); @@ -1028,9 +1026,9 @@ void init_ether() { /* then throw away everything that's currently buffered there; this descriptor may have been open since ldeether ran, with no filtering; a busy net will have stuffed it full */ -#ifdef USE_DLPI +#if defined(USE_DLPI) if (ioctl(ether_fd, I_FLUSH, (char *)FLUSHR) < 0) { perror("init_ether I_FLUSH"); } -#else +#elif defined(USE_NIT) { FD_SET(ether_fd, &rfds); while (select(32, &rfds, NULL, NULL, &EtherTimeout) > 0) @@ -1044,7 +1042,7 @@ void init_ether() { goodpf.Pf_Filter[11] = (DLword)((ether_host[2] << 8) + ether_host[3]); goodpf.Pf_Filter[14] = (DLword)((ether_host[4] << 8) + ether_host[5]); /* and set up the packetfilter */ -#ifdef USE_DLPI +#if defined(USE_DLPI) si.ic_cmd = PFIOCSETF; si.ic_timout = -1; @@ -1066,7 +1064,7 @@ void init_ether() { return; } #endif /* USE_DLPI */ -#ifndef USE_DLPI +#if defined(USE_NIT) DBPRINT(("INIT ETHER: Doing I_SETSIG.\n")); if (ioctl(ether_fd, I_SETSIG, S_INPUT) != 0) { perror("init_ether: I_SETSIG failed:\n"); @@ -1074,7 +1072,7 @@ void init_ether() { ether_fd = -1; return; } -#endif /* USE_DLPI */ +#endif /* USE_NIT */ #endif /* PKTFILTER */ if (ether_fd < 0) error ("ether_fd is -1, but enet opened??"); diff --git a/src/ldeether.c b/src/ldeether.c index 84b9a4b..d9f57e9 100644 --- a/src/ldeether.c +++ b/src/ldeether.c @@ -21,7 +21,7 @@ int main(int argc, char *argv[]) { return (0); } #include #include -#ifdef USE_DLPI +#if defined(USE_DLPI) #include #include #include @@ -53,14 +53,14 @@ char *devices[] = {"le0", "le1", "le2", "le3", "le4", "ie0", "ie1", "i #include #include #include -#ifndef USE_DLPI +#if defined(USE_NIT) #include #ifdef OS4 #include #include #include #endif /* OS4 */ -#endif /* USE_DLPI */ +#endif /* USE_NIT */ #include #include @@ -75,7 +75,7 @@ char filetorun[30] = "lde"; int main(int argc, char *argv[]) { char Earg[30], Ename[30], **newargv; int i; -#ifdef USE_DLPI +#if defined(USE_DLPI) static struct packetfilt pf = {0, 1, {ENF_PUSHZERO}}; struct strioctl si; #endif /* USE_DLPI */ @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) { */ if (!geteuid()) { -#ifdef USE_DLPI +#if defined(USE_DLPI) /* Use DLPI to connect to the ethernet. This code is stolen from NFSWATCH4.3 */ @@ -127,13 +127,10 @@ int main(int argc, char *argv[]) { fcntl(ether_fd, F_SETFL, fcntl(ether_fd, F_GETFL, 0) | O_NONBLOCK); -#else -/* N O T D L P I C O D E */ - +#elif defined(USE_NIT) #ifndef OS4 if ((ether_fd = socket(AF_NIT, SOCK_RAW, NITPROTO_RAW)) >= 0) { #else /* OS4 */ - if ((ether_fd = open("/dev/nit", O_RDWR)) >= 0) { #endif /* OS4 */ @@ -230,10 +227,10 @@ int main(int argc, char *argv[]) { /* then if the net is active, spit out the ether info */ if (ether_fd > 0) { newargv[i++] = "-E"; -#ifdef USE_DLPI +#if defined(USE_DLPI) sprintf(Earg, "%d:%x:%x:%x:%x:%x:%x", ether_fd, ether_host[0], ether_host[1], ether_host[2], ether_host[3], ether_host[4], ether_host[5]); -#else +#elif defined(USE_NIT) sprintf(Earg, "%d:%x:%x:%x:%x:%x:%x:%s", ether_fd, ether_host[0], ether_host[1], ether_host[2], ether_host[3], ether_host[4], ether_host[5], Ename); #endif /* USE_DLPI */ diff --git a/src/main.c b/src/main.c index ec59528..6c342a3 100644 --- a/src/main.c +++ b/src/main.c @@ -36,7 +36,7 @@ #endif /* DOS */ #ifdef MAIKO_ENABLE_ETHERNET -#ifndef USE_DLPI +#if defined(USE_NIT) #include /* needed for Ethernet stuff below */ #endif /* USE_DLPI */ #endif /* MAIKO_ENABLE_ETHERNET */ @@ -428,7 +428,7 @@ int main(int argc, char *argv[]) else if (!strcmp(argv[i], "-E")) { /**** ethernet info ****/ #ifdef MAIKO_ENABLE_ETHERNET int b0, b1, b2, b3, b4, b5; -#ifdef USE_DLPI +#if defined(USE_DLPI) if (argc > ++i && sscanf(argv[i], "%d:%x:%x:%x:%x:%x:%x", ðer_fd, &b0, &b1, &b2, &b3, &b4, &b5) == 7) #else diff --git a/src/timer.c b/src/timer.c index 2e0ab8c..7ae3132 100644 --- a/src/timer.c +++ b/src/timer.c @@ -45,7 +45,7 @@ unsigned long tick_count = 0; /* approx 18 ticks per sec */ #include #endif /* DOS */ -#ifdef USE_DLPI +#if defined(USE_DLPI) #include extern int ether_fd; #endif @@ -546,7 +546,7 @@ static void int_io_init() { perror("ioctl on X fd - SETSIG for input handling failed"); #endif -#ifdef USE_DLPI +#if defined(USE_DLPI) DBPRINT(("INIT ETHER: Doing I_SETSIG.\n")); if (ether_fd > 0) if (ioctl(ether_fd, I_SETSIG, S_INPUT) != 0) { diff --git a/src/uraid.c b/src/uraid.c index ce70e5d..f3a833a 100644 --- a/src/uraid.c +++ b/src/uraid.c @@ -1083,7 +1083,7 @@ int device_after_raid() { #ifdef MAIKO_ENABLE_ETHERNET init_ether(); -#ifdef USE_DLPI +#if defined(USE_DLPI) if (ether_fd > 0) if (ioctl(ether_fd, I_SETSIG, S_INPUT) != 0) { perror("after-uraid: I_SETSIG for ether failed:\n"); diff --git a/src/xrdopt.c b/src/xrdopt.c index 0e4bdee..a7f63b7 100644 --- a/src/xrdopt.c +++ b/src/xrdopt.c @@ -19,9 +19,9 @@ #include #include #ifdef MAIKO_ENABLE_ETHERNET -#ifndef USE_DLPI +#if defined(USE_NIT) #include /* needed for Ethernet stuff below */ -#endif /* USE_DLPI */ +#endif /* USE_NIT */ #endif /* MAIKO_ENABLE_ETHERNET */ #include #include @@ -92,9 +92,9 @@ extern int sysout_size, for_makeinit, please_fork; #ifdef MAIKO_ENABLE_ETHERNET extern int ether_fd; extern u_char ether_host[6]; -#ifndef USE_DLPI +#if defined(USE_NIT) extern struct sockaddr_nit snit; -#endif /* USE_DLPI */ +#endif /* USE_NIT */ #endif /* MAIKO_ENABLE_ETHERNET */ /************************************************************************/ @@ -297,12 +297,12 @@ void read_Xoption(int *argc, char *argv[]) if (XrmGetResource(rDB, "ldex.EtherNet", "Ldex.EtherNet", str_type, &value) == True) { int b0, b1, b2, b3, b4, b5; (void)strncpy(tmp, value.addr, (int)value.size); -#ifdef USE_DLPI +#if defined(USE_DLPI) if (sscanf(tmp, "%d:%x:%x:%x:%x:%x:%x", ðer_fd, &b0, &b1, &b2, &b3, &b4, &b5) == 7) -#else +#elif defined(USE_NIT) if (sscanf(tmp, "%d:%x:%x:%x:%x:%x:%x:%s", ðer_fd, &b0, &b1, &b2, &b3, &b4, &b5, snit.snit_ifname) == 8) -#endif /* USE_DLPI */ +#endif /* USE_NIT */ { ether_host[0] = b0; ether_host[1] = b1;