Deleted Added
full compact
network.c (50917) network.c (54587)
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last attempt in the `sysinstall' line, the next
5 * generation being slated to essentially a complete rewrite.
6 *
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last attempt in the `sysinstall' line, the next
5 * generation being slated to essentially a complete rewrite.
6 *
7 * $FreeBSD: head/usr.sbin/sysinstall/network.c 50917 1999-09-04 16:01:15Z jkh $
7 * $FreeBSD: head/usr.sbin/sysinstall/network.c 54587 1999-12-14 04:25:29Z jkh $
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright

--- 34 unchanged lines hidden (view full) ---

50static pid_t pppPID;
51
52Boolean
53mediaInitNetwork(Device *dev)
54{
55 int i;
56 char *rp;
57 char *cp, ifconfig[255];
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright

--- 34 unchanged lines hidden (view full) ---

50static pid_t pppPID;
51
52Boolean
53mediaInitNetwork(Device *dev)
54{
55 int i;
56 char *rp;
57 char *cp, ifconfig[255];
58
58 WINDOW *w;
59
59 if (!RunningAsInit || networkInitialized)
60 return TRUE;
61
62 if (isDebug())
63 msgDebug("Init routine called for network device %s.\n", dev->name);
64
65 if (!file_readable("/etc/resolv.conf")) {
66 if (DITEM_STATUS(configResolv(NULL)) == DITEM_FAILURE) {

--- 15 unchanged lines hidden (view full) ---

82 }
83 networkInitialized = TRUE;
84 return TRUE;
85 }
86 else if (!strncmp("sl", dev->name, 2)) { /* SLIP? */
87 char *val;
88 char attach[256];
89
60 if (!RunningAsInit || networkInitialized)
61 return TRUE;
62
63 if (isDebug())
64 msgDebug("Init routine called for network device %s.\n", dev->name);
65
66 if (!file_readable("/etc/resolv.conf")) {
67 if (DITEM_STATUS(configResolv(NULL)) == DITEM_FAILURE) {

--- 15 unchanged lines hidden (view full) ---

83 }
84 networkInitialized = TRUE;
85 return TRUE;
86 }
87 else if (!strncmp("sl", dev->name, 2)) { /* SLIP? */
88 char *val;
89 char attach[256];
90
91 w = savescr();
90 dialog_clear_norefresh();
91 /* Cheesy slip attach */
92 snprintf(attach, 256, "slattach -a -h -l -s 9600 %s", dev->devname);
93 val = msgGetInput(attach,
94 "Warning: SLIP is rather poorly supported in this revision\n"
95 "of the installation due to the lack of a dialing utility.\n"
96 "If you can use PPP for this instead then you're much better\n"
97 "off doing so, otherwise SLIP works fairly well for *hardwired*\n"
98 "links. Please edit the following slattach command for\n"
99 "correctness (default here is: VJ compression, Hardware flow-\n"
100 "control, ignore carrier and 9600 baud data rate). When you're\n"
101 "ready, press [ENTER] to execute it.");
102 if (!val) {
103 msgConfirm("slattach command was empty. Try again!");
92 dialog_clear_norefresh();
93 /* Cheesy slip attach */
94 snprintf(attach, 256, "slattach -a -h -l -s 9600 %s", dev->devname);
95 val = msgGetInput(attach,
96 "Warning: SLIP is rather poorly supported in this revision\n"
97 "of the installation due to the lack of a dialing utility.\n"
98 "If you can use PPP for this instead then you're much better\n"
99 "off doing so, otherwise SLIP works fairly well for *hardwired*\n"
100 "links. Please edit the following slattach command for\n"
101 "correctness (default here is: VJ compression, Hardware flow-\n"
102 "control, ignore carrier and 9600 baud data rate). When you're\n"
103 "ready, press [ENTER] to execute it.");
104 if (!val) {
105 msgConfirm("slattach command was empty. Try again!");
106 restorescr(w);
104 return FALSE;
105 }
106 else
107 SAFE_STRCPY(attach, val);
108 /*
109 * Doing this with vsystem() is actually bogus since we should be storing the pid of slattach
110 * for later killing. It's just too convenient to call vsystem(), however, rather than
111 * constructing a proper argument for exec() so we punt on doing slip right for now.
112 */
113 if (vsystem(attach)) {
114 msgConfirm("slattach returned a bad status! Please verify that\n"
115 "the command is correct and try this operation again.");
107 return FALSE;
108 }
109 else
110 SAFE_STRCPY(attach, val);
111 /*
112 * Doing this with vsystem() is actually bogus since we should be storing the pid of slattach
113 * for later killing. It's just too convenient to call vsystem(), however, rather than
114 * constructing a proper argument for exec() so we punt on doing slip right for now.
115 */
116 if (vsystem(attach)) {
117 msgConfirm("slattach returned a bad status! Please verify that\n"
118 "the command is correct and try this operation again.");
119 restorescr(w);
116 return FALSE;
117 }
120 return FALSE;
121 }
122 restorescr(w);
118 }
119
120 snprintf(ifconfig, 255, "%s%s", VAR_IFCONFIG, dev->name);
121 cp = variable_get(ifconfig);
122 if (!cp) {
123 msgConfirm("The %s device is not configured. You will need to do so\n"
124 "in the Networking configuration menu before proceeding.", dev->name);
125 return FALSE;

--- 65 unchanged lines hidden (view full) ---

191startPPP(Device *devp)
192{
193 int fd2, pulse;
194 FILE *fp;
195 char *val;
196 pid_t pid = 0;
197 char myaddr[16], provider[16], speed[16], authname[32], authkey[16];
198 char phone[16];
123 }
124
125 snprintf(ifconfig, 255, "%s%s", VAR_IFCONFIG, dev->name);
126 cp = variable_get(ifconfig);
127 if (!cp) {
128 msgConfirm("The %s device is not configured. You will need to do so\n"
129 "in the Networking configuration menu before proceeding.", dev->name);
130 return FALSE;

--- 65 unchanged lines hidden (view full) ---

196startPPP(Device *devp)
197{
198 int fd2, pulse;
199 FILE *fp;
200 char *val;
201 pid_t pid = 0;
202 char myaddr[16], provider[16], speed[16], authname[32], authkey[16];
203 char phone[16];
199
204 WINDOW *w = savescr();
205
200 /* These are needed to make ppp work */
201 Mkdir("/var/log");
202 Mkdir("/var/run");
203 Mkdir("/var/spool/lock");
204 Mkdir("/etc/ppp");
205
206 dialog_clear_norefresh();
207 if (!variable_get(VAR_SERIAL_SPEED))

--- 39 unchanged lines hidden (view full) ---

247 close(fd2);
248 }
249 if (!Fake)
250 fp = fopen("/etc/ppp/ppp.conf", "a");
251 else
252 fp = fopen("/dev/stderr", "w");
253 if (!fp) {
254 msgConfirm("Couldn't open /etc/ppp/ppp.conf file! This isn't going to work");
206 /* These are needed to make ppp work */
207 Mkdir("/var/log");
208 Mkdir("/var/run");
209 Mkdir("/var/spool/lock");
210 Mkdir("/etc/ppp");
211
212 dialog_clear_norefresh();
213 if (!variable_get(VAR_SERIAL_SPEED))

--- 39 unchanged lines hidden (view full) ---

253 close(fd2);
254 }
255 if (!Fake)
256 fp = fopen("/etc/ppp/ppp.conf", "a");
257 else
258 fp = fopen("/dev/stderr", "w");
259 if (!fp) {
260 msgConfirm("Couldn't open /etc/ppp/ppp.conf file! This isn't going to work");
261 restorescr(w);
255 return 0;
256 }
257 authname[0] = '\0';
258 pulse = 0;
259 dialog_clear_norefresh();
260 if (!dialog_yesno("", "Does your ISP support PAP or CHAP ppp logins?", -1, -1)) {
261 val = msgGetInput(NULL, "Enter the name you use to login to your provider.");
262 SAFE_STRCPY(authname, val);

--- 25 unchanged lines hidden (view full) ---

288 fclose(fp);
289
290 /* Make the ppp config persistent */
291 variable_set2(VAR_PPP_ENABLE, "YES", 0);
292 variable_set2(VAR_PPP_PROFILE, "install", 0);
293
294 if (!Fake && !file_readable("/dev/tun0") && mknod("/dev/tun0", 0600 | S_IFCHR, makedev(52, 0))) {
295 msgConfirm("Warning: No /dev/tun0 device. PPP will not work!");
262 return 0;
263 }
264 authname[0] = '\0';
265 pulse = 0;
266 dialog_clear_norefresh();
267 if (!dialog_yesno("", "Does your ISP support PAP or CHAP ppp logins?", -1, -1)) {
268 val = msgGetInput(NULL, "Enter the name you use to login to your provider.");
269 SAFE_STRCPY(authname, val);

--- 25 unchanged lines hidden (view full) ---

295 fclose(fp);
296
297 /* Make the ppp config persistent */
298 variable_set2(VAR_PPP_ENABLE, "YES", 0);
299 variable_set2(VAR_PPP_PROFILE, "install", 0);
300
301 if (!Fake && !file_readable("/dev/tun0") && mknod("/dev/tun0", 0600 | S_IFCHR, makedev(52, 0))) {
302 msgConfirm("Warning: No /dev/tun0 device. PPP will not work!");
303 restorescr(w);
296 return 0;
297 }
298
299 if (isDebug())
300 msgDebug("About to start PPP on device %s @ %s baud. Provider = %s\n", devp->devname, speed, provider);
301
302 if (!Fake && !(pid = fork())) {
303 int i, fd;

--- 30 unchanged lines hidden (view full) ---

334 "a PAP or CHAP login simply enter \"dial\", otherwise you'll need\n"
335 "to use the \"term\" command which starts a terminal emulator\n"
336 "which you can use to talk to your modem and dial the service\n"
337 "provider. Once you're connected, come back to this screen and\n"
338 "press return.\n\n"
339 "DO NOT PRESS [ENTER] HERE UNTIL THE CONNECTION IS FULLY\n"
340 "ESTABLISHED!");
341 }
304 return 0;
305 }
306
307 if (isDebug())
308 msgDebug("About to start PPP on device %s @ %s baud. Provider = %s\n", devp->devname, speed, provider);
309
310 if (!Fake && !(pid = fork())) {
311 int i, fd;

--- 30 unchanged lines hidden (view full) ---

342 "a PAP or CHAP login simply enter \"dial\", otherwise you'll need\n"
343 "to use the \"term\" command which starts a terminal emulator\n"
344 "which you can use to talk to your modem and dial the service\n"
345 "provider. Once you're connected, come back to this screen and\n"
346 "press return.\n\n"
347 "DO NOT PRESS [ENTER] HERE UNTIL THE CONNECTION IS FULLY\n"
348 "ESTABLISHED!");
349 }
350 restorescr(w);
342 return pid;
343}
351 return pid;
352}