3 # A form for editing ports and other networking options
5 require './squid-lib.pl';
6 $access{'portsnets'} || &error($text{'eports_ecannot'});
7 &ui_print_header(undef, $text{'eports_header'}, "", "edit_ports", 0, 0, 0, &restart_button());
10 print "<form action=save_ports.cgi>\n";
11 print "<table border width=100%>\n";
12 print "<tr $tb> <td><b>$text{'eports_pano'}</b></td> </tr>\n";
13 print "<tr $cb> <td><table width=100%>\n";
16 if ($squid_version >= 2.3) {
17 # Display table of normal ports
18 print "<td valign=top><b>$text{'eports_paap'}</b></td><td colspan=3>\n";
19 &ports_table("http_port");
20 print "</table></td></tr>\n";
22 if ($squid_version >= 2.5) {
23 # Display table of SSL ports
24 print "<tr> <td valign=top><b>$text{'eports_ssl'}</b></td><td colspan=3>\n";
25 &ports_table("https_port");
26 print "</table></td></tr>\n";
29 print &opt_input($text{'eports_ip'}, "icp_port",
30 $conf, $text{'default'}, 6);
33 # Just show single-port inputs
34 print &opt_input($text{'eports_pp'}, "http_port",
35 $conf, $text{'default'}, 6);
36 print &opt_input($text{'eports_ip'}, "icp_port",
37 $conf, $text{'default'}, 6);
41 print &opt_input($text{'eports_ita'}, "tcp_incoming_address",
42 $conf, $text{'eports_a'}, 15);
45 print &opt_input($text{'eports_ota'}, "tcp_outgoing_address",
46 $conf, $text{'eports_a'}, 15);
50 print &opt_input($text{'eports_oua'}, "udp_outgoing_address",
51 $conf, $text{'eports_a'}, 15);
52 print &opt_input($text{'eports_iua'}, "udp_incoming_address",
53 $conf, $text{'eports_a'}, 15);
57 print &address_input($text{'eports_mg'}, "mcast_groups", $conf, 0);
58 print &opt_input($text{'eports_trb'}, "tcp_recv_bufsize", $conf,
59 $text{'eports_od'}, 6);
62 if ($squid_version >= 2.6) {
64 print &choice_input($text{'eports_checkhost'}, "check_hostnames",
65 $conf, "on", $text{'yes'}, "on", $text{'no'},"off");
66 print &choice_input($text{'eports_underscore'}, "allow_underscore",
67 $conf, "on", $text{'yes'}, "on", $text{'no'},"off");
71 if ($squid_version >= 2.5) {
73 print &choice_input($text{'eports_unc'}, "ssl_unclean_shutdown",
74 $conf, "off", $text{'on'},"on", $text{'off'},"off");
78 print "</table></td></tr></table>\n";
79 print "<input type=submit value=$text{'buttsave'}></form>\n";
81 &ui_print_footer("", $text{'eports_return'});
86 local ($p, $i, @ports, @opts);
87 foreach $p (&find_config($_[0], $conf)) {
88 foreach $v (@{$p->{'values'}}) {
89 if ($v =~ /^(\S+):\d+$/ || $v =~ /^\d+$/) {
93 push(@{$opts[$#ports]}, $v);
97 printf "<input type=radio name=$_[0]_ports_def value=1 %s> %s\n",
98 @ports ? "" : "checked", $text{'eports_def'};
99 printf "<input type=radio name=$_[0]_ports_def value=0 %s> %s<br>\n",
100 @ports ? "checked" : "", $text{'eports_sel'};
101 print "<table border>\n";
102 print "<tr $tb> <td><b>$text{'eports_p'}</b></td>\n",
103 "<td><b>$text{'eports_hia'}</b></td> ",
104 ($squid_version >= 2.5 ? "<td><b>$text{'eports_opts'}</b></td> "
107 foreach $p (@ports, '') {
109 printf "<td><input name=$_[0]_port_$i size=6 value='%s'></td> <td>\n",
110 $p =~ /(\d+)$/ ? $1 : '';
111 printf "<input type=radio name=$_[0]_addr_def_$i value=1 %s> All\n",
112 $p =~ /:/ ? '' : 'checked';
113 printf "<input type=radio name=$_[0]_addr_def_$i value=0 %s>\n",
114 $p =~ /:/ ? 'checked' : '';
115 printf "<input name=$_[0]_addr_$i size=20 value='%s'></td>\n",
116 $p =~ /^\[(\S+)\]:/ || $p =~ /^(\S+):/ ? $1 : '';
117 if ($squid_version >= 2.5) {
119 printf "<td><input name=$_[0]_opts_$i size=40 value='%s'></td>\n",
120 join(" ", @{$opts[$i]});