Deleted Added
full compact
network.c (54587) network.c (54722)
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 54587 1999-12-14 04:25:29Z jkh $
7 * $FreeBSD: head/usr.sbin/sysinstall/network.c 54722 1999-12-17 02:46:04Z 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

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

65
66 if (!file_readable("/etc/resolv.conf")) {
67 if (DITEM_STATUS(configResolv(NULL)) == DITEM_FAILURE) {
68 msgConfirm("Can't seem to write out /etc/resolv.conf. Net cannot be used.");
69 return FALSE;
70 }
71 }
72
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

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

65
66 if (!file_readable("/etc/resolv.conf")) {
67 if (DITEM_STATUS(configResolv(NULL)) == DITEM_FAILURE) {
68 msgConfirm("Can't seem to write out /etc/resolv.conf. Net cannot be used.");
69 return FALSE;
70 }
71 }
72
73 w = savescr();
74 dialog_clear_norefresh();
75
73 /* Old PPP process lying around? */
74 if (pppPID) {
76 /* Old PPP process lying around? */
77 if (pppPID) {
75 msgNotify("Killing previous PPP process %d.", pppPID);
78 msgConfirm("Killing previous PPP process %d.", pppPID);
76 kill(pppPID, SIGTERM);
77 pppPID = 0;
78 }
79 if (!strncmp("ppp", dev->name, 3)) { /* PPP? */
80 if (!(pppPID = startPPP(dev))) {
81 msgConfirm("Unable to start PPP! This installation method cannot be used.");
82 return FALSE;
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
79 kill(pppPID, SIGTERM);
80 pppPID = 0;
81 }
82 if (!strncmp("ppp", dev->name, 3)) { /* PPP? */
83 if (!(pppPID = startPPP(dev))) {
84 msgConfirm("Unable to start PPP! This installation method cannot be used.");
85 return FALSE;
86 }
87 networkInitialized = TRUE;
88 return TRUE;
89 }
90 else if (!strncmp("sl", dev->name, 2)) { /* SLIP? */
91 char *val;
92 char attach[256];
93
91 w = savescr();
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"

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

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;
131 }
132 else if (!strcmp(cp, "DHCP"))
133 goto bail;
94 /* Cheesy slip attach */
95 snprintf(attach, 256, "slattach -a -h -l -s 9600 %s", dev->devname);
96 val = msgGetInput(attach,
97 "Warning: SLIP is rather poorly supported in this revision\n"
98 "of the installation due to the lack of a dialing utility.\n"
99 "If you can use PPP for this instead then you're much better\n"
100 "off doing so, otherwise SLIP works fairly well for *hardwired*\n"
101 "links. Please edit the following slattach command for\n"

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

127 cp = variable_get(ifconfig);
128 if (!cp) {
129 msgConfirm("The %s device is not configured. You will need to do so\n"
130 "in the Networking configuration menu before proceeding.", dev->name);
131 return FALSE;
132 }
133 else if (!strcmp(cp, "DHCP"))
134 goto bail;
134 msgNotify("ifconfig %s %s", dev->name, cp);
135 msgDebug("ifconfig %s %s", dev->name, cp);
135 i = vsystem("ifconfig %s %s", dev->name, cp);
136 if (i) {
137 msgConfirm("Unable to configure the %s interface!\n"
138 "This installation method cannot be used.", dev->name);
139 return FALSE;
140 }
141
142 rp = variable_get(VAR_GATEWAY);
143 if (!rp || *rp == '0') {
144 msgConfirm("No gateway has been set. You may be unable to access hosts\n"
145 "not on your local network");
146 }
147 else {
136 i = vsystem("ifconfig %s %s", dev->name, cp);
137 if (i) {
138 msgConfirm("Unable to configure the %s interface!\n"
139 "This installation method cannot be used.", dev->name);
140 return FALSE;
141 }
142
143 rp = variable_get(VAR_GATEWAY);
144 if (!rp || *rp == '0') {
145 msgConfirm("No gateway has been set. You may be unable to access hosts\n"
146 "not on your local network");
147 }
148 else {
148 msgNotify("Adding default route to %s.", rp);
149 msgDebug("Adding default route to %s.", rp);
149 vsystem("route -n add default %s", rp);
150 }
151bail:
152 if (isDebug())
153 msgDebug("Network initialized successfully.\n");
154 networkInitialized = TRUE;
155 return TRUE;
156}

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

168 if (strncmp("sl", dev->name, 2) && strncmp("ppp", dev->name, 3)) {
169 int i;
170 char ifconfig[255];
171
172 snprintf(ifconfig, 255, "%s%s", VAR_IFCONFIG, dev->name);
173 cp = variable_get(ifconfig);
174 if (!cp)
175 return;
150 vsystem("route -n add default %s", rp);
151 }
152bail:
153 if (isDebug())
154 msgDebug("Network initialized successfully.\n");
155 networkInitialized = TRUE;
156 return TRUE;
157}

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

169 if (strncmp("sl", dev->name, 2) && strncmp("ppp", dev->name, 3)) {
170 int i;
171 char ifconfig[255];
172
173 snprintf(ifconfig, 255, "%s%s", VAR_IFCONFIG, dev->name);
174 cp = variable_get(ifconfig);
175 if (!cp)
176 return;
176 msgNotify("ifconfig %s down", dev->name);
177 msgDebug("ifconfig %s down", dev->name);
177 i = vsystem("ifconfig %s down", dev->name);
178 if (i)
179 msgConfirm("Warning: Unable to down the %s interface properly", dev->name);
180 cp = variable_get(VAR_GATEWAY);
181 if (cp) {
178 i = vsystem("ifconfig %s down", dev->name);
179 if (i)
180 msgConfirm("Warning: Unable to down the %s interface properly", dev->name);
181 cp = variable_get(VAR_GATEWAY);
182 if (cp) {
182 msgNotify("Deleting default route.");
183 msgDebug("Deleting default route.");
183 vsystem("route -n delete default");
184 }
185 }
186 else if (pppPID) {
184 vsystem("route -n delete default");
185 }
186 }
187 else if (pppPID) {
187 msgNotify("Killing previous PPP process %d.", pppPID);
188 msgConfirm("Killing previous PPP process %d.", pppPID);
188 kill(pppPID, SIGTERM);
189 pppPID = 0;
190 }
191 networkInitialized = FALSE;
192}
193
194/* Start PPP on the 3rd screen */
195static pid_t

--- 157 unchanged lines hidden ---
189 kill(pppPID, SIGTERM);
190 pppPID = 0;
191 }
192 networkInitialized = FALSE;
193}
194
195/* Start PPP on the 3rd screen */
196static pid_t

--- 157 unchanged lines hidden ---