1 /* SmoothWall install program.
3 * This program is distributed under the terms of the GNU General Public
4 * Licence. See the file COPYING for details.
6 * (c) Lawrence Manning, 2001
7 * Contains stuff related to firing up the network card, including a crude
14 #include <sys/socket.h>
15 #include <netinet/in.h>
16 #include <arpa/inet.h>
23 //extern struct nic nics[];
24 //extern struct knic knics[];
26 int networkmenu(struct keyvalue
*ethernetkv
)
29 char driver
[STRING_SIZE
] = "";
30 char driveroptions
[STRING_SIZE
] = "";
32 char commandstring
[STRING_SIZE
];
33 char address
[STRING_SIZE
], netmask
[STRING_SIZE
];
35 char description
[1000];
37 char title
[STRING_SIZE
];
42 rc
= newtWinTernary(ctr
[TR_CONFIGURE_NETWORKING
], ctr
[TR_PROBE
],
43 ctr
[TR_SELECT
], ctr
[TR_CANCEL
], ctr
[TR_CONFIGURE_NETWORKING_LONG
]);
45 if (rc
== 0 || rc
== 1)
47 probecards(driver
, driveroptions
);
49 errorbox(ctr
[TR_PROBE_FAILED
]);
52 //findnicdescription(driver, description);
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
);
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");
72 replacekeyvalue(ethernetkv
, "GREEN_DEV", "eth0");
73 replacekeyvalue(ethernetkv
, "GREEN_DISPLAYDRIVER", driver
);
75 if (!(changeaddress(ethernetkv
, "GREEN", 0, "")))
78 strcpy(address
, ""); findkey(ethernetkv
, "GREEN_ADDRESS", address
);
79 strcpy(netmask
, ""); findkey(ethernetkv
, "GREEN_NETMASK", netmask
);
81 snprintf(commandstring
, STRING_SIZE
, "/sbin/ifconfig eth0 %s netmask %s up",
83 if (mysystem(commandstring
))
85 errorbox(ctr
[TR_INTERFACE_FAILED_TO_COME_UP
]);