From 3228114dd876142ad731bb4c398f1305c604f893 Mon Sep 17 00:00:00 2001 From: Emmanuel Geoffray Date: Thu, 7 Dec 2017 19:00:48 +0000 Subject: [PATCH] add global to select wireless interface for wifi client --- includes/config.php | 1 + includes/configure_client.php | 4 ++-- includes/dashboard.php | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/includes/config.php b/includes/config.php index 58033aa4..40ecd922 100644 --- a/includes/config.php +++ b/includes/config.php @@ -3,6 +3,7 @@ define('RASPI_CONFIG', '/etc/raspap'); define('RASPI_CONFIG_NETWORKING',RASPI_CONFIG.'/networking'); define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth'); +define('RASPI_WIFI_CLIENT_INTERFACE', 'wifiKey'); // Constants for configuration file paths. // These are typical for default RPi installs. Modify if needed. diff --git a/includes/configure_client.php b/includes/configure_client.php index 4b1ede62..31a77e5e 100755 --- a/includes/configure_client.php +++ b/includes/configure_client.php @@ -134,7 +134,7 @@ function DisplayWPAConfig(){ } } - exec( 'iwconfig wlan0', $iwconfig_return ); + exec( 'iwconfig ' . RASPI_WIFI_CLIENT_INTERFACE, $iwconfig_return ); foreach ($iwconfig_return as $line) { if (preg_match( '/ESSID:\"([^"]+)\"/i',$line,$iwconfig_ssid )) { $networks[$iwconfig_ssid[1]]['connected'] = true; @@ -149,7 +149,7 @@ function DisplayWPAConfig(){

showMessages(); ?>

-

Client settings

+

Client settings for interface

diff --git a/includes/dashboard.php b/includes/dashboard.php index 1f66542a..66bb6bfe 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -8,8 +8,8 @@ function DisplayDashboard(){ $status = new StatusMessages(); - exec( 'ip a s wlan0', $return ); - exec( 'iwconfig wlan0', $return ); + exec( 'ip a s ' . RASPI_WIFI_CLIENT_INTERFACE , $return ); + exec( 'iwconfig ' . RASPI_WIFI_CLIENT_INTERFACE, $return ); $strWlan0 = implode( " ", $return ); $strWlan0 = preg_replace( '/\s\s+/', ' ', $strWlan0 ); @@ -58,17 +58,17 @@ function DisplayDashboard(){ } if( isset($_POST['ifdown_wlan0']) ) { - exec( 'ifconfig wlan0 | grep -i running | wc -l',$test ); + exec( 'ifconfig ' . RASPI_WIFI_CLIENT_INTERFACE . ' | grep -i running | wc -l',$test ); if($test[0] == 1) { - exec( 'sudo ip link set wlan0 down',$return ); + exec( 'sudo ip link set ' . RASPI_WIFI_CLIENT_INTERFACE . ' down',$return ); } else { echo 'Interface already down'; } } elseif( isset($_POST['ifup_wlan0']) ) { - exec( 'ifconfig wlan0 | grep -i running | wc -l',$test ); + exec( 'ifconfig ' . RASPI_WIFI_CLIENT_INTERFACE . ' | grep -i running | wc -l',$test ); if($test[0] == 0) { - exec( 'sudo ip link set wlan0 up',$return ); - exec( 'sudo ip -s a f label wlan0',$return); + exec( 'sudo ip link set ' . RASPI_WIFI_CLIENT_INTERFACE . ' up',$return ); + exec( 'sudo ip -s a f label ' . RASPI_WIFI_CLIENT_INTERFACE,$return); } else { echo 'Interface already up'; } @@ -85,7 +85,7 @@ function DisplayDashboard(){

Interface Information

-
Interface Name
wlan0
+
Interface Name

IP Address

Subnet Mask

Mac Address


@@ -126,9 +126,9 @@ function DisplayDashboard(){
'; + echo ''; } else { - echo ''; + echo ''; } ?>