diff options
author | jkh <jkh@FreeBSD.org> | 1997-01-04 13:29:10 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1997-01-04 13:29:10 +0000 |
commit | 4b75276df931e4fcc3aaad11ed643e5c198cc766 (patch) | |
tree | a69019b9e2ecb8844ca32d67eb829e2e1f24396d | |
parent | faf2f698798b8fa7bd77b85fa31f3304a9580f30 (diff) | |
download | FreeBSD-src-4b75276df931e4fcc3aaad11ed643e5c198cc766.zip FreeBSD-src-4b75276df931e4fcc3aaad11ed643e5c198cc766.tar.gz |
Clean up device handling WRT slip and ppp devices. An incomplete transition
from one convention to another had things pretty fouled up in here.
-rw-r--r-- | release/sysinstall/devices.c | 46 | ||||
-rw-r--r-- | release/sysinstall/sysinstall.h | 4 | ||||
-rw-r--r-- | usr.sbin/sade/devices.c | 46 | ||||
-rw-r--r-- | usr.sbin/sade/sade.h | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/devices.c | 46 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 4 |
6 files changed, 99 insertions, 51 deletions
diff --git a/release/sysinstall/devices.c b/release/sysinstall/devices.c index f1405f4..9b392c9 100644 --- a/release/sysinstall/devices.c +++ b/release/sysinstall/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.56 1996/12/26 21:03:04 jkh Exp $ + * $Id: devices.c,v 1.57 1997/01/03 06:32:24 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -76,8 +76,6 @@ static struct { { DEVICE_TYPE_NETWORK, "cuaa3", "%s on serial port 3 (COM4)" }, { DEVICE_TYPE_NETWORK, "lp0", "Parallel Port IP (PLIP) using laplink cable" }, { DEVICE_TYPE_NETWORK, "lo", "Loop-back (local) network interface" }, - { DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" }, - { DEVICE_TYPE_NETWORK, "ppp", "Point-to-Point Protocol (PPP) interface" }, { DEVICE_TYPE_NETWORK, "de", "DEC DE435 PCI NIC or other DC21040-AA based card" }, { DEVICE_TYPE_NETWORK, "fxp", "Intel EtherExpress Pro/100B PCI Fast Ethernet card" }, { DEVICE_TYPE_NETWORK, "ed", "WD/SMC 80xx; Novell NE1000/2000; 3Com 3C503 card" }, @@ -177,6 +175,7 @@ deviceGetAll(void) int ifflags; char buffer[INTERFACE_MAX * sizeof(struct ifreq)]; char **names; + int supportSLIP = FALSE, supportPPP = FALSE; /* Try and get the disks first */ if ((names = Disk_Names()) != NULL) { @@ -234,9 +233,20 @@ deviceGetAll(void) continue; /* Eliminate network devices that don't make sense */ - if (!strncmp(ifptr->ifr_name, "tun", 3) || !strncmp(ifptr->ifr_name, "lo0", 3)) + if (!strncmp(ifptr->ifr_name, "lo0", 3)) continue; + /* If we have a slip device, don't register it but flag its support for later, when we do the serial devs */ + if (!strncmp(ifptr->ifr_name, "sl", 2)) { + supportSLIP = TRUE; + continue; + } + /* And the same for ppp */ + if (!strncmp(ifptr->ifr_name, "tun", 3) || !strncmp(ifptr->ifr_name, "ppp", 3)) { + supportPPP = TRUE; + continue; + } + /* Try and find its description */ for (i = 0, descr = NULL; device_names[i].name; i++) { int len = strlen(device_names[i].name); @@ -309,17 +319,22 @@ skipif: char *newdesc, *cp; close(fd); - /* Serial devices get a slip and ppp device each */ cp = device_names[i].description; - newdesc = safe_malloc(strlen(cp) + 40); - sprintf(newdesc, cp, "SLIP interface"); - deviceRegister("sl0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, - NULL, mediaShutdownNetwork, NULL); - newdesc = safe_malloc(strlen(cp) + 50); - sprintf(newdesc, cp, "PPP interface"); - deviceRegister("ppp0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, - NULL, mediaShutdownNetwork, NULL); - msgDebug("Found a serial network device named %s on %s\n", device_names[i].name, try); + /* Serial devices get a slip and ppp device each, if supported */ + if (supportSLIP) { + newdesc = safe_malloc(strlen(cp) + 40); + sprintf(newdesc, cp, "SLIP interface"); + deviceRegister("sl0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, + NULL, mediaShutdownNetwork, NULL); + msgDebug("Add mapping for %s on %s to sl0\n", device_names[i].name, try); + } + if (supportPPP) { + newdesc = safe_malloc(strlen(cp) + 50); + sprintf(newdesc, cp, "PPP interface"); + deviceRegister("ppp0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, + NULL, mediaShutdownNetwork, NULL); + msgDebug("Add mapping for %s on %s to ppp0\n", device_names[i].name, try); + } } break; @@ -340,7 +355,8 @@ deviceFind(char *name, DeviceType class) static Device *found[DEV_MAX]; int i, j; - for (i = 0, j = 0; i < numDevs; i++) { + j = 0; + for (i = 0; i < numDevs; i++) { if ((!name || !strcmp(Devices[i]->name, name)) && (class == DEVICE_TYPE_ANY || class == Devices[i]->type)) found[j++] = Devices[i]; diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index d650bce..9ef4cfb 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.96 1996/12/29 05:51:39 jkh Exp $ + * $Id: sysinstall.h,v 1.97 1997/01/03 06:32:35 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -57,7 +57,7 @@ /* Different packages we depend on - update this when package version change! */ #define PACKAGE_GATED "gated-3.5b3" #define PACKAGE_APACHE "apache-1.1.1" -#define PACKAGE_NETCON "commerce/netcon/bsd60" +#define PACKAGE_NETCON "commerce/netcon/bsd61" #define PACKAGE_PCNFSD "pcnfsd-93.02.16" #define PACKAGE_SAMBA "samba-1.9.15p8" #define PACKAGE_LYNX "lynx-2.6" diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c index f1405f4..9b392c9 100644 --- a/usr.sbin/sade/devices.c +++ b/usr.sbin/sade/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.56 1996/12/26 21:03:04 jkh Exp $ + * $Id: devices.c,v 1.57 1997/01/03 06:32:24 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -76,8 +76,6 @@ static struct { { DEVICE_TYPE_NETWORK, "cuaa3", "%s on serial port 3 (COM4)" }, { DEVICE_TYPE_NETWORK, "lp0", "Parallel Port IP (PLIP) using laplink cable" }, { DEVICE_TYPE_NETWORK, "lo", "Loop-back (local) network interface" }, - { DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" }, - { DEVICE_TYPE_NETWORK, "ppp", "Point-to-Point Protocol (PPP) interface" }, { DEVICE_TYPE_NETWORK, "de", "DEC DE435 PCI NIC or other DC21040-AA based card" }, { DEVICE_TYPE_NETWORK, "fxp", "Intel EtherExpress Pro/100B PCI Fast Ethernet card" }, { DEVICE_TYPE_NETWORK, "ed", "WD/SMC 80xx; Novell NE1000/2000; 3Com 3C503 card" }, @@ -177,6 +175,7 @@ deviceGetAll(void) int ifflags; char buffer[INTERFACE_MAX * sizeof(struct ifreq)]; char **names; + int supportSLIP = FALSE, supportPPP = FALSE; /* Try and get the disks first */ if ((names = Disk_Names()) != NULL) { @@ -234,9 +233,20 @@ deviceGetAll(void) continue; /* Eliminate network devices that don't make sense */ - if (!strncmp(ifptr->ifr_name, "tun", 3) || !strncmp(ifptr->ifr_name, "lo0", 3)) + if (!strncmp(ifptr->ifr_name, "lo0", 3)) continue; + /* If we have a slip device, don't register it but flag its support for later, when we do the serial devs */ + if (!strncmp(ifptr->ifr_name, "sl", 2)) { + supportSLIP = TRUE; + continue; + } + /* And the same for ppp */ + if (!strncmp(ifptr->ifr_name, "tun", 3) || !strncmp(ifptr->ifr_name, "ppp", 3)) { + supportPPP = TRUE; + continue; + } + /* Try and find its description */ for (i = 0, descr = NULL; device_names[i].name; i++) { int len = strlen(device_names[i].name); @@ -309,17 +319,22 @@ skipif: char *newdesc, *cp; close(fd); - /* Serial devices get a slip and ppp device each */ cp = device_names[i].description; - newdesc = safe_malloc(strlen(cp) + 40); - sprintf(newdesc, cp, "SLIP interface"); - deviceRegister("sl0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, - NULL, mediaShutdownNetwork, NULL); - newdesc = safe_malloc(strlen(cp) + 50); - sprintf(newdesc, cp, "PPP interface"); - deviceRegister("ppp0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, - NULL, mediaShutdownNetwork, NULL); - msgDebug("Found a serial network device named %s on %s\n", device_names[i].name, try); + /* Serial devices get a slip and ppp device each, if supported */ + if (supportSLIP) { + newdesc = safe_malloc(strlen(cp) + 40); + sprintf(newdesc, cp, "SLIP interface"); + deviceRegister("sl0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, + NULL, mediaShutdownNetwork, NULL); + msgDebug("Add mapping for %s on %s to sl0\n", device_names[i].name, try); + } + if (supportPPP) { + newdesc = safe_malloc(strlen(cp) + 50); + sprintf(newdesc, cp, "PPP interface"); + deviceRegister("ppp0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, + NULL, mediaShutdownNetwork, NULL); + msgDebug("Add mapping for %s on %s to ppp0\n", device_names[i].name, try); + } } break; @@ -340,7 +355,8 @@ deviceFind(char *name, DeviceType class) static Device *found[DEV_MAX]; int i, j; - for (i = 0, j = 0; i < numDevs; i++) { + j = 0; + for (i = 0; i < numDevs; i++) { if ((!name || !strcmp(Devices[i]->name, name)) && (class == DEVICE_TYPE_ANY || class == Devices[i]->type)) found[j++] = Devices[i]; diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index d650bce..9ef4cfb 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.96 1996/12/29 05:51:39 jkh Exp $ + * $Id: sysinstall.h,v 1.97 1997/01/03 06:32:35 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -57,7 +57,7 @@ /* Different packages we depend on - update this when package version change! */ #define PACKAGE_GATED "gated-3.5b3" #define PACKAGE_APACHE "apache-1.1.1" -#define PACKAGE_NETCON "commerce/netcon/bsd60" +#define PACKAGE_NETCON "commerce/netcon/bsd61" #define PACKAGE_PCNFSD "pcnfsd-93.02.16" #define PACKAGE_SAMBA "samba-1.9.15p8" #define PACKAGE_LYNX "lynx-2.6" diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c index f1405f4..9b392c9 100644 --- a/usr.sbin/sysinstall/devices.c +++ b/usr.sbin/sysinstall/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.56 1996/12/26 21:03:04 jkh Exp $ + * $Id: devices.c,v 1.57 1997/01/03 06:32:24 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -76,8 +76,6 @@ static struct { { DEVICE_TYPE_NETWORK, "cuaa3", "%s on serial port 3 (COM4)" }, { DEVICE_TYPE_NETWORK, "lp0", "Parallel Port IP (PLIP) using laplink cable" }, { DEVICE_TYPE_NETWORK, "lo", "Loop-back (local) network interface" }, - { DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" }, - { DEVICE_TYPE_NETWORK, "ppp", "Point-to-Point Protocol (PPP) interface" }, { DEVICE_TYPE_NETWORK, "de", "DEC DE435 PCI NIC or other DC21040-AA based card" }, { DEVICE_TYPE_NETWORK, "fxp", "Intel EtherExpress Pro/100B PCI Fast Ethernet card" }, { DEVICE_TYPE_NETWORK, "ed", "WD/SMC 80xx; Novell NE1000/2000; 3Com 3C503 card" }, @@ -177,6 +175,7 @@ deviceGetAll(void) int ifflags; char buffer[INTERFACE_MAX * sizeof(struct ifreq)]; char **names; + int supportSLIP = FALSE, supportPPP = FALSE; /* Try and get the disks first */ if ((names = Disk_Names()) != NULL) { @@ -234,9 +233,20 @@ deviceGetAll(void) continue; /* Eliminate network devices that don't make sense */ - if (!strncmp(ifptr->ifr_name, "tun", 3) || !strncmp(ifptr->ifr_name, "lo0", 3)) + if (!strncmp(ifptr->ifr_name, "lo0", 3)) continue; + /* If we have a slip device, don't register it but flag its support for later, when we do the serial devs */ + if (!strncmp(ifptr->ifr_name, "sl", 2)) { + supportSLIP = TRUE; + continue; + } + /* And the same for ppp */ + if (!strncmp(ifptr->ifr_name, "tun", 3) || !strncmp(ifptr->ifr_name, "ppp", 3)) { + supportPPP = TRUE; + continue; + } + /* Try and find its description */ for (i = 0, descr = NULL; device_names[i].name; i++) { int len = strlen(device_names[i].name); @@ -309,17 +319,22 @@ skipif: char *newdesc, *cp; close(fd); - /* Serial devices get a slip and ppp device each */ cp = device_names[i].description; - newdesc = safe_malloc(strlen(cp) + 40); - sprintf(newdesc, cp, "SLIP interface"); - deviceRegister("sl0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, - NULL, mediaShutdownNetwork, NULL); - newdesc = safe_malloc(strlen(cp) + 50); - sprintf(newdesc, cp, "PPP interface"); - deviceRegister("ppp0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, - NULL, mediaShutdownNetwork, NULL); - msgDebug("Found a serial network device named %s on %s\n", device_names[i].name, try); + /* Serial devices get a slip and ppp device each, if supported */ + if (supportSLIP) { + newdesc = safe_malloc(strlen(cp) + 40); + sprintf(newdesc, cp, "SLIP interface"); + deviceRegister("sl0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, + NULL, mediaShutdownNetwork, NULL); + msgDebug("Add mapping for %s on %s to sl0\n", device_names[i].name, try); + } + if (supportPPP) { + newdesc = safe_malloc(strlen(cp) + 50); + sprintf(newdesc, cp, "PPP interface"); + deviceRegister("ppp0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, + NULL, mediaShutdownNetwork, NULL); + msgDebug("Add mapping for %s on %s to ppp0\n", device_names[i].name, try); + } } break; @@ -340,7 +355,8 @@ deviceFind(char *name, DeviceType class) static Device *found[DEV_MAX]; int i, j; - for (i = 0, j = 0; i < numDevs; i++) { + j = 0; + for (i = 0; i < numDevs; i++) { if ((!name || !strcmp(Devices[i]->name, name)) && (class == DEVICE_TYPE_ANY || class == Devices[i]->type)) found[j++] = Devices[i]; diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index d650bce..9ef4cfb 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.96 1996/12/29 05:51:39 jkh Exp $ + * $Id: sysinstall.h,v 1.97 1997/01/03 06:32:35 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -57,7 +57,7 @@ /* Different packages we depend on - update this when package version change! */ #define PACKAGE_GATED "gated-3.5b3" #define PACKAGE_APACHE "apache-1.1.1" -#define PACKAGE_NETCON "commerce/netcon/bsd60" +#define PACKAGE_NETCON "commerce/netcon/bsd61" #define PACKAGE_PCNFSD "pcnfsd-93.02.16" #define PACKAGE_SAMBA "samba-1.9.15p8" #define PACKAGE_LYNX "lynx-2.6" |