mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 08:22:44 +00:00
Clean up device handling WRT slip and ppp devices. An incomplete transition
from one convention to another had things pretty fouled up in here.
This commit is contained in:
parent
6befaa491c
commit
719de2bced
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=21276
@ -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];
|
||||
|
@ -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"
|
||||
|
@ -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];
|
||||
|
@ -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"
|
||||
|
@ -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];
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user