]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/install+setup/install/nic.c
Neue Netzwerkdialoge sind zum ersten Test verfuegbar.
[people/pmueller/ipfire-2.x.git] / src / install+setup / install / nic.c
CommitLineData
d6aaa55d
MT
1/* SmoothWall install program.
2 *
3 * This program is distributed under the terms of the GNU General Public
4 * Licence. See the file COPYING for details.
5 *
6 * (c) Lawrence Manning, 2001
7 * Contains stuff related to firing up the network card, including a crude
8 * autodector.
9 *
d6aaa55d
MT
10 */
11
12#include "install.h"
13
14#include <sys/socket.h>
15#include <netinet/in.h>
16#include <arpa/inet.h>
17
18extern FILE *flog;
19extern char *mylog;
10bc6f06 20
d6aaa55d 21extern char **ctr;
10bc6f06 22
5057b611
HS
23//extern struct nic nics[];
24//extern struct knic knics[];
d6aaa55d
MT
25
26int networkmenu(struct keyvalue *ethernetkv)
27{
b4e381a8 28 int rc;
d6aaa55d
MT
29 char driver[STRING_SIZE] = "";
30 char driveroptions[STRING_SIZE] = "";
31 int result = 0;
32 char commandstring[STRING_SIZE];
33 char address[STRING_SIZE], netmask[STRING_SIZE];
b4e381a8 34 int done;
d6aaa55d
MT
35 char description[1000];
36 char message[1000];
37 char title[STRING_SIZE];
b4e381a8 38 done = 0;
d6aaa55d 39
b4e381a8 40 while (!done)
d6aaa55d 41 {
b4e381a8
MT
42 rc = newtWinTernary(ctr[TR_CONFIGURE_NETWORKING], ctr[TR_PROBE],
43 ctr[TR_SELECT], ctr[TR_CANCEL], ctr[TR_CONFIGURE_NETWORKING_LONG]);
44
45 if (rc == 0 || rc == 1)
46 {
47 probecards(driver, driveroptions);
48 if (!strlen(driver))
49 errorbox(ctr[TR_PROBE_FAILED]);
50 else
51 {
75ae2191 52 //findnicdescription(driver, description);
b4e381a8
MT
53 sprintf (title, "%s v%s - %s", NAME, VERSION, SLOGAN);
54 sprintf(message, ctr[TR_FOUND_NIC], NAME, description);
55 newtWinMessage(title, ctr[TR_OK], message);
56 }
75ae2191 57 }
d6aaa55d 58 else
b4e381a8
MT
59 done = 1;
60
61 if (strlen(driver))
62 done = 1;
33634aa8 63 }
b4e381a8
MT
64
65 if (!strlen(driver))
33634aa8 66 goto EXIT;
d6aaa55d
MT
67
68 /* Default is a GREEN nic only. */
69 /* Smoothie is not untarred yet, so we have to delay actually writing the
70 * settings till later. */
71 replacekeyvalue(ethernetkv, "CONFIG_TYPE", "0");
d6aaa55d
MT
72 replacekeyvalue(ethernetkv, "GREEN_DEV", "eth0");
73 replacekeyvalue(ethernetkv, "GREEN_DISPLAYDRIVER", driver);
74
75 if (!(changeaddress(ethernetkv, "GREEN", 0, "")))
76 goto EXIT;
77
78 strcpy(address, ""); findkey(ethernetkv, "GREEN_ADDRESS", address);
79 strcpy(netmask, ""); findkey(ethernetkv, "GREEN_NETMASK", netmask);
80
4809e64e 81 snprintf(commandstring, STRING_SIZE, "/sbin/ifconfig eth0 %s netmask %s up",
d6aaa55d
MT
82 address, netmask);
83 if (mysystem(commandstring))
84 {
85 errorbox(ctr[TR_INTERFACE_FAILED_TO_COME_UP]);
86 goto EXIT;
87 }
88
89 result = 1;
90
91EXIT:
92
93 return result;
94}