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
);
58 choosecards(driver
, driveroptions
);
69 /* Default is a GREEN nic only. */
70 /* Smoothie is not untarred yet, so we have to delay actually writing the
71 * settings till later. */
72 replacekeyvalue(ethernetkv
, "CONFIG_TYPE", "0");
73 replacekeyvalue(ethernetkv
, "GREEN_DRIVER", driver
);
74 replacekeyvalue(ethernetkv
, "GREEN_DRIVER_OPTIONS", driveroptions
);
75 replacekeyvalue(ethernetkv
, "GREEN_DEV", "eth0");
76 replacekeyvalue(ethernetkv
, "GREEN_DISPLAYDRIVER", driver
);
78 if (!(changeaddress(ethernetkv
, "GREEN", 0, "")))
81 strcpy(address
, ""); findkey(ethernetkv
, "GREEN_ADDRESS", address
);
82 strcpy(netmask
, ""); findkey(ethernetkv
, "GREEN_NETMASK", netmask
);
84 snprintf(commandstring
, STRING_SIZE
, "/bin/ifconfig eth0 %s netmask %s up",
86 if (mysystem(commandstring
))
88 errorbox(ctr
[TR_INTERFACE_FAILED_TO_COME_UP
]);