+
+ # Check if an orange interface exists.
+ if ($orange) {
+ # Add orange address.
+ print FILE "$orange\n";
+ }
+
+ print FILE "\n# IPFire red interface, gateway and used DNS-servers.\n";
+ print FILE "# Include the corresponding files to obtain the addresses.\n";
+ print FILE "Include_File = $public_address_file\n";
+ print FILE "Include_File = $gatewayfile\n";
+ print FILE "Include_File = $dns1file\n";
+ print FILE "Include_File = $dns2file\n";
+
+ # Add all user defined hosts and networks to the ignore file.
+ #
+ # Check if the hash contains any elements.
+ if (keys (%ignored)) {
+ # Write headline.
+ print FILE "\n# User defined hosts/networks.\n";
+
+ # Loop through the entire hash and write the host/network
+ # and remark to the ignore file.
+ while ( (my $key) = each %ignored) {
+ my $address = $ignored{$key}[0];
+ my $remark = $ignored{$key}[1];
+ my $status = $ignored{$key}[2];
+
+ # Check if the status of the entry is "enabled".
+ if ($status eq "enabled") {
+ # Check if the address/network is valid.
+ if ((&General::validip($address)) || (&General::validipandmask($address))) {
+ # Write the remark to the file.
+ print FILE "# $remark\n";
+
+ # Write the address/network to the ignore file.
+ print FILE "$address\n\n";
+ }
+ }
+ }
+ }
+
+ close(FILE);
+}
+
+# Private subfunction to obtain IP-addresses from given file names.
+#
+sub _get_address_from_file ($) {
+ my $file = shift;
+
+ # Check if the file exists.
+ if (-e $file) {
+ # Open the given file.
+ open(FILE, "$file") or die "Could not open $file.";
+
+ # Obtain the address from the first line of the file.
+ my $address = <FILE>;
+
+ # Close filehandle
+ close(FILE);
+
+ # Remove newlines.
+ chomp $address;
+
+ # Check if the grabbed address is valid.
+ if (&General::validip($address)) {
+ # Return the address.
+ return $address;
+ }
+ }
+
+ # Return nothing.
+ return;