Esempio n. 1
0
}
if ($_POST['apply']) {
    unset($input_errors);
    if (!is_subsystem_dirty('interfaces')) {
        $input_errors[] = gettext("You have already applied your settings!");
    } else {
        unlink_if_exists("{$g['tmp_path']}/config.cache");
        clear_subsystem_dirty('interfaces');
        if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
            $toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
            foreach ($toapplylist as $ifapply => $ifcfgo) {
                if (isset($config['interfaces'][$ifapply]['enable'])) {
                    interface_bring_down($ifapply, false, $ifcfgo);
                    interface_configure($ifapply, true);
                } else {
                    interface_bring_down($ifapply, true, $ifcfgo);
                    if (isset($config['dhcpd'][$ifapply]['enable']) || isset($config['dhcpdv6'][$ifapply]['enable'])) {
                        services_dhcpd_configure();
                    }
                }
            }
        }
        /* restart snmp so that it binds to correct address */
        services_snmpd_configure();
        /* sync filter configuration */
        setup_gateways_monitor();
        clear_subsystem_dirty('interfaces');
        filter_configure();
        enable_rrd_graphing();
        if (is_subsystem_dirty('staticroutes') && system_routing_configure() == 0) {
            clear_subsystem_dirty('staticroutes');
Esempio n. 2
0
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
require_once "guiconfig.inc";
require_once "filter.inc";
if ($_POST['if'] && $_POST['submit']) {
    $interface = $_POST['if'];
    if ($_POST['status'] == "up") {
        interface_bring_down($interface);
    } else {
        interface_configure($interface);
    }
    header("Location: status_interfaces.php");
    exit;
}
$pgtitle = array(gettext("Status"), gettext("Interfaces"));
$shortcut_section = "interfaces";
include "head.inc";
?>

<body>
<?php 
include "fbegin.inc";
?>
Esempio n. 3
0
 $id = $delbtn;
 if (link_interface_to_group($id)) {
     $input_errors[] = gettext("The interface is part of a group. Please remove it from the group to continue");
 } else {
     if (link_interface_to_bridge($id)) {
         $input_errors[] = gettext("The interface is part of a bridge. Please remove it from the bridge to continue");
     } else {
         if (link_interface_to_gre($id)) {
             $input_errors[] = gettext("The interface is part of a gre tunnel. Please delete the tunnel to continue");
         } else {
             if (link_interface_to_gif($id)) {
                 $input_errors[] = gettext("The interface is part of a gif tunnel. Please delete the tunnel to continue");
             } else {
                 unset($config['interfaces'][$id]['enable']);
                 $realid = get_real_interface($id);
                 interface_bring_down($id);
                 /* down the interface */
                 unset($config['interfaces'][$id]);
                 /* delete the specified OPTn or LAN*/
                 if (is_array($config['dhcpd']) && is_array($config['dhcpd'][$id])) {
                     unset($config['dhcpd'][$id]);
                     services_dhcpd_configure();
                 }
                 if (count($config['filter']['rule']) > 0) {
                     foreach ($config['filter']['rule'] as $x => $rule) {
                         if ($rule['interface'] == $id) {
                             unset($config['filter']['rule'][$x]);
                         }
                     }
                 }
                 if (is_array($config['nat']['rule']) && count($config['nat']['rule']) > 0) {
Esempio n. 4
0
 }
 if (isset($config['vlans']['vlan'])) {
     foreach ($config['vlans']['vlan'] as $vlan) {
         if (!does_interface_exist($vlan['if'])) {
             $input_errors[] = sprintf(gettext("VLAN parent interface %s does not exist."), $vlan['if']);
         }
     }
 }
 if (count($input_errors) == 0) {
     /* No errors detected, so update the config */
     $changes = 0;
     foreach ($_POST as $ifname => $ifport) {
         if (!is_array($ifport) && ($ifname == 'lan' || $ifname == 'wan' || substr($ifname, 0, 3) == 'opt')) {
             $reloadif = false;
             if (!empty($config['interfaces'][$ifname]['if']) && $config['interfaces'][$ifname]['if'] != $ifport) {
                 interface_bring_down($ifname);
                 /* Mark this to be reconfigured in any case. */
                 $reloadif = true;
             }
             $config['interfaces'][$ifname]['if'] = $ifport;
             if ($interfaces[$ifport]['section'] == 'ppps.ppp') {
                 $config['interfaces'][$ifname]['ipaddr'] = $interfaces[$ifport]['type'];
             }
             if (substr($ifport, 0, 3) == 'gre' || substr($ifport, 0, 3) == 'gif') {
                 unset($config['interfaces'][$ifname]['ipaddr']);
                 unset($config['interfaces'][$ifname]['subnet']);
                 unset($config['interfaces'][$ifname]['ipaddrv6']);
                 unset($config['interfaces'][$ifname]['subnetv6']);
             }
             /* check for wireless interfaces, set or clear ['wireless'] */
             if (match_wireless_interface($ifport)) {
Esempio n. 5
0
 }
 if (isset($config['vlans']['vlan'])) {
     foreach ($config['vlans']['vlan'] as $vlan) {
         if (!does_interface_exist($vlan['if'])) {
             $input_errors[] = sprintf(gettext("VLAN parent interface %s does not exist."), $vlan['if']);
         }
     }
 }
 if (count($input_errors) == 0) {
     /* No errors detected, so update the config */
     $changes = 0;
     foreach ($_POST as $ifname => $ifport) {
         if (!is_array($ifport) && ($ifname == 'lan' || $ifname == 'wan' || substr($ifname, 0, 3) == 'opt')) {
             $reloadif = false;
             if (!empty($config['interfaces'][$ifname]['if']) && $config['interfaces'][$ifname]['if'] != $ifport) {
                 interface_bring_down($ifname, true);
                 /* Mark this to be reconfigured in any case. */
                 $reloadif = true;
             }
             $config['interfaces'][$ifname]['if'] = $ifport;
             if ($interfaces[$ifport]['section'] == 'ppps.ppp') {
                 $config['interfaces'][$ifname]['ipaddr'] = $interfaces[$ifport]['type'];
             }
             if (substr($ifport, 0, 3) == 'gre' || substr($ifport, 0, 3) == 'gif') {
                 unset($config['interfaces'][$ifname]['ipaddr']);
                 unset($config['interfaces'][$ifname]['subnet']);
                 unset($config['interfaces'][$ifname]['ipaddrv6']);
                 unset($config['interfaces'][$ifname]['subnetv6']);
             }
             /* check for wireless interfaces, set or clear ['wireless'] */
             if (match_wireless_interface($ifport)) {
Esempio n. 6
0
$pconfig['mtu'] = $wancfg['mtu'];
$pconfig['mss'] = $wancfg['mss'];
if ($_POST['apply']) {
    unset($input_errors);
    if (!is_subsystem_dirty('interfaces')) {
        $intput_errors[] = "Değişiklikleri zaten uyguladınız.";
    } else {
        unlink_if_exists("{$g['tmp_path']}/config.cache");
        clear_subsystem_dirty('interfaces');
        if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
            $toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
            foreach ($toapplylist as $ifapply) {
                if (isset($config['interfaces'][$ifapply]['enable'])) {
                    interface_reconfigure($ifapply, true);
                } else {
                    interface_bring_down($ifapply);
                }
            }
        }
        /* sync filter configuration */
        setup_gateways_monitor();
        clear_subsystem_dirty('staticroutes');
        filter_configure();
    }
    @unlink("{$g['tmp_path']}/.interfaces.apply");
    header("Location: interfaces.php?if={$if}");
    exit;
} else {
    if ($_POST && $_POST['enable'] != "yes") {
        unset($wancfg['enable']);
        write_config();