Signed-off-by: Mohamed <mohamed.kallel@pivasoftware.com>
Signed-off-by: Ahmed ZRIBI <ahmed.zribi@pivasoftware.com>
---
ext/openwrt/scripts/functions/device_info | 62 +++++++-
ext/openwrt/scripts/functions/lan_device | 33 +++--
ext/openwrt/scripts/functions/management_server | 178 +++++++++++++++++------
ext/openwrt/scripts/functions/wan_device | 41 ++++--
4 files changed, 238 insertions(+), 76 deletions(-)
diff --git a/ext/openwrt/scripts/functions/device_info
b/ext/openwrt/scripts/functions/device_info
index 2be20b5..5fe2823 100644
--- a/ext/openwrt/scripts/functions/device_info
+++ b/ext/openwrt/scripts/functions/device_info
@@ -19,7 +19,13 @@ ubus_freecwmp_output
"InternetGatewayDevice.DeviceInfo.Manufacturer" "$val"
}
set_device_info_manufacturer() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@device[0].manufacturer="$1"
+local val=$1
+local parm="InternetGatewayDevice.DeviceInfo.Manufacturer"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@device[0].manufacturer="$val"
+ ;;
+esac
}
get_device_info_oui() {
@@ -39,7 +45,13 @@ ubus_freecwmp_output
"InternetGatewayDevice.DeviceInfo.ManufacturerOUI" "$val"
}
set_device_info_oui() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@device[0].oui="$1"
+local val=$1
+local parm="InternetGatewayDevice.DeviceInfo.ManufacturerOUI"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@device[0].oui="$val"
+ ;;
+esac
}
get_device_info_product_class() {
@@ -59,7 +71,13 @@ ubus_freecwmp_output
"InternetGatewayDevice.DeviceInfo.ProductClass" "$val"
}
set_device_info_product_class() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@device[0].product_class="$1"
+local val=$1
+local parm="InternetGatewayDevice.DeviceInfo.ProductClass"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@device[0].product_class="$val"
+ ;;
+esac
}
get_device_info_serial_number() {
@@ -79,7 +97,13 @@ ubus_freecwmp_output
"InternetGatewayDevice.DeviceInfo.SerialNumber" "$val"
}
set_device_info_serial_number() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@device[0].serial_number="$1"
+local val=$1
+local parm="InternetGatewayDevice.DeviceInfo.SerialNumber"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@device[0].serial_number="$val"
+ ;;
+esac
}
get_device_info_hardware_version() {
@@ -99,7 +123,13 @@ ubus_freecwmp_output
"InternetGatewayDevice.DeviceInfo.HardwareVersion" "$val"
}
set_device_info_hardware_version() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@device[0].hardware_version="$1"
+local val=$1
+local parm="InternetGatewayDevice.DeviceInfo.HardwareVersion"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@device[0].hardware_version="$val"
+ ;;
+esac
}
get_device_info_software_version() {
@@ -119,7 +149,13 @@ ubus_freecwmp_output
"InternetGatewayDevice.DeviceInfo.SoftwareVersion" "$val"
}
set_device_info_software_version() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@device[0].software_version="$1"
+local val=$1
+local parm="InternetGatewayDevice.DeviceInfo.SoftwareVersion"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@device[0].software_version="$val"
+ ;;
+esac
}
get_device_info_uptime() {
@@ -370,24 +406,31 @@ set_device_info() {
case "$1" in
InternetGatewayDevice.DeviceInfo.Manufacturer)
set_device_info_manufacturer "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.DeviceInfo.ManufacturerOUI)
set_device_info_oui "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.DeviceInfo.ProductClass)
set_device_info_product_class "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.DeviceInfo.SerialNumber)
set_device_info_serial_number "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.DeviceInfo.HardwareVersion)
set_device_info_hardware_version "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.DeviceInfo.SoftwareVersion)
set_device_info_software_version "$2"
+ return $FAULT_CPE_NO_FAULT
;;
esac
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
+return $FAULT_CPE_INVALID_PARAMETER_NAME
+# /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
}
check_parameter_device_info_generic() {
@@ -449,8 +492,9 @@ get_device_info_generic_notification() {
}
set_device_info_generic() {
- check_parameter_device_info_generic "$1" ; _tmp=$? ; if [ "$_tmp" -eq 1
]; then return 0; fi
+ check_parameter_device_info_generic "$1" ; _tmp=$? ; if [ "$_tmp" -eq 1
]; then return $FAULT_CPE_INVALID_PARAMETER_NAME; fi
freecwmp_set_parameter_value "$1" "$2"
- /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
+ # /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
+ return $FAULT_CPE_NO_FAULT
}
diff --git a/ext/openwrt/scripts/functions/lan_device
b/ext/openwrt/scripts/functions/lan_device
index 949f11c..db90021 100644
--- a/ext/openwrt/scripts/functions/lan_device
+++ b/ext/openwrt/scripts/functions/lan_device
@@ -33,13 +33,18 @@ esac
set_wlan_enable() {
local num="$1"
local val="$2"
-if [ "$val" = "1" ]; then
- val="0"
-else
- val="1"
-fi
-delay_command "wifi" "wifi" "45"
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
wireless.@wifi-device[$num].disabled="$val"
+local parm="InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Enable"
+case $action in
+ set_value)
+ if [ "$val" = "1" ]; then
+ val="0"
+ else
+ val="1"
+ fi
+ delay_command "wifi" "wifi" "45"
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
wireless.@wifi-device[$num].disabled="$val"
+ ;;
+esac
}
get_wlan_ssid() {
@@ -68,8 +73,13 @@ esac
set_wlan_ssid() {
local num="$1"
local val="$2"
-delay_command "wifi" "wifi" "45"
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
wireless.@wifi-iface[$num].ssid="$val"
+local parm="InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.SSID"
+case $action in
+ set_value)
+ delay_command "wifi" "wifi" "45"
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
wireless.@wifi-iface[$num].ssid="$val"
+ ;;
+esac
}
get_lan_device() {
@@ -223,10 +233,13 @@ set_lan_device() {
case "$1" in
InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Enable)
set_wlan_enable 0 "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID)
set_wlan_ssid 0 "$2"
+ return $FAULT_CPE_NO_FAULT
;;
esac
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
+return $FAULT_CPE_INVALID_PARAMETER_NAME
+# /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
}
diff --git a/ext/openwrt/scripts/functions/management_server
b/ext/openwrt/scripts/functions/management_server
index b1e759d..37b1cb0 100644
--- a/ext/openwrt/scripts/functions/management_server
+++ b/ext/openwrt/scripts/functions/management_server
@@ -26,34 +26,39 @@ ubus_freecwmp_output "$parm" "$val"
}
set_management_server_url() {
-local url=$1
-local scheme
-local hostname
-local path
-local port
-
-scheme=`echo $url | awk -F "://" '{ print $1 }'`
-hostname=`echo $url | awk -F "$scheme://" '{ print $2 }' | awk -F ":" '{ print
$1 }' | awk -F "/" '{ print $1 }'`
-port=`echo $url | awk -F "$scheme://$hostname:" '{ print $2 }' | awk -F '/' '{
print $1 }'`
-
-if [ -z "$port" ]; then
- port=80
- path=`echo $url | awk -F "$scheme://$hostname" '{ print $2 }'`
- echo 123 $path
-else
- path=`echo $url | awk -F "$scheme://$hostname:$port" '{ print $2 }'`
-fi
-
-if [ -z "$path" ]; then
- path="/"
-fi
-
-set_management_server_x_freecwmp_org__acs_scheme $scheme
-set_management_server_x_freecwmp_org__acs_hostname $hostname
-set_management_server_x_freecwmp_org__acs_port $port
-set_management_server_x_freecwmp_org__acs_path $path
-
-ubus ${UBUS_SOCKET:+-s $UBUS_SOCKET} call tr069 inform '{ "event":
"value_change" }' &
+local parm="InternetGatewayDevice.ManagementServer.URL"
+case "$action" in
+ set_value)
+ local url=$1
+ local scheme
+ local hostname
+ local path
+ local port
+
+ scheme=`echo $url | awk -F "://" '{ print $1 }'`
+ hostname=`echo $url | awk -F "$scheme://" '{ print $2 }' | awk -F ":"
'{ print $1 }' | awk -F "/" '{ print $1 }'`
+ port=`echo $url | awk -F "$scheme://$hostname:" '{ print $2 }' | awk -F
'/' '{ print $1 }'`
+
+ if [ -z "$port" ]; then
+ port=80
+ path=`echo $url | awk -F "$scheme://$hostname" '{ print $2 }'`
+ echo 123 $path
+ else
+ path=`echo $url | awk -F "$scheme://$hostname:$port" '{ print
$2 }'`
+ fi
+
+ if [ -z "$path" ]; then
+ path="/"
+ fi
+
+ set_management_server_x_freecwmp_org__acs_scheme $scheme
+ set_management_server_x_freecwmp_org__acs_hostname $hostname
+ set_management_server_x_freecwmp_org__acs_port $port
+ set_management_server_x_freecwmp_org__acs_path $path
+
+ ubus ${UBUS_SOCKET:+-s $UBUS_SOCKET} call tr069 inform '{ "event":
"value_change" }' &
+ ;;
+esac
}
get_management_server_username() {
@@ -74,7 +79,13 @@ ubus_freecwmp_output "$parm" "$val"
}
set_management_server_username() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@acs[0].username="$1"
+local val=$1
+local parm="InternetGatewayDevice.ManagementServer.Username"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@acs[0].username="$val"
+ ;;
+esac
}
get_management_server_password() {
@@ -95,7 +106,13 @@ ubus_freecwmp_output "$parm" "$val"
}
set_management_server_password() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@acs[0].password="$1"
+local val=$1
+local parm="InternetGatewayDevice.ManagementServer.Password"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@acs[0].password="$val"
+ ;;
+esac
}
get_management_server_periodic_inform_enable() {
@@ -117,8 +134,13 @@ ubus_freecwmp_output "$parm" "$val" "$type"
}
set_management_server_periodic_inform_enable() {
+local val=$1
local parm="InternetGatewayDevice.ManagementServer.PeriodicInformEnable"
-freecwmp_set_parameter_value "$parm" "$1"
+case "$action" in
+ set_value)
+ freecwmp_set_parameter_value "$parm" "$val"
+ ;;
+esac
}
get_management_server_periodic_inform_interval() {
@@ -140,8 +162,13 @@ ubus_freecwmp_output "$parm" "$val" "$type"
}
set_management_server_periodic_inform_interval() {
+local val=$1
local parm="InternetGatewayDevice.ManagementServer.PeriodicInformInterval"
-freecwmp_set_parameter_value "$parm" "$1"
+case "$action" in
+ set_value)
+ freecwmp_set_parameter_value "$parm" "$val"
+ ;;
+esac
}
get_management_server_connection_request_url() {
@@ -191,7 +218,13 @@ ubus_freecwmp_output "$parm" "$val"
}
set_management_server_connection_request_username() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@local[0].username="$1"
+local val=$1
+local parm="InternetGatewayDevice.ManagementServer.ConnectionRequestUsername"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@local[0].username="$val"
+ ;;
+esac
}
get_management_server_connection_request_password() {
@@ -212,7 +245,13 @@ ubus_freecwmp_output "$parm" "$val"
}
set_management_server_connection_request_password() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@local[0].password="$1"
+local val=$1
+local parm="InternetGatewayDevice.ManagementServer.ConnectionRequestPassword"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@local[0].password="$val"
+ ;;
+esac
}
# TODO: InternetGatewayDevice.ManagementServer.PeriodicInformTime
@@ -239,7 +278,13 @@ fi
}
set_management_server_x_freecwmp_org__acs_scheme() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@acs[0].scheme="$1"
+local val=$1
+local parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Scheme"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@acs[0].scheme="$val"
+ ;;
+esac
}
get_management_server_x_freecwmp_org__acs_hostname() {
@@ -264,11 +309,17 @@ fi
}
set_management_server_x_freecwmp_org__acs_hostname() {
-if [ -z "$default_management_server_acs_hostname" ]; then
- /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@acs[0].hostname="$1"
-else
- /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@acs[0].hostname="$default_management_server_acs_hostname"
-fi
+local val=$1
+local
parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Hostname"
+case "$action" in
+ set_value)
+ if [ -z "$default_management_server_acs_hostname" ]; then
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@acs[0].hostname="$val"
+ else
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@acs[0].hostname="$default_management_server_acs_hostname"
+ fi
+ ;;
+esac
}
get_management_server_x_freecwmp_org__acs_port() {
@@ -293,7 +344,13 @@ fi
}
set_management_server_x_freecwmp_org__acs_port() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set freecwmp.@acs[0].port="$1"
+local val=$1
+local parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Port"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@acs[0].port="$val"
+ ;;
+esac
}
get_management_server_x_freecwmp_org__acs_path() {
@@ -318,7 +375,13 @@ fi
}
set_management_server_x_freecwmp_org__acs_path() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set freecwmp.@acs[0].path="$1"
+local val=$1
+local parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Path"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@acs[0].path="$val"
+ ;;
+esac
}
get_management_server_x_freecwmp_org__connection_request_port() {
@@ -343,7 +406,13 @@ fi
}
set_management_server_x_freecwmp_org__connection_request_port() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@local[0].port="$1"
+local val=$1
+local
parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__Connection_Request_Port"
+case "$action" in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
freecwmp.@local[0].port="$val"
+ ;;
+esac
}
get_management_server() {
@@ -674,45 +743,59 @@ set_management_server() {
case "$1" in
InternetGatewayDevice.ManagementServer.URL)
set_management_server_url "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.ManagementServer.Username)
set_management_server_username "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.ManagementServer.Password)
set_management_server_password "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.ManagementServer.PeriodicInformEnable)
set_management_server_periodic_inform_enable "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.ManagementServer.PeriodicInformInterval)
set_management_server_periodic_inform_interval "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.ManagementServer.ConnectionRequestURL)
set_management_server_connection_request_url "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.ManagementServer.ConnectionRequestUsername)
set_management_server_connection_request_username "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.ManagementServer.ConnectionRequestPassword)
set_management_server_connection_request_password "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Scheme)
set_management_server_x_freecwmp_org__acs_scheme "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Hostname)
- get_management_server_x_freecwmp_org__acs_hostname "$2"
+ set_management_server_x_freecwmp_org__acs_hostname "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Port)
set_management_server_x_freecwmp_org__acs_port "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Path)
set_management_server_x_freecwmp_org__acs_path "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.ManagementServer.X_freecwmp_org__Connection_Request_Port)
set_management_server_x_freecwmp_org__connection_request_port "$2"
+ return $FAULT_CPE_NO_FAULT
;;
esac
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
+# /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
+return $FAULT_CPE_INVALID_PARAMETER_NAME
}
check_parameter_management_server_generic() {
@@ -750,8 +833,9 @@ get_management_server_generic_notification() {
}
set_management_server_generic() {
- check_parameter_management_server_generic "$1" ; _tmp=$? ; if [ "$_tmp"
-eq 1 ]; then return 0; fi
+ check_parameter_management_server_generic "$1" ; _tmp=$? ; if [ "$_tmp"
-eq 1 ]; then return $FAULT_CPE_INVALID_PARAMETER_NAME; fi
freecwmp_set_parameter_value "$1" "$2"
- /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
+ # /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
+ return $FAULT_CPE_NO_FAULT
}
diff --git a/ext/openwrt/scripts/functions/wan_device
b/ext/openwrt/scripts/functions/wan_device
index 02ba365..c8f1887 100644
--- a/ext/openwrt/scripts/functions/wan_device
+++ b/ext/openwrt/scripts/functions/wan_device
@@ -94,13 +94,18 @@ ubus_freecwmp_output "$parm" "$val" "$type"
set_wan_device_wan_ppp_enable() {
local val=$1
-if [ "$val" -eq 0 ]; then
- /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set network.wan.auto=0
- ifdown wan &
-elif [ "$val" -eq 1 ]; then
- /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set network.wan.auto=1
- ifup wan &
-fi
+local
parm="InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Enable"
+case $action in
+ set_value)
+ if [ "$val" -eq 0 ]; then
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
network.wan.auto=0
+ ifdown wan &
+ elif [ "$val" -eq 1 ]; then
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
network.wan.auto=1
+ ifup wan &
+ fi
+ ;;
+esac
}
get_wan_device_wan_ppp_username() {
@@ -121,7 +126,13 @@ ubus_freecwmp_output "$parm" "$val"
}
set_wan_device_wan_ppp_username() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set network.wan.username="$1"
+local val=$1
+local
parm="InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Username"
+case $action in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
network.wan.username="$val"
+ ;;
+esac
}
get_wan_device_wan_ppp_password() {
@@ -142,7 +153,13 @@ ubus_freecwmp_output "$parm" "$val"
}
set_wan_device_wan_ppp_password() {
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set network.wan.password="$1"
+local val=$1
+local
parm="InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Password"
+case $action in
+ set_value)
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set
network.wan.password="$1"
+ ;;
+esac
}
get_wan_device() {
@@ -452,13 +469,17 @@ set_wan_device() {
case "$1" in
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Enable)
set_wan_device_wan_ppp_enable "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Username)
set_wan_device_wan_ppp_username "$2"
+ return $FAULT_CPE_NO_FAULT
;;
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Password)
set_wan_device_wan_ppp_password "$2"
+ return $FAULT_CPE_NO_FAULT
;;
esac
-/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
+# /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit
+return $FAULT_CPE_INVALID_PARAMETER_NAME
}
--
1.7.4.1
|