mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
easy_qos: rename parameters as per openwrt
This commit is contained in:
parent
7e2cc957b9
commit
772c9641e1
3 changed files with 28 additions and 11 deletions
|
|
@ -4,7 +4,7 @@ START=99
|
||||||
USE_PROCD=1
|
USE_PROCD=1
|
||||||
|
|
||||||
RULE_LIST="/tmp/easy_qos_rule.list"
|
RULE_LIST="/tmp/easy_qos_rule.list"
|
||||||
BRIDGE_INTF="br-lan"
|
BRIDGE_INTF=""
|
||||||
|
|
||||||
[ -f /etc/profile.d/intel.sh ] && {
|
[ -f /etc/profile.d/intel.sh ] && {
|
||||||
. /etc/profile.d/intel.sh
|
. /etc/profile.d/intel.sh
|
||||||
|
|
@ -12,7 +12,7 @@ BRIDGE_INTF="br-lan"
|
||||||
}
|
}
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
echo "${@}"|logger -t easy_q_clas -p debug
|
echo "${@}"|logger -t easy_qos_class -p debug
|
||||||
}
|
}
|
||||||
|
|
||||||
exec_log() {
|
exec_log() {
|
||||||
|
|
@ -46,6 +46,24 @@ get_priority() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_lan_bridge() {
|
||||||
|
local _section=$1
|
||||||
|
local _type
|
||||||
|
local _is_lan
|
||||||
|
|
||||||
|
config_get _type "$section" "type"
|
||||||
|
config_get _is_lan "$section" "is_lan"
|
||||||
|
|
||||||
|
if [ "${_type}" == "bridge" -a "${_is_lan}" == "1" ]; then
|
||||||
|
BRIDGE_INTF="br-${_section}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_bridge_interface() {
|
||||||
|
config_load network
|
||||||
|
config_foreach is_lan_bridge interface
|
||||||
|
}
|
||||||
|
|
||||||
validate_rule_section()
|
validate_rule_section()
|
||||||
{
|
{
|
||||||
uci_validate_section easy_qos rule "${1}" \
|
uci_validate_section easy_qos rule "${1}" \
|
||||||
|
|
@ -61,9 +79,9 @@ clear_existing_rules() {
|
||||||
# execute the delete rules written onto a file then delete the file
|
# execute the delete rules written onto a file then delete the file
|
||||||
[ -f ${RULE_LIST} ] || return 0
|
[ -f ${RULE_LIST} ] || return 0
|
||||||
|
|
||||||
log "Deleting old classification rules"
|
|
||||||
while read line
|
while read line
|
||||||
do
|
do
|
||||||
|
log "Deleting old classification rules"
|
||||||
exec_log classcfg -D ${line} -i ${BRIDGE_INTF}
|
exec_log classcfg -D ${line} -i ${BRIDGE_INTF}
|
||||||
done <${RULE_LIST}
|
done <${RULE_LIST}
|
||||||
sync
|
sync
|
||||||
|
|
@ -84,7 +102,7 @@ create_rule() {
|
||||||
cmd="-j mark --mark ${mark}";
|
cmd="-j mark --mark ${mark}";
|
||||||
|
|
||||||
if [ "${mac_addr}" != "none" ]; then
|
if [ "${mac_addr}" != "none" ]; then
|
||||||
cmd="--smac ${mac_addr}";
|
cmd="--smac ${mac_addr} ${cmd}";
|
||||||
fi
|
fi
|
||||||
if [ "${ports}" != "none" ]; then
|
if [ "${ports}" != "none" ]; then
|
||||||
IFS=","
|
IFS=","
|
||||||
|
|
@ -101,8 +119,6 @@ create_rule() {
|
||||||
cmd="-A ${rule_name} $cmd"
|
cmd="-A ${rule_name} $cmd"
|
||||||
|
|
||||||
# Store the rule_names for cleanup on reload
|
# Store the rule_names for cleanup on reload
|
||||||
log "command to execute $cmd"
|
|
||||||
|
|
||||||
exec_log classcfg ${cmd}
|
exec_log classcfg ${cmd}
|
||||||
[ $? -eq 0 ] && \
|
[ $? -eq 0 ] && \
|
||||||
echo ${rule_name} >> ${RULE_LIST}
|
echo ${rule_name} >> ${RULE_LIST}
|
||||||
|
|
@ -121,7 +137,7 @@ manage_rule() {
|
||||||
port_list=$(echo ${port}|sed 's/ /,/g')
|
port_list=$(echo ${port}|sed 's/ /,/g')
|
||||||
|
|
||||||
if [ -n "${prio_num}" ]; then
|
if [ -n "${prio_num}" ]; then
|
||||||
if [ "${proto}" == "none" -o "${proto}" == "tcp/udp" ]; then
|
if [ "${proto}" == "none" -o "${proto}" == "tcpudp" ]; then
|
||||||
create_rule tcp ${macaddr} ${prio_num} ${port_list}
|
create_rule tcp ${macaddr} ${prio_num} ${port_list}
|
||||||
create_rule udp ${macaddr} ${prio_num} ${port_list}
|
create_rule udp ${macaddr} ${prio_num} ${port_list}
|
||||||
else
|
else
|
||||||
|
|
@ -131,6 +147,7 @@ manage_rule() {
|
||||||
}
|
}
|
||||||
|
|
||||||
reload_service() {
|
reload_service() {
|
||||||
|
get_bridge_interface
|
||||||
clear_existing_rules
|
clear_existing_rules
|
||||||
config_load easy_qos
|
config_load easy_qos
|
||||||
config_foreach manage_rule rule
|
config_foreach manage_rule rule
|
||||||
|
|
@ -143,6 +160,6 @@ start_service() {
|
||||||
}
|
}
|
||||||
|
|
||||||
service_triggers() {
|
service_triggers() {
|
||||||
procd_add_reload_trigger "easy_qos"
|
procd_add_reload_trigger "easy_qos" "network"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ manage_rule() {
|
||||||
prio_num=$(get_priority ${priority})
|
prio_num=$(get_priority ${priority})
|
||||||
if [ -n "${macaddr}" -a -n "${prio_num}" ]; then
|
if [ -n "${macaddr}" -a -n "${prio_num}" ]; then
|
||||||
for p in ${port}; do
|
for p in ${port}; do
|
||||||
if [ "${protocol}" == "none" -o "${protocol}" == "tcp/udp" ]; then
|
if [ "${protocol}" == "none" -o "${protocol}" == "tcpudp" ]; then
|
||||||
create_rule tcp ${macaddr} ${prio_num} ${p}
|
create_rule tcp ${macaddr} ${prio_num} ${p}
|
||||||
create_rule udp ${macaddr} ${prio_num} ${p}
|
create_rule udp ${macaddr} ${prio_num} ${p}
|
||||||
else
|
else
|
||||||
|
|
@ -111,7 +111,7 @@ manage_rule() {
|
||||||
done
|
done
|
||||||
# Create rule for all ports if port is not mentioned in uci
|
# Create rule for all ports if port is not mentioned in uci
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${port}" ]; then
|
||||||
if [ "${protocol}" == "none" -o "${protocol}" == "tcp/udp" ]; then
|
if [ "${protocol}" == "none" -o "${protocol}" == "tcpudp" ]; then
|
||||||
create_rule tcp ${macaddr} ${prio_num}
|
create_rule tcp ${macaddr} ${prio_num}
|
||||||
create_rule udp ${macaddr} ${prio_num}
|
create_rule udp ${macaddr} ${prio_num}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ manage_rule() {
|
||||||
port_list=$(echo ${port}|sed 's/ /,/g')
|
port_list=$(echo ${port}|sed 's/ /,/g')
|
||||||
|
|
||||||
if [ -n "${ip}" -a -n "${prio_num}" ]; then
|
if [ -n "${ip}" -a -n "${prio_num}" ]; then
|
||||||
if [ "${proto}" == "none" -o "${proto}" == "tcp/udp" ]; then
|
if [ "${proto}" == "none" -o "${proto}" == "tcpudp" ]; then
|
||||||
create_rule tcp ${ip} ${prio_num} ${port_list}
|
create_rule tcp ${ip} ${prio_num} ${port_list}
|
||||||
create_rule udp ${ip} ${prio_num} ${port_list}
|
create_rule udp ${ip} ${prio_num} ${port_list}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue