From dcd252bf7522ed6e654601eec811c2f1895416d2 Mon Sep 17 00:00:00 2001 From: SJZ <18494610+Saxon-Sun@users.noreply.github.com> Date: Fri, 17 Jul 2020 10:54:46 +0800 Subject: [PATCH 1/2] Unblockmusic Cloud unlock Log output typo --- package/lean/luci-app-unblockmusic/root/etc/init.d/unblockmusic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/lean/luci-app-unblockmusic/root/etc/init.d/unblockmusic b/package/lean/luci-app-unblockmusic/root/etc/init.d/unblockmusic index b0d2fe987e..66e7d78abe 100755 --- a/package/lean/luci-app-unblockmusic/root/etc/init.d/unblockmusic +++ b/package/lean/luci-app-unblockmusic/root/etc/init.d/unblockmusic @@ -189,7 +189,7 @@ start() else kill -9 $(busybox ps -w | grep 'sleep 60m' | grep -v grep | awk '{print $1}') >/dev/null 2>&1 /usr/bin/UnblockNeteaseMusicCloud >/dev/null 2>&1 & - echo "$(date -R) # UnblockNeteaseMusic Cloud Version - Server: $cloudip (http:$cloudhttp, https:$cloudhttp)" >>/tmp/unblockmusic.log + echo "$(date -R) # UnblockNeteaseMusic Cloud Version - Server: $cloudip (http:$cloudhttp, https:$cloudhttps)" >>/tmp/unblockmusic.log fi set_firewall From a5ac9604663dcc0e6e0f4bb5f9e51e211c834708 Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Fri, 17 Jul 2020 17:38:23 +0800 Subject: [PATCH 2/2] netifd: adjust configs --- package/network/config/gre/files/gre.sh | 21 ++++++----------- package/network/config/ipip/files/ipip.sh | 2 ++ .../{20-smp-packet-steering => 20-smp-tune} | 22 +++++++++--------- .../etc/uci-defaults/14_migrate-dhcp-release | 23 ------------------- .../netifd/files/lib/netifd/dhcp.script | 8 +------ .../netifd/files/lib/netifd/proto/dhcp.sh | 10 ++++---- .../config/netifd/files/lib/network/config.sh | 4 ++-- package/network/config/netifd/files/sbin/ifup | 2 +- package/network/config/vti/files/vti.sh | 2 ++ package/network/config/xfrm/files/xfrm.sh | 2 ++ 10 files changed, 33 insertions(+), 63 deletions(-) rename package/network/config/netifd/files/etc/hotplug.d/net/{20-smp-packet-steering => 20-smp-tune} (72%) delete mode 100644 package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release diff --git a/package/network/config/gre/files/gre.sh b/package/network/config/gre/files/gre.sh index eb3df5b48c..ca11e87cfd 100755 --- a/package/network/config/gre/files/gre.sh +++ b/package/network/config/gre/files/gre.sh @@ -13,9 +13,10 @@ gre_generic_setup() { local local="$3" local remote="$4" local link="$5" - local mtu ipv6 ttl tos zone ikey okey icsum ocsum iseqno oseqno multicast - json_get_vars mtu ipv6 ttl tos zone ikey okey icsum ocsum iseqno oseqno multicast + local mtu ttl tos zone ikey okey icsum ocsum iseqno oseqno multicast + json_get_vars mtu ttl tos zone ikey okey icsum ocsum iseqno oseqno multicast + [ -z "$zone" ] && zone="wan" [ -z "$multicast" ] && multicast=1 proto_init_update "$link" 1 @@ -23,7 +24,6 @@ gre_generic_setup() { proto_add_tunnel json_add_string mode "$mode" json_add_int mtu "${mtu:-1280}" - json_add_boolean ipv6 "${ipv6:-1}" [ -n "$df" ] && json_add_boolean df "$df" [ -n "$ttl" ] && json_add_int ttl "$ttl" [ -n "$tos" ] && json_add_string tos "$tos" @@ -57,7 +57,7 @@ gre_setup() { local remoteip local ipaddr peeraddr - json_get_vars df ipaddr peeraddr tunlink nohostroute + json_get_vars df ipaddr peeraddr tunlink [ -z "$peeraddr" ] && { proto_notify_error "$cfg" "MISSING_PEER_ADDRESS" @@ -77,9 +77,7 @@ gre_setup() { break done - if [ "${nohostroute}" != "1" ]; then - ( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" ) - fi + ( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" ) [ -z "$ipaddr" ] && { local wanif="$tunlink" @@ -136,7 +134,7 @@ grev6_setup() { local remoteip6 local ip6addr peer6addr weakif - json_get_vars ip6addr peer6addr tunlink weakif encaplimit nohostroute + json_get_vars ip6addr peer6addr tunlink weakif encaplimit [ -z "$peer6addr" ] && { proto_notify_error "$cfg" "MISSING_PEER_ADDRESS" @@ -156,9 +154,7 @@ grev6_setup() { break done - if [ "${nohostroute}" != "1" ]; then - ( proto_add_host_dependency "$cfg" "$peer6addr" "$tunlink" ) - fi + ( proto_add_host_dependency "$cfg" "$peer6addr" "$tunlink" ) [ -z "$ip6addr" ] && { local wanif="$tunlink" @@ -249,7 +245,6 @@ gre_generic_init_config() { available=1 proto_config_add_int "mtu" - proto_config_add_boolean "ipv6" proto_config_add_int "ttl" proto_config_add_string "tos" proto_config_add_string "tunlink" @@ -268,7 +263,6 @@ proto_gre_init_config() { proto_config_add_string "ipaddr" proto_config_add_string "peeraddr" proto_config_add_boolean "df" - proto_config_add_boolean "nohostroute" } proto_gretap_init_config() { @@ -282,7 +276,6 @@ proto_grev6_init_config() { proto_config_add_string "peer6addr" proto_config_add_string "weakif" proto_config_add_string "encaplimit" - proto_config_add_boolean "nohostroute" } proto_grev6tap_init_config() { diff --git a/package/network/config/ipip/files/ipip.sh b/package/network/config/ipip/files/ipip.sh index 15b1c978e3..f1c94d6eed 100755 --- a/package/network/config/ipip/files/ipip.sh +++ b/package/network/config/ipip/files/ipip.sh @@ -47,6 +47,8 @@ proto_ipip_setup() { fi } + [ -z "$zone" ] && zone="wan" + proto_init_update "ipip-$cfg" 1 proto_add_tunnel diff --git a/package/network/config/netifd/files/etc/hotplug.d/net/20-smp-packet-steering b/package/network/config/netifd/files/etc/hotplug.d/net/20-smp-tune similarity index 72% rename from package/network/config/netifd/files/etc/hotplug.d/net/20-smp-packet-steering rename to package/network/config/netifd/files/etc/hotplug.d/net/20-smp-tune index 8a86bf75f6..ab9a90418e 100644 --- a/package/network/config/netifd/files/etc/hotplug.d/net/20-smp-packet-steering +++ b/package/network/config/netifd/files/etc/hotplug.d/net/20-smp-tune @@ -14,7 +14,7 @@ find_irq_cpu() { [ -n "$match" ] && { set -- $match shift - for cur in $(seq 1 $NPROCS); do + for cur in `seq 1 $NPROCS`; do [ "$1" -gt 0 ] && { cpu=$(($cur - 1)) break @@ -34,8 +34,8 @@ set_hex_val() { echo "$val" > "$file" } -packet_steering="$(uci get "network.@globals[0].packet_steering")" -[ "$packet_steering" != 1 ] && exit 0 +default_ps="$(uci get "network.@globals[0].default_ps")" +[ -n "$default_ps" -a "$default_ps" != 1 ] && exit 0 exec 512>/var/lock/smp_tune.lock flock 512 || exit 1 @@ -52,16 +52,16 @@ for dev in /sys/class/net/*; do irq_cpu="$(find_irq_cpu "$device")" irq_cpu_mask="$((1 << $irq_cpu))" - for q in ${dev}/queues/tx-*; do - set_hex_val "$q/xps_cpus" "$PROC_MASK" + for q in ${dev}/queues/rx-*; do + set_hex_val "$q/rps_cpus" "$(($PROC_MASK & ~$irq_cpu_mask))" done - # ignore dsa slave ports for RPS - subsys="$(readlink "${dev}/device/subsystem")" - subsys="$(basename "$subsys")" - [ "$subsys" = "mdio_bus" ] && continue + ntxq="$(ls -d ${dev}/queues/tx-* | wc -l)" - for q in ${dev}/queues/rx-*; do - set_hex_val "$q/rps_cpus" "$PROC_MASK" + idx=$(($irq_cpu + 1)) + for q in ${dev}/queues/tx-*; do + set_hex_val "$q/xps_cpus" "$((1 << $idx))" + let "idx = idx + 1" + [ "$idx" -ge "$NPROCS" ] && idx=0 done done diff --git a/package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release b/package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release deleted file mode 100644 index f1b384eecc..0000000000 --- a/package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release +++ /dev/null @@ -1,23 +0,0 @@ -. /lib/functions.sh - -migrate_release() { - local config="$1" - local proto - local release - - config_get proto "$config" proto - config_get release "$config" release - - [ "$proto" = "dhcp" ] && [ -n "$release" ] && { - norelease="$((!$release))" - uci_set network "$config" norelease "$norelease" - uci_remove network "$config" release - } - -} - -config_load network -config_foreach migrate_release interface -uci commit network - -exit 0 diff --git a/package/network/config/netifd/files/lib/netifd/dhcp.script b/package/network/config/netifd/files/lib/netifd/dhcp.script index 6585b641d6..00604f40e7 100755 --- a/package/network/config/netifd/files/lib/netifd/dhcp.script +++ b/package/network/config/netifd/files/lib/netifd/dhcp.script @@ -46,16 +46,10 @@ setup_interface () { proto_add_dns_search "$i" done - # TODO: Deprecate timesvr in favor of timesrv - if [ -n "$timesvr" -a -z "$timesrv" ]; then - timesrv="$timesvr" - echo "Environment variable 'timesvr' will be deprecated; use 'timesrv' instead." - fi - proto_add_data [ -n "$ZONE" ] && json_add_string zone "$ZONE" [ -n "$ntpsrv" ] && json_add_string ntpserver "$ntpsrv" - [ -n "$timesrv" ] && json_add_string timeserver "$timesrv" + [ -n "$timesvr" ] && json_add_string timeserver "$timesvr" [ -n "$hostname" ] && json_add_string hostname "$hostname" [ -n "$message" ] && json_add_string message "$message" [ -n "$timezone" ] && json_add_int timezone "$timezone" diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh index 3034b2ba68..0d06eba06e 100755 --- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh +++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh @@ -14,7 +14,7 @@ proto_dhcp_init_config() { proto_config_add_string clientid proto_config_add_string vendorid proto_config_add_boolean 'broadcast:bool' - proto_config_add_boolean 'norelease:bool' + proto_config_add_boolean 'release:bool' proto_config_add_string 'reqopts:list(string)' proto_config_add_boolean 'defaultreqopts:bool' proto_config_add_string iface6rd @@ -35,8 +35,8 @@ proto_dhcp_setup() { local config="$1" local iface="$2" - local ipaddr hostname clientid vendorid broadcast norelease reqopts defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute - json_get_vars ipaddr hostname clientid vendorid broadcast norelease reqopts defaultreqopts iface6rd delegate zone6rd zone mtu6rd customroutes classlessroute + local ipaddr hostname clientid vendorid broadcast release reqopts defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute + json_get_vars ipaddr hostname clientid vendorid broadcast release reqopts defaultreqopts iface6rd delegate zone6rd zone mtu6rd customroutes classlessroute local opt dhcpopts for opt in $reqopts; do @@ -50,7 +50,7 @@ proto_dhcp_setup() { [ "$defaultreqopts" = 0 ] && defaultreqopts="-o" || defaultreqopts= [ "$broadcast" = 1 ] && broadcast="-B" || broadcast= - [ "$norelease" = 1 ] && norelease="" || norelease="-R" + [ "$release" = 1 ] && release="-R" || release= [ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C" [ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd" [ "$iface6rd" != 0 -a -f /lib/netifd/proto/6rd.sh ] && append dhcpopts "-O 212" @@ -70,7 +70,7 @@ proto_dhcp_setup() { ${ipaddr:+-r $ipaddr} \ ${hostname:+-x "hostname:$hostname"} \ ${vendorid:+-V "$vendorid"} \ - $clientid $defaultreqopts $broadcast $norelease $dhcpopts + $clientid $defaultreqopts $broadcast $release $dhcpopts } proto_dhcp_renew() { diff --git a/package/network/config/netifd/files/lib/network/config.sh b/package/network/config/netifd/files/lib/network/config.sh index 4cd28e4ce1..0ded45edc4 100755 --- a/package/network/config/netifd/files/lib/network/config.sh +++ b/package/network/config/netifd/files/lib/network/config.sh @@ -6,13 +6,13 @@ find_config() { local device="$1" local ifdev ifl3dev ifobj - for ifobj in $(ubus list network.interface.\*); do + for ifobj in `ubus list network.interface.\*`; do interface="${ifobj##network.interface.}" ( json_load "$(ifstatus $interface)" json_get_var ifdev device json_get_var ifl3dev l3_device - if [ "$device" = "$ifdev" ] || [ "$device" = "$ifl3dev" ]; then + if [[ "$device" = "$ifdev" ]] || [[ "$device" = "$ifl3dev" ]]; then echo "$interface" exit 0 else diff --git a/package/network/config/netifd/files/sbin/ifup b/package/network/config/netifd/files/sbin/ifup index 15be535bbf..5515b91f76 100755 --- a/package/network/config/netifd/files/sbin/ifup +++ b/package/network/config/netifd/files/sbin/ifup @@ -37,7 +37,7 @@ done [ "$modes" = "down up" ] && ubus call network reload if [ -n "$ifup_all" ]; then - for interface in $(ubus -S list 'network.interface.*'); do + for interface in `ubus -S list 'network.interface.*'`; do if_call "${interface##network.interface.}" done [ -n "$setup_wifi" ] && /sbin/wifi up diff --git a/package/network/config/vti/files/vti.sh b/package/network/config/vti/files/vti.sh index ebfd9d41e1..0443800a0c 100755 --- a/package/network/config/vti/files/vti.sh +++ b/package/network/config/vti/files/vti.sh @@ -16,6 +16,8 @@ vti_generic_setup() { local mtu zone ikey json_get_vars mtu zone ikey okey + [ -z "$zone" ] && zone="wan" + proto_init_update "$link" 1 proto_add_tunnel diff --git a/package/network/config/xfrm/files/xfrm.sh b/package/network/config/xfrm/files/xfrm.sh index 1bd1958726..edde93c35f 100755 --- a/package/network/config/xfrm/files/xfrm.sh +++ b/package/network/config/xfrm/files/xfrm.sh @@ -28,6 +28,8 @@ proto_xfrm_setup() { ( proto_add_host_dependency "$cfg" '' "$tunlink" ) + [ -z "$zone" ] && zone="wan" + proto_init_update "$cfg" 1 proto_add_tunnel