Exemplo n.º 1
0
                     }
                     /* check for wireless interfaces, set or clear ['wireless'] */
                     if (preg_match($g['wireless_regex'], $ifport)) {
                         if (!is_array($config['interfaces'][$ifname]['wireless'])) {
                             $config['interfaces'][$ifname]['wireless'] = array();
                         }
                     } else {
                         unset($config['interfaces'][$ifname]['wireless']);
                     }
                     /* make sure there is a descr for all interfaces */
                     if (!isset($config['interfaces'][$ifname]['descr'])) {
                         $config['interfaces'][$ifname]['descr'] = strtoupper($ifname);
                     }
                     if ($reloadif == true) {
                         if (preg_match($g['wireless_regex'], $ifport)) {
                             interface_sync_wireless_clones($config['interfaces'][$ifname], false);
                         }
                         /* Reload all for the interface. */
                         interface_configure($ifname, true);
                     }
                 }
             }
         }
         write_config();
         enable_rrd_graphing();
     }
 } else {
     unset($delbtn);
     if (!empty($_POST['del'])) {
         $delbtn = key($_POST['del']);
     }
Exemplo n.º 2
0
function handle_wireless_post()
{
    global $_POST, $config, $g, $wancfg, $if, $wl_countries_attr, $wlanbaseif;
    if (!is_array($wancfg['wireless'])) {
        $wancfg['wireless'] = array();
    }
    $wancfg['wireless']['standard'] = $_POST['standard'];
    $wancfg['wireless']['mode'] = $_POST['mode'];
    $wancfg['wireless']['protmode'] = $_POST['protmode'];
    $wancfg['wireless']['ssid'] = $_POST['ssid'];
    $wancfg['wireless']['channel'] = $_POST['channel'];
    $wancfg['wireless']['authmode'] = $_POST['authmode'];
    $wancfg['wireless']['txpower'] = $_POST['txpower'];
    $wancfg['wireless']['distance'] = $_POST['distance'];
    $wancfg['wireless']['regdomain'] = $_POST['regdomain'];
    $wancfg['wireless']['regcountry'] = $_POST['regcountry'];
    $wancfg['wireless']['reglocation'] = $_POST['reglocation'];
    if (!empty($wancfg['wireless']['regdomain']) && !empty($wancfg['wireless']['regcountry'])) {
        foreach ($wl_countries_attr as $wl_country) {
            if ($wancfg['wireless']['regcountry'] == $wl_country['ID']) {
                $wancfg['wireless']['regdomain'] = $wl_country['rd'][0]['REF'];
                break;
            }
        }
    }
    if (!is_array($wancfg['wireless']['wpa'])) {
        $wancfg['wireless']['wpa'] = array();
    }
    $wancfg['wireless']['wpa']['macaddr_acl'] = $_POST['macaddr_acl'];
    $wancfg['wireless']['wpa']['auth_algs'] = $_POST['auth_algs'];
    $wancfg['wireless']['wpa']['wpa_mode'] = $_POST['wpa_mode'];
    $wancfg['wireless']['wpa']['wpa_key_mgmt'] = $_POST['wpa_key_mgmt'];
    $wancfg['wireless']['wpa']['wpa_pairwise'] = $_POST['wpa_pairwise'];
    $wancfg['wireless']['wpa']['wpa_group_rekey'] = $_POST['wpa_group_rekey'];
    $wancfg['wireless']['wpa']['wpa_gmk_rekey'] = $_POST['wpa_gmk_rekey'];
    $wancfg['wireless']['wpa']['passphrase'] = $_POST['passphrase'];
    $wancfg['wireless']['wpa']['ext_wpa_sw'] = $_POST['ext_wpa_sw'];
    $wancfg['wireless']['auth_server_addr'] = $_POST['auth_server_addr'];
    $wancfg['wireless']['auth_server_port'] = $_POST['auth_server_port'];
    $wancfg['wireless']['auth_server_shared_secret'] = $_POST['auth_server_shared_secret'];
    $wancfg['wireless']['auth_server_addr2'] = $_POST['auth_server_addr2'];
    $wancfg['wireless']['auth_server_port2'] = $_POST['auth_server_port2'];
    $wancfg['wireless']['auth_server_shared_secret2'] = $_POST['auth_server_shared_secret2'];
    if ($_POST['persistcommonwireless'] == "yes") {
        if (!is_array($config['wireless'])) {
            $config['wireless'] = array();
        }
        if (!is_array($config['wireless']['interfaces'])) {
            $config['wireless']['interfaces'] = array();
        }
        if (!is_array($config['wireless']['interfaces'][$wlanbaseif])) {
            $config['wireless']['interfaces'][$wlanbaseif] = array();
        }
    } else {
        if (isset($config['wireless']['interfaces'][$wlanbaseif])) {
            unset($config['wireless']['interfaces'][$wlanbaseif]);
        }
    }
    if (isset($_POST['diversity']) && is_numeric($_POST['diversity'])) {
        $wancfg['wireless']['diversity'] = $_POST['diversity'];
    } else {
        if (isset($wancfg['wireless']['diversity'])) {
            unset($wancfg['wireless']['diversity']);
        }
    }
    if (isset($_POST['txantenna']) && is_numeric($_POST['txantenna'])) {
        $wancfg['wireless']['txantenna'] = $_POST['txantenna'];
    } else {
        if (isset($wancfg['wireless']['txantenna'])) {
            unset($wancfg['wireless']['txantenna']);
        }
    }
    if (isset($_POST['rxantenna']) && is_numeric($_POST['rxantenna'])) {
        $wancfg['wireless']['rxantenna'] = $_POST['rxantenna'];
    } else {
        if (isset($wancfg['wireless']['rxantenna'])) {
            unset($wancfg['wireless']['rxantenna']);
        }
    }
    if ($_POST['hidessid_enable'] == "yes") {
        $wancfg['wireless']['hidessid']['enable'] = true;
    } else {
        if (isset($wancfg['wireless']['hidessid']['enable'])) {
            unset($wancfg['wireless']['hidessid']['enable']);
        }
    }
    if ($_POST['mac_acl_enable'] == "yes") {
        $wancfg['wireless']['wpa']['mac_acl_enable'] = true;
    } else {
        if (isset($wancfg['wireless']['wpa']['mac_acl_enable'])) {
            unset($wancfg['wireless']['wpa']['mac_acl_enable']);
        }
    }
    if ($_POST['rsn_preauth'] == "yes") {
        $wancfg['wireless']['wpa']['rsn_preauth'] = true;
    } else {
        unset($wancfg['wireless']['wpa']['rsn_preauth']);
    }
    if ($_POST['ieee8021x'] == "yes") {
        $wancfg['wireless']['wpa']['ieee8021x']['enable'] = true;
    } else {
        if (isset($wancfg['wireless']['wpa']['ieee8021x']['enable'])) {
            unset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
        }
    }
    if ($_POST['wpa_strict_rekey'] == "yes") {
        $wancfg['wireless']['wpa']['wpa_strict_rekey'] = true;
    } else {
        if (isset($wancfg['wireless']['wpa']['wpa_strict_rekey'])) {
            unset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
        }
    }
    if ($_POST['debug_mode'] == "yes") {
        $wancfg['wireless']['wpa']['debug_mode'] = true;
    } else {
        if (isset($wancfg['wireless']['wpa']['debug_mode'])) {
            sunset($wancfg['wireless']['wpa']['debug_mode']);
        }
    }
    if ($_POST['wpa_enable'] == "yes") {
        $wancfg['wireless']['wpa']['enable'] = $_POST['wpa_enable'] = true;
    } else {
        if (isset($wancfg['wireless']['wpa']['enable'])) {
            unset($wancfg['wireless']['wpa']['enable']);
        }
    }
    if (ALLOWWEP) {
        if ($_POST['wep_enable'] == "yes") {
            if (!is_array($wancfg['wireless']['wep'])) {
                $wancfg['wireless']['wep'] = array();
            }
            $wancfg['wireless']['wep']['enable'] = $_POST['wep_enable'] = true;
        } else {
            if (isset($wancfg['wireless']['wep'])) {
                unset($wancfg['wireless']['wep']);
            }
        }
    }
    if ($_POST['wme_enable'] == "yes") {
        if (!is_array($wancfg['wireless']['wme'])) {
            $wancfg['wireless']['wme'] = array();
        }
        $wancfg['wireless']['wme']['enable'] = $_POST['wme_enable'] = true;
    } else {
        if (isset($wancfg['wireless']['wme']['enable'])) {
            unset($wancfg['wireless']['wme']['enable']);
        }
    }
    if ($_POST['puremode'] == "11g") {
        if (!is_array($wancfg['wireless']['pureg'])) {
            $wancfg['wireless']['pureg'] = array();
        }
        $wancfg['wireless']['pureg']['enable'] = true;
    } else {
        if ($_POST['puremode'] == "11n") {
            if (!is_array($wancfg['wireless']['puren'])) {
                $wancfg['wireless']['puren'] = array();
            }
            $wancfg['wireless']['puren']['enable'] = true;
        } else {
            if (isset($wancfg['wireless']['pureg'])) {
                unset($wancfg['wireless']['pureg']);
            }
            if (isset($wancfg['wireless']['puren'])) {
                unset($wancfg['wireless']['puren']);
            }
        }
    }
    if ($_POST['apbridge_enable'] == "yes") {
        if (!is_array($wancfg['wireless']['apbridge'])) {
            $wancfg['wireless']['apbridge'] = array();
        }
        $wancfg['wireless']['apbridge']['enable'] = $_POST['apbridge_enable'] = true;
    } else {
        if (isset($wancfg['wireless']['apbridge']['enable'])) {
            unset($wancfg['wireless']['apbridge']['enable']);
        }
    }
    if ($_POST['standard'] == "11g Turbo" || $_POST['standard'] == "11a Turbo") {
        if (!is_array($wancfg['wireless']['turbo'])) {
            $wancfg['wireless']['turbo'] = array();
        }
        $wancfg['wireless']['turbo']['enable'] = true;
    } else {
        if (isset($wancfg['wireless']['turbo']['enable'])) {
            unset($wancfg['wireless']['turbo']['enable']);
        }
    }
    if (ALLOWWEP) {
        $wancfg['wireless']['wep']['key'] = array();
        for ($i = 1; $i <= 4; $i++) {
            if ($_POST['key' . $i]) {
                $newkey = array();
                $newkey['value'] = $_POST['key' . $i];
                if ($_POST['txkey'] == $i) {
                    $newkey['txkey'] = true;
                }
                $wancfg['wireless']['wep']['key'][] = $newkey;
            }
        }
    }
    interface_sync_wireless_clones($wancfg, true);
}
Exemplo n.º 3
0
         if (!isset($config['wireless']) || !is_array($config['wireless'])) {
             $config['wireless'] = array();
         }
         if (!isset($config['wireless']['interfaces']) || !is_array($config['wireless']['interfaces'])) {
             $config['wireless']['interfaces'] = array();
         }
         if (empty($config['wireless']['interfaces'][$wlanbaseif])) {
             $config['wireless']['interfaces'][$wlanbaseif] = array();
         }
     } else {
         if (isset($config['wireless']['interfaces'][$wlanbaseif])) {
             unset($config['wireless']['interfaces'][$wlanbaseif]);
         }
     }
     // quite obscure this... copies parts of the config
     interface_sync_wireless_clones($new_config, true);
 }
 if (count($new_ppp_config) > 0) {
     // ppp details changed
     $a_ppps[$pppid] = $new_ppp_config;
 } elseif (!empty($a_ppps[$pppid])) {
     // ppp removed
     $new_config['if'] = $a_ppps[$pppid]['ports'];
     unset($a_ppps[$pppid]);
 }
 // save interface details
 $a_interfaces[$if] = $new_config;
 if (!empty($old_config['ipaddr']) && $old_config['ipaddr'] == 'dhcp' && $new_config['ipaddr'] != 'dhcp') {
     // change from dhcp to something else, kill dhclient
     kill_dhclient_process($old_config['if']);
 }