summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/network.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/sysinstall/network.c')
-rw-r--r--usr.sbin/sysinstall/network.c92
1 files changed, 79 insertions, 13 deletions
diff --git a/usr.sbin/sysinstall/network.c b/usr.sbin/sysinstall/network.c
index d6ac179..db7330d 100644
--- a/usr.sbin/sysinstall/network.c
+++ b/usr.sbin/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.1 1995/05/27 10:38:58 jkh Exp $
+ * $Id: network.c,v 1.2 1995/05/28 03:05:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -46,8 +46,10 @@
/* These routines deal with getting things off of network media */
#include "sysinstall.h"
+#include <sys/fcntl.h>
static Boolean networkInitialized;
+static Boolean startPPP(Device *devp);
Boolean
mediaInitNetwork(Device *dev)
@@ -60,10 +62,14 @@ mediaInitNetwork(Device *dev)
configResolv();
if (!strncmp("cuaa", dev->name, 4)) {
- if (!tcpStartPPP(dev)) {
- msgConfirm("Unable to start PPP! This installation method\ncannot be used.");
- return FALSE;
+ if (!msgYesNo("You have selected a serial-line network interface.\nDo you want to use PPP with it?")) {
+ if (!startPPP(dev)) {
+ msgConfirm("Unable to start PPP! This installation method\ncannot be used.");
+ return FALSE;
+ }
}
+ else
+ msgConfirm("Warning: SLIP is rather poorly supported in this revision\nof the installation due to the lack of a dialing utility.\nIf you can use PPP for this instead then you're much better\noff doing so, otherwise SLIP works fairly well for *hardwired*\nlinks. Use the shell on the 4TH screen (ALT-F4) to run slattach\nand otherwise set the link up, then hit return here to continue.");
}
else {
char *cp, ifconfig[64];
@@ -99,11 +105,8 @@ mediaShutdownNetwork(Device *dev)
if (!networkInitialized)
return;
- if (!strncmp("cuaa", dev->name, 4)) {
- msgConfirm("You may now go to the 3rd screen (ALT-F3) and shut down\nyour PPP connection. It shouldn't be needed any longer\n(unless you wish to create a shell by typing ESC and\nexperiment with it further, in which case go right ahead!)");
- return;
- }
- else {
+ /* If we're running PPP or SLIP, it's too much trouble to shut down so forget it */
+ if (strncmp("cuaa", dev->name, 4)) {
int i;
char ifconfig[64];
@@ -114,10 +117,73 @@ mediaShutdownNetwork(Device *dev)
i = vsystem("ifconfig %s down", dev->name);
if (i)
msgConfirm("Warning: Unable to down the %s interface properly", dev->name);
+ cp = getenv(VAR_GATEWAY);
+ if (cp)
+ vsystem("route delete default");
+ networkInitialized = FALSE;
}
+}
+
+int
+configRoutedFlags(char *str)
+{
+ char *val;
- cp = getenv(VAR_GATEWAY);
- if (cp)
- vsystem("route delete default");
- networkInitialized = FALSE;
+ val = msgGetInput("-q", "Specify the flags for routed; -q is the default, -s is\na good choice for gateway machines.");
+ if (val)
+ variable_set2("routedflags", val);
+ return 0;
+}
+
+/* Start PPP on the 3rd screen */
+static Boolean
+startPPP(Device *devp)
+{
+ int fd;
+ FILE *fp;
+ char *val;
+ char myaddr[16], provider[16];
+
+ fd = open("/dev/ttyv2", O_RDWR);
+ if (fd == -1)
+ return FALSE;
+ Mkdir("/var/log", NULL);
+ Mkdir("/var/spool/lock", NULL);
+ Mkdir("/etc/ppp", NULL);
+ vsystem("touch /etc/ppp/ppp.linkup; chmod +x /etc/ppp/ppp.linkup");
+ vsystem("touch /etc/ppp/ppp.secret; chmod +x /etc/ppp/ppp.secret");
+ fp = fopen("/etc/ppp/ppp.conf", "w");
+ if (!fp) {
+ msgConfirm("Couldn't open /etc/ppp/ppp.conf file! This isn't going to work");
+ return FALSE;
+ }
+ fprintf(fp, "default:\n");
+ fprintf(fp, " set device %s\n", devp->devname);
+ val = msgGetInput("115200",
+"Enter the baud rate for your modem - this can be higher than the actual\nmaximum data rate since most modems can talk at one speed to the\ncomputer and at another speed to the remote end.\n\nIf you're not sure what to put here, just select the default.");
+ if (!val)
+ val = "115200";
+ fprintf(fp, " set speed %s\n", val);
+ if (getenv(VAR_GATEWAY))
+ strcpy(provider, getenv(VAR_GATEWAY));
+ else
+ strcpy(provider, "0");
+ val = msgGetInput(provider, "Enter the IP address of your service provider or 0 if you\ndon't know it and would prefer to negotiate it dynamically.");
+ if (!val)
+ val = "0";
+ if (devp->private && ((DevInfo *)devp->private)->ipaddr[0])
+ strcpy(myaddr, ((DevInfo *)devp->private)->ipaddr);
+ else
+ strcpy(myaddr, "0");
+ fprintf(fp, " set ifaddr %s %s\n", myaddr, val);
+ fclose(fp);
+ if (!fork()) {
+ dup2(fd, 0);
+ dup2(fd, 1);
+ dup2(fd, 2);
+ execl("/stand/ppp", "/stand/ppp", (char *)NULL);
+ exit(1);
+ }
+ msgConfirm("The PPP command is now started on screen 3 (type ALT-F3 to\ninteract with it, ALT-F1 to switch back here). The only command\nyou'll probably want or need to use is the \"term\" command\nwhich starts a terminal emulator you can use to talk to your\nmodem and dial the service provider. Once you're connected,\ncome back to this screen and press return. DO NOT PRESS RETURN\nHERE UNTIL THE CONNECTION IS FULLY ESTABLISHED!");
+ return TRUE;
}
OpenPOWER on IntegriCloud