3 # Show global configuration options
5 require './ipsec-lib.pl';
6 &ui_print_header(undef, $text{'config_title'}, "");
9 ($config) = grep { $_->{'name'} eq 'config' } @conf;
11 print "<form action=save_config.cgi method=post>\n";
12 print "<table border width=100%>\n";
13 print "<tr $tb> <td><b>$text{'config_header'}</b></td> </tr>\n";
14 print "<tr $cb> <td><table width=100%>\n";
16 # Get list of interfaces
17 &foreign_require("net", "net-lib.pl");
18 @allifaces = &unique(sort { $a cmp $b }
19 (map { $_->{'fullname'} } &net::active_interfaces()),
20 (map { $_->{'fullname'} } &net::boot_interfaces()) );
22 # Show interfaces to listen on
23 $i = $config->{'values'}->{'interfaces'};
24 $imode = $i eq '%none' ? 1 :
25 $i eq '%defaultroute' ? 2 :
27 print "<tr> <td valign=top><b>$text{'config_ifaces'}</b></td> <td colspan=3>\n";
29 printf "<input type=radio name=ifaces_mode value=%s %s> %s\n",
30 $m, $m == $imode ? "checked" : "", $text{'config_ifaces'.$m};
32 @iflist = $imode == 3 ? split(/\s+/, $i) : ();
33 print "<br><table border>\n";
34 print "<tr $tb> <td><b>$text{'config_riface'}</b></td> ",
35 "<td><b>$text{'config_iiface'}</b></td> </tr>\n";
37 foreach $ifc (@iflist, "") {
38 local ($ii, $ri) = split(/=/, $ifc);
42 print "<td><select name=ri_$n>\n";
43 print "<option value=''> \n";
44 foreach $r (@allifaces) {
45 next if ($r =~ /^ipsec/ || $r =~ /:/);
46 printf "<option value=%s %s>%s (%s)\n",
47 $r, $ri eq $r ? "selected" : "", $r,
49 $found++ if ($ri eq $r);
51 print "<option value=$ri selected>$ri\n" if (!$found && $ri);
52 print "</select></td>\n";
55 print "<td><select name=ii_$n>\n";
57 printf "<option value=ipsec%d %s>ipsec%d\n",
58 $k, $ii eq "ipsec$k" ? "selected" : "", $k;
59 $found++ if ($ii eq "ipsec$k");
61 print "<option value=$ii selected>$ii\n" if (!$found && $ii);
62 print "</select></td>\n";
67 print "</table></td></tr>\n";
69 # syslog facility/level
70 &foreign_require("syslog", "syslog-lib.pl");
71 $s = $config->{'values'}->{'syslog'};
72 print "<tr> <td><b>$text{'config_syslog'}</b></td> <td colspan=3>\n";
73 printf "<input type=radio name=syslog_def value=1 %s> %s (<tt>%s</tt>)\n",
74 $s ? "" : "checked", $text{'default'}, "daemon.error";
75 printf "<input type=radio name=syslog_def value=0 %s> %s\n",
76 $s ? "checked" : "", $text{'config_fac'};
77 ($fac, $pri) = split(/\./, $s);
78 $pri =~ s/warn$/warning/;
79 $pri =~ s/panic$/emerg/;
80 $pri =~ s/error$/err/;
81 print "<select name=fac>\n";
82 foreach $f (split(/\s+/, $syslog::config{'facilities'})) {
83 printf "<option %s>%s\n", $f eq $fac ? "selected" : "", $f;
85 print "</select> $text{'config_pri'}\n";
86 print "<select name=pri>\n";
87 foreach $p (&syslog::list_priorities()) {
88 printf "<option %s>%s\n", $p eq $pri ? "selected" : "", $p;
90 print "</select></td> </tr>\n";
92 # automatic forwarding enable
93 $f = $config->{'values'}->{'forwardcontrol'};
94 print "<tr> <td><b>$text{'config_fwd'}</b></td>\n";
95 print "<td>",&ui_radio("fwd", $f || "no",
96 [ [ "yes", $text{'yes'} ], [ "no", $text{'no'} ] ]),"</td>\n";
98 # nat traversal enable
99 $n = $config->{'values'}->{'nat_traversal'};
100 print "<td><b>$text{'config_nat'}</b></td>\n";
101 print "<td>",&ui_radio("nat", $n || "no",
102 [ [ "yes", $text{'yes'} ], [ "no", $text{'no'} ] ]),"</td> </tr>\n";
104 print "<td colspan=2></td>\n";
107 print "</table></td></tr></table>\n";
108 print "<input type=submit value='$text{'save'}'></form>\n";
110 &ui_print_footer("", $text{'index_return'});