diff options
author | Jordan K. Hubbard <jkh@FreeBSD.org> | 1996-12-09 06:37:46 +0000 |
---|---|---|
committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 1996-12-09 06:37:46 +0000 |
commit | 5153026dfc295ed55cebfafcf7fa79acf8449625 (patch) | |
tree | 2f792b4a11e67bf3f4ea2c18c4a18e49863cd329 /release | |
parent | b0236c093d82e187cdb69a5b5378416cfe677827 (diff) | |
download | src-5153026dfc295ed55cebfafcf7fa79acf8449625.tar.gz src-5153026dfc295ed55cebfafcf7fa79acf8449625.zip |
Eliminate great evil in the networking code. That's all I'm gonna say.
Notes
Notes:
svn path=/head/; revision=20233
Diffstat (limited to 'release')
-rw-r--r-- | release/sysinstall/network.c | 34 | ||||
-rw-r--r-- | release/sysinstall/sysinstall.h | 3 | ||||
-rw-r--r-- | release/sysinstall/tcpip.c | 57 |
3 files changed, 20 insertions, 74 deletions
diff --git a/release/sysinstall/network.c b/release/sysinstall/network.c index c416f59b0c27..7e3c44533891 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.17 1996/12/08 12:27:58 jkh Exp $ + * $Id: network.c,v 1.18 1996/12/09 06:02:30 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -46,12 +46,14 @@ static Boolean networkInitialized; static pid_t startPPP(Device *devp); +static pid_t pppPID; + Boolean mediaInitNetwork(Device *dev) { int i; char *rp; - char *cp, ifconfig[64]; + char *cp, ifconfig[255]; if (!RunningAsInit || networkInitialized) return TRUE; @@ -60,13 +62,13 @@ mediaInitNetwork(Device *dev) if (!file_readable("/etc/resolv.conf")) configResolv(); - /* Old process lying around? */ - if (dev->private) { - kill((pid_t)dev->private, SIGTERM); - dev->private = NULL; + /* Old PPP process lying around? */ + if (pppPID) { + kill(pppPID, SIGTERM); + pppPID = 0; } if (!strncmp("ppp", dev->name, 3)) { /* PPP? */ - if (!(dev->private = (void *)startPPP(dev))) { + if (!(pppPID = startPPP(dev))) { msgConfirm("Unable to start PPP! This installation method cannot be used."); return FALSE; } @@ -95,8 +97,8 @@ mediaInitNetwork(Device *dev) strcpy(attach, val); /* * Doing this with vsystem() is actually bogus since we should be storing the pid of slattach - * in dev->private for later killing. It's just too convenient to call vsystem(), however, - * rather than constructing a proper argument for exec() so we punt on doing slip right for now. + * for later killing. It's just too convenient to call vsystem(), however, rather than + * constructing a proper argument for exec() so we punt on doing slip right for now. */ if (vsystem(attach)) { msgConfirm("slattach returned a bad status! Please verify that\n" @@ -164,10 +166,10 @@ mediaShutdownNetwork(Device *dev) vsystem("route delete default"); } } - else if (dev->private) { /* ppp sticks its PID there */ - msgNotify("Killing previous PPP process %d.", (int)dev->private); - kill((pid_t)dev->private, SIGTERM); - dev->private = NULL; + else if (pppPID) { + msgNotify("Killing previous PPP process %d.", pppPID); + kill(pppPID, SIGTERM); + pppPID = 0; } networkInitialized = FALSE; } @@ -196,12 +198,12 @@ startPPP(Device *devp) "maximum data rate since most modems can talk at one speed to the\n" "computer and at another speed to the remote end.\n\n" "If you're not sure what to put here, just select the default."); - strcpy(speed, (val && *val) ? val : "115200"); + strncpy(speed, (val && *val) ? val : "115200", 16); - strcpy(provider, variable_get(VAR_GATEWAY) ? variable_get(VAR_GATEWAY) : "0"); + strncpy(provider, variable_get(VAR_GATEWAY) ? variable_get(VAR_GATEWAY) : "0", 16); val = msgGetInput(provider, "Enter the IP address of your service provider or 0 if you\n" "don't know it and would prefer to negotiate it dynamically."); - strcpy(provider, val ? val : "0"); + strncpy(provider, val ? val : "0", 16); if (devp->private && ((DevInfo *)devp->private)->ipaddr[0]) strcpy(myaddr, ((DevInfo *)devp->private)->ipaddr); diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index ddc81116c41a..ddc94e2ef829 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.87 1996/11/09 18:12:17 jkh Exp $ + * $Id: sysinstall.h,v 1.88 1996/12/09 06:02:31 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -621,7 +621,6 @@ extern void mediaShutdownTape(Device *dev); /* tcpip.c */ extern int tcpOpenDialog(Device *dev); extern int tcpMenuSelect(dialogMenuItem *self); -extern int tcpInstallDevice(char *str); extern Boolean tcpDeviceSelect(void); /* termcap.c */ diff --git a/release/sysinstall/tcpip.c b/release/sysinstall/tcpip.c index 7d8dcb01d42a..a774c6d2bd72 100644 --- a/release/sysinstall/tcpip.c +++ b/release/sysinstall/tcpip.c @@ -1,5 +1,5 @@ /* - * $Id: tcpip.c,v 1.48 1996/10/05 16:33:04 jkh Exp $ + * $Id: tcpip.c,v 1.49 1996/11/07 08:03:29 jkh Exp $ * * Copyright (c) 1995 * Gary J Palmer. All rights reserved. @@ -168,61 +168,6 @@ verifySettings(void) return 0; } -int -tcpInstallDevice(char *str) -{ - Device **devs; - Device *dp = NULL; - - /* Clip garbage off the ends */ - string_prune(str); - str = string_skipwhite(str); - if (!*str) - return DITEM_FAILURE; - devs = deviceFind(str, DEVICE_TYPE_NETWORK); - if (devs && (dp = devs[0])) { - char temp[512], ifn[255]; - - if (!dp->private) { - DevInfo *di; - char *ipaddr, *netmask, *extras; - - di = dp->private = (DevInfo *)malloc(sizeof(DevInfo)); - - if ((ipaddr = variable_get(string_concat3(VAR_IPADDR, "_", dp->name))) == NULL) - ipaddr = variable_get(VAR_IPADDR); - - if ((netmask = variable_get(string_concat3(VAR_NETMASK, "_", dp->name))) == NULL) - netmask = variable_get(VAR_NETMASK); - - if ((extras = variable_get(string_concat3(VAR_EXTRAS, "_", dp->name))) == NULL) - extras = variable_get(VAR_EXTRAS); - - string_copy(di->ipaddr, ipaddr); - string_copy(di->netmask, netmask); - string_copy(di->extras, extras); - - if (ipaddr) { - char *ifaces; - - sprintf(temp, "inet %s %s netmask %s", ipaddr, extras ? extras : "", netmask); - sprintf(ifn, "%s%s", VAR_IFCONFIG, dp->name); - variable_set2(ifn, temp); - ifaces = variable_get(VAR_INTERFACES); - if (!ifaces) - variable_set2(VAR_INTERFACES, ifaces = "lo0"); - /* Only add it if it's not there already */ - if (!strstr(ifaces, dp->name)) { - sprintf(ifn, "%s %s", dp->name, ifaces); - variable_set2(VAR_INTERFACES, ifn); - } - } - } - mediaDevice = dp; - } - return dp ? DITEM_SUCCESS : DITEM_FAILURE; -} - /* This is it - how to get TCP setup values */ int tcpOpenDialog(Device *devp) |