From 019fedf51406787d3904598e45f5a867d406becb Mon Sep 17 00:00:00 2001 From: jkh Date: Wed, 12 Jun 1996 17:09:34 +0000 Subject: Dispense with the special case handling of cuaa* devices by synthesizing separate entries for sl0 and ppp0 on each device. --- release/sysinstall/devices.c | 47 ++++++++++++++++---------- release/sysinstall/menus.c | 19 +++++------ release/sysinstall/network.c | 80 ++++++++++++++++++++------------------------ release/sysinstall/tcpip.c | 4 +-- 4 files changed, 78 insertions(+), 72 deletions(-) (limited to 'release') diff --git a/release/sysinstall/devices.c b/release/sysinstall/devices.c index b64c736..7b6d2f3 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.44 1996/04/13 13:31:27 jkh Exp $ + * $Id: devices.c,v 1.45 1996/04/23 01:29:12 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -70,10 +70,10 @@ static struct { { DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" }, { DEVICE_TYPE_FLOPPY, "fd0", "floppy drive unit A" }, { DEVICE_TYPE_FLOPPY, "fd1", "floppy drive unit B" }, - { DEVICE_TYPE_NETWORK, "cuaa0", "Serial port (COM1) - possible PPP/SLIP device" }, - { DEVICE_TYPE_NETWORK, "cuaa1", "Serial port (COM2) - possible PPP/SLIP device" }, - { DEVICE_TYPE_NETWORK, "cuaa2", "Serial port (COM3) - possible PPP/SLIP device" }, - { DEVICE_TYPE_NETWORK, "cuaa3", "Serial port (COM4) - possible PPP/SLIP device" }, + { DEVICE_TYPE_NETWORK, "cuaa0", "Serial port (COM1) configured as %s device" }, + { DEVICE_TYPE_NETWORK, "cuaa1", "Serial port (COM2) configured as %s device" }, + { DEVICE_TYPE_NETWORK, "cuaa2", "Serial port (COM3) configured as %s device" }, + { DEVICE_TYPE_NETWORK, "cuaa3", "Serial port (COM4) configured as %s device" }, { 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" }, @@ -158,18 +158,31 @@ deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean e if (numDevs == DEV_MAX) msgFatal("Too many devices found!"); - newdev = new_device(name); - newdev->description = desc; - newdev->devname = devname; - newdev->type = type; - newdev->enabled = enabled; - newdev->init = init ? init : dummyInit; - newdev->get = get ? get : dummyGet; - newdev->close = close ? close : dummyClose; - newdev->shutdown = shutdown ? shutdown : dummyShutdown; - newdev->private = private; - Devices[numDevs] = newdev; - Devices[++numDevs] = NULL; + if (!strncmp("cuaa", name, 4)) { + char *newdesc; + + /* Serial devices get a slip and ppp device each - trap here and special case the registration */ + newdesc = safe_malloc(strlen(desc) + 5); + sprintf(newdesc, desc, "sl0"); + (void)deviceRegister("sl0", newdesc, devname, type, enabled, init, get, close, shutdown, private); + newdesc = safe_malloc(strlen(desc) + 5); + sprintf(newdesc, desc, "ppp0"); + newdev = deviceRegister("ppp0", newdesc, devname, type, enabled, init, get, close, shutdown, private); + } + else { + newdev = new_device(name); + newdev->description = desc; + newdev->devname = devname; + newdev->type = type; + newdev->enabled = enabled; + newdev->init = init ? init : dummyInit; + newdev->get = get ? get : dummyGet; + newdev->close = close ? close : dummyClose; + newdev->shutdown = shutdown ? shutdown : dummyShutdown; + newdev->private = private; + Devices[numDevs] = newdev; + Devices[++numDevs] = NULL; + } return newdev; } diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c index 7d91b31..b6651ec 100644 --- a/release/sysinstall/menus.c +++ b/release/sysinstall/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.64 1996/06/12 14:02:12 jkh Exp $ + * $Id: menus.c,v 1.65 1996/06/12 14:20:18 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -490,15 +490,14 @@ select one of the following tape devices detected on your system.", DMenu MenuNetworkDevice = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Network interface information required", - "If you are using PPP over a serial device (cuaa0 or cuaa1) as opposed\n\ -to a direct ethernet connection, then you may first need to dial your\n\ -service provider using the ppp utility we provide for that purpose.\n\ -You can also install over a parallel port using a special \"laplink\"\n\ -cable, though this only works if you have another FreeBSD machine running\n\ -a fairly recent (2.0R or later) release to talk to.\n\n\ -To use PPP, select one of the serial devices, otherwise select lp0 for\n\ -the parallel port or one of the ethernet controllers (if you have one)\n\ -for an ethernet installation.", + "If you are using PPP over a serial device as opposed\n" + "to a direct ethernet connection, then you may first need to dial your\n" + "service provider using the ppp utility we provide for that purpose.\n" + "If you're using SLIP over a serial device then it's expected that you\n" + "have a hardwired connection.\n\n" + "You can also install over a parallel port using a special \"laplink\"\n" + "cable to another machine running a fairly recent (2.0R or later) version\n" + "of FreeBSD.", "Press F1 to read network configuration manual", "network_device", { { NULL } }, diff --git a/release/sysinstall/network.c b/release/sysinstall/network.c index 0349321..75b8474 100644 --- a/release/sysinstall/network.c +++ b/release/sysinstall/network.c @@ -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: network.c,v 1.11 1996/04/23 01:29:29 jkh Exp $ + * $Id: network.c,v 1.12 1996/04/28 20:54:04 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -51,7 +51,6 @@ mediaInitNetwork(Device *dev) int i; char *rp; char *cp, ifconfig[64]; - char ifname[255]; if (!RunningAsInit || networkInitialized) return TRUE; @@ -65,58 +64,52 @@ mediaInitNetwork(Device *dev) kill((pid_t)dev->private, SIGTERM); dev->private = NULL; } - if (!strncmp("cuaa", dev->name, 4)) { - if (!msgYesNo("You have selected a serial-line network interface.\n" - "Do you want to use PPP with it?")) { - if (!(dev->private = (void *)startPPP(dev))) { - msgConfirm("Unable to start PPP! This installation method cannot be used."); - return FALSE; - } - networkInitialized = TRUE; - return TRUE; + if (!strncmp("ppp", dev->name, 3)) { /* PPP? */ + if (!(dev->private = (void *)startPPP(dev))) { + msgConfirm("Unable to start PPP! This installation method cannot be used."); + return FALSE; } - else { - char *val; - char attach[256]; + networkInitialized = TRUE; + return TRUE; + } + else if (!strncmp("sl", dev->name, 2)) { /* SLIP? */ + char *val; + char attach[256]; - /* Cheesy slip attach */ - snprintf(attach, 256, "slattach -a -h -l -s 9600 %s", dev->devname); - val = msgGetInput(attach, - "Warning: SLIP is rather poorly supported in this revision\n" - "of the installation due to the lack of a dialing utility.\n" - "If you can use PPP for this instead then you're much better\n" - "off doing so, otherwise SLIP works fairly well for *hardwired*\n" - "links. Please edit the following slattach command for\n" - "correctness (default here is: VJ compression, Hardware flow-\n" - "control, ignore carrier and 9600 baud data rate). When you're\n" - "ready, press [ENTER] to execute it."); - if (!val) - return FALSE; - else - strcpy(attach, val); - if (vsystem(attach)) { - msgConfirm("slattach returned a bad status! Please verify that\n" - "the command is correct and try again."); - return FALSE; - } + /* Cheesy slip attach */ + snprintf(attach, 256, "slattach -a -h -l -s 9600 %s", dev->devname); + val = msgGetInput(attach, + "Warning: SLIP is rather poorly supported in this revision\n" + "of the installation due to the lack of a dialing utility.\n" + "If you can use PPP for this instead then you're much better\n" + "off doing so, otherwise SLIP works fairly well for *hardwired*\n" + "links. Please edit the following slattach command for\n" + "correctness (default here is: VJ compression, Hardware flow-\n" + "control, ignore carrier and 9600 baud data rate). When you're\n" + "ready, press [ENTER] to execute it."); + if (!val) + return FALSE; + else + strcpy(attach, val); + if (vsystem(attach)) { + msgConfirm("slattach returned a bad status! Please verify that\n" + "the command is correct and try again."); + return FALSE; } - strcpy(ifname, "sl0"); } - else - strcpy(ifname, dev->name); snprintf(ifconfig, 255, "%s%s", VAR_IFCONFIG, dev->name); cp = variable_get(ifconfig); if (!cp) { msgConfirm("The %s device is not configured. You will need to do so\n" - "in the Networking configuration menu before proceeding.", ifname); + "in the Networking configuration menu before proceeding.", dev->name); return FALSE; } - msgNotify("Configuring network device %s.", ifname); - i = vsystem("ifconfig %s %s", ifname, cp); + msgNotify("Configuring network device %s.", dev->name); + i = vsystem("ifconfig %s %s", dev->name, cp); if (i) { msgConfirm("Unable to configure the %s interface!\n" - "This installation method cannot be used.", ifname); + "This installation method cannot be used.", dev->name); return FALSE; } @@ -143,7 +136,8 @@ mediaShutdownNetwork(Device *dev) return; msgDebug("Shutdown called for network device %s\n", dev->name); - if (strncmp("cuaa", dev->name, 4)) { + /* Not a serial device? */ + if (strncmp("sl", dev->name, 2) && strncmp("ppp", dev->name, 3)) { int i; char ifconfig[255]; @@ -162,7 +156,7 @@ mediaShutdownNetwork(Device *dev) } networkInitialized = FALSE; } - else if (dev->private) { + else if (dev->private) { /* ppp sticks its PID there */ msgNotify("Killing PPP process %d.", (int)dev->private); kill((pid_t)dev->private, SIGTERM); dev->private = NULL; diff --git a/release/sysinstall/tcpip.c b/release/sysinstall/tcpip.c index 0f0bed7..d9c522f 100644 --- a/release/sysinstall/tcpip.c +++ b/release/sysinstall/tcpip.c @@ -1,5 +1,5 @@ /* - * $Id: tcpip.c,v 1.38 1996/04/30 05:25:15 jkh Exp $ + * $Id: tcpip.c,v 1.39 1996/05/21 15:57:21 jkh Exp $ * * Copyright (c) 1995 * Gary J Palmer. All rights reserved. @@ -488,7 +488,7 @@ tcpOpenDialog(Device *devp) variable_set2(VAR_NAMESERVER, nameserver); if (!devp->private) - devp->private = (DevInfo *)malloc(sizeof(DevInfo)); + devp->private = (DevInfo *)safe_malloc(sizeof(DevInfo)); di = devp->private; strcpy(di->ipaddr, ipaddr); strcpy(di->netmask, netmask); -- cgit v1.1