]>
Commit | Line | Data |
---|---|---|
ac1cfefa MT |
1 | #!/usr/bin/perl |
2 | # | |
3 | # Helper program to write a new IPAC settings file | |
4 | # | |
5 | # (c) Lawrence Manning, 2001 | |
6 | # | |
7 | # $id | |
8 | # | |
9 | ||
10 | use strict; | |
11 | require 'CONFIG_ROOT/general-functions.pl'; | |
12 | ||
13 | my %settings; | |
14 | my $iface; | |
15 | ||
16 | General::readhash("${General::swroot}/ethernet/settings", \%settings); | |
17 | ||
18 | if (!open(FILE, '>/etc/ipac-ng/rules.conf')) { | |
19 | die "Unable to create /etc/ipac-ng/rules.conf"; } | |
20 | ||
21 | if (open(IFACE, "${General::swroot}/red/iface")) | |
22 | { | |
23 | $iface = <IFACE>; | |
24 | close IFACE; | |
25 | chomp ($iface); | |
26 | } | |
27 | ||
28 | print FILE "incoming GREEN ($settings{'GREEN_DEV'})|ipac~o|$settings{'GREEN_DEV'}|all|||\n"; | |
29 | print FILE "outgoing GREEN ($settings{'GREEN_DEV'})|ipac~i|$settings{'GREEN_DEV'}|all|||\n"; | |
30 | print FILE "forwarded incoming GREEN ($settings{'GREEN_DEV'})|ipac~fi|$settings{'GREEN_DEV'}|all|||\n"; | |
31 | print FILE "forwarded outgoing GREEN ($settings{'GREEN_DEV'})|ipac~fo|$settings{'GREEN_DEV'}|all|||\n"; | |
32 | ||
33 | if ($settings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/ ) | |
34 | { | |
35 | print FILE "incoming ORANGE ($settings{'ORANGE_DEV'})|ipac~o|$settings{'ORANGE_DEV'}|all|||\n"; | |
36 | print FILE "outgoing ORANGE ($settings{'ORANGE_DEV'})|ipac~i|$settings{'ORANGE_DEV'}|all|||\n"; | |
37 | print FILE "forwarded incoming ORANGE ($settings{'ORANGE_DEV'})|ipac~fi|$settings{'ORANGE_DEV'}|all|||\n"; | |
38 | print FILE "forwarded outgoing ORANGE ($settings{'ORANGE_DEV'})|ipac~fo|$settings{'ORANGE_DEV'}|all|||\n"; | |
39 | } | |
40 | ||
41 | if ($settings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/ ) | |
42 | { | |
43 | print FILE "incoming BLUE ($settings{'BLUE_DEV'})|ipac~o|$settings{'BLUE_DEV'}|all|||\n"; | |
44 | print FILE "outgoing BLUE ($settings{'BLUE_DEV'})|ipac~i|$settings{'BLUE_DEV'}|all|||\n"; | |
45 | print FILE "forwarded incoming BLUE ($settings{'BLUE_DEV'})|ipac~fi|$settings{'BLUE_DEV'}|all|||\n"; | |
46 | print FILE "forwarded outgoing BLUE ($settings{'BLUE_DEV'})|ipac~fo|$settings{'BLUE_DEV'}|all|||\n"; | |
47 | } | |
48 | if ($iface) { | |
49 | print FILE "incoming RED ($iface)|ipac~o|$iface|all|||\n"; | |
50 | print FILE "outgoing RED ($iface)|ipac~i|$iface|all|||\n"; | |
51 | print FILE "forwarded incoming RED ($iface)|ipac~fi|$iface|all|||\n"; | |
52 | print FILE "forwarded outgoing RED ($iface)|ipac~fo|$iface|all|||\n"; | |
53 | } | |
54 | ||
55 | close FILE; |