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
[];
25 int networkmenu(struct keyvalue
*ethernetkv
)
28 char driver
[STRING_SIZE
] = "";
29 char driveroptions
[STRING_SIZE
] = "";
31 char commandstring
[STRING_SIZE
];
32 char address
[STRING_SIZE
], netmask
[STRING_SIZE
];
34 char description
[1000];
36 char title
[STRING_SIZE
];
41 rc
= newtWinTernary(ctr
[TR_CONFIGURE_NETWORKING
], ctr
[TR_PROBE
],
42 ctr
[TR_SELECT
], ctr
[TR_CANCEL
], ctr
[TR_CONFIGURE_NETWORKING_LONG
]);
44 if (rc
== 0 || rc
== 1)
46 probecards(driver
, driveroptions
);
48 errorbox(ctr
[TR_PROBE_FAILED
]);
51 //findnicdescription(driver, description);
52 sprintf (title
, "%s v%s - %s", NAME
, VERSION
, SLOGAN
);
53 sprintf(message
, ctr
[TR_FOUND_NIC
], NAME
, description
);
54 newtWinMessage(title
, ctr
[TR_OK
], message
);
67 /* Default is a GREEN nic only. */
68 /* Smoothie is not untarred yet, so we have to delay actually writing the
69 * settings till later. */
70 replacekeyvalue(ethernetkv
, "CONFIG_TYPE", "0");
71 replacekeyvalue(ethernetkv
, "GREEN_DEV", "eth0");
72 replacekeyvalue(ethernetkv
, "GREEN_DISPLAYDRIVER", driver
);
74 if (!(changeaddress(ethernetkv
, "GREEN", 0, "")))
77 strcpy(address
, ""); findkey(ethernetkv
, "GREEN_ADDRESS", address
);
78 strcpy(netmask
, ""); findkey(ethernetkv
, "GREEN_NETMASK", netmask
);
80 snprintf(commandstring
, STRING_SIZE
, "/sbin/ifconfig eth0 %s netmask %s up",
82 if (mysystem(commandstring
))
84 errorbox(ctr
[TR_INTERFACE_FAILED_TO_COME_UP
]);