]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/netconfig.cgi
5 # This code is distributed under the terms of the GPL
9 # $Id: netconfig.cgi,v 1.11.2.27 2005/10/27 07:40:14 schaaf Exp $
14 # enable only the following on debugging purpose
16 use CGI
::Carp
'fatalsToBrowser';
18 require '/var/ipfire/general-functions.pl';
19 require "${General::swroot}/lang.pl";
20 require "${General::swroot}/header.pl";
23 $cgiparams{'ACTION'} = '';
24 &Header
::getcgihash
(\
%cgiparams);
27 &General
::readhash
("${General::swroot}/ethernet/settings", \
%ethsettings);
31 my %net_config_type = (0 => "GREEN (RED is modem/ISDN)",
32 1 => "GREEN + ORANGE (RED is modem/ISDN)",
34 3 => "GREEN + ORANGE + RED",
35 4 => "GREEN + BLUE (RED is modem/ISDN)",
36 5 => "GREEN + ORANGE + BLUE (RED is modem/ISDN)",
37 6 => "GREEN + BLUE + RED",
38 7 => "GREEN + ORANGE + BLUE + RED");
40 my %landevice = ("eth0", "eth1", "eth2", "eth3");
41 my %types = ("STATIC", "DHCP", "PPPOE", "PPTP");
46 "100VG-AnyLan Network Adapters, HP J2585B, J2585A, etc" => "hp100" ,
47 "3Com EtherLink III" => "3c509" ,
48 "3Com 3c501" => "3c501" ,
49 "3Com ISA EtherLink XL" => "3c515" ,
50 "3Com 3c503 and 3c503/16" => "3c503" ,
51 "3Com EtherLink MC (3c523)" => "3c523" ,
52 "3Com EtherLink MC/32 (3c527)" => "3c527" ,
53 "3Com EtherLink Plus (3c505)" => "3c505" ,
54 "3Com EtherLink 16" => "3c507" ,
55 "3Com Corkscrew EtherLink PCI III/XL etc." => "3c59x" ,
56 "3Com Typhoon Family (3C990 3CR990 and variants)" => "typhoon" ,
57 "Adaptec Starfire/DuraLAN" => "starfire" ,
58 "Alteon AceNIC/3Com 3C985/Netgear GA620 Gigabit" => "acenic" ,
59 "AMD8111 based 10/100 Ethernet Controller" => "amd8111e" ,
60 "AMD LANCE/PCnetAllied Telesis AT1500, J2405A, etc" => "lance" ,
61 "AMD PCnet32 and AMD PCnetPCI" => "pcnet32" ,
62 "Ansel Communications EISA 3200" => "ac3200" ,
63 "Apricot 680x0 VME, 82596 chipset" => "82596" ,
64 "AT1700/1720" => "at1700" ,
65 "Broadcom 4400" => "b44" ,
66 "Broadcom Tigon3" => "tg3" ,
67 "Cabletron E2100 series ethercards" => "e2100" ,
68 "CATC USB NetMate-based Ethernet" => "catc" ,
69 "CDC USB Ethernet" => "CDCEther" ,
70 "Crystal LAN CS8900/CS8920" => "cs89x0" ,
71 "Compaq Netelligent 10/100 TX PCI UTP, etc" => "tlan" ,
72 "D-Link DL2000-based Gigabit Ethernet" => "dl2k" ,
73 "Digi Intl. RightSwitch SE-X EISA and PCI" => "dgrs" ,
74 "Digital 21x4x Tulip PCI ethernet cards, etc." => "tulip" ,
75 "Digital DEPCA & EtherWORKS,DEPCA, DE100, etc" => "depca" ,
76 "DM9102 PCI Fast Ethernet Adapter" => "dmfe" ,
77 "Dummy Network Card (testing)" => "dummy" ,
78 "EtherWORKS DE425 TP/COAX EISA, DE434 TP PCI, etc." => "de4x5" ,
79 "EtherWORKS 3 (DE203, DE204 and DE205)" => "ewrk3" ,
80 "HP PCLAN/plus" => "hp-plus" ,
81 "HP LAN ethernet" => "hp" ,
82 "IBM LANA" => "ibmlana" ,
83 "ICL EtherTeam 16i/32" ,"eth16i" ,
84 "Intel i82557/i82558 PCI EtherExpressPro" => "e100" ,
85 "Intel EtherExpress Cardbus Ethernet" => "eepro100_cb" ,
86 "Intel i82595 ISA EtherExpressPro10/10+ driver" ,"eepro" ,
87 "Intel EtherExpress 16 (i82586)" => "eexpress" ,
88 "Intel Panther onboard i82596 driver" => "lp486e" ,
89 "Intel PRO/1000 Gigabit Ethernet" => "e1000" ,
90 "KLSI USB KL5USB101-based" => "kaweth" ,
91 "MiCom-Interlan NI5010 ethercard" => "ni5010" ,
92 "Mylex EISA LNE390A/B" => "lne390" ,
93 "Myson MTD-8xx PCI Ethernet" => "fealnx" ,
94 "National Semiconductor DP8381x" => "natsemi" ,
95 "National Semiconductor DP83820" => "ns83820" ,
97 "NE2000 PCI cards, RealTEk RTL-8029, etc" => "ne2k-pci" ,
98 "NE1000 / NE2000 (non-pci)" => "ne" ,
99 "NI50 card (i82586 Ethernet chip)" => "ni52" ,
100 "NI6510, ni6510 EtherBlaster" => "ni65" ,
101 "Novell/Eagle/Microdyne NE3210 EISA" => "ne3210" ,
102 "NVidia Nforce2 Driver" => "forcedeth" ,
103 "Packet Engines Hamachi GNIC-II" => "hamachi" ,
104 "Packet Engines Yellowfin Gigabit-NIC" => "yellowfin" ,
105 "Pegasus/Pegasus-II USB ethernet" => "pegasus" ,
106 "PureData PDUC8028,WD8003 and WD8013 compatibles" => "wd" ,
107 "Racal-Interlan EISA ES3210" => "es3210" ,
108 "RealTek RTL-8139 Fast Ethernet" => "8139too" ,
109 "RealTek RTL-8139C+ series 10/100 PCI Ethernet" => "8139cp" ,
110 "RealTek RTL-8150 USB ethernet" => "rtl8150" ,
111 "RealTek RTL-8169 Gigabit Ethernet" => "r8169" ,
112 "SiS 900 PCI" => "sis900" ,
113 "SKnet MCA" => "sk_mca" ,
114 "SMC 9000 series of ethernet cards" => "smc9194" ,
115 "SMC EtherPower II" => "epic100" ,
116 "SMC Ultra/EtherEZ ISA/PnP Ethernet" => "smc-ultra" ,
117 "SMC Ultra32 EISA Ethernet" => "smc-ultra32" ,
118 "SMC Ultra MCA Ethernet" => "smc-mca" ,
119 "Sundance Alta" => "sundance" ,
120 "SysKonnect SK-98xx" => "sk98lin" ,
121 "Toshiba TC35815 Ethernet" => "tc35815" ,
122 "Tulip chipset Cardbus Ethernet" => "tulip_cb" ,
123 "USB Ethernet" => "usbnet" ,
124 "VIA Rhine PCI Fast Ethernet, etc" => "via-rhine" ,
125 "Winbond W89c840 Ethernet" => "winbond-840" ,
126 "Xircom Cardbus Ethernet" => "xircom_cb" ,
127 "Xircom (tulip-like) Cardbus Ethernet" => "xircom_tulip_cb" );
129 if ($cgiparams{'ACTION'} eq $Lang::tr
{'save'}) {
130 $ethsettings{'CONFIG_TYPE'} = $cgiparams{'CONFIG_TYPE'};
131 $ethsettings{'GREEN_ADDRESS'} = $cgiparams{'GREEN_ADDRESS'};
132 $ethsettings{'GREEN_NETMASK'} = $cgiparams{'GREEN_NETMASK'};
133 $ethsettings{'GREEN_DRIVER'} = $cgiparams{'GREEN_DRIVER'};
134 $ethsettings{'GREEN_DRIVER_OPTIONS'} = $cgiparams{'GREEN_DRIVER_OPTIONS'};
135 $ethsettings{'GREEN_DEV'} = $cgiparams{'GREEN_DEV'};
136 $ethsettings{'GREEN_BROADCAST'} = $cgiparams{'GREEN_BROADCAST'};
137 $ethsettings{'GREEN_NETADDRESS'} = $cgiparams{'GREEN_NETADDRESS'};
138 $ethsettings{'RED_ADDRESS'} = $cgiparams{'RED_ADDRESS'};
139 $ethsettings{'RED_NETMASK'} = $cgiparams{'RED_NETMASK'};
140 $ethsettings{'RED_DRIVER'} = $cgiparams{'RED_DRIVER'};
141 $ethsettings{'RED_DRIVER_OPTIONS'} = $cgiparams{'RED_DRIVER_OPTIONS'};
142 $ethsettings{'RED_DEV'} = $cgiparams{'RED_DEV'};
143 $ethsettings{'RED_BROADCAST'} = $cgiparams{'RED_BROADCAST'};
144 $ethsettings{'RED_TYPE'} = $cgiparams{'RED_TYPE'};
145 $ethsettings{'RED_NETADDRESS'} = $cgiparams{'RED_NETADDRESS'};
146 $ethsettings{'ORANGE_ADDRESS'} = $cgiparams{'ORANGE_ADDRESS'};
147 $ethsettings{'ORANGE_NETMASK'} = $cgiparams{'ORANGE_NETMASK'};
148 $ethsettings{'ORANGE_DRIVER'} = $cgiparams{'ORANGE_DRIVER'};
149 $ethsettings{'ORANGE_DRIVER_OPTIONS'} = $cgiparams{'ORANGE_DRIVER_OPTIONS'};
150 $ethsettings{'ORANGE_DEV'} = $cgiparams{'ORANGE_DEV'};
151 $ethsettings{'ORANGE_BROADCAST'} = $cgiparams{'ORANGE_BROADCAST'};
152 $ethsettings{'ORANGE_NETADDRESS'} = $cgiparams{'ORANGE_NETADDRESS'};
153 $ethsettings{'BLUE_ADDRESS'} = $cgiparams{'BLUE_ADDRESS'};
154 $ethsettings{'BLUE_NETMASK'} = $cgiparams{'BLUE_NETMASK'};
155 $ethsettings{'BLUE_DRIVER'} = $cgiparams{'BLUE_DRIVER'};
156 $ethsettings{'BLUE_DRIVER_OPTIONS'} = $cgiparams{'BLUE_DRIVER_OPTIONS'};
157 $ethsettings{'BLUE_DEV'} = $cgiparams{'BLUE_DEV'};
158 $ethsettings{'BLUE_BROADCAST'} = $cgiparams{'BLUE_BROADCAST'};
159 $ethsettings{'BLUE_NETADDRESS'} = $cgiparams{'BLUE_NETADDRESS'};
161 &General
::writehash
("${General::swroot}/ethernet/settings", \
%ethsettings);
164 &Header
::showhttpheaders
();
166 &Header
::openpage
($Lang::tr
{'net config'}, 1, '');
168 &Header
::openbigbox
('100%', 'center');
170 &Header
::openbox
('100%', 'left', $Lang::tr
{'net config'});
173 <b>$Lang::tr{'net config type'}</b>
174 <form method="POST" action="netconfig.cgi">
178 <select name="CONFIG_TYPE">
182 foreach my $k (sort keys %net_config_type){
183 if ($k eq $ethsettings{'CONFIG_TYPE'}){
184 print "<option value=\"$k\" selected>$net_config_type{$k}</option>";}else{
185 print "<option value=\"$k\">$net_config_type{$k}</option>";}
190 <td valign=top>$Lang::tr{'net config type help'}</td>
191 <td valign=top align=right><input type="reset" name="ACTION" value="$Lang::tr{'reset'}"><input type="submit" name="ACTION" value="$Lang::tr{'save'}"></td>
198 <hr><b>GREEN</b><br />
199 <table width=100%><tr>
200 <td width=12%>$Lang::tr{'ip address'}:</td>
201 <td width=12%><input type=text name="GREEN_ADDRESS" value="$ethsettings{'GREEN_ADDRESS'}" size=15></td>
202 <td width=12%>$Lang::tr{'netmask'}:</td>
203 <td width=12%><input type=text name="GREEN_NETMASK" value="$ethsettings{'GREEN_NETMASK'}" size=15></td>
205 $Lang::tr{'net address'}:
208 <input type=text name="GREEN_NETADDRESS" value="$ethsettings{'GREEN_NETADDRESS'}" size=15/>
212 <td>$Lang::tr{'broadcast'}:</td>
213 <td><input type=text name="GREEN_BROADCAST" value="$ethsettings{'GREEN_BROADCAST'}" size=15></td>
214 <td>$Lang::tr{'device'}:</td>
215 <td><select name="GREEN_DEV">
219 foreach (sort %landevice){
220 if ($_ eq $ethsettings{'GREEN_DEV'}){
221 print "<option value=\"$_\" selected>$_</option>";}else{
222 print "<option value=\"$_\">$_</option>";}
227 <td width=12%>$Lang::tr{'driver'}:$ethsettings{'GREEN_DRIVER'}</td>
228 <td width=40%><select name=GREEN_DRIVER>
232 foreach (sort keys %nic){
233 if ($nic{$_} eq $ethsettings{'GREEN_DRIVER'}){
234 print "<option value=\"$nic{$_}\" selected>$_</option>";}else{
235 print "<option value=\"$nic{$_}\">$_</option>";}
249 <td>$Lang::tr{'options'}:</td>
250 <td><input type=text name="GREEN_DRIVER_OPTIONS" value="$ethsettings{'GREEN_DRIVER_OPTIONS'}" size=45></td>
257 if ($ethsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/){
260 <table width=100%><tr>
261 <td width=12%>$Lang::tr{'ip address'}:</td>
262 <td width=12%><input type=text name="RED_ADDRESS" value="$ethsettings{'RED_ADDRESS'}" size=15></td>
263 <td width=12%>$Lang::tr{'netmask'}:</td>
264 <td width=12%><input type=text name="RED_NETMASK" value="$ethsettings{'RED_NETMASK'}" size=15></td>
265 <td>$Lang::tr{'net address'}:</td>
266 <td><input type=text name="RED_NETADDRESS" value="$ethsettings{'RED_NETADDRESS'}" size=15/></td
269 <td>$Lang::tr{'device'}:</td>
270 <td><select name="RED_DEV">
274 foreach (sort %landevice){
275 if ($_ eq $ethsettings{'RED_DEV'}){
276 print "<option value=\"$_\" selected>$_</option>";}else{
277 print "<option value=\"$_\">$_</option>";}
283 <td>$Lang::tr{'broadcast'}:</td>
284 <td><input type=text name="RED_BROADCAST" value="$ethsettings{'RED_BROADCAST'}" size=15></td>
285 <td width=12%>$Lang::tr{'driver'}:$ethsettings{'RED_DRIVER'}</td>
286 <td width=40%><select name=RED_DRIVER>
290 foreach (sort keys %nic){
291 if ($nic{$_} eq $ethsettings{'RED_DRIVER'}){
292 print "<option value=\"$nic{$_}\" selected>$_</option>";}else{
293 print "<option value=\"$nic{$_}\">$_</option>";}
297 </tr><tr><td> $Lang::tr{'type'}:</td><td><select name="RED_TYPE">
301 foreach (sort %types){
302 if ($_ eq $ethsettings{'RED_TYPE'}){
303 print "<option value=\"$_\" selected>$_</option>";}else{
304 print "<option value=\"$_\">$_</option>";}
311 <td>$Lang::tr{'options'}:</td>
312 <td><input type=text name="RED_DRIVER_OPTIONS" value="$ethsettings{'RED_DRIVER_OPTIONS'}" size=45></td>
321 if ($ethsettings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/){
323 <hr><b>ORANGE</b><br />
324 <table width=100%><tr>
325 <td width=12%>$Lang::tr{'ip address'}:</td>
326 <td width=12%><input type=text name="ORANGE_ADDRESS" value="$ethsettings{'ORANGE_ADDRESS'}" size=15></td>
327 <td width=12%>$Lang::tr{'netmask'}:</td>
328 <td width=12%><input type=text name="ORANGE_NETMASK" value="$ethsettings{'ORANGE_NETMASK'}" size=15></td>
329 <td>$Lang::tr{'net address'}:</td>
330 <td><input type=text name="ORANGE_NETADDRESS" value="$ethsettings{'ORANGE_NETADDRESS'}" size=15/></td>
333 <td>$Lang::tr{'device'}:</td>
334 <td><select name="ORANGE_DEV">
338 foreach (sort %landevice){
339 if ($_ eq $ethsettings{'ORANGE_DEV'}){
340 print "<option value=\"$_\" selected>$_</option>";}else{
341 print "<option value=\"$_\">$_</option>";}
347 <td>$Lang::tr{'broadcast'}:</td>
348 <td><input type=text name="ORANGE_BROADCAST" value="$ethsettings{'ORANGE_BROADCAST'}" size=15></td>
349 <td width=12%>$Lang::tr{'driver'}:$ethsettings{'ORANGE_DRIVER'}</td>
350 <td width=40%><select name=ORANGE_DRIVER>
354 foreach (sort keys %nic){
355 if ($nic{$_} eq $ethsettings{'ORANGE_DRIVER'}){
356 print "<option value=\"$nic{$_}\" selected>$_</option>";}else{
357 print "<option value=\"$nic{$_}\">$_</option>";}
365 <td>$Lang::tr{'options'}:</td>
366 <td><input type=text name="ORANGE_DRIVER_OPTIONS" value="$ethsettings{'ORANGE_DRIVER_OPTIONS'}" size=45></td>
375 if ($ethsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/){
377 <hr><b>BLUE</b><br />
378 <table width=100%><tr>
379 <td width=12%>$Lang::tr{'ip address'}:</td>
380 <td width=12%><input type=text name="BLUE_ADDRESS" value="$ethsettings{'BLUE_ADDRESS'}" size=15></td>
381 <td width=12%>$Lang::tr{'netmask'}:</td>
382 <td width=12%><input type=text name="BLUE_NETMASK" value="$ethsettings{'BLUE_NETMASK'}" size=15></td>
383 <td>$Lang::tr{'net address'}:</td>
384 <td><input type=text name="BLUE_NETADDRESS" value="$ethsettings{'BLUE_NETADDRESS'}" size=15/></td>
387 <td>$Lang::tr{'device'}:</td>
388 <td><select name="BLUE_DEV">
392 foreach (sort %landevice){
393 if ($_ eq $ethsettings{'BLUE_DEV'}){
394 print "<option value=\"$_\" selected>$_</option>";}else{
395 print "<option value=\"$_\">$_</option>";}
401 <td>$Lang::tr{'broadcast'}:</td>
402 <td><input type=text name="BLUE_BROADCAST" value="$ethsettings{'BLUE_BROADCAST'}" size=15></td>
403 <td width=12%>$Lang::tr{'driver'}:$ethsettings{'BLUE_DRIVER'}</td>
404 <td width=40%><select name=BLUE_DRIVER>
408 foreach (sort keys %nic){
409 if ($nic{$_} eq $ethsettings{'BLUE_DRIVER'}){
410 print "<option value=\"$nic{$_}\" selected>$_</option>";}else{
411 print "<option value=\"$nic{$_}\">$_</option>";}
420 <td>$Lang::tr{'options'}:</td>
421 <td><input type=text name="BLUE_DRIVER_OPTIONS" value="$ethsettings{'BLUE_DRIVER_OPTIONS'}" size=45></td>
437 &Header
::closebigbox
();
439 &Header
::closepage
();