1997-12-05 17:26:27 +03:00
|
|
|
/* $NetBSD: net.c,v 1.25 1997/12/05 14:26:27 jonathan Exp $ */
|
1997-09-27 03:02:53 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 1997 Piermont Information Systems Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Written by Philip A. Nelson for Piermont Information Systems Inc.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software develooped for the NetBSD Project by
|
|
|
|
* Piermont Information Systems Inc.
|
|
|
|
* 4. The name of Piermont Information Systems Inc. may not be used to endorse
|
|
|
|
* or promote products derived from this software without specific prior
|
|
|
|
* written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS''
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
|
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* net.c -- routines to fetch files off the network. */
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <curses.h>
|
|
|
|
#include <unistd.h>
|
1997-11-22 17:16:55 +03:00
|
|
|
#include <sys/param.h>
|
1997-09-27 03:02:53 +04:00
|
|
|
#include "defs.h"
|
|
|
|
#include "md.h"
|
|
|
|
#include "msg_defs.h"
|
|
|
|
#include "menu_defs.h"
|
|
|
|
#include "txtwalk.h"
|
|
|
|
|
1997-10-29 04:06:42 +03:00
|
|
|
static int network_up = 0;
|
1997-10-20 10:13:25 +04:00
|
|
|
|
1997-10-22 19:28:33 +04:00
|
|
|
/* Get the list of network interfaces. */
|
|
|
|
|
1997-09-27 03:02:53 +04:00
|
|
|
static void get_ifconfig_info (void)
|
|
|
|
{
|
|
|
|
char *textbuf;
|
|
|
|
int textsize;
|
1997-10-07 08:01:29 +04:00
|
|
|
char *t;
|
1997-09-27 03:02:53 +04:00
|
|
|
|
|
|
|
/* Get ifconfig information */
|
|
|
|
|
|
|
|
textsize = collect (T_OUTPUT, &textbuf,
|
1997-10-01 09:04:24 +04:00
|
|
|
"/sbin/ifconfig -l 2>/dev/null");
|
1997-09-27 03:02:53 +04:00
|
|
|
if (textsize < 0) {
|
|
|
|
endwin();
|
|
|
|
(void) fprintf (stderr, "Could not run ifconfig.");
|
|
|
|
exit (1);
|
|
|
|
}
|
1997-10-01 09:04:24 +04:00
|
|
|
(void) strtok(textbuf,"\n");
|
|
|
|
strncpy (net_devices, textbuf, textsize<STRSIZE ? textsize : STRSIZE);
|
|
|
|
net_devices[STRSIZE] = 0;
|
1997-09-27 03:02:53 +04:00
|
|
|
free (textbuf);
|
1997-10-07 08:01:29 +04:00
|
|
|
|
|
|
|
/* Remove lo0 and anything after ... */
|
|
|
|
t = strstr (net_devices, "lo0");
|
|
|
|
if (t != NULL)
|
|
|
|
*t = 0;
|
1997-09-27 03:02:53 +04:00
|
|
|
}
|
|
|
|
|
1997-11-22 17:16:55 +03:00
|
|
|
/* Fill in defaults network values for the selected interface */
|
|
|
|
|
|
|
|
static void get_ifinterface_info(void)
|
|
|
|
{
|
|
|
|
char *textbuf;
|
|
|
|
int textsize;
|
|
|
|
char *t;
|
|
|
|
char hostname[MAXHOSTNAMELEN];
|
|
|
|
|
|
|
|
/* First look to see if the selected interface is already configured. */
|
|
|
|
textsize = collect(T_OUTPUT, &textbuf, "/sbin/ifconfig %s 2>/dev/null",
|
|
|
|
net_dev);
|
|
|
|
if (textsize >= 0) {
|
|
|
|
(void)strtok(textbuf, " \t\n"); /* ignore interface name */
|
|
|
|
while ((t = strtok(NULL, " \t\n")) != NULL) {
|
|
|
|
if (strcmp(t, "inet") == 0) {
|
|
|
|
t = strtok(NULL, " \t\n");
|
|
|
|
if (strcmp(t, "0.0.0.0") != 0)
|
|
|
|
strcpy(net_ip, t);
|
|
|
|
}
|
|
|
|
else if (strcmp(t, "netmask") == 0) {
|
|
|
|
t = strtok(NULL, " \t\n");
|
|
|
|
if (strcmp(t, "0x0") != 0)
|
|
|
|
strcpy(net_mask, t);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check host (and domain?) name */
|
|
|
|
if (gethostname(hostname, sizeof(hostname)) == 0)
|
|
|
|
strncpy(net_host, hostname, sizeof(net_host));
|
|
|
|
}
|
|
|
|
|
1997-10-22 19:28:33 +04:00
|
|
|
/* Get the information to configure the network, configure it and
|
|
|
|
make sure both the gateway and the name server are up. */
|
1997-09-27 03:02:53 +04:00
|
|
|
|
1997-10-22 19:28:33 +04:00
|
|
|
int config_network (void)
|
1997-09-27 03:02:53 +04:00
|
|
|
{ char *tp;
|
|
|
|
char defname[255];
|
|
|
|
int octet0;
|
|
|
|
int pass;
|
|
|
|
|
|
|
|
FILE *f;
|
1997-11-02 11:20:40 +03:00
|
|
|
time_t now;
|
1997-09-27 03:02:53 +04:00
|
|
|
|
1997-10-20 10:13:25 +04:00
|
|
|
if (network_up)
|
|
|
|
return 1;
|
|
|
|
|
1997-11-22 16:52:45 +03:00
|
|
|
network_up = 1;
|
1997-09-27 03:02:53 +04:00
|
|
|
net_devices[0] = '\0';
|
|
|
|
get_ifconfig_info ();
|
1997-11-22 03:29:33 +03:00
|
|
|
if (strlen(net_devices) == 0) {
|
|
|
|
/* No network interfaces found! */
|
|
|
|
msg_display (MSG_nonet);
|
|
|
|
process_menu (MENU_ok);
|
|
|
|
return -1;
|
|
|
|
}
|
1997-09-27 03:02:53 +04:00
|
|
|
strncpy (defname, net_devices, 255);
|
|
|
|
tp = defname;
|
|
|
|
strsep(&tp, " ");
|
|
|
|
msg_prompt (MSG_asknetdev, defname, net_dev, 255, net_devices);
|
|
|
|
tp = net_dev;
|
|
|
|
strsep(&tp, " ");
|
|
|
|
net_dev[strlen(net_dev)+1] = 0;
|
|
|
|
net_dev[strlen(net_dev)] = ' ';
|
|
|
|
while ((strlen(net_dev) != 4 && strlen(net_dev) != 5) ||
|
|
|
|
strstr(net_devices, net_dev) == NULL) {
|
|
|
|
msg_prompt (MSG_badnet, defname, net_dev, 10,
|
|
|
|
net_devices);
|
|
|
|
tp = net_dev;
|
|
|
|
strsep(&tp, " ");
|
|
|
|
net_dev[strlen(net_dev)+1] = 0;
|
|
|
|
net_dev[strlen(net_dev)] = ' ';
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Remove that space we added. */
|
|
|
|
net_dev[strlen(net_dev)-1] = 0;
|
1997-11-22 17:16:55 +03:00
|
|
|
|
|
|
|
/* Preload any defaults we can find */
|
|
|
|
get_ifinterface_info ();
|
|
|
|
pass = strlen(net_mask) == 0 ? 0 : 1;
|
1997-09-27 03:02:53 +04:00
|
|
|
|
|
|
|
/* Get other net information */
|
|
|
|
msg_display (MSG_netinfo);
|
|
|
|
do {
|
|
|
|
msg_prompt_add (MSG_net_domain, net_domain, net_domain,
|
|
|
|
STRSIZE);
|
|
|
|
msg_prompt_add (MSG_net_host, net_host, net_host, STRSIZE);
|
|
|
|
msg_prompt_add (MSG_net_ip, net_ip, net_ip, STRSIZE);
|
|
|
|
octet0 = atoi(net_ip);
|
|
|
|
if (!pass) {
|
|
|
|
if (0 <= octet0 && octet0 <= 127)
|
|
|
|
strcpy (net_mask, "0xff000000");
|
|
|
|
else if (127 <= octet0 && octet0 <= 191)
|
|
|
|
strcpy (net_mask, "0xffff0000");
|
|
|
|
else if (192 <= octet0 && octet0 <= 223)
|
|
|
|
strcpy (net_mask, "0xffff0000");
|
|
|
|
}
|
|
|
|
msg_prompt_add (MSG_net_mask, net_mask, net_mask, STRSIZE);
|
|
|
|
msg_prompt_add (MSG_net_defroute, net_defroute, net_defroute,
|
|
|
|
STRSIZE);
|
1997-10-20 10:13:25 +04:00
|
|
|
msg_prompt_add (MSG_net_namesrv, net_namesvr, net_namesvr,
|
|
|
|
STRSIZE);
|
1997-09-27 03:02:53 +04:00
|
|
|
|
1997-11-22 16:52:45 +03:00
|
|
|
msg_display (MSG_netok, net_domain, net_host, net_ip, net_mask,
|
|
|
|
*net_namesvr == '\0' ? "<none>" : net_namesvr,
|
|
|
|
*net_defroute == '\0' ? "<none>" : net_defroute);
|
1997-09-27 03:02:53 +04:00
|
|
|
process_menu (MENU_yesno);
|
|
|
|
if (!yesno)
|
|
|
|
msg_display (MSG_netagain);
|
|
|
|
pass++;
|
|
|
|
} while (!yesno);
|
|
|
|
|
1997-11-22 16:52:45 +03:00
|
|
|
/* Create /etc/resolv.conf if a nameserver was given */
|
|
|
|
if (strcmp(net_namesvr, "") != 0) {
|
1997-09-27 03:02:53 +04:00
|
|
|
#ifdef DEBUG
|
1997-11-22 16:52:45 +03:00
|
|
|
f = fopen ("/tmp/resolv.conf", "w");
|
1997-09-27 03:02:53 +04:00
|
|
|
#else
|
1997-11-22 16:52:45 +03:00
|
|
|
f = fopen ("/etc/resolv.conf", "w");
|
1997-09-27 03:02:53 +04:00
|
|
|
#endif
|
1997-11-22 16:52:45 +03:00
|
|
|
if (f == NULL) {
|
|
|
|
endwin();
|
|
|
|
(void)fprintf(stderr, "%s", msg_string(MSG_resolv));
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
time(&now);
|
|
|
|
/* NB: ctime() returns a string ending in '\n' */
|
|
|
|
(void)fprintf (f, ";\n; BIND data file\n; %s %s;\n",
|
|
|
|
"Created by NetBSD sysinst on", ctime(&now));
|
|
|
|
(void)fprintf (f,
|
|
|
|
"nameserver %s\nlookup file bind\nsearch %s\n",
|
|
|
|
net_namesvr, net_domain);
|
|
|
|
fclose (f);
|
1997-09-27 03:02:53 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
run_prog ("/sbin/ifconfig lo0 127.0.0.1");
|
|
|
|
run_prog ("/sbin/ifconfig %s inet %s netmask %s", net_dev, net_ip,
|
|
|
|
net_mask);
|
1997-10-01 09:04:24 +04:00
|
|
|
|
1997-11-22 16:52:45 +03:00
|
|
|
/* Set a default route if one was given */
|
|
|
|
if (strcmp(net_defroute, "") != 0) {
|
|
|
|
run_prog ("/sbin/route -f > /dev/null 2> /dev/null");
|
|
|
|
run_prog ("/sbin/route add default %s > /dev/null 2> /dev/null",
|
|
|
|
net_defroute);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strcmp(net_namesvr, "") != 0 && network_up)
|
|
|
|
network_up = !run_prog ("/sbin/ping -c 2 %s > /dev/null",
|
|
|
|
net_defroute);
|
|
|
|
|
|
|
|
if (strcmp(net_defroute, "") != 0 && network_up)
|
|
|
|
network_up = !run_prog ("/sbin/ping -c 2 %s > /dev/null",
|
|
|
|
net_namesvr);
|
1997-10-20 10:13:25 +04:00
|
|
|
|
|
|
|
return network_up;
|
1997-09-27 03:02:53 +04:00
|
|
|
}
|
|
|
|
|
1997-09-27 04:09:22 +04:00
|
|
|
int
|
1997-09-27 03:02:53 +04:00
|
|
|
get_via_ftp (void)
|
1997-09-27 04:09:22 +04:00
|
|
|
{
|
1997-10-29 04:06:42 +03:00
|
|
|
distinfo *list;
|
1997-10-15 08:35:17 +04:00
|
|
|
char filename[SSTRSIZE];
|
1997-09-27 04:09:22 +04:00
|
|
|
int ret;
|
1997-09-27 03:02:53 +04:00
|
|
|
|
1997-10-30 03:03:32 +03:00
|
|
|
while (!config_network ()) {
|
1997-10-01 09:04:24 +04:00
|
|
|
msg_display (MSG_netnotup);
|
|
|
|
process_menu (MENU_yesno);
|
|
|
|
if (!yesno)
|
|
|
|
return 0;
|
|
|
|
}
|
1997-10-29 04:06:42 +03:00
|
|
|
|
|
|
|
cd_dist_dir ("ftp");
|
|
|
|
|
1997-11-05 04:23:06 +03:00
|
|
|
/* Fill in final values for ftp_dir. */
|
1997-11-25 09:53:07 +03:00
|
|
|
strncat (ftp_dir, rel, STRSIZE-strlen(ftp_dir));
|
1997-11-05 04:23:06 +03:00
|
|
|
strcat (ftp_dir, "/");
|
|
|
|
strncat (ftp_dir, machine, STRSIZE-strlen(ftp_dir));
|
1997-09-27 03:02:53 +04:00
|
|
|
strncat (ftp_dir, ftp_prefix, STRSIZE-strlen(ftp_dir));
|
|
|
|
process_menu (MENU_ftpsource);
|
|
|
|
|
1997-10-18 02:17:05 +04:00
|
|
|
list = dist_list;
|
1997-09-27 03:02:53 +04:00
|
|
|
endwin();
|
1997-10-29 04:06:42 +03:00
|
|
|
while (list->name) {
|
|
|
|
if (!list->getit) {
|
|
|
|
list++;
|
|
|
|
continue;
|
|
|
|
}
|
1997-11-25 09:53:07 +03:00
|
|
|
snprintf (filename, SSTRSIZE, "%s%s", list->name, dist_postfix);
|
1997-09-27 03:02:53 +04:00
|
|
|
if (strcmp ("ftp", ftp_user) == 0)
|
1997-12-05 17:26:27 +03:00
|
|
|
ret = run_prog("/usr/bin/ftp -a 'ftp://%s/%s/%s'",
|
1997-09-27 04:09:22 +04:00
|
|
|
ftp_host, ftp_dir,
|
1997-10-15 08:35:17 +04:00
|
|
|
filename);
|
1997-09-27 03:02:53 +04:00
|
|
|
else
|
1997-12-05 17:26:27 +03:00
|
|
|
ret = run_prog("/usr/bin/ftp 'ftp://%s:%s@%s/%s/%s'",
|
1997-09-27 04:09:22 +04:00
|
|
|
ftp_user, ftp_pass, ftp_host, ftp_dir,
|
1997-10-15 08:35:17 +04:00
|
|
|
filename);
|
1997-09-27 04:09:22 +04:00
|
|
|
if (ret) {
|
|
|
|
/* Error getting the file. Bad host name ... ? */
|
1997-11-25 03:24:52 +03:00
|
|
|
msg_display (MSG_ftperror_cont);
|
|
|
|
getchar();
|
1997-10-18 02:24:20 +04:00
|
|
|
puts (CL);
|
1997-09-27 04:09:22 +04:00
|
|
|
wrefresh (stdscr);
|
|
|
|
msg_display (MSG_ftperror);
|
|
|
|
process_menu (MENU_yesno);
|
|
|
|
if (yesno)
|
|
|
|
process_menu (MENU_ftpsource);
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
endwin();
|
|
|
|
} else
|
|
|
|
list++;
|
1997-11-11 03:43:31 +03:00
|
|
|
|
1997-09-27 03:02:53 +04:00
|
|
|
}
|
|
|
|
puts (CL); /* Just to make sure. */
|
1997-09-27 04:09:22 +04:00
|
|
|
wrefresh (stdscr);
|
1997-09-27 03:02:53 +04:00
|
|
|
#ifndef DEBUG
|
1997-11-02 11:20:40 +03:00
|
|
|
chdir("/"); /* back to current real root */
|
1997-09-27 03:02:53 +04:00
|
|
|
#endif
|
1997-09-27 04:09:22 +04:00
|
|
|
return 1;
|
1997-09-27 03:02:53 +04:00
|
|
|
}
|
|
|
|
|
1997-10-15 08:35:17 +04:00
|
|
|
int
|
1997-09-27 03:02:53 +04:00
|
|
|
get_via_nfs(void)
|
|
|
|
{
|
1997-10-30 03:03:32 +03:00
|
|
|
while (!config_network ()) {
|
1997-10-15 08:35:17 +04:00
|
|
|
msg_display (MSG_netnotup);
|
|
|
|
process_menu (MENU_yesno);
|
|
|
|
if (!yesno)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1997-09-27 03:02:53 +04:00
|
|
|
/* Get server and filepath */
|
1997-10-15 08:35:17 +04:00
|
|
|
process_menu (MENU_nfssource);
|
1997-12-05 17:00:59 +03:00
|
|
|
again:
|
1997-10-15 08:35:17 +04:00
|
|
|
|
1997-12-05 17:00:59 +03:00
|
|
|
run_prog("/sbin/umount /mnt2 2> /dev/null");
|
|
|
|
|
1997-09-27 03:02:53 +04:00
|
|
|
/* Mount it */
|
1997-12-05 17:00:59 +03:00
|
|
|
if (run_prog("/sbin/mount -t nfs %s:%s /mnt2", nfs_host, nfs_dir)) {
|
|
|
|
msg_display (MSG_nfsbadmount, nfs_host, nfs_dir);
|
1997-10-15 08:35:17 +04:00
|
|
|
process_menu (MENU_nfsbadmount);
|
|
|
|
if (!yesno)
|
|
|
|
return 0;
|
1997-12-05 17:00:59 +03:00
|
|
|
if (!ignorerror)
|
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Verify distribution files exist. */
|
|
|
|
if (distribution_sets_exist_p("/mnt2") == 0) {
|
|
|
|
msg_display(MSG_badsetdir, "/mnt2");
|
|
|
|
process_menu (MENU_nfsbadmount);
|
|
|
|
if (!yesno)
|
|
|
|
return (0);
|
|
|
|
if (!ignorerror)
|
|
|
|
goto again;
|
1997-10-15 08:35:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* return location, don't clean... */
|
1997-11-11 03:43:31 +03:00
|
|
|
strcpy (ext_dir, "/mnt2");
|
1997-10-15 08:35:17 +04:00
|
|
|
clean_dist_dir = 0;
|
1997-10-20 10:13:25 +04:00
|
|
|
mnt2_mounted = 1;
|
1997-10-15 08:35:17 +04:00
|
|
|
return 1;
|
1997-09-27 03:02:53 +04:00
|
|
|
}
|
1997-10-20 10:13:25 +04:00
|
|
|
|
1997-11-03 02:43:11 +03:00
|
|
|
/*
|
|
|
|
* Write the network config info the user entered via menus into the
|
|
|
|
* config files in the target disk. Be careful not to lose any
|
|
|
|
* information we don't immediately add back, in case the install
|
|
|
|
* target is the currently-active root.
|
|
|
|
*/
|
1997-10-20 10:13:25 +04:00
|
|
|
void
|
|
|
|
mnt_net_config(void)
|
|
|
|
{
|
|
|
|
char ans [5] = "y";
|
1997-11-02 11:20:40 +03:00
|
|
|
char ifconfig_fn [STRSIZE];
|
1997-11-05 10:28:20 +03:00
|
|
|
FILE *f;
|
1997-10-20 10:13:25 +04:00
|
|
|
|
|
|
|
if (network_up) {
|
|
|
|
msg_prompt (MSG_mntnetconfig, ans, ans, 5);
|
|
|
|
if (*ans == 'y') {
|
1997-11-02 11:20:40 +03:00
|
|
|
|
1997-11-03 02:43:11 +03:00
|
|
|
/* If not running in target, copy resolv.conf there. */
|
1997-11-05 10:28:20 +03:00
|
|
|
dup_file_into_target("/etc/resolv.conf");
|
1997-11-03 02:43:11 +03:00
|
|
|
/*
|
|
|
|
* Add IPaddr/hostname to /etc/hosts.
|
|
|
|
* Be careful not to clobber any existing contents.
|
|
|
|
* Relies on ordered seach of /etc/hosts. XXX YP?
|
|
|
|
*/
|
1997-11-05 10:28:20 +03:00
|
|
|
f = target_fopen("/etc/hosts", "a");
|
|
|
|
if (f != 0) {
|
1997-11-09 18:54:15 +03:00
|
|
|
fprintf(f, msg_string(MSG_etc_hosts),
|
|
|
|
net_ip, net_host, net_domain,
|
|
|
|
net_host);
|
|
|
|
fclose(f);
|
1997-11-05 10:28:20 +03:00
|
|
|
}
|
1997-11-03 02:43:11 +03:00
|
|
|
|
|
|
|
/* Write IPaddr and netmask to /etc/ifconfig.if[0-9] */
|
1997-11-05 10:28:20 +03:00
|
|
|
snprintf (ifconfig_fn, STRSIZE,
|
|
|
|
"/etc/ifconfig.%s", net_dev);
|
|
|
|
f = target_fopen(ifconfig_fn, "w");
|
|
|
|
if (f != 0) {
|
|
|
|
fprintf(f, "%s netmask %s\n",
|
|
|
|
net_ip, net_mask);
|
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
f = target_fopen("/etc/mygate", "w");
|
|
|
|
if (f != 0) {
|
|
|
|
fprintf(f, "%s\n", net_defroute);
|
|
|
|
fclose(f);
|
|
|
|
}
|
1997-10-20 10:13:25 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|