update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'address'), $_POST['name'], $origname); update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'port'), $_POST['name'], $origname); update_alias_names_upon_change(array('nat', 'rule'), array('target'), $_POST['name'], $origname); update_alias_names_upon_change(array('nat', 'rule'), array('local-port'), $_POST['name'], $origname); // NAT 1:1 Rules //update_alias_names_upon_change(array('nat', 'onetoone'), array('external'), $_POST['name'], $origname); //update_alias_names_upon_change(array('nat', 'onetoone'), array('source', 'address'), $_POST['name'], $origname); update_alias_names_upon_change(array('nat', 'onetoone'), array('destination', 'address'), $_POST['name'], $origname); // NAT Outbound Rules update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('source', 'network'), $_POST['name'], $origname); update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('sourceport'), $_POST['name'], $origname); update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('destination', 'address'), $_POST['name'], $origname); update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('dstport'), $_POST['name'], $origname); update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('target'), $_POST['name'], $origname); // Alias in an alias update_alias_names_upon_change(array('aliases', 'alias'), array('address'), $_POST['name'], $origname); } pfSense_handle_custom_code("/usr/local/pkg/firewall_aliases_edit/pre_write_config"); if (isset($id) && $a_aliases[$id]) { if ($a_aliases[$id]['name'] != $alias['name']) { foreach ($a_aliases as $aliasid => $aliasd) { if ($aliasd['address'] != "") { $tmpdirty = false; $tmpaddr = explode(" ", $aliasd['address']); foreach ($tmpaddr as $tmpidx => $tmpalias) { if ($tmpalias == $a_aliases[$id]['name']) { $tmpaddr[$tmpidx] = $alias['name']; $tmpdirty = true; } } if ($tmpdirty == true) {
} /* check for interface names with an alias */ if (is_array($ifdescrs)) { foreach ($ifdescrs as $iface) { if (is_alias($config['interfaces'][$iface]['descr'])) { // Firewall rules $origname = $config['interfaces'][$iface]['descr']; $newname = $config['interfaces'][$iface]['descr'] . "Alias"; update_alias_names_upon_change(array('filter', 'rule'), array('source', 'address'), $newname, $origname); update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'address'), $newname, $origname); // NAT Rules update_alias_names_upon_change(array('nat', 'rule'), array('source', 'address'), $newname, $origname); update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'address'), $newname, $origname); update_alias_names_upon_change(array('nat', 'rule'), array('target'), $newname, $origname); // Alias in an alias update_alias_names_upon_change(array('aliases', 'alias'), array('address'), $newname, $origname); } } } unlink_if_exists("{$g['tmp_path']}/config.cache"); // Reset configuration version to something low // in order to force the config upgrade code to // run through with all steps that are required. $config['system']['version'] = "1.0"; // Deal with descriptions longer than 63 characters for ($i = 0; isset($config["filter"]["rule"][$i]); $i++) { if (count($config['filter']['rule'][$i]['descr']) > 63) { $config['filter']['rule'][$i]['descr'] = substr($config['filter']['rule'][$i]['descr'], 0, 63); } } // Move interface from ipsec to enc0
} /* check for interface names with an alias */ if (is_array($ifdescrs)) { foreach ($ifdescrs as $iface) { if (is_alias($config['interfaces'][$iface]['descr'])) { // Firewall rules $origname = $config['interfaces'][$iface]['descr']; $newname = $config['interfaces'][$iface]['descr'] . "Alias"; update_alias_names_upon_change('filter', 'rule', 'source', 'address', $newname, $origname); update_alias_names_upon_change('filter', 'rule', 'destination', 'address', $newname, $origname); // NAT Rules update_alias_names_upon_change('nat', 'rule', 'target', '', $newname, $origname); update_alias_names_upon_change('nat', 'rule', 'external-port', '', $newname, $origname); update_alias_names_upon_change('nat', 'rule', 'local-port', '', $newname, $origname); // Alias in an alias update_alias_names_upon_change('aliases', 'alias', 'address', '', $newname, $origname); } } } unlink_if_exists("/tmp/config.cache"); write_config(); add_base_packages_menu_items(); conf_mount_ro(); $savemsg = "m0n0wall ayarları sisteme uyarlandı {$g['product_name']}.<p>Firewall şu anda yeniden başlatılıyor."; $reboot_needed = true; } if (isset($config['captiveportal']['enable'])) { /* for some reason ipfw doesn't init correctly except on bootup sequence */ $savemsg = "Ayarlar yapılandırıldı.<p>Firewall şu anda yeniden başlatılıyor."; $reboot_needed = true; }