3 # Save global address and topology options
5 require './bind8-lib.pl';
6 $access{'defaults'} || &error($text{'net_ecannot'});
7 &error_setup($text{'net_err'});
10 &lock_file(&make_chroot($config{'named_conf'}));
11 $conf = &get_config();
12 $options = &find("options", $conf);
13 if (!$in{'listen_def'}) {
14 for($i=0; defined($addr = $in{"addrs_$i"}); $i++) {
16 local $l = { 'name' => 'listen-on',
18 if (!$in{"pdef_$i"}) {
19 $in{"port_$i"} =~ /^\d+$/ ||
20 &error(&text('net_eport', $in{"port_$i"}));
21 $l->{'values'} = [ 'port', $in{"port_$i"} ];
23 $port = $in{"pdef_$i"} ? 53 : $in{"port_$i"};
24 $used{$port}++ && &error(&text('net_eusedport', $port));
26 [ map { { 'name' => $_ } } split(/\s+/, $addr) ];
30 &save_directive($options, 'listen-on', \@listen, 1);
31 if (!$in{'saddr_def'}) {
32 &check_ipaddress($in{'saddr'}) ||
33 &error(&text('net_eaddr', $in{'saddr'}));
34 push(@qvals, "address", $in{'saddr'});
36 if (!$in{'sport_def'}) {
37 $in{'sport'} =~ /^\d+$/ || &error(&text('net_eport', $in{'sport'}));
38 push(@qvals, "port", $in{'sport'});
41 &save_directive($options, 'query-source',
42 [ { 'name' => 'query-source',
43 'values' => \@qvals } ], 1);
46 &save_directive($options, 'query-source', [ ], 1);
48 $in{'topology_def'} || $in{'topology'} || &error($text{'net_etopology'});
49 &save_addr_match('topology', $options, 1);
50 $in{'allow-recursion_def'} || $in{'allow-recursion'} ||
51 &error($text{'net_erecur'});
52 &save_addr_match('allow-recursion', $options, 1);
55 &unlock_file(&make_chroot($config{'named_conf'}));
56 &webmin_log("net", undef, undef, \%in);