<empty commit message>

This commit is contained in:
zribiahmed 2013-05-17 18:08:26 +00:00
parent a62dc31085
commit 4e093453e0
4 changed files with 1216 additions and 135 deletions

View file

@ -547,6 +547,7 @@ fi
if [ "$action" = "inform" ]; then
action="get_value"
extern_intf=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get cwmp.cpe.default_wan_interface`
get_device_info_manufacturer
get_device_info_oui

View file

@ -3,12 +3,18 @@
# Copyright (C) 2012 Ahmed Zribi <ahmed.zribi@pivasoftware.com>
get_wlan_number_of_entries() {
local val=`/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} show wireless | fgrep '=wifi-iface' | wc -l`
local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless | fgrep '=wifi-iface' | wc -l`
eval "export -- \"$1=$val\""
}
get_lan_number_of_entries() {
local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show network | fgrep 'is_lan=1' | wc -l`
eval "export -- \"$1=$val\""
}
get_wlan_enable() {
local num="$1"
local num_lan="$2"
local type="xsd:boolean"
local val=""
local permissions=""
@ -21,17 +27,17 @@ case "$action" in
else
val="1"
fi
freecwmp_output "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Enable" "$val" "$permissions" "$type"
freecwmp_output "InternetGatewayDevice.LANDevice.$num_lan.WLANConfiguration.$num.Enable" "$val" "$permissions" "$type"
;;
get_name)
permissions="1"
let num=$num+1
freecwmp_output "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Enable" "$val" "$permissions"
freecwmp_output "InternetGatewayDevice.LANDevice.$num_lan.WLANConfiguration.$num.Enable" "$val" "$permissions"
;;
get_notification)
let num=$num+1
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Enable"
freecwmp_output "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Enable" "$val"
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$num_lan.WLANConfiguration.$num.Enable"
freecwmp_output "InternetGatewayDevice.LANDevice.$num_lan.WLANConfiguration.$num.Enable" "$val"
;;
esac
}
@ -59,6 +65,7 @@ esac
get_wlan_status() {
local num="$1"
local num_lan="$2"
local type="xsd:string"
local val=""
local permissions=""
@ -71,17 +78,17 @@ case "$action" in
else
val="Up"
fi
freecwmp_output "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Status" "$val" "$permissions" "$type"
freecwmp_output "InternetGatewayDevice.LANDevice.$num_lan.WLANConfiguration.$num.Status" "$val" "$permissions" "$type"
;;
get_name)
permissions="0"
let num=$num+1
freecwmp_output "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Status" "$val" "$permissions"
freecwmp_output "InternetGatewayDevice.LANDevice.$num_lan.WLANConfiguration.$num.Status" "$val" "$permissions"
;;
get_notification)
let num=$num+1
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Status"
freecwmp_output "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Status" "$val"
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$num_lan.WLANConfiguration.$num.Status"
freecwmp_output "InternetGatewayDevice.LANDevice.$num_lan.WLANConfiguration.$num.Status" "$val"
;;
esac
}
@ -1463,45 +1470,51 @@ local max_num
get_wlan_number_of_entries "max_num"
local max_lan_device
get_lan_number_of_entries "max_lan_device"
case "$1" in
InternetGatewayDevice.)
get_ip_interface_ip_address
get_ip_interface_netmask
for i in `seq 1 $max_num`;do
freecwmp_parse_formated_parameter $1"LANDevice.1.WLANConfiguration.$i." "InternetGatewayDevice.LANDevice.1.WLANConfiguration.{i}." "rc" "num"
if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then
let uci_num=$num-1
get_wlan_enable $uci_num
get_wlan_status $uci_num
get_wlan_bssid $uci_num
get_wlan_max_bit_rate $uci_num
get_wlan_channel $uci_num
get_wlan_ssid $uci_num
get_wlan_beacon_type $uci_num
get_wlan_mac_control_enable $uci_num
get_wlan_standard $uci_num
get_wlan_wep_key_index $uci_num
get_wlan_key_passphrase $uci_num
get_wlan_wep_encryption_level $uci_num
get_wlan_basic_encryption_modes $uci_num
get_wlan_basic_authentication_mode $uci_num
get_wlan_wpa_encryption_modes $uci_num
get_wlan_wpa_authentication_mode $uci_num
get_wlan_ieee_11i_encryption_modes $uci_num
get_wlan_ieee_11i_authentication_mode $uci_num
get_wlan_radio_enabled $uci_num
get_wlan_device_operation_mode $uci_num
get_wlan_authentication_service_mode $uci_num
get_wlan_total_associations $uci_num
get_wlan_associated_device $uci_num
get_wlan_wep_key $uci_num "1"
get_wlan_wep_key $uci_num "2"
get_wlan_wep_key $uci_num "3"
get_wlan_wep_key $uci_num "4"
get_wlan_pre_shared_key $uci_num "1"
get_wlan_pre_shared_key_key_passphrase $uci_num "1"
get_wlan_pre_shared_key_associated_device_MACAddress $uci_num "1"
fi
for k in `seq 1 $max_lan_device`;do
for i in `seq 1 $max_num`;do
freecwmp_parse_formated_parameter $1"LANDevice.$k.WLANConfiguration.$i." "InternetGatewayDevice.LANDevice.$k.WLANConfiguration.{i}." "rc" "num"
if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then
let uci_num=$num-1
get_wlan_enable $uci_num $k
get_wlan_status $uci_num $k
get_wlan_bssid $uci_num
get_wlan_max_bit_rate $uci_num
get_wlan_channel $uci_num
get_wlan_ssid $uci_num
get_wlan_beacon_type $uci_num
get_wlan_mac_control_enable $uci_num
get_wlan_standard $uci_num
get_wlan_wep_key_index $uci_num
get_wlan_key_passphrase $uci_num
get_wlan_wep_encryption_level $uci_num
get_wlan_basic_encryption_modes $uci_num
get_wlan_basic_authentication_mode $uci_num
get_wlan_wpa_encryption_modes $uci_num
get_wlan_wpa_authentication_mode $uci_num
get_wlan_ieee_11i_encryption_modes $uci_num
get_wlan_ieee_11i_authentication_mode $uci_num
get_wlan_radio_enabled $uci_num
get_wlan_device_operation_mode $uci_num
get_wlan_authentication_service_mode $uci_num
get_wlan_total_associations $uci_num
get_wlan_associated_device $uci_num
get_wlan_wep_key $uci_num "1"
get_wlan_wep_key $uci_num "2"
get_wlan_wep_key $uci_num "3"
get_wlan_wep_key $uci_num "4"
get_wlan_pre_shared_key $uci_num "1"
get_wlan_pre_shared_key_key_passphrase $uci_num "1"
get_wlan_pre_shared_key_associated_device_MACAddress $uci_num "1"
fi
done
done
return $FAULT_CPE_NO_FAULT
;;

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@
# Copyright (C) 2012 Ahmed Zribi <ahmed.zribi@pivasoftware.com>
handle_wan_logical_intf() {
for config in `ubus list|grep network.interface.|sed 's/network.interface.//g'`;do
for config in `ubus list|sed -n 's/network\.interface\.//p'`;do
local ifname="`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get network.$config.ifname|cut -f1 -d ' '`"
local _orig_ifname="`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get network.$config._orig_ifname|cut -f1 -d ' '`"
local logical_intf
@ -37,7 +37,7 @@ done
}
handle_wan_interface() {
for config in `ubus list|grep network.interface.|sed 's/network.interface.//g'`;do
for config in `ubus list|sed -n 's/network\.interface\.//p'`;do
local ifname="`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get network.$config.ifname|cut -f1 -d ' '`"
local _orig_ifname="`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get network.$config._orig_ifname|cut -f1 -d ' '`"
local logical_intf
@ -55,7 +55,7 @@ for config in `ubus list|grep network.interface.|sed 's/network.interface.//g'`;
instance=3
fi
if [ "`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get network.$config.is_lan`" != "1" ];then
echo $config:$instance:$logical_intf
echo $logical_intf:$instance:$config
fi
done
}
@ -81,9 +81,9 @@ if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
fi
for intf in $list_interface;do
iface=`echo $intf|cut -f1 -d:`
iface=`echo $intf|cut -f3 -d:`
dev=`echo $intf|cut -f2 -d:`
logical_intf=`echo $intf|cut -f3 -d:`
logical_intf=`echo $intf|cut -f1 -d:`
wan=`get_wan_logical_intf $logical_intf`
if [ "$prev_wan" != "$wan" -a "$prev_wan" != "" ];then
wan_ip=1
@ -103,7 +103,8 @@ for intf in $list_interface;do
fault_code="$?"
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
elif [ "`echo $parameter|grep '\.$'`" = "" -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fi
if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
@ -112,7 +113,8 @@ for intf in $list_interface;do
fault_code="$?"
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
elif [ "`echo $parameter|grep '\.$'`" = "" -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fi
if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
@ -121,7 +123,8 @@ for intf in $list_interface;do
fault_code="$?"
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
elif [ "`echo $parameter|grep '\.$'`" = "" -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fi
if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
@ -130,7 +133,8 @@ for intf in $list_interface;do
fault_code="$?"
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
elif [ "`echo $parameter|grep '\.$'`" = "" -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fi
if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
@ -139,7 +143,8 @@ for intf in $list_interface;do
fault_code="$?"
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
elif [ "`echo $parameter|grep '\.$'`" = "" -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fi
if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
@ -148,7 +153,8 @@ for intf in $list_interface;do
fault_code="$?"
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
elif [ "`echo $parameter|grep '\.$'`" = "" -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fi
if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
@ -160,7 +166,8 @@ for intf in $list_interface;do
fault_code="$?"
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
elif [ "`echo $parameter|grep '\.$'`" = "" -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fi
if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
@ -169,7 +176,8 @@ for intf in $list_interface;do
fault_code="$?"
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
elif [ "`echo $parameter|grep '\.$'`" = "" -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fi
if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
@ -178,7 +186,8 @@ for intf in $list_interface;do
fault_code="$?"
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
elif [ "`echo $parameter|grep '\.$'`" = "" -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fi
if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
@ -187,7 +196,8 @@ for intf in $list_interface;do
fault_code="$?"
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
elif [ "`echo $parameter|grep '\.$'`" = "" -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fi
if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
@ -196,7 +206,8 @@ for intf in $list_interface;do
fault_code="$?"
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
elif [ "`echo $parameter|grep '\.$'`" = "" -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fi
if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
@ -205,7 +216,8 @@ for intf in $list_interface;do
fault_code="$?"
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
elif [ "`echo $parameter|grep '\.$'`" = "" -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fi
if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
@ -214,7 +226,8 @@ for intf in $list_interface;do
fault_code="$?"
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fault_err=$FAULT_CPE_NO_FAULT
elif [ "`echo $parameter|grep '\.$'`" = "" -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
fi
if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then
return $fault_code
@ -543,7 +556,6 @@ local parameter="$1"
local parm="$2"
local get_fn="$3"
local intf="$8"
local extern_intf=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get cwmp.cpe.default_wan_interface`
local fault_code=$FAULT_CPE_INVALID_PARAMETER_NAME
if [ "$intf" = "$extern_intf" -a "`echo $parm|grep ExternalIPAddress`" != "" ];then
eval "$get_fn $parm $intf" 2> /dev/null