├── scripts
├── data
│ ├── PR_patches.txt
│ ├── feeds_install.txt
│ ├── feeds_update.txt
│ ├── PR_patches_packages.txt
│ └── feeds_uninstall.txt
├── lib
│ ├── String
│ │ ├── SanitizeForVariable.sh
│ │ ├── GetSpaces.sh
│ │ ├── IsNumber.sh
│ │ ├── UUID.sh
│ │ └── SlashReplacement.sh
│ ├── util
│ │ ├── bash4.sh
│ │ ├── pipe.sh
│ │ ├── exits.sh
│ │ ├── command.sh
│ │ ├── tryCatch.sh
│ │ ├── test.sh
│ │ ├── log.sh
│ │ ├── variable.sh
│ │ └── class.sh
│ ├── Array
│ │ ├── Contains.sh
│ │ ├── List.sh
│ │ ├── Intersect.sh
│ │ └── Reverse.sh
│ ├── TypePrimitives
│ │ ├── integer.sh
│ │ ├── boolean.sh
│ │ ├── map.sh
│ │ ├── array.sh
│ │ └── string.sh
│ └── UI
│ │ ├── Console.sh
│ │ ├── Cursor.sh
│ │ ├── Color.var.sh
│ │ └── Color.sh
├── before_build.sh
├── after_build.sh
├── create_kmods
├── create_acl_for_luci.sh
└── manual-generate.sh
├── configs
├── files
│ ├── etc
│ │ ├── acme
│ │ │ ├── certs
│ │ │ │ └── EMPTY
│ │ │ └── config
│ │ │ │ └── EMPTY
│ │ ├── netdata
│ │ │ ├── .opt-out-from-anonymous-statistics
│ │ │ ├── ebpf.conf
│ │ │ ├── charts.d
│ │ │ │ └── sqm.conf
│ │ │ ├── netdata.conf
│ │ │ ├── charts.d.conf
│ │ │ ├── edit-config
│ │ │ └── exporting.conf
│ │ ├── opkg
│ │ │ ├── customfeeds.conf
│ │ │ └── distfeeds.conf
│ │ ├── config
│ │ │ ├── irqbalance
│ │ │ ├── sqm
│ │ │ ├── watchcat
│ │ │ ├── argon
│ │ │ ├── luci_netports
│ │ │ └── network
│ │ └── hotplug.d
│ │ │ ├── ntp
│ │ │ └── 20-ntpd-logger
│ │ │ └── iface
│ │ │ └── 99-network
│ ├── usr
│ │ ├── lib
│ │ │ ├── OpenWrtScripts
│ │ │ │ ├── median.awk
│ │ │ │ ├── networkhammer.sh
│ │ │ │ ├── TestScripts
│ │ │ │ │ ├── sqm.sh
│ │ │ │ │ └── snmp.sh
│ │ │ │ ├── test
│ │ │ │ │ ├── test_summary.sh
│ │ │ │ │ └── pingsamples.txt
│ │ │ │ ├── autoSQM.sh
│ │ │ │ ├── lib
│ │ │ │ │ └── summarize_pings.sh
│ │ │ │ ├── getstats.sh
│ │ │ │ ├── tunnelbroker.sh
│ │ │ │ └── idlelatency.sh
│ │ │ └── lua
│ │ │ │ └── luci
│ │ │ │ └── view
│ │ │ │ └── admin_status
│ │ │ │ └── index
│ │ │ │ └── links.htm
│ │ ├── share
│ │ │ └── rpcd
│ │ │ │ └── acl.d
│ │ │ │ └── netports.json
│ │ └── local
│ │ │ └── bin
│ │ │ └── opkg_list_installed.sh
│ ├── www
│ │ └── luci-static
│ │ │ └── resources
│ │ │ ├── netports
│ │ │ ├── buttons
│ │ │ │ └── retweet.svg
│ │ │ ├── icons
│ │ │ │ ├── fixed_down.svg
│ │ │ │ ├── fixed_disabled.svg
│ │ │ │ ├── fixed_up.svg
│ │ │ │ ├── ppp_down.svg
│ │ │ │ ├── ppp_disabled.svg
│ │ │ │ ├── ppp_up.svg
│ │ │ │ ├── usb_stick_down.svg
│ │ │ │ ├── usb_stick_disabled.svg
│ │ │ │ ├── usb_stick_up.svg
│ │ │ │ ├── tunnel_down.svg
│ │ │ │ ├── tunnel_disabled.svg
│ │ │ │ ├── tunnel_up.svg
│ │ │ │ ├── usb_rndis_down.svg
│ │ │ │ ├── usb_rndis_disabled.svg
│ │ │ │ ├── usb_rndis_up.svg
│ │ │ │ ├── wifi_up.svg
│ │ │ │ ├── copper_down.svg
│ │ │ │ ├── copper_disabled.svg
│ │ │ │ ├── copper_up.svg
│ │ │ │ ├── wifi_down.svg
│ │ │ │ └── wifi_disabled.svg
│ │ │ └── netports.css
│ │ │ └── view
│ │ │ └── status
│ │ │ └── include
│ │ │ └── 25_netports.js
│ └── sbin
│ │ └── shutdown
├── patches
│ ├── TMP
│ │ ├── work
│ │ │ ├── amsdu-disable.sh
│ │ │ ├── 60-restrict.conf
│ │ │ ├── divblock.sh
│ │ │ └── defconfig_hardened
│ │ └── unused
│ │ │ ├── 0032-DNM-Thumb-2_userspace.patch
│ │ │ └── 0030-2522-80211n_256QAM-Rebased.patch
│ ├── 0009-build-hardening-misc-added-flags.patch
│ ├── OFF
│ │ ├── 0010-ethtool-fix-depends.patch
│ │ └── 0002-kernel-generic-5.4-config-hardening.patch
│ ├── 0005-dnsmasq-only-listen-on-br-lan-interface.patch
│ ├── 0001-Revert-uhttpd-don-t-redirect-to-HTTPS-by-default.patch
│ ├── 0006-mwlwifi-Disable-tx_amsdu.patch
│ ├── 0008-ARM-Cortex-A9-build-the-userspace-with-Thumb-2-instr.patch
│ ├── 0007-arm-aarch64-Set-O2-as-default-for-Cortex-A-processor.patch
│ ├── 0004-base-files-sysctl.d-basic-hardening.patch
│ ├── 0010-Add-divblock-an-extremely-simple-ad-blocker.patch
│ └── 0002-kernel-generic-5.15-config-hardening.patch
└── feeds.conf.default
├── images
├── 2021
│ ├── 06
│ │ ├── logo.png
│ │ └── linksys-wrt3200acm.jpg
│ └── openwrt_logo.png
├── wrt32x.jpg
├── e8450_side.png
├── openwrt_logo.png
└── network_port_status.png
├── .github
└── workflows
│ ├── cancel_workflows.yml
│ ├── build-wrt32x.yml
│ ├── build-e8450.yml
│ ├── QuickClean.yml
│ ├── update-checker.yml
│ └── cleanup.yml
├── LICENSE
└── doc
├── mt6000_v2
├── installed_pkg_(non_default).txt
├── mt6000
└── installed_pkg_(manual_list).txt
/scripts/data/PR_patches.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/scripts/data/feeds_install.txt:
--------------------------------------------------------------------------------
1 | -a
2 |
--------------------------------------------------------------------------------
/scripts/data/feeds_update.txt:
--------------------------------------------------------------------------------
1 | -a
2 |
--------------------------------------------------------------------------------
/configs/files/etc/acme/certs/EMPTY:
--------------------------------------------------------------------------------
1 | #
2 |
--------------------------------------------------------------------------------
/configs/files/etc/acme/config/EMPTY:
--------------------------------------------------------------------------------
1 | #
2 |
--------------------------------------------------------------------------------
/scripts/data/PR_patches_packages.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/scripts/data/feeds_uninstall.txt:
--------------------------------------------------------------------------------
1 | bluld
2 |
--------------------------------------------------------------------------------
/configs/files/etc/netdata/.opt-out-from-anonymous-statistics:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/wrt32x.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ferboiar/wrt32x/HEAD/images/wrt32x.jpg
--------------------------------------------------------------------------------
/images/e8450_side.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ferboiar/wrt32x/HEAD/images/e8450_side.png
--------------------------------------------------------------------------------
/images/2021/06/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ferboiar/wrt32x/HEAD/images/2021/06/logo.png
--------------------------------------------------------------------------------
/images/openwrt_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ferboiar/wrt32x/HEAD/images/openwrt_logo.png
--------------------------------------------------------------------------------
/images/2021/openwrt_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ferboiar/wrt32x/HEAD/images/2021/openwrt_logo.png
--------------------------------------------------------------------------------
/images/network_port_status.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ferboiar/wrt32x/HEAD/images/network_port_status.png
--------------------------------------------------------------------------------
/images/2021/06/linksys-wrt3200acm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ferboiar/wrt32x/HEAD/images/2021/06/linksys-wrt3200acm.jpg
--------------------------------------------------------------------------------
/scripts/lib/String/SanitizeForVariable.sh:
--------------------------------------------------------------------------------
1 | String::SanitizeForVariableName() {
2 | local type="$1"
3 | echo "${type//[^a-zA-Z0-9]/_}"
4 | }
5 |
--------------------------------------------------------------------------------
/scripts/lib/util/bash4.sh:
--------------------------------------------------------------------------------
1 | [[ "${BASH_VERSINFO[0]}" -lt 4 ]] && echo "The module you are trying to load requires bash >= 4" && exit 1 || true
2 |
--------------------------------------------------------------------------------
/configs/files/etc/netdata/ebpf.conf:
--------------------------------------------------------------------------------
1 | [global]
2 | ebpf load mode = entry
3 | disable apps = no
4 |
5 | [ebpf programs]
6 | process = yes
7 | network viewer = yes
8 |
--------------------------------------------------------------------------------
/scripts/lib/String/GetSpaces.sh:
--------------------------------------------------------------------------------
1 | String::GetSpaces() {
2 | local howMany="$1"
3 |
4 | if [[ "$howMany" -gt 0 ]]
5 | then
6 | ( printf "%*s" "$howMany" )
7 | fi
8 | }
9 |
--------------------------------------------------------------------------------
/scripts/lib/Array/Contains.sh:
--------------------------------------------------------------------------------
1 | Array::Contains() {
2 | local element
3 | for element in "${@:2}"
4 | do
5 | [[ "$element" = "$1" ]] && return 0
6 | done
7 | return 1
8 | }
9 |
--------------------------------------------------------------------------------
/scripts/lib/util/pipe.sh:
--------------------------------------------------------------------------------
1 | # no dependencies
2 |
3 | Pipe::Capture() {
4 | read -r -d '' $1 || true
5 | }
6 |
7 | Pipe::CaptureFaithful() {
8 | IFS= read -r -d '' $1 || true
9 | }
10 |
--------------------------------------------------------------------------------
/scripts/lib/String/IsNumber.sh:
--------------------------------------------------------------------------------
1 | String::IsNumber() {
2 | local input="$1"
3 |
4 | local regex='^-?[0-9]+([.][0-9]+)?$'
5 | if ! [[ "$input" =~ $regex ]]
6 | then
7 | return 1
8 | fi
9 | return 0
10 | }
11 |
--------------------------------------------------------------------------------
/configs/files/etc/opkg/customfeeds.conf:
--------------------------------------------------------------------------------
1 | # add your custom package feeds here
2 | #
3 | # src/gz example_feed_name http://www.example.com/path/to/files
4 | src/gz stangri_repo https://raw.githubusercontent.com/stangri/openwrt-repo/master
5 |
--------------------------------------------------------------------------------
/configs/files/etc/config/irqbalance:
--------------------------------------------------------------------------------
1 | config irqbalance 'irqbalance'
2 | option enabled '1'
3 |
4 | # The default value is 10 seconds
5 | #option interval '10'
6 |
7 | # List of IRQ's to ignore
8 | #list banirq '36'
9 | #list banirq '69'
10 |
11 |
--------------------------------------------------------------------------------
/configs/files/usr/lib/OpenWrtScripts/median.awk:
--------------------------------------------------------------------------------
1 | #/usr/bin/env awk
2 | {
3 | count[NR] = $1;
4 | }
5 | END {
6 | if (NR % 2) {
7 | print count[(NR + 1) / 2];
8 | } else {
9 | print (count[(NR / 2)] + count[(NR / 2) + 1]) / 2.0;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/configs/files/etc/hotplug.d/ntp/20-ntpd-logger:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | [ $ACTION = "step" ] && logger -t ntpd Time set, stratum=$stratum interval=$poll_interval offset=$offset
3 | [ $ACTION = "stratum" ] && logger -t ntpd Stratum change, stratum=$stratum interval=$poll_interval offset=$offset
4 |
--------------------------------------------------------------------------------
/configs/patches/TMP/work/amsdu-disable.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh /etc/rc.common
2 |
3 | USE_PROCD=0
4 |
5 | START=18
6 | STOP=30
7 |
8 | echo "0" >> /sys/kernel/debug/ieee80211/phy0/mwlwifi/tx_amsdu
9 | echo "0" >> /sys/kernel/debug/ieee80211/phy1/mwlwifi/tx_amsdu
10 | logger "AMSDU Disabled"
11 |
--------------------------------------------------------------------------------
/scripts/before_build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Enter your commands here, e.g.
4 | # echo "Start build!"
5 | cd openwrt || exit
6 |
7 | #git reset --hard 29a3967e61334d0c6a1a7d391f0e751272d77b1d
8 | #git revert --no-edit eaa9c94c75748265b9260691d5f59c9d3711f7d4
9 |
10 |
11 | exit 0
12 |
--------------------------------------------------------------------------------
/configs/files/etc/config/sqm:
--------------------------------------------------------------------------------
1 | config queue 'eth1'
2 | option enabled '1'
3 | option interface 'wan'
4 | option qdisc 'cake'
5 | option script 'piece_of_cake.qos'
6 | option linklayer 'none'
7 | option verbosity '5'
8 | option debug_logging '0'
9 |
--------------------------------------------------------------------------------
/scripts/lib/TypePrimitives/integer.sh:
--------------------------------------------------------------------------------
1 | import util/namedParameters util/type
2 |
3 | namespace oo/type
4 | ## Awaiting pull requests for this one!
5 |
6 | integer.=() {
7 | [string] value
8 |
9 | this="$value"
10 |
11 | @return
12 | }
13 |
14 | Type::InitializePrimitive integer
15 |
--------------------------------------------------------------------------------
/configs/files/etc/config/watchcat:
--------------------------------------------------------------------------------
1 | config watchcat
2 | option period '1h'
3 | option mode 'ping_reboot'
4 | option pinghosts '8.8.8.8'
5 | option forcedelay '30'
6 | option pingperiod '1m'
7 | option pingsize 'standard'
8 | option interface 'wan'
9 |
--------------------------------------------------------------------------------
/configs/files/usr/share/rpcd/acl.d/netports.json:
--------------------------------------------------------------------------------
1 | {
2 | "luci-app-tn-netports": {
3 | "description": "Grant access to network ports status information",
4 | "read": {
5 | "ubus": {
6 | "netports": [ "getPortsInfo" ]
7 | },
8 | "uci": [ "luci_netports" ]
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/scripts/lib/Array/List.sh:
--------------------------------------------------------------------------------
1 | import util/namedParameters
2 |
3 | ## generates a list separated by new lines
4 | Array::List() {
5 | @required [string] variableName
6 | [string] separator=$'\n'
7 |
8 | local indirectAccess="${variableName}[*]"
9 | (
10 | local IFS="$separator"
11 | echo "${!indirectAccess}"
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/configs/files/usr/lib/OpenWrtScripts/networkhammer.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Continuously hammer the network with continuous netperfrunner tests
3 | # Initially created to put load on Wi-Fi for CeroWrt
4 | #
5 |
6 | echo "Hammering the network to gw.home.lan. Hit Ctl-C to cancel"
7 | while true;
8 | do
9 | ./netperfrunner.sh -H gw.home.lan
10 | done
11 |
--------------------------------------------------------------------------------
/configs/files/etc/config/argon:
--------------------------------------------------------------------------------
1 | config global
2 | option primary '#5e72e4'
3 | option dark_primary '#483d8b'
4 | option blur '10'
5 | option blur_dark '10'
6 | option transparency '0.5'
7 | option transparency_dark '0.5'
8 | option save 'Save Changes'
9 | option bing_background '1'
10 | option mode 'dark'
11 |
--------------------------------------------------------------------------------
/.github/workflows/cancel_workflows.yml:
--------------------------------------------------------------------------------
1 | name: Cancel Workflows
2 |
3 | on:
4 | workflow_dispatch:
5 | # schedule:
6 | # - cron: 1 8 * * 1
7 | # watch:
8 | # types: started
9 |
10 | jobs:
11 |
12 | Cancel-All-Workflows:
13 | runs-on: ubuntu-20.04
14 | steps:
15 | - name: Cancel build runs
16 | uses: styfle/cancel-workflow-action@main
17 | with:
18 | workflow_id: ${{ github.event.workflow.id }}
19 |
--------------------------------------------------------------------------------
/configs/files/etc/hotplug.d/iface/99-network:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 |
4 | [ "$(uci -q get network.lan.ifname)" ] || (uci -q set network.lan.ifname="`uci -q get network.lan.device`";uci commit network)
5 | [ "$(uci -q get network.wan.ifname)" ] || (uci -q set network.wan.ifname="`uci -q get network.wan.device`";uci commit network)
6 | [ "$(uci -q get network.wan6.ifname)" ] || (uci -q set network.wan6.ifname="`uci -q get network.wan6.device`";uci commit network)
7 |
--------------------------------------------------------------------------------
/scripts/lib/UI/Console.sh:
--------------------------------------------------------------------------------
1 | import UI/Color
2 |
3 | Console::WriteStdErr() {
4 | # http://stackoverflow.com/questions/2990414/echo-that-outputs-to-stderr
5 | cat <<< "$*" 1>&2
6 | return
7 | }
8 |
9 | Console::WriteStdErrAnnotated() {
10 | local script="$1"
11 | local lineNo=$2
12 | local color=$3
13 | local type=$4
14 | shift; shift; shift; shift
15 |
16 | Console::WriteStdErr "$color[$type] $(UI.Color.Blue)[${script}:${lineNo}]$(UI.Color.Default) $* "
17 | }
18 |
--------------------------------------------------------------------------------
/configs/files/usr/lib/lua/luci/view/admin_status/index/links.htm:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/configs/feeds.conf.default:
--------------------------------------------------------------------------------
1 | src-git-full packages https://git.openwrt.org/feed/packages.git
2 | src-git-full luci https://git.openwrt.org/project/luci.git
3 | src-git-full routing https://git.openwrt.org/feed/routing.git
4 | src-git-full telephony https://git.openwrt.org/feed/telephony.git
5 | #src-git-full video https://github.com/openwrt/video.git
6 | #src-git-full targets https://github.com/openwrt/targets.git
7 | #src-git-full oldpackages http://git.openwrt.org/packages.git
8 | #src-link custom /usr/src/openwrt/custom-feed
9 |
--------------------------------------------------------------------------------
/scripts/lib/String/UUID.sh:
--------------------------------------------------------------------------------
1 | String::GenerateUUID() {
2 | ## https://gist.github.com/markusfisch/6110640
3 | local N B C='89ab'
4 |
5 | for (( N=0; N < 16; ++N ))
6 | do
7 | B=$(( $RANDOM%256 ))
8 |
9 | case $N in
10 | 6)
11 | printf '4%x' $(( B%16 ))
12 | ;;
13 | 8)
14 | printf '%c%x' ${C:$RANDOM%${#C}:1} $(( B%16 ))
15 | ;;
16 | 3 | 5 | 7 | 9)
17 | printf '%02x-' $B
18 | ;;
19 | *)
20 | printf '%02x' $B
21 | ;;
22 | esac
23 | done
24 | }
25 |
--------------------------------------------------------------------------------
/scripts/lib/Array/Intersect.sh:
--------------------------------------------------------------------------------
1 | import util/namedParameters util/type
2 |
3 | Array::Intersect() {
4 | @required [array] arrayA
5 | @required [array] arrayB
6 |
7 | array intersection
8 |
9 | # http://stackoverflow.com/questions/2312762/compare-difference-of-two-arrays-in-bash
10 | for i in "${arrayA[@]}"
11 | do
12 | local skip=
13 | for j in "${arrayB[@]}"
14 | do
15 | [[ "$i" == "$j" ]] && { skip=1; break; }
16 | done
17 | [[ -n $skip ]] || intersection+=("$i")
18 | done
19 |
20 | @get intersection
21 | }
22 |
--------------------------------------------------------------------------------
/configs/files/etc/netdata/charts.d/sqm.conf:
--------------------------------------------------------------------------------
1 | # Modify to match the interface(s) where your SQM configuration is applied.
2 | # Each interface names should be placed in quotes and separated by a space.
3 | # e.g. for eth0 and eth1: declare -a sqm_ifc=("eth0" "eth1") [default: "eth0"]
4 | #declare -a sqm_ifc=("eth0" "ifb4eth0")
5 | declare -a sqm_ifc=("eth0" "wan.20")
6 |
7 | # Modify to change where the SQM chart appears in Netdata's web interface. [default: 90000]
8 | # (the priority is used to sort the charts on the dashboard)
9 | # 1 = the first chart
10 | sqm_priority=90000
11 |
--------------------------------------------------------------------------------
/scripts/lib/String/SlashReplacement.sh:
--------------------------------------------------------------------------------
1 | String::ReplaceSlashes() {
2 | local stringToMark="$1"
3 |
4 | # Workaround for a Bash bug that causes string replacement to fail when a \ is in the string
5 | local slash="\\"
6 | local slashReplacement='_%SLASH%_'
7 | echo "${stringToMark/$slash$slash/$slashReplacement}"
8 | }
9 |
10 | String::RestoreSlashes() {
11 | local stringToMark="$1"
12 |
13 | # Workaround for a Bash bug that causes string replacement to fail when a \ is in the string
14 | local slash="\\"
15 | local slashReplacement='_%SLASH%_'
16 | echo "${stringToMark/$slashReplacement/$slash}"
17 | }
18 |
--------------------------------------------------------------------------------
/scripts/lib/Array/Reverse.sh:
--------------------------------------------------------------------------------
1 | import util/namedParameters
2 |
3 | ## TODO: consider making Parameters::Methods
4 | ## since this actually modifies parameters, not arrays
5 |
6 | ## static methods should be Array::Method, with capital letter
7 |
8 | # static version
9 | Array::Reverse() {
10 | [...rest] this
11 |
12 | local -i length=${#this[@]} #$(this length)
13 | local -a outArray
14 | local -i indexFromEnd
15 | local -i index
16 |
17 | for index in "${!this[@]}"
18 | do
19 | indexFromEnd=$(( $length - 1 - $index ))
20 | outArray+=( "${this[$indexFromEnd]}" )
21 | done
22 |
23 | @get outArray
24 | }
25 |
--------------------------------------------------------------------------------
/configs/files/usr/lib/OpenWrtScripts/TestScripts/sqm.sh:
--------------------------------------------------------------------------------
1 | DOWNLOADSPEED=8264
2 | UPLOADSPEED=911
3 | WANIF=eth0
4 | echo 'Setting SQM to' $DOWNLOADSPEED/$UPLOADSPEED 'kbps down/up'
5 | uci set sqm.@queue[0].interface=$WANIF
6 | uci set sqm.@queue[0].enabled=1
7 | uci set sqm.@queue[0].download=$DOWNLOADSPEED
8 | uci set sqm.@queue[0].upload=$UPLOADSPEED
9 | uci set sqm.@queue[0].script='simple.qos' # Already the default
10 | uci set sqm.@queue[0].qdisc='fq_codel'
11 | uci set sqm.@queue[0].itarget='auto'
12 | uci set sqm.@queue[0].etarget='auto'
13 | uci set sqm.@queue[0].linklayer='atm'
14 | uci set sqm.@queue[0].overhead='44'
15 | uci commit sqm
--------------------------------------------------------------------------------
/configs/files/etc/opkg/distfeeds.conf:
--------------------------------------------------------------------------------
1 | src/gz openwrt_core https://downloads.openwrt.org/snapshots/targets/mvebu/cortexa9/packages
2 | src/gz openwrt_base https://downloads.openwrt.org/snapshots/packages/arm_cortex-a9_vfpv3-d16/base
3 | src/gz openwrt_luci https://downloads.openwrt.org/snapshots/packages/arm_cortex-a9_vfpv3-d16/luci
4 | src/gz openwrt_packages https://downloads.openwrt.org/snapshots/packages/arm_cortex-a9_vfpv3-d16/packages
5 | src/gz openwrt_routing https://downloads.openwrt.org/snapshots/packages/arm_cortex-a9_vfpv3-d16/routing
6 | src/gz openwrt_telephony https://downloads.openwrt.org/snapshots/packages/arm_cortex-a9_vfpv3-d16/telephony
7 |
--------------------------------------------------------------------------------
/configs/patches/0009-build-hardening-misc-added-flags.patch:
--------------------------------------------------------------------------------
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 | From: Tad
3 | Date: Fri, 2 Jul 2021 13:03:00 -0400
4 | Subject: [PATCH] build: hardening: misc added flags
5 |
6 | Signed-off-by: Tad
7 | ---
8 | include/hardening.mk | 1 +
9 | 1 file changed, 1 insertion(+)
10 |
11 | diff --git a/include/hardening.mk b/include/hardening.mk
12 | index 6acd862f5c..83d30eaed9 100644
13 | --- a/include/hardening.mk
14 | +++ b/include/hardening.mk
15 | @@ -59,3 +59,4 @@ ifdef CONFIG_PKG_RELRO_FULL
16 | endif
17 | endif
18 |
19 | +TARGET_CFLAGS += -fstack-clash-protection -fwrapv
20 |
--------------------------------------------------------------------------------
/scripts/after_build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #cd openwrt || exit
3 | #cd openwrt
4 |
5 | #if [[ -f "usr/lib/acme/acme.sh" ]]; then
6 | # if [[ ! -f "usr/lib/acme/acme.sh.bak" ]]; then
7 | # echo "Backing up original acme.sh script..."
8 | # mv usr/lib/acme/acme.sh usr/lib/acme/acme.sh.bak
9 | # fi
10 | # echo "Downloading acme.sh script from repo..."
11 | # wget -q -O usr/lib/acme/acme.sh https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh
12 | # echo "Download complete, you may now enjoy a up to date acme.sh script"
13 | # else echo "acme.sh file not found, perhaps acme isn't installed"
14 | #fi
15 |
16 | # Enter your commands here, e.g.
17 | # echo "Success!"
18 | exit 0
19 |
--------------------------------------------------------------------------------
/scripts/lib/TypePrimitives/boolean.sh:
--------------------------------------------------------------------------------
1 | import util/namedParameters util/type
2 |
3 | namespace oo/type
4 | ### BOOLEAN
5 |
6 | boolean.__getter__() {
7 | test "$this" == "${__primitive_extension_fingerprint__boolean}:true"
8 | }
9 |
10 | boolean.toString() {
11 | if [[ "$this" == "${__primitive_extension_fingerprint__boolean}:true" ]]
12 | then
13 | @return:value true
14 | else
15 | @return:value false
16 | fi
17 | }
18 |
19 | boolean.=() {
20 | [string] value
21 |
22 | if [[ "$value" == "true" ]]
23 | then
24 | this="${__primitive_extension_fingerprint__boolean}:true"
25 | else
26 | this="${__primitive_extension_fingerprint__boolean}:false"
27 | fi
28 |
29 | @return
30 | }
31 |
32 | Type::InitializePrimitive boolean
33 | ### /BOOLEAN
34 |
--------------------------------------------------------------------------------
/scripts/lib/UI/Cursor.sh:
--------------------------------------------------------------------------------
1 | import util/class
2 |
3 | class:UI.Cursor() {
4 | # http://askubuntu.com/questions/366103/saving-more-corsor-positions-with-tput-in-bash-terminal
5 | # http://unix.stackexchange.com/questions/88296/get-vertical-cursor-position
6 |
7 | private integer x
8 | private integer y
9 |
10 | UI.Cursor.capture() {
11 | local x
12 | local y
13 | IFS=';' read -sdR -p $'\E[6n' y x
14 |
15 | this y = $(( ${y#*[} - 1 ))
16 | this x = $(( ${x} - 1 ))
17 |
18 | @return
19 | }
20 |
21 | UI.Cursor.restore() {
22 | [integer] shift=1
23 |
24 | local -i totalHeight=$(tput lines)
25 | local -i y=$(this y)
26 | local -i x=$(this x)
27 |
28 | (( $y + 1 == $totalHeight )) && y+=-$shift
29 |
30 | tput cup $y $x
31 |
32 | @return
33 | }
34 | }
35 |
36 | Type::Initialize UI.Cursor
37 |
--------------------------------------------------------------------------------
/configs/patches/OFF/0010-ethtool-fix-depends.patch:
--------------------------------------------------------------------------------
1 | From 4baf7608c95cf6f353c7c609f50f85419067fc2c Mon Sep 17 00:00:00 2001
2 | From: Chen Minqiang
3 | Date: Thu, 5 Aug 2021 09:17:15 +0800
4 | Subject: [PATCH] ethtool: fix depends
5 |
6 | Fixes: #430
7 | Signed-off-by: Eliminater74
8 | ---
9 | package/network/utils/ethtool/Makefile | 1 -
10 | 1 file changed, 1 deletion(-)
11 |
12 | diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile
13 | index a82e5c92fa..16b3c4e46f 100644
14 | --- a/package/network/utils/ethtool/Makefile
15 | +++ b/package/network/utils/ethtool/Makefile
16 | @@ -38,7 +38,6 @@ define Package/ethtool-full
17 | TITLE += (full)
18 | VARIANT:=full
19 | PROVIDES:=ethtool
20 | - CONFLICTS:=ethtool
21 | DEPENDS:=+libmnl
22 | endef
23 |
24 | --
25 | 2.32.0
26 |
--------------------------------------------------------------------------------
/configs/files/usr/lib/OpenWrtScripts/test/test_summary.sh:
--------------------------------------------------------------------------------
1 | # Test scaffolding for the summarize_pings() subroutine.
2 | # Take a known set of ping readings (in ./pingsamples.txt), strip out bogus stuff,
3 | # then pass the first N lines (passed in as an argument) to the summarize_pings() function
4 | #
5 |
6 | # include the summarize_pings() function from the library
7 | . "../lib/summarize_pings.sh"
8 |
9 | PINGFILE=$(mktemp /tmp/measurepings.XXXXXX) || exit 1
10 |
11 | # pre-format the pingsamples for ease of counting...
12 | # strip out any line that doesn't contain "time" (e.g., not time= or timeout)
13 | # Only send the specified number of lines into $PINGFILE
14 | cat < pingsamples.txt | \
15 | grep time | \
16 | head -n "$1" > "$PINGFILE"
17 | echo "=== PINGFILE ==="
18 | cat "$PINGFILE"
19 | echo "========"
20 | summarize_pings "$PINGFILE"
21 | rm "$PINGFILE"
22 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/buttons/retweet.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/configs/files/etc/config/luci_netports:
--------------------------------------------------------------------------------
1 | config global 'global'
2 | option default_additional_info 'true'
3 | option default_h_mode 'true'
4 | option hv_mode_switch_button 'true'
5 |
6 | config port
7 | option ifname 'wan'
8 | option type 'copper'
9 |
10 | config port
11 | option ifname 'lan1'
12 | option type 'copper'
13 |
14 | config port
15 | option ifname 'lan2'
16 | option type 'copper'
17 |
18 | config port
19 | option ifname 'lan3'
20 | option type 'copper'
21 |
22 | config port
23 | option ifname 'lan4'
24 | option type 'copper'
25 |
26 | config port
27 | option ifname 'wlan0'
28 | option type 'wifi'
29 |
30 | config port
31 | option ifname 'wlan1'
32 | option type 'wifi'
33 |
34 | config port
35 | option ifname 'wlan2'
36 | option type 'wifi'
37 |
38 | config port
39 | option ifname 'tun0'
40 | option name 'VPN_NAS'
41 | option type 'vpn'
42 |
43 | config port
44 | option ifname 'tap0'
45 | option type 'vpn'
46 |
--------------------------------------------------------------------------------
/configs/patches/TMP/work/60-restrict.conf:
--------------------------------------------------------------------------------
1 | dev.tty.ldisc_autoload=0
2 | fs.protected_fifos=2
3 | fs.protected_hardlinks=1
4 | fs.protected_regular=2
5 | fs.protected_symlinks=1
6 | fs.suid_dumpable=0
7 | kernel.dmesg_restrict=1
8 | kernel.kexec_load_disabled=1
9 | kernel.kptr_restrict=2
10 | kernel.perf_event_paranoid=3
11 | kernel.randomize_va_space=2
12 | kernel.yama.ptrace_scope=1
13 | net.core.bpf_jit_harden=2
14 | net.ipv4.icmp_ignore_bogus_error_responses=1
15 | net.ipv6.conf.all.addr_gen_mode=3
16 | net.ipv6.conf.all.max_addresses=128
17 | net.ipv6.conf.all.regen_max_retry=32
18 | net.ipv6.conf.all.temp_prefered_lft=21600
19 | net.ipv6.conf.all.use_tempaddr=2
20 | net.ipv6.conf.default.addr_gen_mode=3
21 | net.ipv6.conf.default.max_addresses=128
22 | net.ipv6.conf.default.regen_max_retry=32
23 | net.ipv6.conf.default.temp_prefered_lft=21600
24 | net.ipv6.conf.default.use_tempaddr=2
25 | vm.mmap_rnd_bits=32
26 | vm.mmap_rnd_compat_bits=16
27 | vm.unprivileged_userfaultfd=0
28 |
--------------------------------------------------------------------------------
/configs/patches/0005-dnsmasq-only-listen-on-br-lan-interface.patch:
--------------------------------------------------------------------------------
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 | From: Tad
3 | Date: Fri, 27 Nov 2020 13:47:56 -0500
4 | Subject: [PATCH] dnsmasq: only listen on br-lan interface
5 |
6 | dnsmasq should not listen on all interfaces, restrict it to br-lan.
7 |
8 | Note: this will break default config if your LAN isn't br-lan.
9 | Signed-off-by: Tad
10 | ---
11 | package/network/services/dnsmasq/files/dnsmasq.conf | 2 ++
12 | 1 file changed, 2 insertions(+)
13 |
14 | diff --git a/package/network/services/dnsmasq/files/dnsmasq.conf b/package/network/services/dnsmasq/files/dnsmasq.conf
15 | index bf5816be56..24440b5e1c 100644
16 | --- a/package/network/services/dnsmasq/files/dnsmasq.conf
17 | +++ b/package/network/services/dnsmasq/files/dnsmasq.conf
18 | @@ -35,3 +35,5 @@
19 | # "bert" another name, bertrand
20 | # The fields are ,
21 | #cname=bertand,bert
22 | +
23 | +interface=br-lan
24 |
--------------------------------------------------------------------------------
/scripts/lib/util/exits.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | #
3 | # exits
4 | #
5 | # Those values are come from /usr/include/sysexits.h
6 | #
7 |
8 | # successful termination
9 | Util_ExitCode_OK=0
10 | Util_ExitCode_USAGE=64 # command line usage error
11 | Util_ExitCode_DATAERR=65 # data format error
12 | Util_ExitCode_NOINPUT=66 # cannot open input
13 | Util_ExitCode_NOUSER=67 # addressee unknown
14 | Util_ExitCode_NOHOST=68 # host name unknown
15 | Util_ExitCode_UNAVAILABLE=69 # service unavailable
16 | Util_ExitCode_SOFTWARE=70 # internal software error
17 | Util_ExitCode_OSERR=71 # system error (e.g., can't fork)
18 | Util_ExitCode_OSFILE=72 # critical OS file missing
19 | Util_ExitCode_CANTCREAT=73 # can't create (user) output file
20 | Util_ExitCode_IOERR=74 # input/output error
21 | Util_ExitCode_TEMPFAIL=75 # temp failure; user is invited to retry
22 | Util_ExitCode_PROTOCOL=76 # remote error in protocol
23 | Util_ExitCode_NOPERM=77 # permission denied
24 | Util_ExitCode_CONFIG=78 # configuration error
25 |
--------------------------------------------------------------------------------
/configs/files/etc/netdata/netdata.conf:
--------------------------------------------------------------------------------
1 | # Full configuration can be retrieved from the running
2 | # server at http://localhost:19999/netdata.conf
3 | #
4 | # Example:
5 | # curl -o /etc/netdata/netdata.conf http://localhost:19999/netdata.conf
6 | #
7 |
8 | [global]
9 | update every = 2
10 | memory deduplication (ksm) = no
11 | debug log = syslog
12 | error log = syslog
13 | access log = none
14 | run as user = root
15 |
16 | [web]
17 | allow connections from = localhost 10.* 192.168.* 172.16.* 172.17.* 172.18.* 172.19.* 172.20.* 172.21.* 172.22.* 172.23.* 172.24.* 172.25.* 172.26.* 172.27.* 172.28.* 172.29.* 172.30.* 172.31.*
18 | allow dashboard from = localhost 10.* 192.168.* 172.16.* 172.17.* 172.18.* 172.19.* 172.20.* 172.21.* 172.22.* 172.23.* 172.24.* 172.25.* 172.26.* 172.27.* 172.28.* 172.29.* 172.30.* 172.31.*
19 |
20 | [plugins]
21 | cgroups = no
22 | apps = no
23 | charts.d = yes
24 | fping = no
25 | node.d = no
26 | python.d = no
27 |
28 | [health]
29 | enabled = no
30 |
31 | [plugin:proc:ipc]
32 | shared memory totals = no
33 |
--------------------------------------------------------------------------------
/scripts/create_kmods:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # SPDX-License-Identifier: GPL-3.0-only
3 | #
4 | # Copyright (C) 2021 ImmortalWrt.org
5 | #
6 | # Copyright (C) 2022 PureFusionWRT (Not Original Author)
7 |
8 | set -x
9 |
10 | export TOPDIR="$PWD"
11 |
12 | pushd "$BIN_DIR" || exit
13 | rm -rf "kmods/$KMOD_DIR"
14 | mkdir -p "kmods/$KMOD_DIR"
15 |
16 | cp -fpR "packages"/automount* "kmods/$KMOD_DIR"/
17 | for i in "packages"/kmod-*; do cp -fpR "$i" "kmods/$KMOD_DIR"/; done
18 | popd
19 |
20 | pushd "$BIN_DIR/kmods/$KMOD_DIR" || exit
21 | "$TOPDIR"/scripts/ipkg-make-index.sh . 2>&1 > "Packages.manifest"
22 | grep -vE "^(Maintainer|LicenseFiles|Source|SourceName|Require|SourceDateEpoch)" "Packages.manifest" > "Packages"
23 | case "$(((64 + "$(stat -L -c%s "Packages")") % 128))" in
24 | 110|111)
25 | echo -e "\033[33mWARNING: Applying padding in Packages to workaround usign SHA-512 bug!\033[0m"
26 | { echo ""; echo ""; } >> "Packages"
27 | ;;
28 | esac
29 | gzip -9nc "Packages" > "Packages.gz"
30 | "$STAGING_DIR_HOST"/bin/usign -S -m "Packages" -s "$KEY_BUILD"
31 | popd
32 |
--------------------------------------------------------------------------------
/configs/patches/0001-Revert-uhttpd-don-t-redirect-to-HTTPS-by-default.patch:
--------------------------------------------------------------------------------
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 | From: Tad
3 | Date: Tue, 2 Feb 2021 06:14:22 -0500
4 | Subject: [PATCH] Revert "uhttpd: don't redirect to HTTPS by default"
5 |
6 | This reverts commit 0cf3c5dd7257dff1c87b61c5e53e5b1787ab7015.
7 |
8 | Signed-off-by: Tad
9 | ---
10 | package/network/services/uhttpd/files/uhttpd.config | 2 +-
11 | 1 file changed, 1 insertion(+), 1 deletion(-)
12 |
13 | diff --git a/package/network/services/uhttpd/files/uhttpd.config b/package/network/services/uhttpd/files/uhttpd.config
14 | index a9b8ff3d15..4bb2c3463e 100644
15 | --- a/package/network/services/uhttpd/files/uhttpd.config
16 | +++ b/package/network/services/uhttpd/files/uhttpd.config
17 | @@ -10,7 +10,7 @@ config uhttpd main
18 | list listen_https [::]:443
19 |
20 | # Redirect HTTP requests to HTTPS if possible
21 | - option redirect_https 0
22 | + option redirect_https 1
23 |
24 | # Server document root
25 | option home /www
26 |
--------------------------------------------------------------------------------
/scripts/lib/util/command.sh:
--------------------------------------------------------------------------------
1 | # no dependencies
2 |
3 | Command::GetType() {
4 | local name="$1"
5 | local typeMatch=$(type -t "$name" 2> /dev/null || true)
6 | echo "$typeMatch"
7 | }
8 |
9 | Command::Exists(){
10 | local name="$1"
11 | local typeMatch=$(Command::GetType "$name")
12 | [[ "$typeMatch" == "alias" || "$typeMatch" == "function" || "$typeMatch" == "builtin" ]]
13 | }
14 |
15 | Alias::Exists(){
16 | local name="$1"
17 | local typeMatch=$(Command::GetType "$name")
18 | [[ "$typeMatch" == "alias" ]]
19 | }
20 |
21 | Function::Exists(){
22 | local name="$1"
23 | declare -f "$name" &> /dev/null
24 | }
25 |
26 | Function::GetAllStartingWith() {
27 | local startsWith="$1"
28 | compgen -A 'function' "$startsWith" || true
29 | }
30 |
31 | Function::InjectCode() {
32 | local functionName="$1"
33 | local injectBefore="$2"
34 | local injectAfter="$3"
35 | local body=$(declare -f "$functionName")
36 | body="${body#*{}" # trim start
37 | body="${body%\}}" # trim end
38 | local enter=$'\n'
39 | eval "${functionName}() { ${enter}${injectBefore}${body}${injectAfter}${enter} }"
40 | }
41 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/fixed_down.svg:
--------------------------------------------------------------------------------
1 |
2 |
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019-2020 P3TERX
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/fixed_disabled.svg:
--------------------------------------------------------------------------------
1 |
2 |
18 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/fixed_up.svg:
--------------------------------------------------------------------------------
1 |
2 |
18 |
--------------------------------------------------------------------------------
/configs/files/usr/lib/OpenWrtScripts/TestScripts/snmp.sh:
--------------------------------------------------------------------------------
1 | # Configure snmpd in OpenWrt
2 | # Edit the four variables below (COMMUNITYSTRING, LOCATION, CONTACT, SYSTEMNAME),
3 | # then run this script using:
4 | #
5 | # sh snmp.sh
6 | #
7 | COMMUNITYSTRING=public
8 | LOCATION='Under The House'
9 | CONTACT="somebody@example.com"
10 | SYSTEMNAME="One Really Sweet Router"
11 |
12 | echo 'Configuring and starting snmpd'
13 | # Listen port 161 (v4 & v6), with specified community string
14 | uci set snmpd.@agent[0].agentaddress='UDP:161,UDP6:161'
15 | uci set snmpd.@com2sec[0].community="$COMMUNITYSTRING"
16 |
17 | # set up to listen for IPv6 queries as well
18 | uci add snmpd com2sec6
19 | uci set snmpd.@com2sec6[-1].secname=ro
20 | uci set snmpd.@com2sec6[-1].source=default
21 | uci set snmpd.@com2sec6[-1].community="$COMMUNITYSTRING"
22 |
23 | # Set a few system variables
24 | uci set snmpd.@system[-1].sysLocation="$LOCATION"
25 | uci set snmpd.@system[-1].sysContact="$CONTACT"
26 | uci set snmpd.@system[-1].sysName="$SYSTEMNAME"
27 | uci commit snmpd
28 |
29 | # restart the snmpd, and enable it to restart at next boot
30 | /etc/init.d/snmpd restart
31 | /etc/init.d/snmpd enable
32 |
--------------------------------------------------------------------------------
/configs/files/usr/local/bin/opkg_list_installed.sh:
--------------------------------------------------------------------------------
1 | #!/bin/ash
2 |
3 | list_pkgs() {
4 | opkg list-installed | cut -f 1 -d " "
5 | }
6 |
7 | show_deps() {
8 | opkg depends $1 | sed -e 1d -e 's/^\s*//'
9 | }
10 |
11 | if [ $(id -u) != 0 ]; then
12 | echo 'you must be root.'
13 | exit 1
14 | fi
15 |
16 | TMPDIR=/tmp/$$
17 | if [ -d $TMPDIR ]; then
18 | rm -rf $TMPDIR
19 | fi
20 | mkdir $TMPDIR
21 |
22 | trap "rm -rf $TMPDIR; exit 1" 1 2 3 15
23 |
24 | # listup default packages
25 | echo "entware-opt" > $TMPDIR/defaults
26 | show_deps entware-opt >> $TMPDIR/defaults
27 |
28 | # listup installed, but not default
29 | touch $TMPDIR/pkgs_not_default
30 | mkdir $TMPDIR/deps
31 | for p in $(list_pkgs); do
32 | egrep "^$p\$" $TMPDIR/defaults > /dev/null
33 | if [ $? != 0 ]; then
34 | echo $p >> $TMPDIR/pkgs_not_default
35 | # listup depends
36 | show_deps $p > $TMPDIR/deps/$p.deps
37 | fi
38 | done
39 |
40 | # listup not depended by any others from not defaults
41 | for p in $(cat $TMPDIR/pkgs_not_default); do
42 | egrep "^$p\$" $TMPDIR/deps/* > /dev/null
43 | if [ $? != 0 ]; then
44 | echo $p
45 | fi
46 | done
47 |
48 | rm -rf $TMPDIR
49 |
50 | exit 0
51 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/ppp_down.svg:
--------------------------------------------------------------------------------
1 |
2 |
20 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/ppp_disabled.svg:
--------------------------------------------------------------------------------
1 |
2 |
22 |
--------------------------------------------------------------------------------
/configs/patches/TMP/unused/0032-DNM-Thumb-2_userspace.patch:
--------------------------------------------------------------------------------
1 | From rsalvaterra at gmail.com Fri Jun 19 05:45:25 2020
2 | From: Rui Salvaterra
3 | Date: Fri, 19 Jun 2020 10:45:25 +0100
4 | Subject: [OpenWrt-Devel] [RFC PATCH] ARM Cortex-A9: build the userspace with
5 | Thumb-2 instructions
6 | Message-ID: <20200619094523.3162-1-rsalvaterra@gmail.com>
7 |
8 | Thumb-2 code is denser than pure ARM, reducing RAM usage and improving
9 | performance due to better instruction cache footprint.
10 |
11 | There's no reason for not enabling this feature on other ARMv7 targets
12 | (cortex-a7 and cortex-a8), but I don't have the hardware to test it.
13 |
14 | Signed-off-by: Rui Salvaterra
15 | ---
16 | include/target.mk | 3 +++
17 | 1 file changed, 3 insertions(+)
18 |
19 | diff --git a/include/target.mk b/include/target.mk
20 | index a2ceb7f783..dfc6f4e480 100644
21 | --- a/include/target.mk
22 | +++ b/include/target.mk
23 | @@ -196,6 +196,9 @@ ifeq ($(DUMP),1)
24 | CPU_TYPE = sparc
25 | CPU_CFLAGS_ultrasparc = -mcpu=ultrasparc
26 | endif
27 | + ifeq ($(ARCH),arm)
28 | + CPU_CFLAGS_cortex-a9 = -mthumb
29 | + endif
30 | ifeq ($(ARCH),aarch64)
31 | CPU_TYPE ?= generic
32 | CPU_CFLAGS_generic = -mcpu=generic
33 | --
34 | 2.27.0
35 |
--------------------------------------------------------------------------------
/scripts/lib/TypePrimitives/map.sh:
--------------------------------------------------------------------------------
1 | import util/namedParameters util/type
2 |
3 | namespace oo/type
4 |
5 | ### MAP
6 | ## TODO: use vars, not $1-9 so $ref: references are resolved
7 |
8 | map.set() {
9 | this["$1"]="$2"
10 |
11 | @return #this
12 | }
13 |
14 | map.delete() {
15 | unset this["$1"]
16 |
17 | @return #this
18 | }
19 |
20 | map.get() {
21 | @return:value "${this[$1]}"
22 | }
23 |
24 | Type::InitializePrimitive map
25 |
26 | ### /MAP
27 |
28 |
29 | ## TODO:
30 | #Array::Assign() {
31 | # local source="$1"
32 | # local target="$2"
33 | #
34 | # eval "local -a tempMap=\"\$$__assign_paramNo\""
35 | # local index
36 | # local value
37 | #
38 | # ## copy the array / map item by item
39 | # for index in "${!tempMap[@]}"
40 | # do
41 | # eval "$__assign_varName[\$index]=\"\${tempMap[\$index]}\""
42 | # done
43 | #
44 | # unset index value tempMap
45 | #}
46 | #
47 | #Map::Assign() {
48 | # ## TODO: test this
49 | # eval "local -$(Variable::GetDeclarationFlagFromType '$__assign_varType') tempMap=\"\$$__assign_paramNo\""
50 | # local index
51 | # local value
52 | #
53 | # ## copy the array / map item by item
54 | # for index in "${!tempMap[@]}"
55 | # do
56 | # eval "$__assign_varName[\$index]=\"\${tempMap[\$index]}\""
57 | # done
58 | #
59 | # unset index value tempMap
60 | #}
61 |
--------------------------------------------------------------------------------
/configs/files/sbin/shutdown:
--------------------------------------------------------------------------------
1 | #!/bin/ash
2 |
3 | # default to use shutdown command
4 | ACTION="poweroff"
5 |
6 | # Get shutdown parameters
7 | # How Qemu-GA invokes -h -P +0 by default
8 | while [ -n "$1" ]; do
9 | case "$1" in
10 | -r)
11 | ACTION="reboot"
12 | shift
13 | ;;
14 |
15 | -k)
16 | ACTION="warning"
17 | shift
18 | ;;
19 |
20 | -h|-H)
21 | ACTION="halt"
22 | shift
23 | ;;
24 |
25 | -n)
26 | ACTION="poweroff"
27 | shift
28 | ;;
29 |
30 | -c)
31 | echo "Cancel shutdown, but not support the Openwrt!" > /dev/kmsg
32 | ACTION="stop"
33 | shift
34 | ;;
35 |
36 | -p|-P)
37 | ACTION="poweroff"
38 | shift
39 | ;;
40 |
41 | -*)
42 | shift
43 | ;;
44 |
45 | *)
46 | break
47 | ;;
48 |
49 | esac
50 | done
51 |
52 | if [ $# == 0 ]; then
53 | echo "Shutting down without any params" > /dev/kmsg
54 | /sbin/poweroff
55 |
56 | elif [ "$ACTION" = "poweroff" ]; then
57 | /sbin/poweroff;
58 |
59 | elif [ "$ACTION" = "reboot" ]; then
60 | /sbin/reboot
61 |
62 | elif [ "$ACTION" = "warning" ]; then
63 | echo "shutdown warning">/dev/kmsg
64 | /sbin/poweroff;
65 |
66 | elif [ "$ACTION" = "halt" ]; then
67 | /sbin/halt
68 | fi
69 |
--------------------------------------------------------------------------------
/configs/patches/0006-mwlwifi-Disable-tx_amsdu.patch:
--------------------------------------------------------------------------------
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 | From: Tad
3 | Date: Tue, 1 Dec 2020 03:57:45 -0500
4 | Subject: [PATCH] mwlwifi: Disable tx_amsdu
5 |
6 | This fixes the high latencies.
7 | Unsure who figured this out.
8 | https://forum.archive.openwrt.org/viewtopic.php?id=64949&p=161
9 | https://forum.openwrt.org/t/linksys-wrt1200ac-wireless-performance-on-latest-stable/39392/4
10 | https://github.com/kaloz/mwlwifi/commit/574e24e7dd661676e585dacd54e4f93b24e78ba0
11 |
12 | Signed-off-by: Tad
13 | ---
14 | package/base-files/files/etc/init.d/amsdu-disable | 10 ++++++++++
15 | 1 file changed, 10 insertions(+)
16 | create mode 100755 package/base-files/files/etc/init.d/amsdu-disable
17 |
18 | diff --git a/package/base-files/files/etc/init.d/amsdu-disable b/package/base-files/files/etc/init.d/amsdu-disable
19 | new file mode 100755
20 | index 0000000000..a83dc32dd6
21 | --- /dev/null
22 | +++ b/package/base-files/files/etc/init.d/amsdu-disable
23 | @@ -0,0 +1,10 @@
24 | +#!/bin/sh /etc/rc.common
25 | +
26 | +USE_PROCD=0
27 | +
28 | +START=18
29 | +STOP=30
30 | +
31 | +echo "0" >> /sys/kernel/debug/ieee80211/phy0/mwlwifi/tx_amsdu
32 | +echo "0" >> /sys/kernel/debug/ieee80211/phy1/mwlwifi/tx_amsdu
33 | +logger "AMSDU Disabled"
34 |
--------------------------------------------------------------------------------
/configs/patches/0008-ARM-Cortex-A9-build-the-userspace-with-Thumb-2-instr.patch:
--------------------------------------------------------------------------------
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 | From: Rui Salvaterra
3 | Date: Fri, 19 Jun 2020 10:45:25 +0100
4 | Subject: [PATCH] ARM Cortex-A9: build the userspace with Thumb-2 instructions
5 |
6 | Thumb-2 code is denser than pure ARM, reducing RAM usage and improving
7 | performance due to better instruction cache footprint.
8 |
9 | There's no reason for not enabling this feature on other ARMv7 targets
10 | (cortex-a7 and cortex-a8), but I don't have the hardware to test it.
11 |
12 | Signed-off-by: Rui Salvaterra
13 | Tested-by: Tad
14 | ---
15 | include/target.mk | 5 +++++
16 | 1 file changed, 5 insertions(+)
17 |
18 | diff --git a/include/target.mk b/include/target.mk
19 | index de5038c17c..6b6a5e586e 100644
20 | --- a/include/target.mk
21 | +++ b/include/target.mk
22 | @@ -252,6 +252,11 @@ ifeq ($(DUMP),1)
23 | CPU_TYPE = sparc
24 | CPU_CFLAGS_ultrasparc = -mcpu=ultrasparc
25 | endif
26 | + ifeq ($(ARCH),arm)
27 | + CPU_CFLAGS_cortex-a7 = -mthumb
28 | + CPU_CFLAGS_cortex-a8 = -mthumb
29 | + CPU_CFLAGS_cortex-a9 = -mthumb
30 | + endif
31 | ifeq ($(ARCH),aarch64)
32 | CPU_TYPE ?= generic
33 | CPU_CFLAGS_generic = -mcpu=generic
34 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/ppp_up.svg:
--------------------------------------------------------------------------------
1 |
2 |
24 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/usb_stick_down.svg:
--------------------------------------------------------------------------------
1 |
2 |
21 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/usb_stick_disabled.svg:
--------------------------------------------------------------------------------
1 |
2 |
21 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/usb_stick_up.svg:
--------------------------------------------------------------------------------
1 |
2 |
21 |
--------------------------------------------------------------------------------
/.github/workflows/build-wrt32x.yml:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2020 - 2022
3 | #
4 | # Updated: 03/13/2022 Eliminater74
5 | #
6 | # This is free software, licensed under the MIT License.
7 | # See /LICENSE for more information.
8 | #
9 | # Description: Build OpenWrt using GitHub Actions
10 | #
11 |
12 | name: Build Linksys wrt32x firmware
13 | on:
14 | workflow_dispatch:
15 | # schedule:
16 | # * is a special character in YAML so you have to quote this string
17 | # el primer día de cada mes a las 05:00
18 | # - cron: '00 05 01 * *'
19 |
20 | jobs:
21 | trigger-nightly-builds:
22 | if: github.event != 'workflow_dispatch'
23 | runs-on: ubuntu-latest
24 | steps:
25 | - name: Emit repository_dispatch
26 | uses: mvasigh/dispatch-action@main
27 | with:
28 | token: ${{ secrets.PAT }}
29 | repo: wrt32x
30 | owner: ferboiar
31 | event_type: repository_dispatch
32 | message: |
33 | {
34 | "HARDWARE_DEVICE": "wrt32x",
35 | "HARDWARE_ID": "wrt32x",
36 | "SOURCE_DIRECTORY_A": "openwrt/bin/packages/arm_cortex-a9_vfpv3-d16",
37 | "SOURCE_DIRECTORY_B": "openwrt/bin/targets/mvebu/cortexa9/kmods/$KMOD_DIR",
38 | "ARQUITECTURA": "mvebu/cortexa9/",
39 | "config_file": "wrt32x.config",
40 | "ISP": "none"
41 | }
42 |
--------------------------------------------------------------------------------
/configs/patches/0007-arm-aarch64-Set-O2-as-default-for-Cortex-A-processor.patch:
--------------------------------------------------------------------------------
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 | From: Daniel Engberg
3 | Date: Thu, 28 Mar 2019 12:57:45 +0000
4 | Subject: [PATCH] arm/aarch64: Set -O2 as default for Cortex-A processor cores
5 |
6 | Platforms using Cortex-A processor cores aren't constrained in
7 | terms of storage as much as other supported platforms such as MIPS.
8 | Set O2 as default since Os can severly limit performance as it's
9 | more targeted at keeping down binary size.
10 |
11 | Tested on mvebu, sunxi
12 |
13 | Signed-off-by: Daniel Engberg
14 | Tested-by: Tad
15 | ---
16 | include/target.mk | 6 +++++-
17 | 1 file changed, 5 insertions(+), 1 deletion(-)
18 |
19 | diff --git a/include/target.mk b/include/target.mk
20 | index a2c8b7bdbf..de5038c17c 100644
21 | --- a/include/target.mk
22 | +++ b/include/target.mk
23 | @@ -208,7 +208,11 @@ LINUX_RECONF_DIFF = $(SCRIPT_DIR)/kconfig.pl - '>' $(call __linux_confcmd,$(filt
24 | ifeq ($(DUMP),1)
25 | BuildTarget=$(BuildTargets/DumpCurrent)
26 |
27 | - CPU_CFLAGS = -Os -pipe
28 | + ifneq ($(findstring cortex-a,$(CPU_TYPE)),)
29 | + CPU_CFLAGS = -O2 -pipe
30 | + else
31 | + CPU_CFLAGS = -Os -pipe
32 | + endif
33 | ifneq ($(findstring mips,$(ARCH)),)
34 | ifneq ($(findstring mips64,$(ARCH)),)
35 | CPU_TYPE ?= mips64
36 |
--------------------------------------------------------------------------------
/configs/patches/TMP/work/divblock.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh /etc/rc.common
2 | #License: GPL-2.0-or-later
3 |
4 | START=99
5 | USE_PROCD=1
6 |
7 | DIVBLOCK_HOSTS="https://divested.dev/hosts-dnsmasq";
8 | DIVBLOCK_OUTPUT="/tmp/dnsmasq.d/divblock.conf";
9 |
10 | reload_service()
11 | {
12 | stop "$@"
13 | start "$@"
14 | }
15 |
16 | start_service()
17 | {
18 | #Tasks
19 | # - Download the list if dnsmasq is enabled
20 | # - Sanitize it to only allow comments and domain overrides to the invalid (#) address
21 | # - TODO: add basic exclusion list support
22 | # - Restart dnsmasq
23 | if /etc/init.d/dnsmasq enabled; then
24 | sleep 15; #wait for network and system to settle after boot XXX: ugly
25 | if wget $DIVBLOCK_HOSTS -O - | grep -i -e '^#' -e '^address=/.*/#' > $DIVBLOCK_OUTPUT; then
26 | logger -t divblock "downloaded";
27 | /etc/init.d/dnsmasq restart;
28 | logger -t divblock "restarted dnsmasq";
29 | else
30 | logger -t divblock "failed to download";
31 | fi;
32 | else
33 | logger -t divblock "dnsmasq is disabled, not starting";
34 | fi;
35 | }
36 |
37 | stop_service()
38 | {
39 | #Tasks
40 | # - Delete the list if available
41 | # - Restart dnsmasq if running
42 | if rm $DIVBLOCK_OUTPUT &>/dev/null; then logger -t divblock "deleted"; fi;
43 | if /etc/init.d/dnsmasq running; then
44 | /etc/init.d/dnsmasq restart;
45 | logger -t divblock "restarted dnsmasq";
46 | else
47 | logger -t divblock "dnsmasq stopped, not restarting";
48 | fi;
49 | }
50 |
--------------------------------------------------------------------------------
/.github/workflows/build-e8450.yml:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2020 - 2022
3 | #
4 | # Updated: 03/13/2022 Eliminater74
5 | #
6 | # This is free software, licensed under the MIT License.
7 | # See /LICENSE for more information.
8 | #
9 | # Description: Build OpenWrt using GitHub Actions
10 | #
11 | # "SOURCE_DIRECTORY_B": "openwrt/bin/targets/mediatek/mt7622/kmods/$KMOD_DIR",
12 |
13 | name: Build Linksys e8450 (AKA Belkin rt3200) firmware
14 | on:
15 | workflow_dispatch:
16 | # schedule:
17 | # * is a special character in YAML so you have to quote this string
18 | # el primer día de cada mes a las 00:00
19 | # - cron: '00 00 01 * *'
20 |
21 | jobs:
22 | trigger-nightly-builds:
23 | if: github.event != 'workflow_dispatch'
24 | runs-on: ubuntu-latest
25 | steps:
26 | - name: Emit repository_dispatch
27 | uses: mvasigh/dispatch-action@main
28 | with:
29 | token: ${{ secrets.PAT }}
30 | repo: wrt32x
31 | owner: ferboiar
32 | event_type: repository_dispatch
33 | message: |
34 | {
35 | "HARDWARE_DEVICE": "e8450",
36 | "HARDWARE_ID": "e8450",
37 | "SOURCE_DIRECTORY_A": "openwrt/bin/packages/arm_cortex-a9_vfpv3-d16",
38 | "SOURCE_DIRECTORY_B": "openwrt/bin/targets/mediatek/mt7622/kmods",
39 | "ARQUITECTURA": "mediatek/mt7622/",
40 | "config_file": "rt3200.config",
41 | "ISP": "none"
42 | }
43 |
--------------------------------------------------------------------------------
/.github/workflows/QuickClean.yml:
--------------------------------------------------------------------------------
1 | name: Quick Clean
2 |
3 | on:
4 | workflow_dispatch:
5 | # schedule:
6 | # - cron: 1 8 * * 1
7 | # watch:
8 | # types: started
9 |
10 | jobs:
11 |
12 | Cleanup-Old-Releases:
13 | runs-on: ubuntu-20.04
14 | steps:
15 | - uses: dev-drprasad/delete-older-releases@v0.2.0
16 | with:
17 | repo: ferboiar/wrt32x # defaults to current repo
18 | keep_latest: 12
19 | delete_tags: true
20 | delete_tag_pattern: ""
21 | env:
22 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 |
24 | Cleanup-Old-Artifacts:
25 | runs-on: ubuntu-20.04
26 | steps:
27 | - name: Cleanup Old Action Artifacts
28 | uses: kolpav/purge-artifacts-action@master
29 | with:
30 | token: ${{ github.token }}
31 | expire-in: 0
32 |
33 | Cleanup-Workflow-Logs:
34 | runs-on: ubuntu-20.04
35 | steps:
36 | - name: Cleanup Workflow Logs
37 | uses: Mattraks/delete-workflow-runs@main
38 | with:
39 | token: ${{ github.token }}
40 | repository: ${{ github.repository }}
41 | retain_days: 1
42 |
43 | Clean-up-previous-workflow-runs:
44 | runs-on: ubuntu-20.04
45 | steps:
46 | - name: Delete previous workflow runs
47 | uses: egmacke/action-cleanup-workflow-runs@master
48 | with:
49 | token: ${{ github.token }}
50 | repository: ${{ github.repository }}
51 | workflow: ${{ github.workflow }}
52 | retain: 2
53 | branch: ${{ github.branch }}
54 |
--------------------------------------------------------------------------------
/.github/workflows/update-checker.yml:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2019-2021 P3TERX
3 | #
4 | # This is free software, licensed under the MIT License.
5 | # See /LICENSE for more information.
6 | #
7 | # https://github.com/P3TERX/Actions-OpenWrt
8 | # File: .github/workflows/update-checker.yml
9 | # Description: Source code update checker
10 | #
11 |
12 | name: Update Checker
13 |
14 | env:
15 | REPO_URL: https://github.com/openwrt/openwrt
16 | REPO_BRANCH: master
17 |
18 | on:
19 | workflow_dispatch:
20 | # schedule:
21 | # - cron: 0 */18 * * *
22 |
23 | jobs:
24 | check:
25 | runs-on: ubuntu-latest
26 |
27 | steps:
28 |
29 | - name: Get Commit Hash
30 | id: getHash
31 | run: |
32 | git clone --depth 1 $REPO_URL -b $REPO_BRANCH .
33 | echo "::set-output name=commitHash::$(git rev-parse HEAD)"
34 | - name: Compare Commit Hash
35 | id: cacheHash
36 | uses: actions/cache@v2
37 | with:
38 | path: .commitHash
39 | key: HEAD-${{ steps.getHash.outputs.commitHash }}
40 |
41 | - name: Save New Commit Hash
42 | if: steps.cacheHash.outputs.cache-hit != 'true'
43 | run: |
44 | echo ${{ steps.getHash.outputs.commitHash }} | tee .commitHash
45 | - name: Trigger build
46 | if: steps.cacheHash.outputs.cache-hit != 'true'
47 | uses: peter-evans/repository-dispatch@v1
48 | with:
49 | token: ${{ secrets.ACTIONS_TRIGGER_PAT }}
50 | event-type: Source Code Update
51 |
52 | - name: Delete workflow runs
53 | uses: GitRML/delete-workflow-runs@main
54 | with:
55 | retain_days: 1
56 | keep_minimum_runs: 1
57 |
--------------------------------------------------------------------------------
/configs/files/etc/config/network:
--------------------------------------------------------------------------------
1 | config interface 'loopback'
2 | option device 'lo'
3 | option proto 'static'
4 | option ipaddr '127.0.0.1'
5 | option netmask '255.0.0.0'
6 |
7 | config globals 'globals'
8 | option ula_prefix 'fd5d:280a:da90::/48'
9 |
10 | config device
11 | option name 'br-lan'
12 | option type 'bridge'
13 | list ports 'lan1'
14 | list ports 'lan2'
15 | list ports 'lan3'
16 | list ports 'lan4'
17 |
18 | config interface 'lan'
19 | option device 'br-lan'
20 | option proto 'static'
21 | option ipaddr '10.0.1.254'
22 | option netmask '255.255.255.0'
23 | option ip6assign '60'
24 | option ifname 'br-lan'
25 |
26 | config device
27 | option name 'wan'
28 | option macaddr '62:38:e0:c3:59:d0'
29 |
30 | config interface 'wan'
31 | option proto 'dhcp'
32 | option device 'wan.20'
33 | option ifname 'wan.20'
34 |
35 | config interface 'wan6'
36 | option proto 'dhcpv6'
37 | option device 'wan.20'
38 | option reqaddress 'try'
39 | option reqprefix 'auto'
40 | option ifname 'wan.20'
41 |
42 | config device
43 | option type '8021q'
44 | option ifname 'wan'
45 | option vid '20'
46 | option name 'wan.20'
47 | list egress_qos_mapping '0:0'
48 | list egress_qos_mapping '1:0'
49 | list egress_qos_mapping '2:0'
50 | list egress_qos_mapping '3:0'
51 | list egress_qos_mapping '4:0'
52 | list egress_qos_mapping '5:0'
53 | list egress_qos_mapping '6:0'
54 | list egress_qos_mapping '7:0'
55 | option macaddr 'C0:9F:E1:8A:8F:01'
56 |
--------------------------------------------------------------------------------
/configs/files/etc/netdata/charts.d.conf:
--------------------------------------------------------------------------------
1 | # This is the configuration for charts.d.plugin
2 |
3 | # Each of its collectors can read configuration eiher from this file
4 | # or a NAME.conf file (where NAME is the collector name).
5 | # The collector specific file has higher precedence.
6 |
7 | # This file is a shell script too.
8 |
9 | # -----------------------------------------------------------------------------
10 |
11 | # number of seconds to run without restart
12 | # after this time, charts.d.plugin will exit
13 | # netdata will restart it, but a small gap
14 | # will appear in the charts.d.plugin charts.
15 | #restart_timeout=$[3600 * 4]
16 |
17 | # when making iterations, charts.d can loop more frequently
18 | # to prevent plugins missing iterations.
19 | # this is a percentage relative to update_every to align its
20 | # iterations.
21 | # The minimum is 10%, the maximum 100%.
22 | # So, if update_every is 1 second and time_divisor is 50,
23 | # charts.d will iterate every 500ms.
24 | # Charts will be called to collect data only if the time
25 | # passed since the last time the collected data is equal or
26 | # above their update_every.
27 | #time_divisor=50
28 |
29 | # -----------------------------------------------------------------------------
30 |
31 | # the default enable/disable for all charts.d collectors
32 | # the default is "yes"
33 | enable_all_charts="no"
34 |
35 | # BY DEFAULT ENABLED MODULES
36 | # ap=yes
37 | # apcupsd=yes
38 | # libreswan=yes
39 | # nut=yes
40 | # opensips=yes
41 | sqm=yes
42 |
43 | # -----------------------------------------------------------------------------
44 | # THESE NEED TO BE SET TO "force" TO BE ENABLED
45 |
46 | # Nothing useful.
47 | # Just an example charts.d plugin you can use as a template.
48 | # example=force
49 |
--------------------------------------------------------------------------------
/configs/patches/0004-base-files-sysctl.d-basic-hardening.patch:
--------------------------------------------------------------------------------
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 | From: Tad
3 | Date: Fri, 27 Nov 2020 13:49:59 -0500
4 | Subject: [PATCH] base-files: sysctl.d: basic hardening
5 |
6 | Set some sysctls that increase security.
7 |
8 | Signed-off-by: Tad
9 | ---
10 | .../files/etc/sysctl.d/60-restrict.conf | 27 +++++++++++++++++++
11 | 1 file changed, 27 insertions(+)
12 | create mode 100644 package/base-files/files/etc/sysctl.d/60-restrict.conf
13 |
14 | diff --git a/package/base-files/files/etc/sysctl.d/60-restrict.conf b/package/base-files/files/etc/sysctl.d/60-restrict.conf
15 | new file mode 100644
16 | index 0000000000..2b5162fdb7
17 | --- /dev/null
18 | +++ b/package/base-files/files/etc/sysctl.d/60-restrict.conf
19 | @@ -0,0 +1,27 @@
20 | +dev.tty.ldisc_autoload=0
21 | +fs.protected_fifos=2
22 | +fs.protected_hardlinks=1
23 | +fs.protected_regular=2
24 | +fs.protected_symlinks=1
25 | +fs.suid_dumpable=0
26 | +kernel.dmesg_restrict=1
27 | +kernel.kexec_load_disabled=1
28 | +kernel.kptr_restrict=2
29 | +kernel.perf_event_paranoid=3
30 | +kernel.randomize_va_space=2
31 | +kernel.yama.ptrace_scope=1
32 | +net.core.bpf_jit_harden=2
33 | +net.ipv4.icmp_ignore_bogus_error_responses=1
34 | +net.ipv6.conf.all.addr_gen_mode=3
35 | +net.ipv6.conf.all.max_addresses=128
36 | +net.ipv6.conf.all.regen_max_retry=32
37 | +net.ipv6.conf.all.temp_prefered_lft=21600
38 | +net.ipv6.conf.all.use_tempaddr=2
39 | +net.ipv6.conf.default.addr_gen_mode=3
40 | +net.ipv6.conf.default.max_addresses=128
41 | +net.ipv6.conf.default.regen_max_retry=32
42 | +net.ipv6.conf.default.temp_prefered_lft=21600
43 | +net.ipv6.conf.default.use_tempaddr=2
44 | +vm.mmap_rnd_bits=32
45 | +vm.mmap_rnd_compat_bits=16
46 | +vm.unprivileged_userfaultfd=0
47 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/tunnel_down.svg:
--------------------------------------------------------------------------------
1 |
2 |
17 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/tunnel_disabled.svg:
--------------------------------------------------------------------------------
1 |
2 |
17 |
--------------------------------------------------------------------------------
/configs/files/usr/lib/OpenWrtScripts/autoSQM.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | /etc/init.d/sqm stop
3 |
4 | if [ ! -d /tmp/speedtestResult ]; then
5 | mkdir /tmp/speedtestResult
6 | fi
7 |
8 | sh betterspeedtest.sh -t 15 -n 15 -p www.google.com -H netperf-eu.bufferbloat.net >> /tmp/speedtestResult/speedtestLog-"$(date +"%Y-%m-%d").log"
9 |
10 | /etc/init.d/sqm start
11 |
12 | #Get list of speedtest
13 | cat /tmp/speedtestResult/speedtestLog-"$(date +"%Y-%m-%d").log" | grep -i download | tr -d "Download: " | tr -d Mbps | sort -n > /tmp/download.txt
14 | cat /tmp/speedtestResult/speedtestLog-"$(date +"%Y-%m-%d").log" | grep -i upload | tr -d "Upload: " | tr -d Mbps | sort -n > /tmp/upload.txt
15 |
16 | ## remove old log
17 | rm -rf /tmp/speedtestResult/speedtestLog-"$(date +"%Y-%m-%d").log"
18 |
19 | #get average speed for download & upload
20 | download=`cat /tmp/download.txt | awk -f median.awk`
21 | upload=`cat /tmp/upload.txt | awk -f median.awk`
22 |
23 | ## Remove old leftover files
24 | rm -rf /tmp/download.txt /tmp/upload.txt
25 |
26 | #convert to Kbps & adjust to 90% speed
27 | downloadKbps=$(awk "BEGIN {download = $download; print download*1000*90/100}")
28 | uploadKbps=$(awk "BEGIN {upload = $upload; print upload*1000*90/100}")
29 | echo $downloadKbps
30 | echo $uploadKbps
31 |
32 | #set value to SQM use uci
33 | #change value after -gt to only apply SQM if the result greate than X (in kbps)
34 | if [ "$downloadKbps" -gt 10000 ] && [ "$uploadKbps" -gt 10000 ]; then
35 | echo "setting up SQM with new value"
36 | uci set sqm.eth1.upload=${uploadKbps%%.*}
37 | uci set sqm.eth1.download=${downloadKbps%%.*}
38 | uci commit sqm
39 | /etc/init.d/sqm reload
40 | echo "auto sqm DONE --> Set sqm.eth1.upload="${uploadKbps%%.*}" / sqm.eth1.download="${downloadKbps%%.*}
41 | logger -t autoSQM -p info "Set download = $downloadKbps, upload = $uploadKbps"
42 | fi
43 |
--------------------------------------------------------------------------------
/.github/workflows/cleanup.yml:
--------------------------------------------------------------------------------
1 | name: Cleaning
2 |
3 | on:
4 | workflow_dispatch:
5 | schedule:
6 | - cron: 1 8 * * 1
7 | # watch:
8 | # types: started
9 |
10 | jobs:
11 |
12 | #Cleanup-Old-Releases:
13 | # runs-on: ubuntu-20.04
14 | # steps:
15 | # - name: Delete Older Releases
16 | # uses: dev-drprasad/delete-older-releases@master
17 | # with:
18 | # keep_latest: 12
19 | # delete_tags: true
20 | # env:
21 | # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 |
23 | Cleanup-Old-Artifacts:
24 | runs-on: ubuntu-20.04
25 | steps:
26 | - name: Cleanup Old Action Artifacts
27 | uses: kolpav/purge-artifacts-action@master
28 | with:
29 | token: ${{ github.token }}
30 | expire-in: 5d
31 |
32 | Remove-Old-Artifacts:
33 | runs-on: ubuntu-20.04
34 | steps:
35 | - name: Remove old artifacts
36 | uses: c-hive/gha-remove-artifacts@v1
37 | with:
38 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39 | age: '1 day'
40 | skip-recent: 5
41 |
42 | Cleanup-Workflow-Logs:
43 | runs-on: ubuntu-20.04
44 | steps:
45 | - name: Delete workflow runs
46 | uses: Mattraks/delete-workflow-runs@v2
47 | with:
48 | token: ${{ github.token }}
49 | repository: ${{ github.repository }}
50 | retain_days: 7
51 | keep_minimum_runs: 6
52 |
53 | Delete-Workflow-Runs:
54 | runs-on: ubuntu-20.04
55 | steps:
56 | - name: Delete workflow runs
57 | uses: dmvict/clean-workflow-runs@v1.0.0
58 | with:
59 | token: ${{ secrets.GITHUB_TOKEN }}
60 | run_conclusions: |
61 | failure
62 | timed_out
63 | save_period: 5
64 | save_min_runs_number: 1
65 | dry: false
66 |
--------------------------------------------------------------------------------
/configs/files/usr/lib/OpenWrtScripts/lib/summarize_pings.sh:
--------------------------------------------------------------------------------
1 | # Process the ping times from the passed-in file, and summarize the results
2 | # grep to keep lines that have "time=", then sed to isolate the time stamps, and sort them
3 | # Use awk to build an array of those values, and print first & last (which are min, max)
4 | # and compute average.
5 | # If the number of samples is >= 10, also compute median, and 10th and 90th percentile readings
6 |
7 | # Display the values as:
8 | # Latency: (in msec, 11 pings, 8.33% packet loss)
9 | # Min: 16.556
10 | # 10pct: 16.561
11 | # Median: 22.370
12 | # Avg: 21.203
13 | # 90pct: 23.202
14 | # Max: 23.394
15 |
16 | summarize_pings() {
17 |
18 | grep "time" < "$1" | cat | \
19 | sed 's/^.*time=\([^ ]*\) ms/\1/'| \
20 | # tee >&2 | \
21 | sort -n | \
22 | awk 'BEGIN {numdrops=0; numrows=0} \
23 | { \
24 | # print ; \
25 | if ( $0 ~ /timeout/ ) { \
26 | numdrops += 1; \
27 | } else { \
28 | numrows += 1; \
29 | arr[numrows]=$1; sum+=$1; \
30 | } \
31 | } \
32 | END { \
33 | pc10="-"; pc90="-"; med="-"; \
34 | if (numrows == 0) {numrows=1} \
35 | if (numrows>=10) \
36 | { # get the 10th pctile - never the first one
37 | ix=int(numrows/10); if (ix=1) {ix+=1}; pc10=arr[ix]; \
38 | # get the 90th pctile
39 | ix=int(numrows*9/10);pc90=arr[ix]; \
40 | # get the median
41 | if (numrows%2==1) med=arr[(numrows+1)/2]; else med=(arr[numrows/2]); \
42 | }; \
43 | pktloss = numdrops/(numdrops+numrows) * 100; \
44 | printf("\n Latency: (in msec, %d pings, %4.2f%% packet loss)\n Min: %4.3f \n 10pct: %4.3f \n Median: %4.3f \n Avg: %4.3f \n 90pct: %4.3f \n Max: %4.3f\n", numrows, pktloss, arr[1], pc10, med, sum/numrows, pc90, arr[numrows] )\
45 | }'
46 | }
47 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/tunnel_up.svg:
--------------------------------------------------------------------------------
1 |
2 |
19 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/usb_rndis_down.svg:
--------------------------------------------------------------------------------
1 |
2 |
21 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/usb_rndis_disabled.svg:
--------------------------------------------------------------------------------
1 |
2 |
21 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/usb_rndis_up.svg:
--------------------------------------------------------------------------------
1 |
2 |
21 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/view/status/include/25_netports.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019, Tano Systems. All Rights Reserved.
3 | * Anton Kikin
4 | */
5 |
6 | 'use strict';
7 | 'require rpc';
8 | 'require uci';
9 | 'require netports';
10 |
11 | var callSessionAccess = rpc.declare({
12 | object: 'session',
13 | method: 'access',
14 | params: [ 'scope', 'object', 'function' ],
15 | expect: { 'access': false }
16 | });
17 |
18 | var callNetPortsGetInfo = rpc.declare({
19 | object: 'netports',
20 | method: 'getPortsInfo',
21 | expect: { '': {} }
22 | });
23 |
24 | var netports_el = E('div', {});
25 | var netports_object = null;
26 |
27 | return L.Class.extend({
28 | __init__: function() {
29 | var head = document.getElementsByTagName('head')[0];
30 | var css = E('link', { 'href': L.resource('netports/netports.css'), 'rel': 'stylesheet' });
31 | head.appendChild(css);
32 |
33 | uci.load('luci_netports').then(function() {
34 | var np_default_additional_info =
35 | parseInt(uci.get('luci_netports', 'global', 'default_additional_info')) == 1;
36 |
37 | var np_default_h_mode =
38 | parseInt(uci.get('luci_netports', 'global', 'default_h_mode')) == 1;
39 |
40 | var np_hv_mode_switch_button =
41 | parseInt(uci.get('luci_netports', 'global', 'hv_mode_switch_button')) == 1;
42 |
43 | netports_object = new netports.NetPorts({
44 | target: netports_el,
45 | mode: np_default_h_mode ? 0 : 1,
46 | modeSwitchButton: np_hv_mode_switch_button,
47 | autoSwitchHtoV: true,
48 | autoSwitchHtoVThreshold: 6,
49 | hModeFirstColWidth: 20,
50 | hModeExpanded: np_default_additional_info,
51 | });
52 | });
53 | },
54 |
55 | title: _('Network Interfaces Ports Status'),
56 |
57 | load: function() {
58 | return Promise.all([
59 | L.resolveDefault(callNetPortsGetInfo(), {}),
60 | callSessionAccess('access-group', 'luci-app-tn-netports', 'read'),
61 | ]);
62 | },
63 |
64 | render: function(data) {
65 | var hasReadPermission = data[1];
66 |
67 | if (!hasReadPermission)
68 | return E([]);
69 |
70 | if (netports_object)
71 | netports_object.updateData(data[0]);
72 |
73 | return E([ netports_el ]);
74 | }
75 | });
76 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/netports.css:
--------------------------------------------------------------------------------
1 | .netports-table .td,
2 | .netports-table .th {
3 | line-height: 1.3em;
4 | }
5 | .netports-linkstatus-icon-container {
6 | width: 42px;
7 | }
8 | .netports-linkstatus-icon {
9 | display: inline-block;
10 | max-width: 100%;
11 | width: 100%;
12 | height: auto;
13 | }
14 | .netports-linkstatus-icon-container-v {
15 | float: left;
16 | margin-right: 8px;
17 | }
18 | .netports-linkstatus-text {
19 | white-space: nowrap;
20 | }
21 | .netports-linkstatus-text-disconnected,
22 | .netports-linkstatus-text-disabled {
23 | color: #bbbbbb;
24 | }
25 | .netports-ifacebox,
26 | .netports-ifacebox-head {
27 | width: auto !important;
28 | width: fit-content !important;
29 | width: -moz-fit-content !important;
30 | width: -webkit-fit-content !important;
31 | }
32 | .netports-ifacebox {
33 | display: block;
34 | padding: 0;
35 | margin: 0;
36 | min-width: auto;
37 | }
38 | .netports-ifacebox-head {
39 | padding-right: 8px;
40 | padding-left: 8px;
41 | text-align: center;
42 | min-width: 100px;
43 | }
44 | .netports-ifacebox-head a {
45 | color: inherit;
46 | }
47 | .netports-title {
48 | text-align: left;
49 | justify-content: space-between;
50 | display: flex;
51 | flex-flow: row-reverse;
52 | align-items: flex-end;
53 | }
54 | .netports-copyright {
55 | margin: 0;
56 | color: #ccc;
57 | font-size: 85%;
58 | white-space: nowrap;
59 | }
60 | .netports-buttons {
61 | margin: 0 6px 0 0;
62 | padding: 0;
63 | display: flex;
64 | flex-flow: row-reverse;
65 | }
66 | .netports-buttons button {
67 | margin-bottom: 8px;
68 | margin-right: 4px;
69 | height: 22px;
70 | padding: 0 10px;
71 | display: inline-flex;
72 | background: linear-gradient(#fff, #fff 25%, #e6e6e6) no-repeat;
73 | box-shadow: 0 1px 3px 0 grey;
74 | }
75 | .netports-buttons button:disabled {
76 | opacity: 0.6;
77 | }
78 | .netports-buttons button svg {
79 | width: 18px;
80 | height: 18px;
81 | vertical-align: middle;
82 | fill: #333;
83 | }
84 | .netports-buttons button:hover svg {
85 | fill: #008dd2;
86 | }
87 | .netports-buttons button:disabled svg {
88 | fill: #aaa;
89 | }
90 | .netports-copyright a {
91 | color: #ccc;
92 | font-weight: normal;
93 | text-decoration: none;
94 | }
95 | .netports-copyright a:hover {
96 | color: #aaa;
97 | text-decoration: underline;
98 | }
99 |
--------------------------------------------------------------------------------
/doc/mt6000_v2:
--------------------------------------------------------------------------------
1 | SFO+HFO and WED instead of SQM
2 | SFO: software offloading
3 | WED: https://openwrt.org/toh/linksys/e8450#wireless_ethernet_dispatch_wed_hw_acceleration_for_wireless_clients
4 |
5 | LUCI:
6 | ====
7 | luci-app-acme
8 | luci-app-banip
9 | NO luci-app-bcp38
10 | NO luci-app-dockerman
11 | NO docker-compose
12 | NO dockerd
13 | luci-app-ddns
14 | NO luci-app-hd-idle
15 | luci-app-https-dns-proxy
16 | luci-app-irqbalance
17 | luci-app-nft-qos
18 | luci-app-ttyd
19 | luci-app-opkg
20 | luci-app-pbr
21 | luci-app-samba4
22 | luci-app-sqm
23 | luci-app-upnp
24 | luci-app-watchcat
25 | NO luci-app-wol
26 | luci-mod-admin-full
27 | luci-proto-ppp
28 | luci-lib-ipkg
29 |
30 | Estadisticas
31 | ============
32 | luci-app-statistics
33 | collectd-mod-cpufreq
34 | collectd-mod-ethstat
35 | collectd-mod-iptables
36 | NO collectd-mod-sensors
37 | collectd-mod-syslog
38 | collectd-mod-vmem
39 | collectd-mod-wireless
40 | collectd-mod-thermal
41 | luci-app-vnstat2
42 | luci-app-nlbwmon
43 | htop
44 | iperf3
45 | netperf
46 |
47 | Wireguard
48 | =========
49 | wireguard-tools
50 | luci-proto-wireguard (no instalo, lo delego en glinet)
51 | luci-app-wireguard (no instalo, lo delego en glinet)
52 | kmod-wireguard
53 |
54 | OpenVPN client/server
55 | =====================
56 | openvpn-openssl
57 | luci-app-openvpn (no instalo, lo delego en glinet)
58 | kmod-tun
59 |
60 | USB Storage
61 | ===========
62 | kmod-usb-storage
63 | kmod-usb-storage-extras
64 | kmod-usb-storage-uas
65 | kmod-usb-ohci
66 | kmod-usb-uhci
67 | kmod-usb2
68 | kmod-usb3
69 | kmod-fs-ext4
70 | kmod-fs-exfat
71 | kmod-fs-vfat
72 | kmod-fs-ntfs
73 | kmod-scsi-core
74 | kmod-nls-cp437
75 | kmod-nls-iso8859-1
76 | block-mount
77 | e2fsprogs
78 | usbutils
79 | usbids
80 | ntfs-3g
81 |
82 | Temas
83 | =====
84 | luci-theme-material
85 | luci-theme-bootstrap
86 |
87 | file manager/system bins
88 | ========================
89 | attr
90 | dmesg
91 | fdisk
92 | gzip
93 | nano
94 | more
95 |
96 | varios:
97 | ======
98 | acme-acmesh
99 | acme-acmesh-dnsapi
100 | adguardhome (no instalo, lo delego en glinet)
101 | ca-certificates
102 | irqbalance
103 | ddns-scripts-cloudflare
104 | ddns-scripts-noip
105 | msmtp
106 | nmap-full
107 | samba4-utils
108 | sysfsutils
109 | tcpdump
110 | zoneinfo-europe
111 | umdns
112 |
--------------------------------------------------------------------------------
/configs/files/etc/netdata/edit-config:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | [ -f /etc/profile ] && . /etc/profile
4 |
5 | file="${1}"
6 |
7 | if [ "$(command -v editor)" ]; then
8 | EDITOR="${EDITOR-editor}"
9 | else
10 | EDITOR="${EDITOR-vi}"
11 | fi
12 |
13 | [ -z "${NETDATA_USER_CONFIG_DIR}" ] && NETDATA_USER_CONFIG_DIR="/etc/netdata"
14 | [ -z "${NETDATA_STOCK_CONFIG_DIR}" ] && NETDATA_STOCK_CONFIG_DIR="/usr/lib/netdata/conf.d"
15 |
16 | if [ -z "${file}" ]; then
17 | cat << EOF
18 |
19 | USAGE:
20 | ${0} FILENAME
21 |
22 | Copy and edit the stock config file named: FILENAME
23 | if FILENAME is already copied, it will be edited as-is.
24 |
25 | The EDITOR shell variable is used to define the editor to be used.
26 |
27 | Stock config files at: '${NETDATA_STOCK_CONFIG_DIR}'
28 | User config files at: '${NETDATA_USER_CONFIG_DIR}'
29 |
30 | Available files in '${NETDATA_STOCK_CONFIG_DIR}' to copy and edit:
31 |
32 | EOF
33 |
34 | cd "${NETDATA_STOCK_CONFIG_DIR}" || exit 1
35 | ls >&2 -R ./*.conf ./*/*.conf
36 | exit 1
37 |
38 | fi
39 |
40 | edit() {
41 | echo >&2 "Editing '${1}' ..."
42 |
43 | # check we can edit
44 | if [ ! -w "${1}" ]; then
45 | echo >&2 "Cannot write to ${1}! Aborting ..."
46 | exit 1
47 | fi
48 |
49 | "${EDITOR}" "${1}"
50 | exit $?
51 | }
52 |
53 | copy_and_edit() {
54 | # check we can copy
55 | if [ ! -w "${NETDATA_USER_CONFIG_DIR}" ]; then
56 | echo >&2 "Cannot write to ${NETDATA_USER_CONFIG_DIR}! Aborting ..."
57 | exit 1
58 | fi
59 |
60 | if [ ! -f "${NETDATA_USER_CONFIG_DIR}/${1}" ]; then
61 | echo >&2 "Copying '${NETDATA_STOCK_CONFIG_DIR}/${1}' to '${NETDATA_USER_CONFIG_DIR}/${1}' ... "
62 | cp -p "${NETDATA_STOCK_CONFIG_DIR}/${1}" "${NETDATA_USER_CONFIG_DIR}/${1}" || exit 1
63 | fi
64 |
65 | edit "${NETDATA_USER_CONFIG_DIR}/${1}"
66 | }
67 |
68 | # make sure it is not absolute filename
69 | c1="$(echo "${file}" | cut -b 1)"
70 | if [ "${c1}" = "/" ] || [ "${c1}" = "." ]; then
71 | echo >&2 "Please don't use filenames starting with '/' or '.'"
72 | exit 1
73 | fi
74 |
75 | # already exists
76 | [ -f "${NETDATA_USER_CONFIG_DIR}/${file}" ] && edit "${NETDATA_USER_CONFIG_DIR}/${file}"
77 |
78 | # stock config is valid, copy and edit
79 | [ -f "${NETDATA_STOCK_CONFIG_DIR}/${file}" ] && copy_and_edit "${file}"
80 |
81 | # no such config found
82 | echo >&2 "File '${file}' is not found in '${NETDATA_STOCK_CONFIG_DIR}'"
83 | exit 1
84 |
--------------------------------------------------------------------------------
/configs/patches/0010-Add-divblock-an-extremely-simple-ad-blocker.patch:
--------------------------------------------------------------------------------
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 | From: Tad
3 | Date: Fri, 3 Dec 2021 17:31:47 -0500
4 | Subject: [PATCH] Add divblock, an extremely simple "ad" blocker
5 |
6 | Signed-off-by: Tad
7 | ---
8 | package/base-files/files/etc/init.d/divblock | 51 ++++++++++++++++++++
9 | 1 file changed, 51 insertions(+)
10 | create mode 100755 package/base-files/files/etc/init.d/divblock
11 |
12 | diff --git a/package/base-files/files/etc/init.d/divblock b/package/base-files/files/etc/init.d/divblock
13 | new file mode 100755
14 | index 0000000000..19bd197520
15 | --- /dev/null
16 | +++ b/package/base-files/files/etc/init.d/divblock
17 | @@ -0,0 +1,51 @@
18 | +#!/bin/sh /etc/rc.common
19 | +#License: GPL-2.0-or-later
20 | +
21 | +START=99
22 | +USE_PROCD=1
23 | +
24 | +DIVBLOCK_HOSTS="https://divested.dev/hosts-dnsmasq";
25 | +DIVBLOCK_OUTPUT="/tmp/dnsmasq.d/divblock.conf";
26 | +DIVBLOCK_EXCLUSIONS="/etc/config/divblock-exclusions";
27 | +
28 | +reload_service()
29 | +{
30 | + stop "$@"
31 | + start "$@"
32 | +}
33 | +
34 | +start_service()
35 | +{
36 | + if [ ! -e "$DIVBLOCK_EXCLUSIONS" ]; then touch "$DIVBLOCK_EXCLUSIONS"; fi;
37 | + #Tasks
38 | + # - Download the list if dnsmasq is enabled
39 | + # - Sanitize it to only allow comments and domain overrides to the invalid (#) address
40 | + # - Filter out patterns from the exclusion file
41 | + # - Restart dnsmasq
42 | + if /etc/init.d/dnsmasq enabled; then
43 | + sleep 15; #wait for network and system to settle after boot XXX: ugly
44 | + if wget $DIVBLOCK_HOSTS -O - | grep -i -e '^#' -e '^address=/.*/#' | grep -v -f "$DIVBLOCK_EXCLUSIONS" > $DIVBLOCK_OUTPUT; then
45 | + logger -t divblock "downloaded";
46 | + /etc/init.d/dnsmasq restart;
47 | + logger -t divblock "restarted dnsmasq";
48 | + else
49 | + logger -t divblock "failed to download";
50 | + fi;
51 | + else
52 | + logger -t divblock "dnsmasq is disabled, not starting";
53 | + fi;
54 | +}
55 | +
56 | +stop_service()
57 | +{
58 | + #Tasks
59 | + # - Delete the list if available
60 | + # - Restart dnsmasq if running
61 | + if rm $DIVBLOCK_OUTPUT &>/dev/null; then logger -t divblock "deleted"; fi;
62 | + if /etc/init.d/dnsmasq running; then
63 | + /etc/init.d/dnsmasq restart;
64 | + logger -t divblock "restarted dnsmasq";
65 | + else
66 | + logger -t divblock "dnsmasq stopped, not restarting";
67 | + fi;
68 | +}
69 |
--------------------------------------------------------------------------------
/scripts/lib/util/tryCatch.sh:
--------------------------------------------------------------------------------
1 | # no dependencies
2 | declare -ig __oo__insideTryCatch=0
3 | declare -g __oo__presetShellOpts="$-"
4 |
5 | # in case try-catch is nested, we set +e before so the parent handler doesn't catch us instead
6 | alias try='[[ $__oo__insideTryCatch -eq 0 ]] || __oo__presetShellOpts="$(echo $- | sed 's/[is]//g')"; __oo__insideTryCatch+=1; set +e; ( set -e; true; '
7 | alias catch='); declare __oo__tryResult=$?; __oo__insideTryCatch+=-1; [[ $__oo__insideTryCatch -lt 1 ]] || set -${__oo__presetShellOpts:-e} && Exception::Extract $__oo__tryResult || '
8 |
9 | Exception::SetupTemp() {
10 | declare -g __oo__storedExceptionLineFile="$(mktemp -t stored_exception_line.$$.XXXXXXXXXX)"
11 | declare -g __oo__storedExceptionSourceFile="$(mktemp -t stored_exception_source.$$.XXXXXXXXXX)"
12 | declare -g __oo__storedExceptionBacktraceFile="$(mktemp -t stored_exception_backtrace.$$.XXXXXXXXXX)"
13 | declare -g __oo__storedExceptionFile="$(mktemp -t stored_exception.$$.XXXXXXXXXX)"
14 | }
15 |
16 | Exception::CleanUp() {
17 | local exitVal=$?
18 | rm -f $__oo__storedExceptionLineFile $__oo__storedExceptionSourceFile $__oo__storedExceptionBacktraceFile $__oo__storedExceptionFile || exit 1
19 | exit $exitVal
20 | }
21 |
22 | Exception::ResetStore() {
23 | > $__oo__storedExceptionLineFile
24 | > $__oo__storedExceptionFile
25 | > $__oo__storedExceptionSourceFile
26 | > $__oo__storedExceptionBacktraceFile
27 | }
28 |
29 | Exception::GetLastException() {
30 | if [[ -s $__oo__storedExceptionFile ]]
31 | then
32 | cat $__oo__storedExceptionLineFile
33 | cat $__oo__storedExceptionFile
34 | cat $__oo__storedExceptionSourceFile
35 | cat $__oo__storedExceptionBacktraceFile
36 |
37 | Exception::ResetStore
38 | else
39 | echo -e "${BASH_LINENO[1]}\n \n${BASH_SOURCE[2]#./}"
40 | fi
41 | }
42 |
43 | Exception::Extract() {
44 | local retVal=$1
45 | unset __oo__tryResult
46 |
47 | if [[ $retVal -gt 0 ]]
48 | then
49 | local IFS=$'\n'
50 | __EXCEPTION__=( $(Exception::GetLastException) )
51 |
52 | local -i counter=0
53 | local -i backtraceNo=0
54 |
55 | while [[ $counter -lt ${#__EXCEPTION__[@]} ]]
56 | do
57 | __BACKTRACE_LINE__[$backtraceNo]="${__EXCEPTION__[$counter]}"
58 | counter+=1
59 | __BACKTRACE_COMMAND__[$backtraceNo]="${__EXCEPTION__[$counter]}"
60 | counter+=1
61 | __BACKTRACE_SOURCE__[$backtraceNo]="${__EXCEPTION__[$counter]}"
62 | counter+=1
63 | backtraceNo+=1
64 | done
65 |
66 | return 1 # so that we may continue with a "catch"
67 | fi
68 | return 0
69 | }
70 |
71 | Exception::SetupTemp
72 | trap Exception::CleanUp EXIT INT TERM
73 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/wifi_up.svg:
--------------------------------------------------------------------------------
1 |
2 |
25 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/copper_down.svg:
--------------------------------------------------------------------------------
1 |
2 |
40 |
--------------------------------------------------------------------------------
/configs/files/etc/netdata/exporting.conf:
--------------------------------------------------------------------------------
1 | [exporting:global]
2 | enabled = no
3 | # send configured labels = yes
4 | # send automatic labels = no
5 | # update every = 10
6 |
7 | [prometheus:exporter]
8 | # send names instead of ids = yes
9 | # send configured labels = yes
10 | # send automatic labels = no
11 | # send charts matching = *
12 | # send hosts matching = localhost *
13 | # prefix = netdata
14 |
15 | # An example configuration for graphite, json, opentsdb exporting connectors
16 | # [graphite:my_graphite_instance]
17 | # enabled = no
18 | # destination = localhost
19 | # data source = average
20 | # prefix = netdata
21 | # hostname = my_hostname
22 | # update every = 10
23 | # buffer on failures = 10
24 | # timeout ms = 20000
25 | # send names instead of ids = yes
26 | # send charts matching = *
27 | # send hosts matching = localhost *
28 |
29 | # [prometheus_remote_write:my_prometheus_remote_write_instance]
30 | # enabled = no
31 | # destination = localhost
32 | # remote write URL path = /receive
33 | # data source = average
34 | # prefix = netdata
35 | # hostname = my_hostname
36 | # update every = 10
37 | # buffer on failures = 10
38 | # timeout ms = 20000
39 | # send names instead of ids = yes
40 | # send charts matching = *
41 | # send hosts matching = localhost *
42 |
43 | # [kinesis:my_kinesis_instance]
44 | # enabled = no
45 | # destination = us-east-1
46 | # stream name = netdata
47 | # aws_access_key_id = my_access_key_id
48 | # aws_secret_access_key = my_aws_secret_access_key
49 | # data source = average
50 | # prefix = netdata
51 | # hostname = my_hostname
52 | # update every = 10
53 | # buffer on failures = 10
54 | # timeout ms = 20000
55 | # send names instead of ids = yes
56 | # send charts matching = *
57 | # send hosts matching = localhost *
58 |
59 | # [pubsub:my_pubsub_instance]
60 | # enabled = no
61 | # destination = pubsub.googleapis.com
62 | # credentials file = /etc/netdata/pubsub_credentials.json
63 | # project id = my_project
64 | # topic id = my_topic
65 | # data source = average
66 | # prefix = netdata
67 | # hostname = my_hostname
68 | # update every = 10
69 | # buffer on failures = 10
70 | # timeout ms = 20000
71 | # send names instead of ids = yes
72 | # send charts matching = *
73 | # send hosts matching = localhost *
74 |
75 | # [mongodb:my_mongodb_instance]
76 | # enabled = no
77 | # destination = localhost
78 | # database = my_database
79 | # collection = my_collection
80 | # data source = average
81 | # prefix = netdata
82 | # hostname = my_hostname
83 | # update every = 10
84 | # buffer on failures = 10
85 | # timeout ms = 20000
86 | # send names instead of ids = yes
87 | # send charts matching = *
88 | # send hosts matching = localhost *
89 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/copper_disabled.svg:
--------------------------------------------------------------------------------
1 |
2 |
40 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/copper_up.svg:
--------------------------------------------------------------------------------
1 |
2 |
42 |
--------------------------------------------------------------------------------
/scripts/lib/util/test.sh:
--------------------------------------------------------------------------------
1 | import util/class util/tryCatch UI/Cursor
2 |
3 | class:Test() {
4 | private UI.Cursor onStartCursor
5 | private string groupName
6 | public string errors
7 | # public boolean errors = false
8 |
9 | Test.Start() {
10 | [string] verb
11 | [string] description
12 |
13 | this onStartCursor capture
14 | echo "$(UI.Color.Yellow)$(UI.Powerline.PointingArrow) $(UI.Color.Yellow)[$(UI.Color.LightGray)$(UI.Color.Bold)TEST$(UI.Color.NoBold)$(UI.Color.Yellow)] $(UI.Color.White)${verb} ${description}$(UI.Color.Default)"
15 | @return
16 | }
17 |
18 | Test.OK() {
19 | [string] printInPlace=true
20 |
21 | [[ $printInPlace == true ]] && this onStartCursor restore
22 |
23 | echo "$(UI.Color.Green)$(UI.Powerline.OK) $(UI.Color.Yellow)[ $(UI.Color.Green)$(UI.Color.Bold)OK$(UI.Color.NoBold) $(UI.Color.Yellow)]$(UI.Color.Default)"
24 | @return
25 | }
26 |
27 | Test.EchoedOK() {
28 | this OK false
29 | }
30 |
31 | Test.Fail() {
32 | [string] line
33 | [string] error
34 | [string] source
35 | echo "$(UI.Color.Red)$(UI.Powerline.Fail) $(UI.Color.Yellow)[$(UI.Color.Red)$(UI.Color.Bold)FAIL$(UI.Color.NoBold)$(UI.Color.Yellow)]$(UI.Color.Default) in $(UI.Color.Yellow)${source}$(UI.Color.Default):$(UI.Color.Blue)${line}$(UI.Color.Default) $(UI.Powerline.RefersTo) $(UI.Color.Red)${error}$(UI.Color.Default)"
36 | @return
37 | }
38 |
39 | Test.DisplaySummary() {
40 | if [[ $(this errors) == true ]]
41 | # if this errors
42 | then
43 | echo "$(UI.Powerline.ArrowLeft) $(UI.Color.Magenta)Completed [$(UI.Color.White)$(this groupName)$(UI.Color.Magenta)]: $(UI.Color.Default)$(UI.Color.Red)There were errors $(UI.Color.Default)$(UI.Powerline.Lightning)"
44 | this errors = false
45 | else
46 | echo "$(UI.Powerline.ArrowLeft) $(UI.Color.Magenta)Completed [$(UI.Color.White)$(this groupName)$(UI.Color.Magenta)]: $(UI.Color.Default)$(UI.Color.Yellow)Test group completed successfully $(UI.Color.Default)$(UI.Powerline.ThumbsUp)"
47 | fi
48 | @return
49 | }
50 |
51 | Test.NewGroup() {
52 | [string] groupName
53 |
54 | echo "$(UI.Powerline.ArrowRight)" $(UI.Color.Magenta)Testing [$(UI.Color.White)${groupName}$(UI.Color.Magenta)]: $(UI.Color.Default)
55 |
56 | this groupName = "$groupName"
57 |
58 | @return
59 | }
60 | }
61 |
62 | Type::InitializeStatic Test
63 |
64 | ### TODO: special case for static classes
65 | ### for storage use a generated variable name (hash of class name?)
66 | ### for execution use class' name, e.g. Test Start
67 |
68 | alias describe='Test NewGroup'
69 | alias summary='Test DisplaySummary'
70 | alias caught="echo \"CAUGHT: $(UI.Color.Red)\$__BACKTRACE_COMMAND__$(UI.Color.Default) in \$__BACKTRACE_SOURCE__:\$__BACKTRACE_LINE__\""
71 | alias it="Test Start it"
72 | alias expectPass="Test OK; catch { Test errors = true; Test Fail \"\${__EXCEPTION__[@]}\"; }"
73 | alias expectOutputPass="Test EchoedOK; catch { Test errors = true; Test Fail; }"
74 | alias expectFail='catch { caught; Test EchoedOK; }; test $? -eq 1 && Test errors = false; '
75 |
--------------------------------------------------------------------------------
/scripts/create_acl_for_luci.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # [CTCGFW]immortalwrt
3 | # Use it under GPLv3, please.
4 | # --------------------------------------------------------
5 | # Script for creating ACL file for each LuCI APP
6 |
7 | error_font="\033[31m[Error]$\033[0m "
8 | success_font="\033[32m[Success]\033[0m "
9 | info_font="\033[36m[Info]\033[0m "
10 |
11 | function echo_green_bg(){
12 | echo -e "\033[42;37m$1\033[0m"
13 | }
14 |
15 | function echo_yellow_bg(){
16 | echo -e "\033[43;37m$1\033[0m"
17 | }
18 |
19 | function echo_red_bg(){
20 | echo -e "\033[41;37m$1\033[0m"
21 | }
22 |
23 | function clean_outdated_files(){
24 | rm -f "create_acl_for_luci.err" "create_acl_for_luci.warn" "create_acl_for_luci.ok"
25 | }
26 |
27 | function check_if_acl_exist(){
28 | ls "$1"/root/usr/share/rpcd/acl.d/*.json >/dev/null 2>&1 && return 0 || return 1
29 | }
30 |
31 | function check_config_files(){
32 | [ "$(find "$1"/root/etc/config/* 2>/dev/null | wc -l)" -ne "1" ] && return 0 || return 1
33 | }
34 |
35 | function get_config_name(){
36 | find "$1"/root/etc/config/* 2>/dev/null | awk -F '/' '{print $NF}'
37 | }
38 |
39 | function create_acl_file(){
40 | mkdir -p "$1"
41 | echo -e "{
42 | \"$2\": {
43 | \"description\": \"Grant UCI access for $2\",
44 | \"read\": {
45 | \"uci\": [ \"$3\" ]
46 | },
47 | \"write\": {
48 | \"uci\": [ \"$3\" ]
49 | }
50 | }
51 | }" > "$1/$2.json"
52 | }
53 |
54 | function auto_create_acl(){
55 | luci_app_list="$(find package -maxdepth 2 | grep -Eo "package/.+/luci-app-[a-zA-Z0-9_-]+" | sort -s)"
56 |
57 | [ "$(echo -e "${luci_app_list}" | wc -l)" -gt "0" ] && for i in ${luci_app_list}
58 | do
59 | if check_if_acl_exist "$i"; then
60 | echo_yellow_bg "$i: has ACL file already, skipping..." | tee -a create_acl_for_luci.warn
61 | elif check_config_files "$i"; then
62 | echo_red_bg "$i: has no/multi config file(s), skipping..." | tee -a create_acl_for_luci.err
63 | else
64 | create_acl_file "$i/root/usr/share/rpcd/acl.d" "${i##*/}" "$(get_config_name "$i")"
65 | echo_green_bg "$i: ACL file has been generated." | tee -a create_acl_for_luci.ok
66 | fi
67 | done
68 | }
69 |
70 | while getopts "achml:n:p:" input_arg
71 | do
72 | case $input_arg in
73 | a)
74 | clean_outdated_files
75 | auto_create_acl
76 | exit
77 | ;;
78 | m)
79 | manual_mode=1
80 | ;;
81 | p)
82 | acl_path="$OPTARG"
83 | ;;
84 | l)
85 | luci_name="$OPTARG"
86 | ;;
87 | n)
88 | conf_name="$OPTARG"
89 | ;;
90 | c)
91 | clean_outdated_files
92 | exit
93 | ;;
94 | h|?|*)
95 | echo -e "${info_font}Usage: $0 [-a|-m (-p ) -l -n |-c]"
96 | exit 2
97 | ;;
98 | esac
99 | done
100 |
101 | [ "$?" -ne "0" ] && exit
102 |
103 | if [ "*${manual_mode}*" == "*1*" ]; then
104 | acl_path="${acl_path:-root/usr/share/rpcd/acl.d}"
105 | if create_acl_file "${acl_path}" "${luci_name}" "${conf_name}"; then
106 | echo -e "${success_font}Output file: $(ls "${acl_path}/${luci_name}.json")"
107 | echo_green_bg "$(cat "${acl_path}/${luci_name}.json")"
108 | echo_green_bg "${luci_name}: ACL file has been generated." >> "create_acl_for_luci.ok"
109 | [ -e "create_acl_for_luci.err" ] && sed -i "/${luci_name}/d" "create_acl_for_luci.err"
110 | else
111 | echo -e "${error_font}Failed to create file ${acl_path}/${luci_name}.json"
112 | echo_red_bg "${luci_name}: Failed to create ACL file." >> "create_acl_for_luci.err"
113 | fi
114 | else
115 | echo -e "${info_font}Usage: $0 [-a|-m -p -l -n |-c]"
116 | exit 2
117 | fi
118 |
--------------------------------------------------------------------------------
/configs/files/usr/lib/OpenWrtScripts/getstats.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | #
3 | # getstats.sh - Collect diagnostic information about OpenWrt
4 | # Write the data to a file (usually /tmp/openwrtstats.txt)
5 | #
6 | # Usage: sh getstats.sh [ "command 1 to be executed" "command 2" "command 3" ... ]
7 | #
8 | # ***** To install and run this script *****
9 | #
10 | # SSH into your router and execute these statements.
11 | #
12 | # ssh root@192.168.1.1
13 | # cd /tmp
14 | # cat > getstats.sh
15 | # [paste in the contents of this file, then hit ^D]
16 | # sh getstats.sh
17 | # The results listed are written to the designated file
18 | # (usually /tmp/openwrtstats.txt, unless redirected)
19 | #
20 | # License: GPL Copyright (c) 2013-2018 Rich Brown
21 | #
22 | # Based on Sebastian Moeller's original set of diagnostic info:
23 | # https://lists.bufferbloat.net/pipermail/cerowrt-devel/2014-April/002871.html
24 | # Based on alexmow's script to list user-installed packages
25 | # https://forum.openwrt.org/t/script-to-list-installed-packages-for-simplifying-sysupgrade/7188/16
26 |
27 | # File that will receive command results
28 | out_fqn=/tmp/openwrtstats.txt
29 |
30 | # ------- display_command() -------
31 | # Format the command results into the output file
32 | # Redirect both standard out and error out to that file.
33 |
34 | display_command() {
35 | echo "[ $1 ]" >> $out_fqn
36 | eval "$1" >> $out_fqn 2>> $out_fqn
37 | echo -e "\n" >> $out_fqn
38 | }
39 |
40 | # ------- display_user_packages() ---------
41 | # Display a list of all packages installed after the kernel was built
42 |
43 | display_user_packages() {
44 | echo "[ User-installed packages ]" >> $out_fqn
45 |
46 | install_time=`opkg status kernel | awk '$1 == "Installed-Time:" { print $2 }'`
47 | opkg status | awk '$1 == "Package:" {package = $2} \
48 | $1 == "Status:" { user_inst = / user/ && / installed/ } \
49 | $1 == "Installed-Time:" && $2 != '$install_time' && user_inst { print package }' | \
50 | sort >> $out_fqn 2>> $out_fqn
51 |
52 | echo -e "\n" >> $out_fqn
53 | }
54 |
55 | # ------- Main Routine -------
56 |
57 | # Examine first argument to see if they're asking for help
58 | if [ "$1" == "-h" ] || [ "$1" == "--help" ]
59 | then
60 | echo 'Usage: sh $0 "command 1 to be executed" "command 2" "command 3" ... '
61 | echo ' '
62 | exit
63 | fi
64 |
65 |
66 | # Write a heading for the file
67 |
68 | echo "===== $0 at `date` =====" > $out_fqn
69 |
70 | # Display four sets of commands:
71 | # 1. Common diagnostic commands
72 | # 2. Additional user-supplied commands (from the command line)
73 | # 3. User-installed opkg packages
74 | # 4. Longer/less common diagnostic output
75 |
76 | # 1. Display the common diagnostic commands
77 | # These are read from the list delimited by "EOF"
78 |
79 | while read LINE; do
80 | display_command "$LINE"
81 | done << EOF
82 | cat /etc/banner
83 | date
84 | cat /etc/openwrt_release
85 | uname -a
86 | uptime
87 | top -b | head -n 20
88 | du -sh / ; du -sh /*
89 | EOF
90 |
91 |
92 | # 2. Extract arguments from the command line and display them.
93 | while [ $# -gt 0 ]
94 | do
95 | display_command "$1"
96 | shift 1
97 | done
98 |
99 | # 3. Display user-installed opkg packages
100 | display_user_packages
101 |
102 | # 4. Display the long/less frequently-needed commands
103 |
104 | while read LINE; do
105 | display_command "$LINE"
106 | done << EOF
107 | ifconfig
108 | logread
109 | dmesg
110 | EOF
111 |
112 | # End the report
113 | echo "===== end of $0 =====" >> $out_fqn
114 |
115 |
116 | #cat $out_fqn
117 | echo "Done... Diagnostic information written to $out_fqn"
118 | echo " "
119 |
120 | # Now press Ctl-D, then type "sh getstats.sh"
121 |
122 |
--------------------------------------------------------------------------------
/doc/installed_pkg_(non_default).txt:
--------------------------------------------------------------------------------
1 | # list up does not depend on any other of the non-default
2 |
3 | wrt32x@/usr/lib/OpenWrtScripts # /usr/local/bin/opkg_list_installed.sh
4 | acme-dnsapi
5 | autocore-arm
6 | base-files
7 | blkid
8 | blockd
9 | bmon
10 | btrfs-progs
11 | busybox
12 | ca-certificates
13 | collectd-mod-cpufreq
14 | collectd-mod-ethstat
15 | collectd-mod-iptables
16 | collectd-mod-openvpn
17 | collectd-mod-sensors
18 | collectd-mod-syslog
19 | collectd-mod-thermal
20 | collectd-mod-vmem
21 | collectd-mod-wireless
22 | coreutils-nohup
23 | coreutils-stat
24 | coreutils-timeout
25 | cpulimit
26 | ddns-scripts-cloudflare
27 | ddns-scripts-noip
28 | dmesg
29 | dropbear
30 | e2fsprogs
31 | firewall
32 | hostip
33 | htop
34 | httping
35 | ip-bridge
36 | ip6tables-legacy
37 | iperf3-ssl
38 | ipset-dns
39 | ipt2socks
40 | iptables-legacy
41 | iptables-mod-condition
42 | iptables-mod-dhcpmac
43 | iptables-mod-filter
44 | iptables-mod-hashlimit
45 | iptables-mod-iface
46 | iptables-mod-ipmark
47 | iptables-mod-iprange
48 | iptables-mod-ipsec
49 | iptables-mod-nat-extra
50 | iptables-mod-physdev
51 | iptables-mod-proto
52 | iptables-mod-socket
53 | iptables-mod-tproxy
54 | iptgeoip
55 | iputils-arping
56 | irqbalance
57 | kernel
58 | kmod
59 | kmod-ata-marvell-sata
60 | kmod-ath9k-htc
61 | kmod-crypto-ecb
62 | kmod-crypto-ecdh
63 | kmod-crypto-sha512
64 | kmod-fs-ext4
65 | kmod-fs-ntfs
66 | kmod-fs-vfat
67 | kmod-gpio-button-hotplug
68 | kmod-hid
69 | kmod-ipt-nathelper-rtsp
70 | kmod-ipt-offload
71 | kmod-nft-offload
72 | kmod-usb-ohci-pci
73 | kmod-usb-storage-extras
74 | kmod-usb-storage-uas
75 | kmod-usb-uhci
76 | kmod-usb2-pci
77 | kmod-usb3
78 | knot-host
79 | libcap-ng
80 | libjpeg-turbo
81 | libnftnl11
82 | libopenssl-devcrypto
83 | libudev-zero
84 | libzstd
85 | logd
86 | lscpu
87 | luabitop
88 | luci-app-argon-config
89 | luci-app-bird1-ipv4
90 | luci-app-cpu-status
91 | luci-app-disks-info
92 | luci-app-dnsmasq-ipset
93 | luci-app-fileassistant
94 | luci-app-log
95 | luci-app-mqos
96 | luci-app-ramfree
97 | luci-app-tcpdump
98 | luci-app-temp-status
99 | luci-app-timecontrol
100 | luci-i18n-acme-en
101 | luci-i18n-adblock-en
102 | luci-i18n-advanced-reboot-en
103 | luci-i18n-banip-en
104 | luci-i18n-base-en
105 | luci-i18n-bcp38-en
106 | luci-i18n-dcwapd-en
107 | luci-i18n-ddns-en
108 | luci-i18n-dnscrypt-proxy-en
109 | luci-i18n-firewall-en
110 | luci-i18n-hd-idle-en
111 | luci-i18n-https-dns-proxy-en
112 | luci-i18n-nlbwmon-en
113 | luci-i18n-omcproxy-en
114 | luci-i18n-openvpn-en
115 | luci-i18n-opkg-en
116 | luci-i18n-qos-en
117 | luci-i18n-rebootschedule-en
118 | luci-i18n-samba4-en
119 | luci-i18n-sqm-en
120 | luci-i18n-statistics-en
121 | luci-i18n-udpxy-en
122 | luci-i18n-uhttpd-en
123 | luci-i18n-upnp-en
124 | luci-i18n-vnstat2-en
125 | luci-i18n-vpn-policy-routing-en
126 | luci-i18n-vpnbypass-en
127 | luci-i18n-watchcat-en
128 | luci-i18n-wifischedule-en
129 | luci-i18n-wireguard-en
130 | luci-i18n-wol-en
131 | luci-ssl-openssl
132 | luci-theme-argon
133 | luci-theme-edge
134 | luci-theme-material
135 | luci-theme-openwrt-2020
136 | more
137 | mount-utils
138 | msmtp
139 | mtd
140 | mtr-json
141 | mwlwifi-firmware-88w8864
142 | mwlwifi-firmware-88w8964
143 | my-default-settings
144 | nano
145 | netdata
146 | netperf
147 | nmap-full
148 | ntfs-3g
149 | odhcp6c
150 | odhcpd-ipv6only
151 | openvpn-easy-rsa
152 | openvpn-openssl
153 | ppp
154 | ppp-mod-pppoe
155 | procd
156 | procd-seccomp
157 | procd-ujail
158 | samba4-utils
159 | sqm-scripts-extra
160 | tar
161 | tc-mod-iptables
162 | tc-tiny
163 | tcping
164 | tree
165 | uboot-envtools
166 | urandom-seed
167 | urngd
168 | usbids
169 | usbutils
170 | wol
171 | wpad-openssl
172 | wsdd2
173 | zoneinfo-core
174 | zoneinfo-europe
175 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/wifi_down.svg:
--------------------------------------------------------------------------------
1 |
2 |
19 |
--------------------------------------------------------------------------------
/configs/files/www/luci-static/resources/netports/icons/wifi_disabled.svg:
--------------------------------------------------------------------------------
1 |
2 |
19 |
--------------------------------------------------------------------------------
/configs/patches/TMP/work/defconfig_hardened:
--------------------------------------------------------------------------------
1 | CONFIG_ARM64_BTI_KERNEL=y
2 | CONFIG_ARM64_EPAN=y
3 | CONFIG_ARM64_MTE=y
4 | CONFIG_ARM64_PAN=y
5 | CONFIG_ARM64_PTR_AUTH=y
6 | CONFIG_ARM64_SW_TTBR0_PAN=y
7 | CONFIG_ARM64_UAO=y
8 | CONFIG_BUG=y
9 | CONFIG_BUG_ON_DATA_CORRUPTION=y
10 | CONFIG_CC_STACKPROTECTOR_STRONG=y
11 | CONFIG_CPU_SW_DOMAIN_PAN=y
12 | CONFIG_DEBUG_CREDENTIALS=y
13 | CONFIG_DEBUG_KERNEL=y
14 | CONFIG_DEBUG_LIST=y
15 | CONFIG_DEBUG_NOTIFIERS=y
16 | CONFIG_DEBUG_RODATA=y
17 | CONFIG_DEBUG_SET_MODULE_RONX=y
18 | CONFIG_DEBUG_SG=y
19 | CONFIG_DEBUG_VIRTUAL=y
20 | CONFIG_TEST_DEBUG_VIRTUAL=n
21 | CONFIG_DEBUG_WX=y
22 | CONFIG_FORTIFY_SOURCE=y
23 | CONFIG_HARDEN_BRANCH_PREDICTOR=y
24 | CONFIG_HARDENED_USERCOPY=y
25 | CONFIG_HARDEN_EL2_VECTORS=y
26 | CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
27 | CONFIG_INIT_ON_FREE_DEFAULT_ON=y
28 | CONFIG_INIT_STACK_ALL=y
29 | CONFIG_INIT_STACK_ALL_ZERO=y
30 | CONFIG_IO_STRICT_DEVMEM=y
31 | CONFIG_IPV6_PRIVACY=y
32 | CONFIG_KAISER=y
33 | CONFIG_KGSL_PER_PROCESS_PAGE_TABLE=y
34 | CONFIG_LEGACY_VSYSCALL_NONE=y
35 | CONFIG_MMC_SECDISCARD=y
36 | CONFIG_PAGE_POISONING=y
37 | CONFIG_PAGE_POISONING_NO_SANITY=y
38 | CONFIG_PAGE_POISONING_ZERO=y
39 | CONFIG_PAGE_TABLE_ISOLATION=y
40 | CONFIG_PANIC_ON_OOPS=y
41 | CONFIG_RANDOMIZE_BASE=y
42 | CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y
43 | CONFIG_RANDOMIZE_MEMORY=y
44 | CONFIG_REFCOUNT_FULL=y
45 | CONFIG_RETPOLINE=y
46 | CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
47 | CONFIG_SCHED_STACK_END_CHECK=y
48 | CONFIG_SECCOMP=y
49 | CONFIG_SECCOMP_FILTER=y
50 | CONFIG_SECURITY=y
51 | CONFIG_SECURITY_DMESG_RESTRICT=y
52 | CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y
53 | CONFIG_SECURITY_YAMA=y
54 | CONFIG_SECURITY_YAMA_STACKED=y
55 | CONFIG_SHUFFLE_PAGE_ALLOCATOR=y
56 | CONFIG_SLAB_FREELIST_HARDENED=y
57 | CONFIG_SLAB_FREELIST_RANDOM=y
58 | CONFIG_SLAB_HARDENED=y
59 | CONFIG_SLUB_HARDENED=y
60 | CONFIG_STACKPROTECTOR_PER_TASK=y
61 | CONFIG_STACKPROTECTOR_STRONG=y
62 | CONFIG_STRICT_DEVMEM=y
63 | CONFIG_STRICT_KERNEL_RWX=y
64 | CONFIG_STRICT_MEMORY_RWX=y
65 | CONFIG_STRICT_MODULE_RWX=y
66 | CONFIG_SYN_COOKIES=y
67 | CONFIG_THREAD_INFO_IN_TASK=y
68 | CONFIG_UNMAP_KERNEL_AT_EL0=y
69 | CONFIG_VMAP_STACK=y
70 | CONFIG_ACPI_APEI_EINJ=n
71 | CONFIG_ACPI_CUSTOM_METHOD=n
72 | CONFIG_ACPI_TABLE_UPGRADE=n
73 | CONFIG_BINFMT_AOUT=n
74 | CONFIG_BINFMT_MISC=n
75 | CONFIG_BLK_DEV_FD=n
76 | CONFIG_BT_HS=n
77 | CONFIG_CHECKPOINT_RESTORE=n
78 | CONFIG_COMPAT_BRK=n
79 | CONFIG_COMPAT_VDSO=n
80 | CONFIG_CP_ACCESS64=n
81 | CONFIG_DEBUG_KMEMLEAK=n
82 | CONFIG_DEVKMEM=n
83 | CONFIG_DEVMEM=n
84 | CONFIG_DEVPORT=n
85 | CONFIG_EARJACK_DEBUGGER=n
86 | CONFIG_HARDENED_USERCOPY_FALLBACK=n
87 | CONFIG_HIBERNATION=n
88 | CONFIG_HWPOISON_INJECT=n
89 | CONFIG_IA32_EMULATION=n
90 | CONFIG_INPUT_EVBUG=n
91 | CONFIG_IOMMU_NON_SECURE=n
92 | CONFIG_IO_URING=n
93 | CONFIG_IP_DCCP=n
94 | CONFIG_IP_SCTP=n
95 | CONFIG_KEXEC=n
96 | CONFIG_KEXEC_FILE=n
97 | CONFIG_KSM=n
98 | CONFIG_LDISC_AUTOLOAD=n
99 | CONFIG_LEGACY_PTYS=n
100 | CONFIG_LIVEPATCH=n
101 | CONFIG_MEM_SOFT_DIRTY=n
102 | CONFIG_MMIOTRACE=n
103 | CONFIG_MMIOTRACE_TEST=n
104 | CONFIG_MODIFY_LDT_SYSCALL=n
105 | CONFIG_MSM_BUSPM_DEV=n
106 | CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG=n
107 | CONFIG_NOTIFIER_ERROR_INJECTION=n
108 | CONFIG_OABI_COMPAT=n
109 | CONFIG_PAGE_OWNER=n
110 | CONFIG_PROC_KCORE=n
111 | CONFIG_PROC_VMCORE=n
112 | CONFIG_RDS=n
113 | CONFIG_RDS_TCP=n
114 | CONFIG_SECURITY_SELINUX_DISABLE=n
115 | CONFIG_SECURITY_WRITABLE_HOOKS=n
116 | CONFIG_SLAB_MERGE_DEFAULT=n
117 | CONFIG_STACKLEAK_METRICS=n
118 | CONFIG_STACKLEAK_RUNTIME_DISABLE=n
119 | CONFIG_TIMER_STATS=n
120 | CONFIG_TSC=n
121 | CONFIG_TSPP2=n
122 | CONFIG_UKSM=n
123 | CONFIG_UPROBES=n
124 | CONFIG_USELIB=n
125 | CONFIG_USERFAULTFD=n
126 | CONFIG_VIDEO_VIVID=n
127 | CONFIG_WLAN_FEATURE_MEMDUMP=n
128 | CONFIG_X86_IOPL_IOPERM=n
129 | CONFIG_X86_PTDUMP=n
130 | CONFIG_X86_VSYSCALL_EMULATION=n
131 | CONFIG_ZSMALLOC_STAT=n
132 | CONFIG_DEFAULT_MMAP_MIN_ADDR=32768
133 | CONFIG_LSM_MMAP_MIN_ADDR=32768
134 |
--------------------------------------------------------------------------------
/configs/files/usr/lib/OpenWrtScripts/tunnelbroker.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Script for configuring OpenWrt to create a new 'henet' interface that
3 | # uses '6in4' encapsulation to send your IPv6 packets inside IPv4 packets.
4 | # It uses Hurricane Electric as the tunnel at http://www.tunnelbroker.net/
5 | #
6 | # There are a few steps to set this up:
7 | # 1) Go to the Tunnelbroker.net site to set up your free account
8 | # 2) From its main page, click "Create Regular Tunnel"
9 | # - Enter your IP address in "IPv4 Endpoint" (paste in the address you're "viewing from")
10 | # - Select a nearby Tunnel Server
11 | # - Click "Create Tunnel"
12 | # 3) On the resulting Tunnel Details page, click "Assign /48" to get a /48 prefix
13 | # 4) From the Tunnel Details page, copy and paste the matching values to the variables below
14 | # Note: The User_Name is the name you used to create the account
15 | # Note: Find the Update_Key on the Advanced Tab of the Tunnel Details page.
16 |
17 | User_Name=abdcef
18 | Tunnel_ID=123456
19 | Server_IPv4_Address=123.45.67.89
20 | Client_IPv6_Address=2001:470:abcd:ef::/64
21 | Routed_48=2001:470:abcd::/48
22 | Update_Key=AbCDeF54321vWxYz
23 |
24 | # 5) Finally, ssh into the router and execute this script with these steps:
25 | #
26 | # ssh root@192.168.1.1 # use your router's address
27 | # cd /tmp
28 | # cat > tunnel.sh
29 | # [paste in the contents of this file, then hit ^D]
30 | # [edit the script to match your tunnelbroker values (see #4 above)]
31 | # sh tunnel.sh
32 | # [Restart your router. This seems to make a difference.]
33 | #
34 | # Presto! Your tunnel is set up. You should now be able
35 | # communicate directly with IPv6 devices.
36 |
37 | # ==============================================
38 | # Download and update all the interesting packages
39 | # Some of these are pre-installed, but there is no
40 | # harm in updating/installing them a second time.
41 | opkg update
42 | opkg install 6in4
43 |
44 | # ==============================================
45 | # Create a 6in4 interface named 'henet' to tunnel IPv6.
46 | #
47 | echo 'Setting up HE.net tunnel'
48 | uci set network.henet=interface
49 | uci set network.henet.proto=6in4
50 | uci set network.henet.peeraddr=$Server_IPv4_Address
51 | uci set network.henet.ip6addr=$Client_IPv6_Address
52 | uci set network.henet.ip6prefix=$Routed_48_Prefix
53 | uci set network.henet.tunnelid=$Tunnel_ID
54 | uci set network.henet.username=$User_Name
55 | uci set network.henet.password=$Update_Key
56 | uci set network.henet.mtu=1424
57 | uci set network.henet.ttl=64
58 | uci commit network
59 |
60 | # ==============================================
61 | # Configure the 6in4-henet interface into the WAN zone (along with wan & wan6)
62 | uci set firewall.@zone[1].network='wan wan6 henet'
63 | uci commit firewall
64 |
65 | # ==============================================
66 | # Invoke the new configuration
67 | echo 'Restarting network...'
68 | /etc/init.d/network restart
69 | echo 'Restarting firewall...'
70 | /etc/init.d/firewall restart
71 |
72 | # Belt and suspenders - you could also restart
73 | echo 'Done. You could also restart the router now to ensure these take effect.'
74 |
75 | # ==============================================
76 | #
77 | # Re-establishing the Tunnel
78 | #
79 | # The automatic re-establishment code of the 6in4 module appears not always to work.
80 | # If the 6in4 tunnel goes down, you may need to re-establish it manually,
81 | # say, when your external IP address changes.
82 | #
83 | # To re-establish the tunnel, simply paste the following URL (with the parameters defined above).
84 | # into your browser. You should get a cryptic "OK" response.
85 | #
86 | # User_Name is your user account name
87 | # Update_Key is the Update Key shown above
88 | # Tunnel_ID is the Tunnel ID
89 | # https://User_Name:Update_Key@ipv4.tunnelbroker.net/nic/update?hostname=Tunnel_ID
90 | #
91 | # --- end of script ---
92 | #
93 | # Final Steps:
94 | # 1) Hit Ctl-D
95 | # 2) Edit six lines of the file (User_Name through Update_Key) to add your tunnelbroker values
96 | # 3) Type: sh tunnel.sh
97 |
--------------------------------------------------------------------------------
/scripts/manual-generate.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Copyright (C) 2006-2021
4 | #
5 | # Updated: 03/11/2022
6 | #
7 | # This program is free software; you can redistribute it and/or modify
8 | # it under the terms of the GNU General Public License as published by
9 | # the Free Software Foundation; either version 2 of the License, or
10 | # (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with this program; if not, write to the Free Software
19 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 | ########################################################################################
21 | # exec 3>&1 1>>${LOG_FILE}
22 | #
23 | # echo -e "${blue} This is stdout"
24 | # echo -e "${blue} This is stderr" 1>&2
25 | # echo -e "${blue} This is the console (fd 3)" 1>&3
26 | # echo -e "${blue} This is both the log and the console":${reset}" | tee /dev/fd/3
27 | #######################################################################################
28 | # RUN This Bash Script to manually run the following scripts below.
29 | # Copy manual-generate.sh to OpenWRT Clone Directory as well as the other
30 | # scripts listed below.
31 | # Then Run This Script: Once menuconfig is showing,
32 | # Make your special changes then save as device needed:
33 | #
34 | ### ============================================= ###
35 |
36 | echo "Make sure you have:"
37 | echo "-------------------"
38 | echo " "
39 | echo "scripts (Directory)"
40 | echo " functions.sh"
41 | echo " fetch_packages.sh"
42 | echo "configs (Directory)"
43 | echo " feeds.conf.default <-- Can use the default version if you want"
44 | echo " wrt32x.config <-- This is needed regardless unless you change the name"
45 | echo " patches (Directory)"
46 | echo " "
47 | sleep 5
48 | ### ------------------------------------------------------------------------------- ###
49 | FILE=functions.sh
50 | if [ ! -f "$FILE" ]; then
51 | echo "$FILE does not exist."
52 | exit
53 | fi
54 | FILE=fetch_packages.sh
55 | if [ ! -f "$FILE" ]; then
56 | echo "$FILE does not exist."
57 | exit
58 | fi
59 | FILE=feeds.conf.default
60 | if [ ! -f "$FILE" ]; then
61 | echo "$FILE does not exist."
62 | exit
63 | fi
64 | FILE=wrtmulti.config
65 | if [ ! -f "$FILE" ]; then
66 | echo "$FILE does not exist. Or Dif device Chosen, Change Name here:"
67 | exit
68 | fi
69 | FILE=patches
70 | if [ ! -d "$FILE" ]; then
71 | echo "$FILE Directory not exist."
72 | exit
73 | fi
74 | ### ------------------------------------------------------------------------------- ###
75 | GITHUB_WORKSPACE=$PWD
76 |
77 |
78 | echo "Cloning from: fetch_packages.sh"
79 | ./fetch_packages.sh
80 |
81 | echo "------------------------------"
82 | echo "Loading Functions into Memory."
83 | echo "------------------------------"
84 | source ./functions.sh
85 |
86 | echo "Delete Not needed or wanted in Packages"
87 | #DELETE_UNWANTED
88 |
89 | echo "Delete Duplicate packages"
90 | #DELETE_DUPLICATES
91 |
92 | echo "Running: update -a, install -a, uninstall bluld"
93 | ./scripts/feeds update -a
94 | ./scripts/feeds install -a
95 | ./scripts/feeds uninstall bluld
96 |
97 | echo "copy wrt32x.config .config for Linksys wrt32x or copy rt3200.config .config for Linksys e8450 (Belkin rt3200)"
98 | echo "default: wrt32x.config (do a manual copy for e8450: cp rt3200.config .config)"
99 | cp wrt32x.config .config
100 |
101 | echo "Applying Patches"
102 | git am patches/*.patch
103 |
104 | echo "Running: functions.sh"
105 | BUILD_USER_DOMAIN
106 | PRE_DEFCONFIG_ADDONS
107 | CCACHE_SETUP
108 | #DEFAULT_THEME_CHANGE
109 | REMOVE_LANGUAGES
110 |
111 | echo "Make Menuconfig"
112 | make menuconfig
113 |
114 | echo "Finished: EXIT"
115 | exit 0
116 |
--------------------------------------------------------------------------------
/scripts/lib/UI/Color.var.sh:
--------------------------------------------------------------------------------
1 | alias UI.Color.IsAvailable='[ $(tput colors 2>/dev/null || echo 0) -ge 16 ] && [ -t 1 ]'
2 | if UI.Color.IsAvailable
3 | then
4 | UI_Color_Default=$'\033[0m'
5 |
6 | UI_Color_Black=$'\033[0;30m'
7 | UI_Color_Red=$'\033[0;31m'
8 | UI_Color_Green=$'\033[0;32m'
9 | UI_Color_Yellow=$'\033[0;33m'
10 | UI_Color_Blue=$'\033[0;34m'
11 | UI_Color_Magenta=$'\033[0;35m'
12 | UI_Color_Cyan=$'\033[0;36m'
13 | UI_Color_LightGray=$'\033[0;37m'
14 |
15 | UI_Color_DarkGray=$'\033[0;90m'
16 | UI_Color_LightRed=$'\033[0;91m'
17 | UI_Color_LightGreen=$'\033[0;92m'
18 | UI_Color_LightYellow=$'\033[0;93m'
19 | UI_Color_LightBlue=$'\033[0;94m'
20 | UI_Color_LightMagenta=$'\033[0;95m'
21 | UI_Color_LightCyan=$'\033[0;96m'
22 | UI_Color_White=$'\033[0;97m'
23 |
24 | # flags
25 | UI_Color_Bold=$'\033[1m'
26 | UI_Color_Dim=$'\033[2m'
27 | UI_Color_Italics=$'\033[3m'
28 | UI_Color_Underline=$'\033[4m'
29 | UI_Color_Blink=$'\033[5m'
30 | UI_Color_Invert=$'\033[7m'
31 | UI_Color_Invisible=$'\033[8m'
32 |
33 | UI_Color_NoBold=$'\033[21m'
34 | UI_Color_NoDim=$'\033[22m'
35 | UI_Color_NoItalics=$'\033[23m'
36 | UI_Color_NoUnderline=$'\033[24m'
37 | UI_Color_NoBlink=$'\033[25m'
38 | UI_Color_NoInvert=$'\033[27m'
39 | UI_Color_NoInvisible=$'\033[28m'
40 | else
41 | UI_Color_Default=""
42 |
43 | UI_Color_Black=""
44 | UI_Color_Red=""
45 | UI_Color_Green=""
46 | UI_Color_Yellow=""
47 | UI_Color_Blue=""
48 | UI_Color_Magenta=""
49 | UI_Color_Cyan=""
50 | UI_Color_LightGray=""
51 |
52 | UI_Color_DarkGray=""
53 | UI_Color_LightRed=""
54 | UI_Color_LightGreen=""
55 | UI_Color_LightYellow=""
56 | UI_Color_LightBlue=""
57 | UI_Color_LightMagenta=""
58 | UI_Color_LightCyan=""
59 | UI_Color_White=""
60 |
61 | # flags
62 | UI_Color_Bold=""
63 | UI_Color_Dim=""
64 | UI_Color_Italics=""
65 | UI_Color_Underline=""
66 | UI_Color_Blink=""
67 | UI_Color_Invert=""
68 | UI_Color_Invisible=""
69 |
70 | UI_Color_NoBold=""
71 | UI_Color_NoDim=""
72 | UI_Color_NoItalics=""
73 | UI_Color_NoUnderline=""
74 | UI_Color_NoBlink=""
75 | UI_Color_NoInvert=""
76 | UI_Color_NoInvisible=""
77 | fi
78 |
79 | alias UI.Powerline.IsAvailable="UI.Color.IsAvailable && test -z \${NO_UNICODE-} && (echo -e $'\u1F3B7' | grep -v F3B7) &> /dev/null"
80 | if UI.Powerline.IsAvailable
81 | then
82 | UI_Powerline_PointingArrow=$'\u27a1'
83 | UI_Powerline_ArrowLeft=$'\ue0b2'
84 | UI_Powerline_ArrowRight=$'\ue0b0'
85 | UI_Powerline_ArrowRightDown=$'\u2198'
86 | UI_Powerline_ArrowDown=$'\u2B07'
87 | UI_Powerline_PlusMinus=$'\ue00b1'
88 | UI_Powerline_Branch=$'\ue0a0'
89 | UI_Powerline_RefersTo=$'\u27a6'
90 | UI_Powerline_OK=$'\u2714'
91 | UI_Powerline_Fail=$'\u2718'
92 | UI_Powerline_Lightning=$'\u26a1'
93 | UI_Powerline_Cog=$'\u2699'
94 | UI_Powerline_Heart=$'\u2764'
95 |
96 | # colorful
97 | UI_Powerline_Star=$'\u2b50'
98 | UI_Powerline_Saxophone=$'\U1F3B7'
99 | UI_Powerline_ThumbsUp=$'\U1F44D'
100 | else
101 | UI_Powerline_PointingArrow="'~'"
102 | UI_Powerline_ArrowLeft="'<'"
103 | UI_Powerline_ArrowRight="'>'"
104 | UI_Powerline_ArrowRightDown="'>'"
105 | UI_Powerline_ArrowDown="'_'"
106 | UI_Powerline_PlusMinus="'+-'"
107 | UI_Powerline_Branch="'|}'"
108 | UI_Powerline_RefersTo="'*'"
109 | UI_Powerline_OK="'+'"
110 | UI_Powerline_Fail="'x'"
111 | UI_Powerline_Lightning="'!'"
112 | UI_Powerline_Cog="'{*}'"
113 | UI_Powerline_Heart="'<3'"
114 |
115 | # colorful
116 | UI_Powerline_Star="'*''"
117 | UI_Powerline_Saxophone="'(YEAH)'"
118 | UI_Powerline_ThumbsUp="'(OK)'"
119 | fi
120 |
121 | UI.Color.Print() {
122 | local -i colorCode="$1"
123 |
124 | if UI.Color.IsAvailable
125 | then
126 | local colorString="\$'\033[${colorCode}m'"
127 | eval echo "${colorString}"
128 | else
129 | echo
130 | fi
131 | }
132 |
133 | UI.Color.256text() {
134 | local -i colorNumber="$1"
135 |
136 | if UI.Color.IsAvailable
137 | then
138 | local colorString="\$'\033[38;5;${colorNumber}m'"
139 | eval echo "${colorString}"
140 | else
141 | echo
142 | fi
143 | }
144 |
145 | UI.Color.256background() {
146 | local -i colorNumber="$1"
147 |
148 | if UI.Color.IsAvailable
149 | then
150 | local colorString="\$'\033[48;5;${colorNumber}m'"
151 | eval echo "${colorString}"
152 | else
153 | echo
154 | fi
155 | }
156 |
--------------------------------------------------------------------------------
/scripts/lib/TypePrimitives/array.sh:
--------------------------------------------------------------------------------
1 | import util/namedParameters util/type Array
2 |
3 | namespace oo/type
4 | ### ARRAY
5 |
6 | ## these three are same as map - make map extend array and merge in the future
7 | array.get() {
8 | @return:value "${this[$1]}"
9 | }
10 |
11 | array.set() {
12 | this["$1"]="$2"
13 |
14 | @return #this
15 | }
16 |
17 | array.delete() {
18 | unset this["$1"]
19 |
20 | @return #this
21 | }
22 |
23 | array.push() {
24 | [...rest] values
25 |
26 | local value
27 |
28 | for value in "${values[@]}"
29 | do
30 | this+=("$value")
31 | done
32 |
33 | @return
34 | }
35 |
36 | array.length() {
37 | local value="${#this[@]}"
38 | @return value
39 | }
40 |
41 | array.contains() {
42 | local element
43 |
44 | @return # is it required? TODO: test
45 |
46 | ## TODO: probably should return a [boolean] type, not normal return
47 |
48 | for element in "${this[@]}"
49 | do
50 | [[ "$element" == "$1" ]] && return 0
51 | done
52 | return 1
53 | }
54 |
55 | array.indexOf() {
56 | # Log this: $(declare -p this)
57 |
58 | local index
59 |
60 | for index in "${!this[@]}"
61 | do
62 | # Log index: $index "${!this[@]}"
63 | # Log value: "${this[$index]}"
64 | [[ "${this[$index]}" == "$1" ]] && @return:value $index && return
65 | done
66 | @return:value -1
67 | }
68 |
69 | array.reverse() {
70 | # Log reversing: $(@get this)
71 | local -i length=${#this[@]} #$(this length)
72 | local -a outArray
73 | local -i indexFromEnd
74 | local -i index
75 |
76 | for index in "${!this[@]}"
77 | do
78 | indexFromEnd=$(( $length - 1 - $index ))
79 | outArray+=( "${this[$indexFromEnd]}" )
80 | done
81 |
82 | @return outArray
83 | }
84 |
85 | array.forEach() {
86 | [string] action
87 |
88 | string item
89 | integer index
90 |
91 | string methodName=__array_forEach_temp_method
92 | eval "$methodName() { $action ; }"
93 |
94 | # DEBUG Console::WriteStdErr "escaping: $methodName() { $action ; }"
95 |
96 | for index in "${!this[@]}"
97 | do
98 | item="${this[$index]}"
99 | # eval "$action"
100 | $methodName "$item" "$index"
101 | done
102 |
103 | unset -f $methodName
104 |
105 | @return
106 | }
107 |
108 | array.map() {
109 | [string] action
110 |
111 | string item
112 | integer index
113 | array out
114 |
115 | string methodName=__array_map_temp_method
116 |
117 | eval "$methodName() { $action ; }"
118 |
119 | for index in "${!this[@]}"
120 | do
121 | item="${this[$index]}"
122 | out[$index]=$($methodName "$item" "$index")
123 | done
124 |
125 | unset -f $methodName
126 |
127 | @return out
128 | }
129 |
130 |
131 | array.concatPush() {
132 | @required [array] concatWithArray
133 |
134 | # TODO: why doesn't this work? seems that it is run in a subshell?
135 | # var: concatWithArray forEach 'var: self push "$(var: item)"'
136 |
137 | local index
138 | for index in "${!concatWithArray[@]}"
139 | do
140 | this push "${concatWithArray[$index]}"
141 | done
142 |
143 | @return
144 | }
145 |
146 | array.concat() {
147 | @required [array] concatWithArray
148 |
149 | array outArray=$(this)
150 |
151 | local index
152 | for index in "${!concatWithArray[@]}"
153 | do
154 | var: outArray push "${concatWithArray[$index]}"
155 | done
156 |
157 | # TODO:
158 | # var: concatWithArray forEach 'var: outArray push "$(var: item)"'
159 |
160 | @return outArray
161 | }
162 |
163 | array.getLastElement() {
164 | @return:value "${this[(${#this[@]}-1)]}"
165 | # alternative in bash 4.2: ${this[-1]}
166 | }
167 |
168 | array.withoutLastElement() {
169 | @return:value "${this[@]:0:(${#this[@]}-1)}"
170 | }
171 |
172 | array.toString() {
173 | [string] separator=$'\n'
174 | @return:value "$(Array::List this "$separator")"
175 | }
176 |
177 | array.toJSON() {
178 | string json=$(this forEach 'printf %s "$(var: item toJSON), "')
179 | @return:value "[${json%,*}]"
180 | }
181 |
182 | array.every() {
183 | [integer] every
184 | [integer] startingIndex
185 |
186 | array returnArray
187 |
188 | local -i count=0
189 |
190 | local index
191 | for index in "${!this[@]}"
192 | do
193 | if [[ $index -eq $(( $every * $count + $startingIndex )) ]]
194 | then
195 | #echo "$index: ${this[$index]}"
196 | returnArray+=( "${this[$index]}" )
197 | count+=1
198 | fi
199 | done
200 |
201 | @return returnArray
202 | }
203 |
204 | Type::InitializePrimitive array
205 |
206 | ### /ARRAY
207 |
--------------------------------------------------------------------------------
/doc/mt6000:
--------------------------------------------------------------------------------
1 | SFO+HFO and WED instead of SQM
2 | SFO: software offloading
3 | WED: https://openwrt.org/toh/linksys/e8450#wireless_ethernet_dispatch_wed_hw_acceleration_for_wireless_clients
4 |
5 |
6 | LUCI:
7 | ====
8 | luci-app-acme
9 | luci-app-attendedsysupgrade
10 | luci-app-banip
11 | luci-app-bcp38
12 | luci-app-dcwapd: https://edgewaterwireless.com/dual-channel-wi-fi-tutorial/
13 | luci-app-dockerman
14 | luci-app-ddns
15 | luci-app-dnscrypt-proxy
16 | luci-app-hd-idle
17 | luci-app-https-dns-proxy
18 | luci-app-irqbalance
19 | luci-app-nft-qos
20 | luci-app-omcproxy
21 | luci-app-opkg
22 | luci-app-pbr
23 | luci-app-samba4
24 | luci-app-sqm
25 | luci-app-upnp
26 | luci-app-watchcat
27 | luci-app-wifischedule
28 | luci-app-wol
29 | luci-mod-admin-full
30 | luci-proto-ppp
31 | luci-ssl
32 |
33 | Estadisticas
34 | ============
35 | luci-app-statistics
36 | collectd-mod-cpufreq
37 | collectd-mod-thermal
38 | collectd-mod-ethstat
39 | collectd-mod-iptables
40 | collectd-mod-openvpn (doesn't work)
41 | collectd-mod-sensors
42 | collectd-mod-syslog
43 | collectd-mod-vmem
44 | collectd-mod-wireless
45 | luci-app-vnstat2
46 | luci-app-nlbwmon
47 | htop
48 | iperf3
49 | netperf
50 |
51 | Wireguard
52 | =========
53 | wireguard-tools
54 | luci-proto-wireguard
55 | luci-app-wireguard
56 | kmod-wireguard
57 |
58 | OpenVPN client/server
59 | =====================
60 | openvpn-openssl
61 | openvpn-easy-rsa
62 | luci-app-openvpn
63 | kmod-tun
64 |
65 | Softether
66 | =========
67 | luci-app-softether
68 | softethervpn5-client
69 |
70 | USB Storage
71 | ===========
72 | kmod-usb-storage
73 | kmod-usb-storage-extras
74 | kmod-usb-storage-uas
75 | kmod-usb-ohci
76 | kmod-usb-uhci
77 | kmod-usb2
78 | kmod-usb3
79 | kmod-fs-ext4
80 | kmod-fs-vfat
81 | kmod-fs-ntfs
82 | kmod-scsi-core
83 | kmod-nls-cp437
84 | kmod-nls-iso8859-1
85 | block-mount
86 | e2fsprogs
87 | usbutils
88 | usbids
89 | ntfs-3g
90 |
91 | Temas
92 | =====
93 | luci-theme-material
94 | luci-theme-bootstrap
95 |
96 | file manager/system bins
97 | ========================
98 | attr
99 | dmesg
100 | fdisk
101 | gzip
102 | nano
103 | more
104 |
105 | varios:
106 | ======
107 | acme-acmesh
108 | acme-acmesh-dnsapi
109 | adguardhome
110 | auc
111 | ca-certificates
112 | irqbalance
113 | ddns-scripts-cloudflare
114 | ddns-scripts-noip
115 | msmtp
116 | nmap-full
117 | samba4-utils
118 | sysfsutils
119 | tcpdump
120 | zoneinfo-europe
121 |
122 | lede:
123 | luci-app-fileassistant
124 | luci-app-mqos
125 | luci-app-cpu-status
126 | luci-app-cpu-perf
127 | luci-app-disks-info
128 | luci-app-log
129 | luci-app-ramfree
130 | luci-app-temp-status
131 | luci-app-tcpdump
132 | luci-app-timecontrol
133 | luci-theme-argon
134 |
135 | Also, if you configure Adguard Home to listen on br-lan then this patch 8 seems to be necessary, otherwise the service starts too early and then fails
136 | https://github.com/openwrt/packages/pull/22211
137 |
138 | https://openwrt.org/toh/gl.inet/gl-mt6000
139 |
140 | 1) Remove Power from the router
141 | 2) Press and Hold the reset button
142 | 3) Apply power whilst still holding the reset button
143 | 4) After 5 seconds head to http://192.168.1.1
144 | 5) Flash OpenWRT https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/openwrt-mediatek-filogic-glinet_gl-mt6000-squashfs-sysupgrade.bin
145 |
146 | listado en horizontal
147 | luci-app-acme luci-app-attendedsysupgrade luci-app-banip luci-app-bcp38 luci-app-dcwapd luci-app-dockerman luci-app-ddns luci-app-dnscrypt-proxy luci-app-hd-idle luci-app-https-dns-proxy luci-app-irqbalance luci-app-nft-qos luci-app-omcproxy luci-app-opkg luci-app-pbr luci-app-samba4 luci-app-sqm luci-app-upnp luci-app-watchcat luci-app-wifischedule luci-app-wol luci-mod-admin-full luci-proto-ppp luci-ssl luci-app-statistics collectd-mod-cpufreq collectd-mod-thermal collectd-mod-ethstat collectd-mod-iptables collectd-mod-openvpn collectd-mod-sensors collectd-mod-syslog collectd-mod-vmem collectd-mod-wireless luci-app-vnstat2 luci-app-nlbwmon htop iperf3 netperf wireguard-tools luci-proto-wireguard luci-app-wireguard kmod-wireguard openvpn-openssl openvpn-easy-rsa luci-app-openvpn kmod-tun luci-app-softether softethervpn5-client kmod-usb-storage kmod-usb-storage-extras kmod-usb-storage-uas kmod-usb-ohci kmod-usb-uhci kmod-usb2 kmod-usb3 kmod-fs-ext4 kmod-fs-vfat kmod-fs-ntfs kmod-scsi-core kmod-nls-cp437 kmod-nls-iso8859-1 block-mount e2fsprogs usbutils usbids ntfs-3g luci-theme-material luci-theme-bootstrap attr dmesg fdisk gzip nano more acme-acmesh acme-acmesh-dnsapi adguardhome auc ca-certificates irqbalance ddns-scripts-cloudflare ddns-scripts-noip msmtp nmap-full samba4-utils sysfsutils tcpdump zoneinfo-europe
148 |
149 |
--------------------------------------------------------------------------------
/doc/installed_pkg_(manual_list).txt:
--------------------------------------------------------------------------------
1 | ==============================
2 | = Manual listing by category =
3 | ==============================
4 |
5 | ('-' means package explicitly deleted)
6 |
7 | USB Storage
8 | ===========
9 | kmod-usb-storage
10 | kmod-usb-storage-extras
11 | kmod-usb-storage-uas
12 | kmod-usb-ohci
13 | kmod-usb-ohci-pci
14 | kmod-usb-uhci
15 | kmod-usb2
16 | kmod-usb2-pci
17 | kmod-usb3
18 | kmod-fs-ext4
19 | kmod-fs-vfat
20 | kmod-fs-ntfs
21 | kmod-scsi-core
22 | kmod-nls-base
23 | kmod-nls-cp437
24 | kmod-nls-iso8859-1
25 | kmod-nls-utf8
26 | block-mount
27 | e2fsprogs
28 | usbutils
29 | usbids
30 | ntfs-3g
31 |
32 | Wireguard
33 | =========
34 | wireguard-tools
35 | luci-proto-wireguard
36 | luci-app-wireguard
37 | kmod-wireguard
38 |
39 | OpenVPN client/server
40 | =====================
41 | openvpn-openssl
42 | openvpn-easy-rsa
43 | luci-app-openvpn
44 | luci-app-openvpn-server
45 |
46 | Atheros AR9271 WTXUP 802.11n Driver (USB Wifi)
47 | ==============================================
48 | ath9k-htc-firmware
49 | kmod-ath
50 | kmod-ath9k-common
51 | kmod-ath9k-htc
52 |
53 | NetData
54 | =======
55 | netdata
56 | - luci-app-netdata (do not install, does not work with firefox, to enter netdata you have to do it from outside --> http://ip:1999)
57 | bash
58 | coreutils-timeout
59 | curl
60 |
61 | LuCI Apps (not mentioned above)
62 | =============================
63 | luci-app-argon-config
64 | luci-app-cpu-status
65 | luci-app-cpu-perf
66 | luci-app-disks-info
67 | luci-app-fileassistant
68 | luci-app-log
69 | luci-app-mqos
70 | luci-app-ramfree
71 | luci-app-temp-status
72 | luci-app-acme
73 | luci-app-adblock
74 | luci-app-advanced-reboot
75 | luci-app-banip
76 | luci-app-bird1-ipv4
77 | luci-app-bcp38
78 | luci-app-dcwapd
79 | luci-app-ddns
80 | luci-app-dnscrypt-proxy
81 | luci-app-firewall
82 | luci-app-hd-idle
83 | luci-app-https-dns-proxy
84 | luci-app-nlbwmon
85 | luci-app-omcproxy
86 | luci-app-opkg
87 | luci-app-qos
88 | luci-app-rebootschedule (from https://github.com/ferboiar/luci-app-rebootschedule)
89 | luci-app-sqm
90 | luci-app-samba4
91 | luci-app-statistics
92 | luci-app-tcpdump
93 | luci-app-timecontrol
94 | luci-app-uhttpd
95 | luci-app-upnp
96 | luci-app-udpxy
97 | luci-app-vnstat2
98 | luci-app-vpn-policy-routing
99 | luci-app-vpnbypass
100 | luci-app-watchcat
101 | luci-app-wifischedule
102 | luci-app-wol
103 |
104 | LuCI Themes
105 | ===========
106 | luci-theme-argon
107 | luci-theme-bootstrap (dark and light new ones)
108 | luci-theme-edge
109 | luci-theme-material
110 | luci-theme-openwrt-2020
111 | luci-theme-openwrt
112 |
113 | file manager/system bins
114 | ========================
115 | attr
116 | dmesg
117 | fdisk
118 | gzip
119 | nano
120 |
121 | various
122 | =======
123 | acme-dnsapi
124 | base-files
125 | blockd
126 | busybox
127 | ca-certificates
128 | collectd
129 | collectd-mod-cpu
130 | collectd-mod-cpufreq
131 | collectd-mod-ethstat
132 | collectd-mod-interface
133 | collectd-mod-iptables
134 | collectd-mod-iwinfo
135 | collectd-mod-load
136 | collectd-mod-memory
137 | collectd-mod-network
138 | collectd-mod-openvpn (doesn't work)
139 | collectd-mod-rrdtool
140 | collectd-mod-sensors
141 | collectd-mod-syslog
142 | collectd-mod-thermal
143 | collectd-mod-vmem
144 | collectd-mod-wireless
145 | coreutils-nohup
146 | cpulimit
147 | ddns-scripts-cloudflare
148 | ddns-scripts-noip
149 | dnsmasq
150 | dropbear
151 | etherwake (required for Wake on LAN, this or WoL)
152 | htop
153 | ip-bridge
154 | iperf3
155 | irqbalance
156 | kmod
157 | kmod-ata-marvell-sata
158 | kmod-ipt-nathelper-rtsp
159 | knot-host (for ddns)
160 | more
161 | msmtp (required for banip and adblock)
162 | mtd
163 | mtr-json
164 | mwlwifi-firmware-88w8964
165 | nmap-full
166 | netperf
167 | odhcp6c
168 | odhcpd-ipv6only
169 | ppp
170 | ppp-mod-pppoe
171 | procd
172 | samba4-utils
173 | sysfsutils
174 | tcping
175 | tc-tiny
176 | tcpdump (required for banip and adblock)
177 | uboot-envtools
178 | uci
179 | urandom-seed
180 | urngd
181 | wol
182 | wpad-openssl
183 | wsdd2
184 | zoneinfo-europe
185 |
186 | -luci-ssl (openssl instead of wolfssl)
187 | -libustream-wolfssl
188 | -wpad-basic-wolfssl
189 | -px5g-wolfssl
190 |
191 | -libwolfssl*
192 | CONFIG_PACKAGE_curl=y
193 | CONFIG_LIBCURL_OPENSSL=y
194 | luci
195 | luci-ssl-openssl
196 | libustream-openssl
197 |
198 | openssl support: https://forum.openwrt.org/t/purefusion-wrt3200acm-wrt32x-wrt1200ac-wrt1900acs-wrt1900acv1-wrt1900acv2-builds/100399/45
199 |
200 | without bluetooth (https://forum.openwrt.org/t/purefusion-wrt3200acm-wrt32x-wrt1200ac-wrt1900acs-wrt1900acv1-wrt1900acv2-builds/100399/102)
201 | -kmod-bluetooth
202 | -kmod-btmrvl
203 | -kmod-mmc
204 | -kmod-mwifiex-sdio
205 | -mwifiex-sdio-firmware
206 |
--------------------------------------------------------------------------------
/scripts/lib/util/log.sh:
--------------------------------------------------------------------------------
1 | import util/bash4
2 | import UI/Color UI/Console
3 |
4 | declare -Ag __oo__logScopes
5 | declare -Ag __oo__logScopeOutputs
6 | declare -Ag __oo__logDisabledFilter
7 | declare -Ag __oo__loggers
8 |
9 | Log::NameScope() {
10 | local scopeName="$1"
11 | local script="${BASH_SOURCE[1]}"
12 | __oo__logScopes["$script"]="$scopeName"
13 | }
14 |
15 | Log::AddOutput() {
16 | local scopeName="$1"
17 | local outputType="${2:-STDERR}"
18 | __oo__logScopeOutputs["$scopeName"]+="$outputType;"
19 | }
20 |
21 | Log::ResetOutputsAndFilters() {
22 | local scopeName="$1"
23 | unset __oo__logScopeOutputs["$scopeName"]
24 | unset __oo__logDisabledFilter["$scopeName"]
25 | }
26 |
27 | Log::ResetAllOutputsAndFilters() {
28 | unset __oo__logScopeOutputs
29 | unset __oo__logDisabledFilter
30 | declare -Ag __oo__logScopeOutputs
31 | declare -Ag __oo__logDisabledFilter
32 | }
33 |
34 | Log::DisableFilter() {
35 | __oo__logDisabledFilter["$1"]=true
36 | }
37 |
38 | Log() {
39 | local callingFunction="${FUNCNAME[1]}"
40 | local callingScript="${BASH_SOURCE[1]}"
41 | local scope
42 | if [[ ! -z "${__oo__logScopes["$callingScript"]}" ]]
43 | then
44 | scope="${__oo__logScopes["$callingScript"]}"
45 | else # just the filename without extension
46 | scope="${callingScript##*/}"
47 | scope="${scope%.*}"
48 | fi
49 | local loggerList
50 | local loggers
51 | local logger
52 | local logged
53 |
54 | if [[ ! -z "$subject" ]]
55 | then
56 | if [[ ! -z "${__oo__logScopeOutputs["$scope/$callingFunction/$subject"]}" ]]
57 | then
58 | loggerList="${__oo__logScopeOutputs["$scope/$callingFunction/$subject"]}"
59 | elif [[ ! -z "${__oo__logScopeOutputs["$scope/$subject"]}" ]]
60 | then
61 | loggerList="${__oo__logScopeOutputs["$scope/$subject"]}"
62 | elif [[ ! -z "${__oo__logScopeOutputs["$subject"]}" ]]
63 | then
64 | loggerList="${__oo__logScopeOutputs["$subject"]}"
65 | fi
66 |
67 | loggers=( ${loggerList//;/ } )
68 | for logger in "${loggers[@]}"
69 | do
70 | subject="${subject:-LOG}" Log::Using "$logger" "$@"
71 | logged=true
72 | done
73 | fi
74 |
75 | if [[ ! -z "${__oo__logScopeOutputs["$scope/$callingFunction"]}" ]]
76 | then
77 | if [[ -z $logged ]] || [[ ${__oo__logDisabledFilter["$scope/$callingFunction"]} == true || ${__oo__logDisabledFilter["$scope"]} == true ]]
78 | then
79 | loggerList="${__oo__logScopeOutputs["$scope/$callingFunction"]}"
80 | loggers=( ${loggerList//;/ } )
81 | for logger in "${loggers[@]}"
82 | do
83 | subject="${subject:-LOG}" Log::Using "$logger" "$@"
84 | logged=true
85 | done
86 | fi
87 | fi
88 |
89 | if [[ ! -z "${__oo__logScopeOutputs["$scope"]}" ]]
90 | then
91 | if [[ -z $logged ]] || [[ ${__oo__logDisabledFilter["$scope"]} == true ]]
92 | then
93 | loggerList="${__oo__logScopeOutputs["$scope"]}"
94 | loggers=( ${loggerList//;/ } )
95 | for logger in "${loggers[@]}"
96 | do
97 | subject="${subject:-LOG}" Log::Using "$logger" "$@"
98 | done
99 | fi
100 | fi
101 | }
102 |
103 | Log::RegisterLogger() {
104 | local logger="$1"
105 | local method="$2"
106 | __oo__loggers["$logger"]="$method"
107 | }
108 |
109 | Log::Using() {
110 | local logger="$1"
111 | shift
112 | if [[ ! -z ${__oo__loggers["$logger"]} ]]
113 | then
114 | ${__oo__loggers["$logger"]} "$@"
115 | fi
116 | }
117 |
118 | Logger::DEBUG() {
119 | Console::WriteStdErrAnnotated "${BASH_SOURCE[3]##*/}" ${BASH_LINENO[2]} $(UI.Color.Yellow) DEBUG "$@"
120 | }
121 | Logger::ERROR() {
122 | Console::WriteStdErrAnnotated "${BASH_SOURCE[3]##*/}" ${BASH_LINENO[2]} $(UI.Color.Red) ERROR "$@"
123 | }
124 | Logger::INFO() {
125 | Console::WriteStdErrAnnotated "${BASH_SOURCE[3]##*/}" ${BASH_LINENO[2]} $(UI.Color.Blue) INFO "$@"
126 | }
127 | Logger::WARN() {
128 | Console::WriteStdErrAnnotated "${BASH_SOURCE[3]##*/}" ${BASH_LINENO[2]} $(UI.Color.Yellow) WARN "$@"
129 | }
130 | Logger::CUSTOM() {
131 | Console::WriteStdErr "$(UI.Color.Yellow)[${subject^^}] $(UI.Color.Default)$* "
132 | }
133 | Logger::DETAILED() {
134 | Console::WriteStdErrAnnotated "${BASH_SOURCE[3]##*/}" ${BASH_LINENO[2]} $(UI.Color.Yellow) "${subject^^}" "$@"
135 | }
136 |
137 | Log::RegisterLogger STDERR Console::WriteStdErr
138 | Log::RegisterLogger DEBUG Logger::DEBUG
139 | Log::RegisterLogger ERROR Logger::ERROR
140 | Log::RegisterLogger INFO Logger::INFO
141 | Log::RegisterLogger WARN Logger::WARN
142 | Log::RegisterLogger CUSTOM Logger::CUSTOM
143 | Log::RegisterLogger DETAILED Logger::DETAILED
144 |
145 | alias namespace="Log::NameScope"
146 | namespace oo/log
147 |
--------------------------------------------------------------------------------
/configs/patches/OFF/0002-kernel-generic-5.4-config-hardening.patch:
--------------------------------------------------------------------------------
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 | From: Tad
3 | Date: Thu, 3 Dec 2020 04:31:48 -0500
4 | Subject: [PATCH] kernel: generic 5.4: config hardening
5 |
6 | Enables various security options.
7 | Disables various high-risk bits.
8 |
9 | Signed-off-by: Tad
10 | ---
11 | target/linux/generic/config-5.4 | 133 ++++++++++++++++++++++++++++++++
12 | 1 file changed, 133 insertions(+)
13 |
14 | diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4
15 | index bf2b462529..688411ab4d 100644
16 | --- a/target/linux/generic/config-5.4
17 | +++ b/target/linux/generic/config-5.4
18 | @@ -6581,3 +6581,136 @@ CONFIG_ZONE_DMA=y
19 | # CONFIG_ZRAM_MEMORY_TRACKING is not set
20 | # CONFIG_ZSMALLOC is not set
21 | # CONFIG_ZX_TDM is not set
22 | +CONFIG_ARM64_BTI_KERNEL=y
23 | +CONFIG_ARM64_EPAN=y
24 | +CONFIG_ARM64_MTE=y
25 | +CONFIG_ARM64_PAN=y
26 | +CONFIG_ARM64_PTR_AUTH=y
27 | +CONFIG_ARM64_SW_TTBR0_PAN=y
28 | +CONFIG_ARM64_UAO=y
29 | +CONFIG_BUG=y
30 | +CONFIG_BUG_ON_DATA_CORRUPTION=y
31 | +CONFIG_CC_STACKPROTECTOR_STRONG=y
32 | +CONFIG_CPU_SW_DOMAIN_PAN=y
33 | +CONFIG_DEBUG_CREDENTIALS=y
34 | +CONFIG_DEBUG_KERNEL=y
35 | +CONFIG_DEBUG_LIST=y
36 | +CONFIG_DEBUG_NOTIFIERS=y
37 | +CONFIG_DEBUG_RODATA=y
38 | +CONFIG_DEBUG_SET_MODULE_RONX=y
39 | +CONFIG_DEBUG_SG=y
40 | +CONFIG_DEBUG_VIRTUAL=y
41 | +CONFIG_TEST_DEBUG_VIRTUAL=n
42 | +CONFIG_DEBUG_WX=y
43 | +CONFIG_FORTIFY_SOURCE=y
44 | +CONFIG_HARDEN_BRANCH_PREDICTOR=y
45 | +CONFIG_HARDENED_USERCOPY=y
46 | +CONFIG_HARDEN_EL2_VECTORS=y
47 | +CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
48 | +CONFIG_INIT_ON_FREE_DEFAULT_ON=y
49 | +CONFIG_INIT_STACK_ALL=y
50 | +CONFIG_INIT_STACK_ALL_ZERO=y
51 | +CONFIG_IO_STRICT_DEVMEM=y
52 | +CONFIG_IPV6_PRIVACY=y
53 | +CONFIG_KAISER=y
54 | +CONFIG_KGSL_PER_PROCESS_PAGE_TABLE=y
55 | +CONFIG_LEGACY_VSYSCALL_NONE=y
56 | +CONFIG_MMC_SECDISCARD=y
57 | +CONFIG_PAGE_POISONING=y
58 | +CONFIG_PAGE_POISONING_NO_SANITY=y
59 | +CONFIG_PAGE_POISONING_ZERO=y
60 | +CONFIG_PAGE_TABLE_ISOLATION=y
61 | +CONFIG_PANIC_ON_OOPS=y
62 | +CONFIG_RANDOMIZE_BASE=y
63 | +CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y
64 | +CONFIG_RANDOMIZE_MEMORY=y
65 | +CONFIG_REFCOUNT_FULL=y
66 | +CONFIG_RETPOLINE=y
67 | +CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
68 | +CONFIG_SCHED_STACK_END_CHECK=y
69 | +CONFIG_SECCOMP=y
70 | +CONFIG_SECCOMP_FILTER=y
71 | +CONFIG_SECURITY=y
72 | +CONFIG_SECURITY_DMESG_RESTRICT=y
73 | +CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y
74 | +CONFIG_SECURITY_YAMA=y
75 | +CONFIG_SECURITY_YAMA_STACKED=y
76 | +CONFIG_SHUFFLE_PAGE_ALLOCATOR=y
77 | +CONFIG_SLAB_FREELIST_HARDENED=y
78 | +CONFIG_SLAB_FREELIST_RANDOM=y
79 | +CONFIG_SLAB_HARDENED=y
80 | +CONFIG_SLUB_HARDENED=y
81 | +CONFIG_STACKPROTECTOR_PER_TASK=y
82 | +CONFIG_STACKPROTECTOR_STRONG=y
83 | +CONFIG_STRICT_DEVMEM=y
84 | +CONFIG_STRICT_KERNEL_RWX=y
85 | +CONFIG_STRICT_MEMORY_RWX=y
86 | +CONFIG_STRICT_MODULE_RWX=y
87 | +CONFIG_SYN_COOKIES=y
88 | +CONFIG_THREAD_INFO_IN_TASK=y
89 | +CONFIG_UNMAP_KERNEL_AT_EL0=y
90 | +CONFIG_VMAP_STACK=y
91 | +CONFIG_ACPI_APEI_EINJ=n
92 | +CONFIG_ACPI_CUSTOM_METHOD=n
93 | +CONFIG_ACPI_TABLE_UPGRADE=n
94 | +CONFIG_BINFMT_AOUT=n
95 | +CONFIG_BINFMT_MISC=n
96 | +CONFIG_BLK_DEV_FD=n
97 | +CONFIG_BT_HS=n
98 | +CONFIG_CHECKPOINT_RESTORE=n
99 | +CONFIG_COMPAT_BRK=n
100 | +CONFIG_COMPAT_VDSO=n
101 | +CONFIG_CP_ACCESS64=n
102 | +CONFIG_DEBUG_KMEMLEAK=n
103 | +CONFIG_DEVKMEM=n
104 | +CONFIG_DEVMEM=n
105 | +CONFIG_DEVPORT=n
106 | +CONFIG_EARJACK_DEBUGGER=n
107 | +CONFIG_HARDENED_USERCOPY_FALLBACK=n
108 | +CONFIG_HIBERNATION=n
109 | +CONFIG_HWPOISON_INJECT=n
110 | +CONFIG_IA32_EMULATION=n
111 | +CONFIG_INPUT_EVBUG=n
112 | +CONFIG_IOMMU_NON_SECURE=n
113 | +CONFIG_IO_URING=n
114 | +CONFIG_IP_DCCP=n
115 | +CONFIG_IP_SCTP=n
116 | +CONFIG_KEXEC=n
117 | +CONFIG_KEXEC_FILE=n
118 | +CONFIG_KSM=n
119 | +CONFIG_LDISC_AUTOLOAD=n
120 | +CONFIG_LEGACY_PTYS=n
121 | +CONFIG_LIVEPATCH=n
122 | +CONFIG_MEM_SOFT_DIRTY=n
123 | +CONFIG_MMIOTRACE=n
124 | +CONFIG_MMIOTRACE_TEST=n
125 | +CONFIG_MODIFY_LDT_SYSCALL=n
126 | +CONFIG_MSM_BUSPM_DEV=n
127 | +CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG=n
128 | +CONFIG_NOTIFIER_ERROR_INJECTION=n
129 | +CONFIG_OABI_COMPAT=n
130 | +CONFIG_PAGE_OWNER=n
131 | +CONFIG_PROC_KCORE=n
132 | +CONFIG_PROC_VMCORE=n
133 | +CONFIG_RDS=n
134 | +CONFIG_RDS_TCP=n
135 | +CONFIG_SECURITY_SELINUX_DISABLE=n
136 | +CONFIG_SECURITY_WRITABLE_HOOKS=n
137 | +CONFIG_SLAB_MERGE_DEFAULT=n
138 | +CONFIG_STACKLEAK_METRICS=n
139 | +CONFIG_STACKLEAK_RUNTIME_DISABLE=n
140 | +CONFIG_TIMER_STATS=n
141 | +CONFIG_TSC=n
142 | +CONFIG_TSPP2=n
143 | +CONFIG_UKSM=n
144 | +CONFIG_UPROBES=n
145 | +CONFIG_USELIB=n
146 | +CONFIG_USERFAULTFD=n
147 | +CONFIG_VIDEO_VIVID=n
148 | +CONFIG_WLAN_FEATURE_MEMDUMP=n
149 | +CONFIG_X86_IOPL_IOPERM=n
150 | +CONFIG_X86_PTDUMP=n
151 | +CONFIG_X86_VSYSCALL_EMULATION=n
152 | +CONFIG_ZSMALLOC_STAT=n
153 | +CONFIG_DEFAULT_MMAP_MIN_ADDR=32768
154 | +CONFIG_LSM_MMAP_MIN_ADDR=32768
155 |
--------------------------------------------------------------------------------
/scripts/lib/util/variable.sh:
--------------------------------------------------------------------------------
1 | import util/command
2 | namespace util/variable
3 |
4 | declare __declaration_type ## for Variable::ExportDeclarationAndTypeToVariables (?)
5 |
6 | Variable::Exists() {
7 | local variableName="$1"
8 | declare -p "$variableName" &> /dev/null
9 | }
10 |
11 | Variable::GetAllStartingWith() {
12 | local startsWith="$1"
13 | compgen -A 'variable' "$startsWith" || true
14 | }
15 |
16 | Variable::GetDeclarationFlagFromType() {
17 | DEBUG subject="GetParamFromType" Log 'getting param from type' "$@"
18 |
19 | local typeInfo="$1"
20 | local fallback="$2"
21 |
22 | if [[ "$typeInfo" == "map" ]] || Function::Exists "class:${typeInfo}"
23 | then
24 | echo A
25 | else
26 | case "$typeInfo" in
27 | "reference")
28 | echo n
29 | ;;
30 | "array")
31 | echo a
32 | ;;
33 | "string" | "boolean")
34 | echo -
35 | ;;
36 | "integer")
37 | echo i
38 | ;;
39 | "integerArray")
40 | echo ai
41 | ;;
42 | *)
43 | echo "${fallback:-A}"
44 | ;;
45 | esac
46 | fi
47 | }
48 |
49 | Variable::GetPrimitiveTypeFromDeclarationFlag() {
50 | local typeInfo="$1"
51 |
52 | case "$typeInfo" in
53 | "n"*)
54 | echo reference
55 | ;;
56 | "a"*)
57 | echo array
58 | ;;
59 | "A"*)
60 | echo map
61 | ;;
62 | "i"*)
63 | echo integer
64 | ;;
65 | "ai"*)
66 | echo integerArray
67 | ;;
68 | "Ai"*)
69 | echo integerMap
70 | ;;
71 | *)
72 | echo string
73 | ;;
74 | esac
75 | }
76 |
77 | Variable::ExportDeclarationAndTypeToVariables() {
78 | local variableName="$1"
79 | local targetVariable="$2"
80 | local dereferrence="${3:-true}"
81 |
82 | # TODO: rename for a safer, less common variablename so parents can output to declaration
83 | local declaration
84 | local regexArray="declare -([a-zA-Z-]+) $variableName='(.*)'"
85 | local regex="declare -([a-zA-Z-]+) $variableName=\"(.*)\""
86 | local regexArrayBash4_4="declare -([a-zA-Z-]+) $variableName=(.*)"
87 | local definition=$(declare -p $variableName 2> /dev/null || true)
88 |
89 | local escaped="'\\\'"
90 | local escapedQuotes='\\"'
91 | local singleQuote='"'
92 |
93 | local doubleSlashes='\\\\'
94 | local singleSlash='\'
95 |
96 | [[ -z "$definition" ]] && e="Variable $variableName not defined" throw
97 |
98 | if [[ "$definition" =~ $regexArray ]]
99 | then
100 | declaration="${BASH_REMATCH[2]//$escaped/}"
101 | elif [[ "$definition" =~ $regex ]]
102 | then
103 | declaration="${BASH_REMATCH[2]//$escaped/}" ## TODO: is this transformation needed?
104 | declaration="${declaration//$escapedQuotes/$singleQuote}"
105 | declaration="${declaration//$doubleSlashes/$singleSlash}"
106 | elif [[ "$definition" =~ $regexArrayBash4_4 ]]
107 | then
108 | declaration="${BASH_REMATCH[2]}"
109 | fi
110 |
111 | local variableType
112 |
113 | DEBUG Log "Variable Is $variableName = $definition ==== ${BASH_REMATCH[1]}"
114 |
115 | local primitiveType=${BASH_REMATCH[1]}
116 |
117 | local objectTypeIndirect="$variableName[__object_type]"
118 | if [[ "$primitiveType" =~ [A] && ! -z "${!objectTypeIndirect}" ]]
119 | then
120 | DEBUG Log "Object Type $variableName[__object_type] = ${!objectTypeIndirect}"
121 | variableType="${!objectTypeIndirect}"
122 | # elif [[ ! -z ${__primitive_extension_fingerprint__boolean+x} && "$primitiveType" == '-' && "${!variableName}" == "${__primitive_extension_fingerprint__boolean}"* ]]
123 | # then
124 | # variableType="boolean"
125 | else
126 | variableType="$(Variable::GetPrimitiveTypeFromDeclarationFlag "$primitiveType")"
127 | DEBUG Log "Primitive Type $primitiveType Resolved ${variableType}"
128 | fi
129 |
130 | if [[ "$variableType" == 'string' ]] && Function::Exists 'Type::GetPrimitiveExtensionFromVariable'
131 | then
132 | local extensionType=$(Type::GetPrimitiveExtensionFromVariable "${variableName}")
133 | if [[ ! -z "$extensionType" ]]
134 | then
135 | variableType="$extensionType"
136 | fi
137 | fi
138 |
139 | DEBUG Log "Variable $variableName is typeof $variableType"
140 |
141 | if [[ "$variableType" == 'reference' && "$dereferrence" == 'true' ]]
142 | then
143 | local dereferrencedVariableName="$declaration"
144 | Variable::ExportDeclarationAndTypeToVariables "$dereferrencedVariableName" "$targetVariable" "$dereferrence"
145 | else
146 | eval "$targetVariable=\"\$declaration\""
147 | eval "${targetVariable}_type=\$variableType"
148 | fi
149 | }
150 |
151 | Variable::PrintDeclaration() {
152 | local variableName="${1}"
153 | local dereferrence="${2:-true}"
154 |
155 | local __declaration
156 | local __declaration_type
157 | Variable::ExportDeclarationAndTypeToVariables "$variableName" __declaration "$dereferrence"
158 | echo "$__declaration"
159 | }
160 |
161 | alias @get='Variable::PrintDeclaration'
162 |
--------------------------------------------------------------------------------
/scripts/lib/util/class.sh:
--------------------------------------------------------------------------------
1 | namespace util/type
2 | import util/type String/SanitizeForVariable
3 | # ------------------------ #
4 |
5 | Type::DefineProperty() {
6 | local visibility="$1"
7 | local class="$2"
8 | local type="$3"
9 | local property="$4"
10 | local assignment="$5"
11 | local defaultValue="$6"
12 |
13 | class="${class//[^a-zA-Z0-9]/_}"
14 |
15 | eval "__${class}_property_names+=( '$property' )"
16 | eval "__${class}_property_types+=( '$type' )"
17 | eval "__${class}_property_visibilities+=( '$visibility' )"
18 | # if [[ "$assignment" == '=' && ! -z "$defaultValue" ]]
19 | # then
20 | eval "__${class}_property_defaults+=( \"\$defaultValue\" )"
21 | # fi
22 | }
23 |
24 | private() {
25 | # ${FUNCNAME[1]} contains the name of the class
26 | local class=${FUNCNAME[1]#*:}
27 |
28 | Type::DefineProperty private $class "$@"
29 | }
30 |
31 | public() {
32 | # ${FUNCNAME[1]} contains the name of the class
33 | local class=${FUNCNAME[1]#*:}
34 |
35 | Type::DefineProperty public $class "$@"
36 | }
37 |
38 | Type::Initialize() {
39 | local name="$1"
40 | local style="${2:-default}"
41 |
42 | Function::Exists class:$name && class:$name || true
43 |
44 | Type::ConvertAllOfTypeToMethodsIfNeeded "$name"
45 |
46 | case "$style" in
47 | 'primitive') ;;
48 | 'static')
49 | declare -Ag __oo_static_instance_${name}="$(Type::Construct $name)"
50 | eval "${name}"'(){ '"Type::Handle __oo_static_instance_${name}"' "$@"; }'
51 | ;;
52 | *)
53 | ## add alias for parameters
54 | alias [$name]="_type=$name Variable::TrapAssign local -A"
55 |
56 | ## add alias for creating vars
57 | alias $name="_type=$name Type::TrapAssign declare -A"
58 | ;;
59 | esac
60 | }
61 |
62 | Type::InitializeStatic() {
63 | local name="$1"
64 |
65 | Type::Initialize "$name" static
66 | }
67 |
68 | Type::Construct() {
69 | local type="$1"
70 | local typeSanitized=$(String::SanitizeForVariableName $type)
71 | local assignToVariable="$2"
72 |
73 | if [[ ! -z "${__constructor_recursion+x}" ]]
74 | then
75 | __constructor_recursion=$(( ${__constructor_recursion} + 1 ))
76 | fi
77 |
78 | local -A constructedType=( [__object_type]="$type" )
79 | # else
80 | # echo "$assignToVariable[__object_type]=\"$type\""
81 | # fi
82 |
83 | if Variable::Exists "__${typeSanitized}_property_names"
84 | then
85 | local propertyIndexesIndirect="__${typeSanitized}_property_names[@]"
86 | local -i propertyIndex=0
87 | local propertyName
88 | for propertyName in "${!propertyIndexesIndirect}"
89 | do
90 | # local propertyNameIndirect=__${typeSanitized}_property_names[$propertyIndex]
91 | # local propertyName="${!propertyNameIndirect}"
92 |
93 | local propertyTypeIndirect=__${typeSanitized}_property_types[$propertyIndex]
94 | local propertyType="${!propertyTypeIndirect}"
95 |
96 | local defaultValueIndirect=__${typeSanitized}_property_defaults[$propertyIndex]
97 | local defaultValue="${!defaultValueIndirect}"
98 |
99 | if [[ $propertyType == 'boolean' ]] && [[ "$defaultValue" == 'false' || "$defaultValue" == 'true' ]]
100 | then
101 | defaultValue="${__primitive_extension_fingerprint__boolean}:$defaultValue"
102 | fi
103 |
104 | local constructedPropertyDefinition="$defaultValue"
105 |
106 | DEBUG Log "iterating type: ${typeSanitized}, property: [$propertyIndex] $propertyName = $defaultValue"
107 |
108 | ## AUTOMATICALLY CONSTRUCTS THE PROPERTIES:
109 | # case "$propertyType" in
110 | # 'array'|'map'|'string'|'integer'|'integerArray') ;;
111 | # # 'integer') constructedPropertyDefinition="${__integer_fingerprint}$defaultValue" ;;
112 | # # 'integerArray') constructedPropertyDefinition="${__integer_array_fingerprint}$defaultValue" ;;
113 | # * )
114 | # if [[ -z "$defaultValue" && "$__constructor_recursion" -lt 15 ]]
115 | # then
116 | # constructedPropertyDefinition=$(Type::Construct "$propertyType")
117 | # fi
118 | # ;;
119 | # esac
120 |
121 | if [[ ! -z "$constructedPropertyDefinition" ]]
122 | then
123 | ## initialize non-empty fields
124 |
125 | DEBUG Log "Will exec: constructedType+=( [\"$propertyName\"]=\"$constructedPropertyDefinition\" )"
126 | constructedType+=( ["$propertyName"]="$constructedPropertyDefinition" )
127 | # eval 'constructedType+=( ["$propertyName"]="$constructedPropertyDefinition" )'
128 | fi
129 |
130 | propertyIndex+=1
131 | done
132 | fi
133 |
134 | if [[ -z "$assignToVariable" ]]
135 | then
136 | Variable::PrintDeclaration constructedType
137 | else
138 | local constructedIndex
139 | for constructedIndex in "${!constructedType[@]}"
140 | do
141 | eval "$assignToVariable[\"\$constructedIndex\"]=\"\${constructedType[\"\$constructedIndex\"]}\""
142 | done
143 | fi
144 | }
145 |
146 | alias new='Type::Construct'
147 |
--------------------------------------------------------------------------------
/scripts/lib/TypePrimitives/string.sh:
--------------------------------------------------------------------------------
1 | import util/namedParameters util/type String
2 |
3 | namespace oo/type
4 | ### STRING
5 |
6 | string.=() {
7 | [string] value
8 |
9 | this="$value"
10 |
11 | @return
12 | }
13 |
14 | string.toUpper() {
15 | @return:value "${this^^}"
16 | }
17 |
18 | string.toArray() {
19 | [string] separationCharacter=$'\n' # $'\UFAFAF'
20 |
21 | array returnArray
22 |
23 | local newLine=$'\n'
24 | local string="${this//"$newLine"/"$separationCharacter"}"
25 | local IFS=$separationCharacter
26 | local element
27 | for element in $string
28 | do
29 | returnArray+=( "$element" )
30 | done
31 |
32 | local newLines=${string//[^$separationCharacter]}
33 | local -i trailingNewLines=$(( ${#newLines} - ${#returnArray[@]} + 1 ))
34 | while (( trailingNewLines-- ))
35 | do
36 | returnArray+=( "" )
37 | done
38 |
39 | @return returnArray
40 | }
41 |
42 | ## test this:
43 | string.getMatchGroups() {
44 | @handleless @required [string] regex
45 | [string] returnMatchNumber='@' # @ means all
46 |
47 | array returnArray
48 |
49 | subject="matchGroups" Log "string to match on: $this"
50 |
51 | local -i matchNo=0
52 | local string="$this"
53 | while [[ "$string" =~ $regex ]]
54 | do
55 | subject="regex" Log "match $matchNo: ${BASH_REMATCH[*]}"
56 |
57 | if [[ "$returnMatchNumber" == "@" || $matchNo -eq "$returnMatchNumber" ]]
58 | then
59 | returnArray+=( "${BASH_REMATCH[@]}" )
60 | [[ "$returnMatchNumber" == "@" ]] || { @return returnArray && return 0; }
61 | fi
62 | # cut out the match so we may continue
63 | string="${string/"${BASH_REMATCH[0]}"}" # "
64 | matchNo+=1
65 | done
66 |
67 | @return returnArray
68 | }
69 |
70 | string.match() {
71 | @handleless @required [string] regex
72 | [integer] capturingGroup=0
73 | [string] returnMatchNumber=0 # @ means all
74 |
75 | DEBUG subject="string.match" Log "string to match on: $this"
76 |
77 | array allMatches=$(this getMatchGroups "$regex" "$returnMatchNumber")
78 |
79 | @return:value "${allMatches[$capturingGroup]}"
80 | }
81 |
82 | string.toJSON() {
83 | ## http://stackoverflow.com/a/3020108/595157
84 |
85 | string escaped="$this"
86 | escaped=$(var: escaped forEachChar '(( 16#$(var: char getCharCode) < 20 )) && printf "\\${char}" || printf "$char"')
87 |
88 | escaped="${escaped//\\/\\\\}" ## slashes
89 | escaped="\"${escaped//\"/\\\"}\"" ## quotes
90 |
91 | @return escaped
92 | }
93 |
94 | string.forEachChar() {
95 | [string] action
96 |
97 | string char
98 | integer index
99 |
100 | string methodName=__string_forEachChar_temp_method
101 |
102 | eval "$methodName() { $action ; }"
103 |
104 | for (( index=0; index<${#this}; index++ ))
105 | do
106 | char="${this:$index:1}"
107 | $methodName "$char" "$index"
108 | done
109 |
110 | unset -f $methodName
111 |
112 | @return
113 | }
114 |
115 | string.getCharCode() {
116 | ## returns char code of the first character
117 | @return:value $(printf %x "'$this")
118 | }
119 |
120 | Type::InitializePrimitive string
121 |
122 | ### /STRING
123 |
124 | ## TODO:
125 |
126 | #static String.TabsForSpaces() {
127 | # [string] input
128 | # # TODO: [string] spaceCount=4
129 | #
130 | # # hardcoded 1 tab = 4 spaces
131 | # echo "${input//[ ]/ }"
132 | #}
133 | #
134 | #static String.RegexMatch() {
135 | # [string] text; [string] regex; [string] param
136 | #
137 | # if [[ "$text" =~ $regex ]]; then
138 | # if [[ ! -z $param ]]; then
139 | # echo "${BASH_REMATCH[${param}]}"
140 | # fi
141 | # return 0
142 | # else
143 | # return 1
144 | # # no match
145 | # fi
146 | #}
147 | #
148 | #static String.SpaceCount() {
149 | # [string] text
150 | #
151 | # # note: you shouldn't mix tabs and spaces, we explicitly don't count tabs here
152 | # local spaces="$(String.RegexMatch "$text" "^[ ]*([ ]*)[.]*" 1)"
153 | # echo "${#spaces}"
154 | #}
155 | #
156 | #static String.Trim() {
157 | # [string] text
158 | #
159 | # echo "$(String.RegexMatch "$text" "^[ ]*(.*)" 1)"
160 | # #text="${text#"${text%%[![:space:]]*}"}" # remove leading whitespace characters
161 | # #text="${text%"${text##*[![:space:]]}"}" # remove trailing whitespace characters
162 | # #echo -n "$text"
163 | #}
164 | #
165 | #static String.Contains() {
166 | # [string] string
167 | # [string] match
168 | #
169 | # [[ "$string" == *"$match"* ]]
170 | # return $?
171 | #}
172 | #
173 | #static String.StartsWith() {
174 | # [string] string
175 | # [string] match
176 | #
177 | # [[ "$string" == "$match"* ]]
178 | # return $?
179 | #}
180 | #
181 | #static String.EndsWith() {
182 | # [string] string
183 | # [string] match
184 | #
185 | # [[ "$string" == *"$match" ]]
186 | # return $?
187 | #}
188 | #
189 | #method String::GetSanitizedVariableName() {
190 | # String.GetSanitizedVariableName "$($this)"
191 | #}
192 | #
193 | #method String::RegexMatch() {
194 | # [string] regex
195 | # [string] param
196 | #
197 | # String.RegexMatch "$($this)" "$regex" "$param"
198 | #}
199 |
--------------------------------------------------------------------------------
/configs/files/usr/lib/OpenWrtScripts/test/pingsamples.txt:
--------------------------------------------------------------------------------
1 | PING 1.1.1.1 (1.1.1.1): 56 data bytes
2 | 64 bytes from 1.1.1.1: icmp_seq=0 ttl=55 time=22.370 ms
3 | 64 bytes from 1.1.1.1: icmp_seq=1 ttl=55 time=22.639 ms
4 | 64 bytes from 1.1.1.1: icmp_seq=2 ttl=55 time=23.202 ms
5 | 64 bytes from 1.1.1.1: icmp_seq=3 ttl=55 time=16.561 ms
6 | 64 bytes from 1.1.1.1: icmp_seq=4 ttl=55 time=23.394 ms
7 | 64 bytes from 1.1.1.1: icmp_seq=5 ttl=55 time=22.348 ms
8 | 64 bytes from 1.1.1.1: icmp_seq=6 ttl=55 time=23.250 ms
9 | 64 bytes from 1.1.1.1: icmp_seq=7 ttl=55 time=16.556 ms
10 | Request timeout for icmp_seq 8
11 | 64 bytes from 1.1.1.1: icmp_seq=9 ttl=55 time=22.247 ms
12 | 64 bytes from 1.1.1.1: icmp_seq=10 ttl=55 time=17.617 ms
13 | 64 bytes from 1.1.1.1: icmp_seq=11 ttl=55 time=23.049 ms
14 | 64 bytes from 1.1.1.1: icmp_seq=12 ttl=55 time=16.619 ms
15 | 64 bytes from 1.1.1.1: icmp_seq=13 ttl=55 time=22.737 ms
16 | 64 bytes from 1.1.1.1: icmp_seq=14 ttl=55 time=22.806 ms
17 | 64 bytes from 1.1.1.1: icmp_seq=15 ttl=55 time=22.971 ms
18 | 64 bytes from 1.1.1.1: icmp_seq=16 ttl=55 time=16.498 ms
19 | 64 bytes from 1.1.1.1: icmp_seq=17 ttl=55 time=23.385 ms
20 | 64 bytes from 1.1.1.1: icmp_seq=18 ttl=55 time=22.898 ms
21 | 64 bytes from 1.1.1.1: icmp_seq=19 ttl=55 time=22.988 ms
22 | 64 bytes from 1.1.1.1: icmp_seq=20 ttl=55 time=23.051 ms
23 | 64 bytes from 1.1.1.1: icmp_seq=21 ttl=55 time=16.487 ms
24 | 64 bytes from 1.1.1.1: icmp_seq=22 ttl=55 time=16.692 ms
25 | 64 bytes from 1.1.1.1: icmp_seq=23 ttl=55 time=15.711 ms
26 | 64 bytes from 1.1.1.1: icmp_seq=24 ttl=55 time=17.799 ms
27 | 64 bytes from 1.1.1.1: icmp_seq=25 ttl=55 time=23.230 ms
28 | 64 bytes from 1.1.1.1: icmp_seq=26 ttl=55 time=22.493 ms
29 | 64 bytes from 1.1.1.1: icmp_seq=27 ttl=55 time=23.209 ms
30 | 64 bytes from 1.1.1.1: icmp_seq=28 ttl=55 time=22.708 ms
31 | 64 bytes from 1.1.1.1: icmp_seq=29 ttl=55 time=22.146 ms
32 | 64 bytes from 1.1.1.1: icmp_seq=30 ttl=55 time=22.887 ms
33 | 64 bytes from 1.1.1.1: icmp_seq=31 ttl=55 time=23.119 ms
34 | 64 bytes from 1.1.1.1: icmp_seq=32 ttl=55 time=23.049 ms
35 | 64 bytes from 1.1.1.1: icmp_seq=33 ttl=55 time=17.061 ms
36 | 64 bytes from 1.1.1.1: icmp_seq=34 ttl=55 time=23.603 ms
37 | 64 bytes from 1.1.1.1: icmp_seq=35 ttl=55 time=16.382 ms
38 | 64 bytes from 1.1.1.1: icmp_seq=36 ttl=55 time=23.197 ms
39 | 64 bytes from 1.1.1.1: icmp_seq=37 ttl=55 time=17.043 ms
40 | 64 bytes from 1.1.1.1: icmp_seq=38 ttl=55 time=25.956 ms
41 | 64 bytes from 1.1.1.1: icmp_seq=39 ttl=55 time=23.118 ms
42 | 64 bytes from 1.1.1.1: icmp_seq=40 ttl=55 time=23.350 ms
43 | 64 bytes from 1.1.1.1: icmp_seq=41 ttl=55 time=23.614 ms
44 | 64 bytes from 1.1.1.1: icmp_seq=42 ttl=55 time=16.343 ms
45 | 64 bytes from 1.1.1.1: icmp_seq=43 ttl=55 time=28.280 ms
46 | 64 bytes from 1.1.1.1: icmp_seq=44 ttl=55 time=23.024 ms
47 | 64 bytes from 1.1.1.1: icmp_seq=45 ttl=55 time=22.868 ms
48 | 64 bytes from 1.1.1.1: icmp_seq=46 ttl=55 time=16.664 ms
49 | 64 bytes from 1.1.1.1: icmp_seq=47 ttl=55 time=22.922 ms
50 | 64 bytes from 1.1.1.1: icmp_seq=48 ttl=55 time=23.331 ms
51 | 64 bytes from 1.1.1.1: icmp_seq=49 ttl=55 time=23.770 ms
52 | 64 bytes from 1.1.1.1: icmp_seq=50 ttl=55 time=22.904 ms
53 | 64 bytes from 1.1.1.1: icmp_seq=51 ttl=55 time=23.393 ms
54 | 64 bytes from 1.1.1.1: icmp_seq=52 ttl=55 time=22.398 ms
55 | 64 bytes from 1.1.1.1: icmp_seq=53 ttl=55 time=18.838 ms
56 | 64 bytes from 1.1.1.1: icmp_seq=54 ttl=55 time=17.159 ms
57 | 64 bytes from 1.1.1.1: icmp_seq=55 ttl=55 time=23.008 ms
58 | 64 bytes from 1.1.1.1: icmp_seq=56 ttl=55 time=23.543 ms
59 | 64 bytes from 1.1.1.1: icmp_seq=57 ttl=55 time=16.356 ms
60 | 64 bytes from 1.1.1.1: icmp_seq=58 ttl=55 time=16.766 ms
61 | 64 bytes from 1.1.1.1: icmp_seq=59 ttl=55 time=22.899 ms
62 | 64 bytes from 1.1.1.1: icmp_seq=60 ttl=55 time=23.018 ms
63 | 64 bytes from 1.1.1.1: icmp_seq=61 ttl=55 time=16.107 ms
64 | 64 bytes from 1.1.1.1: icmp_seq=62 ttl=55 time=23.279 ms
65 | 64 bytes from 1.1.1.1: icmp_seq=63 ttl=55 time=17.151 ms
66 | 64 bytes from 1.1.1.1: icmp_seq=64 ttl=55 time=16.751 ms
67 | 64 bytes from 1.1.1.1: icmp_seq=65 ttl=55 time=23.201 ms
68 | 64 bytes from 1.1.1.1: icmp_seq=66 ttl=55 time=23.518 ms
69 | 64 bytes from 1.1.1.1: icmp_seq=67 ttl=55 time=23.008 ms
70 | 64 bytes from 1.1.1.1: icmp_seq=68 ttl=55 time=23.239 ms
71 | 64 bytes from 1.1.1.1: icmp_seq=69 ttl=55 time=22.914 ms
72 | 64 bytes from 1.1.1.1: icmp_seq=70 ttl=55 time=17.153 ms
73 | 64 bytes from 1.1.1.1: icmp_seq=71 ttl=55 time=22.090 ms
74 | 64 bytes from 1.1.1.1: icmp_seq=72 ttl=55 time=23.510 ms
75 | 64 bytes from 1.1.1.1: icmp_seq=73 ttl=55 time=23.084 ms
76 | 64 bytes from 1.1.1.1: icmp_seq=74 ttl=55 time=22.768 ms
77 | 64 bytes from 1.1.1.1: icmp_seq=75 ttl=55 time=22.237 ms
78 | 64 bytes from 1.1.1.1: icmp_seq=76 ttl=55 time=23.340 ms
79 | 64 bytes from 1.1.1.1: icmp_seq=77 ttl=55 time=16.883 ms
80 | 64 bytes from 1.1.1.1: icmp_seq=78 ttl=55 time=23.954 ms
81 | 64 bytes from 1.1.1.1: icmp_seq=79 ttl=55 time=23.415 ms
82 | 64 bytes from 1.1.1.1: icmp_seq=80 ttl=55 time=16.897 ms
83 | 64 bytes from 1.1.1.1: icmp_seq=81 ttl=55 time=18.440 ms
84 | 64 bytes from 1.1.1.1: icmp_seq=82 ttl=55 time=20.889 ms
85 |
86 | --- 1.1.1.1 ping statistics ---
87 | 83 packets transmitted, 83 packets received, 0.0% packet loss
88 | round-trip min/avg/max/stddev = 15.711/21.256/28.280/2.984 ms
89 |
--------------------------------------------------------------------------------
/scripts/lib/UI/Color.sh:
--------------------------------------------------------------------------------
1 | alias UI.Color.IsAvailable='[ $(tput colors 2>/dev/null || echo 0) -ge 16 ] && [ -t 1 ]'
2 | if UI.Color.IsAvailable
3 | then
4 | alias UI.Color.Default="echo \$'\033[0m'"
5 |
6 | alias UI.Color.Black="echo \$'\033[0;30m'"
7 | alias UI.Color.Red="echo \$'\033[0;31m'"
8 | alias UI.Color.Green="echo \$'\033[0;32m'"
9 | alias UI.Color.Yellow="echo \$'\033[0;33m'"
10 | alias UI.Color.Blue="echo \$'\033[0;34m'"
11 | alias UI.Color.Magenta="echo \$'\033[0;35m'"
12 | alias UI.Color.Cyan="echo \$'\033[0;36m'"
13 | alias UI.Color.LightGray="echo \$'\033[0;37m'"
14 |
15 | alias UI.Color.DarkGray="echo \$'\033[0;90m'"
16 | alias UI.Color.LightRed="echo \$'\033[0;91m'"
17 | alias UI.Color.LightGreen="echo \$'\033[0;92m'"
18 | alias UI.Color.LightYellow="echo \$'\033[0;93m'"
19 | alias UI.Color.LightBlue="echo \$'\033[0;94m'"
20 | alias UI.Color.LightMagenta="echo \$'\033[0;95m'"
21 | alias UI.Color.LightCyan="echo \$'\033[0;96m'"
22 | alias UI.Color.White="echo \$'\033[0;97m'"
23 |
24 | # flags
25 | alias UI.Color.Bold="echo \$'\033[1m'"
26 | alias UI.Color.Dim="echo \$'\033[2m'"
27 | alias UI.Color.Italics="echo \$'\033[3m'"
28 | alias UI.Color.Underline="echo \$'\033[4m'"
29 | alias UI.Color.Blink="echo \$'\033[5m'"
30 | alias UI.Color.Invert="echo \$'\033[7m'"
31 | alias UI.Color.Invisible="echo \$'\033[8m'"
32 |
33 | alias UI.Color.NoBold="echo \$'\033[21m'"
34 | alias UI.Color.NoDim="echo \$'\033[22m'"
35 | alias UI.Color.NoItalics="echo \$'\033[23m'"
36 | alias UI.Color.NoUnderline="echo \$'\033[24m'"
37 | alias UI.Color.NoBlink="echo \$'\033[25m'"
38 | alias UI.Color.NoInvert="echo \$'\033[27m'"
39 | alias UI.Color.NoInvisible="echo \$'\033[28m'"
40 | else
41 | alias UI.Color.Default="echo"
42 |
43 | alias UI.Color.Black="echo"
44 | alias UI.Color.Red="echo"
45 | alias UI.Color.Green="echo"
46 | alias UI.Color.Yellow="echo"
47 | alias UI.Color.Blue="echo"
48 | alias UI.Color.Magenta="echo"
49 | alias UI.Color.Cyan="echo"
50 | alias UI.Color.LightGray="echo"
51 |
52 | alias UI.Color.DarkGray="echo"
53 | alias UI.Color.LightRed="echo"
54 | alias UI.Color.LightGreen="echo"
55 | alias UI.Color.LightYellow="echo"
56 | alias UI.Color.LightBlue="echo"
57 | alias UI.Color.LightMagenta="echo"
58 | alias UI.Color.LightCyan="echo"
59 | alias UI.Color.White="echo"
60 |
61 | # flags
62 | alias UI.Color.Bold="echo"
63 | alias UI.Color.Dim="echo"
64 | alias UI.Color.Underline="echo"
65 | alias UI.Color.Blink="echo"
66 | alias UI.Color.Invert="echo"
67 | alias UI.Color.Invisible="echo"
68 |
69 | alias UI.Color.NoBold="echo"
70 | alias UI.Color.NoDim="echo"
71 | alias UI.Color.NoUnderline="echo"
72 | alias UI.Color.NoBlink="echo"
73 | alias UI.Color.NoInvert="echo"
74 | alias UI.Color.NoInvisible="echo"
75 | fi
76 |
77 | alias UI.Powerline.IsAvailable="UI.Color.IsAvailable && test -z \${NO_UNICODE-} && (echo -e $'\u1F3B7' | grep -v F3B7) &> /dev/null"
78 | if UI.Powerline.IsAvailable
79 | then
80 | alias UI.Powerline.PointingArrow="echo -e $'\u27a1'"
81 | alias UI.Powerline.ArrowLeft="echo -e $'\u25c0'"
82 | alias UI.Powerline.ArrowRight="echo -e $'\u25b6'"
83 | alias UI.Powerline.ArrowRightDown="echo -e $'\u2198'"
84 | alias UI.Powerline.ArrowDown="echo -e $'\u2B07'"
85 | alias UI.Powerline.PlusMinus="echo -e $'\ue00b1'"
86 | alias UI.Powerline.Branch="echo -e $'\ue0a0'"
87 | alias UI.Powerline.RefersTo="echo -e $'\u27a6'"
88 | alias UI.Powerline.OK="echo -e $'\u2714'"
89 | alias UI.Powerline.Fail="echo -e $'\u2718'"
90 | alias UI.Powerline.Lightning="echo -e $'\u26a1'"
91 | alias UI.Powerline.Cog="echo -e $'\u2699'"
92 | alias UI.Powerline.Heart="echo -e $'\u2764'"
93 |
94 | # colorful
95 | alias UI.Powerline.Star="echo -e $'\u2b50'"
96 | alias UI.Powerline.Saxophone="echo -e $'\U1F3B7'"
97 | alias UI.Powerline.ThumbsUp="echo -e $'\U1F44D'"
98 | else
99 | alias UI.Powerline.PointingArrow="echo '~'"
100 | alias UI.Powerline.ArrowLeft="echo '<'"
101 | alias UI.Powerline.ArrowRight="echo '>'"
102 | alias UI.Powerline.ArrowRightDown="echo '>'"
103 | alias UI.Powerline.ArrowDown="echo '_'"
104 | alias UI.Powerline.PlusMinus="echo '+-'"
105 | alias UI.Powerline.Branch="echo '|}'"
106 | alias UI.Powerline.RefersTo="echo '*'"
107 | alias UI.Powerline.OK="echo '+'"
108 | alias UI.Powerline.Fail="echo 'x'"
109 | alias UI.Powerline.Lightning="echo '!'"
110 | alias UI.Powerline.Cog="echo '{*}'"
111 | alias UI.Powerline.Heart="echo '<3'"
112 |
113 | # colorful
114 | alias UI.Powerline.Star="echo '*''"
115 | alias UI.Powerline.Saxophone="echo '(YEAH)'"
116 | alias UI.Powerline.ThumbsUp="echo '(OK)'"
117 | fi
118 |
119 | UI.Color.Print() {
120 | local -i colorCode="$1"
121 |
122 | if UI.Color.IsAvailable
123 | then
124 | local colorString="\$'\033[${colorCode}m'"
125 | eval echo "${colorString}"
126 | else
127 | echo
128 | fi
129 | }
130 |
131 | UI.Color.256text() {
132 | local -i colorNumber="$1"
133 |
134 | if UI.Color.IsAvailable
135 | then
136 | local colorString="\$'\033[38;5;${colorNumber}m'"
137 | eval echo "${colorString}"
138 | else
139 | echo
140 | fi
141 | }
142 |
143 | UI.Color.256background() {
144 | local -i colorNumber="$1"
145 |
146 | if UI.Color.IsAvailable
147 | then
148 | local colorString="\$'\033[48;5;${colorNumber}m'"
149 | eval echo "${colorString}"
150 | else
151 | echo
152 | fi
153 | }
154 |
--------------------------------------------------------------------------------
/configs/files/usr/lib/OpenWrtScripts/idlelatency.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # idlelatency.sh - Script to get latency statistics on an idle line
4 | # This script starts a ping, then collects statistics on the latency
5 | # for a designated time period
6 |
7 | # Usage: sh idlelatency.sh [-4 -6] [ -t duration ] [ -p host-to-ping ]
8 |
9 | # Options: If options are present:
10 | #
11 | # -4 | -6: enable ipv4 or ipv6 testing (ipv4 is the default)
12 | # -t | --time: Duration for how long each direction's test should run - (default - 60 seconds)
13 | # -p | --ping: Host to ping to measure latency (default - gstatic.com)
14 |
15 | # Copyright (c) 2014-2020 - Rich Brown rich.brown@blueberryhillsoftware.com
16 | # GPLv2
17 |
18 | # Summarize the contents of the ping's output file to show min, avg, median, max, etc.
19 | # input parameter ($1) file contains the output of the ping command
20 |
21 | summarize_pings() {
22 |
23 | # Process the ping times, and summarize the results
24 | # grep to keep lines that have "time=", then sed to isolate the time stamps, and sort them
25 | # awk builds an array of those values, and prints first & last (which are min, max)
26 | # and computes average.
27 | # If the number of samples is >= 10, also computes median, and 10th and 90th percentile readings
28 |
29 | # stop pinging and drawing dots
30 | kill_pings
31 | kill_dots
32 |
33 | sed 's/^.*time=\([^ ]*\) ms/\1/' < $1 | grep -v "PING" | sort -n | \
34 | awk 'BEGIN {numdrops=0; numrows=0;} \
35 | { \
36 | if ( $0 ~ /timeout/ ) { \
37 | numdrops += 1; \
38 | } else { \
39 | numrows += 1; \
40 | arr[numrows]=$1; sum+=$1; \
41 | } \
42 | } \
43 | END { \
44 | pc10="-"; pc90="-"; med="-"; \
45 | if (numrows == 0) {numrows=1} \
46 | if (numrows>=10) \
47 | { ix=int(numrows/10); pc10=arr[ix]; ix=int(numrows*9/10);pc90=arr[ix]; \
48 | if (numrows%2==1) med=arr[(numrows+1)/2]; else med=(arr[numrows/2]); \
49 | }; \
50 | pktloss = numdrops/(numdrops+numrows) * 100; \
51 | printf("\n Latency: (in msec, %d pings, %4.2f%% packet loss)\n Min: %4.3f \n 10pct: %4.3f \n Median: %4.3f \n Avg: %4.3f \n 90pct: %4.3f \n Max: %4.3f\n", numrows, pktloss, arr[1], pc10, med, sum/numrows, pc90, arr[numrows] )\
52 | }'
53 |
54 | # and finally remove the PINGFILE
55 | rm $1
56 |
57 | }
58 |
59 | # Print a line of dots as a progress indicator.
60 |
61 | print_dots() {
62 | while : ; do
63 | printf "."
64 | sleep 1s
65 | done
66 | }
67 |
68 | # Stop the current print_dots() process
69 |
70 | kill_dots() {
71 | # echo "Pings: $ping_pid Dots: $dots_pid"
72 | kill -9 $dots_pid
73 | wait $dots_pid 2>/dev/null
74 | dots_pid=0
75 | }
76 |
77 | # Stop the current ping process
78 |
79 | kill_pings() {
80 | # echo "Pings: $ping_pid Dots: $dots_pid"
81 | kill -9 $ping_pid
82 | wait $ping_pid 2>/dev/null
83 | ping_pid=0
84 | }
85 |
86 | # Stop the current pings and dots, and exit
87 | # ping command catches (and handles) first Ctrl-C, so you have to hit it again...
88 | kill_pings_and_dots_and_exit() {
89 | kill_dots
90 | kill_pings
91 | echo "\nStopped"
92 | exit 1
93 | }
94 |
95 | # ------------ start_pings() ----------------
96 | # Start printing dots, then start a ping process, saving the results to a PINGFILE
97 |
98 | start_pings() {
99 |
100 | # Create temp file
101 | PINGFILE=`mktemp /tmp/measurepings.XXXXXX` || exit 1
102 |
103 | # Start dots
104 | print_dots &
105 | dots_pid=$!
106 | # echo "Dots PID: $dots_pid"
107 |
108 | # Start Ping
109 | if [ $TESTPROTO -eq "-4" ]
110 | then
111 | "${PING4}" $PINGHOST > $PINGFILE &
112 | else
113 | "${PING6}" $PINGHOST > $PINGFILE &
114 | fi
115 | ping_pid=$!
116 | # echo "Ping PID: $ping_pid"
117 |
118 | }
119 |
120 | # ------- Start of the main routine --------
121 |
122 | # Usage: sh idlelatency.sh [ -4 -6 ] [ -t duration ] [ -p host-to-ping ]
123 |
124 | # -4 or -6 to control whether to use IPv4 or IPv6
125 | # “t” and “time” Time to run the test in each direction (default: 60 seconds)
126 | # “p” and “ping” Host to ping for latency measurements (default: gstatic.com)
127 |
128 | # set an initial values for defaults
129 | TESTDUR="60"
130 |
131 | PING4=ping
132 | command -v ping4 > /dev/null 2>&1 && PING4=ping4
133 | PING6=ping6
134 |
135 | PINGHOST="gstatic.com"
136 | TESTPROTO="-4"
137 |
138 | # read the options
139 |
140 | # extract options and their arguments into variables.
141 | while [ $# -gt 0 ]
142 | do
143 | case "$1" in
144 | -4|-6) TESTPROTO=$1 ; shift 1 ;;
145 | -t|--time)
146 | case "$2" in
147 | "") echo "Missing duration" ; exit 1 ;;
148 | *) TESTDUR=$2 ; shift 2 ;;
149 | esac ;;
150 | -p|--ping)
151 | case "$2" in
152 | "") echo "Missing ping host" ; exit 1 ;;
153 | *) PINGHOST=$2 ; shift 2 ;;
154 | esac ;;
155 | --) shift ; break ;;
156 | *) echo "Usage: sh idlelatency.sh [-4 -6] [ -t duration ] [ -p host-to-ping ]" ; exit 1 ;;
157 | esac
158 | done
159 |
160 | # Start the main test
161 |
162 | if [ $TESTPROTO -eq "-4" ]
163 | then
164 | PROTO="ipv4"
165 | else
166 | PROTO="ipv6"
167 | fi
168 | DATE=`date "+%Y-%m-%d %H:%M:%S"`
169 |
170 | # Catch a Ctl-C and stop the pinging and the print_dots
171 | trap kill_pings_and_dots_and_exit HUP INT TERM
172 |
173 | echo "THIS SCRIPT IS NO LONGER MAINTAINED."
174 | echo "Use the --idle option with the betterspeedtest.sh script"
175 | echo "$DATE Testing idle line while pinging $PINGHOST ($TESTDUR seconds)"
176 | start_pings
177 | sleep $TESTDUR
178 | summarize_pings $PINGFILE
179 |
--------------------------------------------------------------------------------
/configs/patches/TMP/unused/0030-2522-80211n_256QAM-Rebased.patch:
--------------------------------------------------------------------------------
1 | From 872bfa8e6a93bb7131cf8ad4393857e5728744e1 Mon Sep 17 00:00:00 2001
2 | From: DENG Qingfang
3 | Date: Sat, 3 Oct 2020 12:33:42 -0400
4 | Subject: [PATCH] mac80211/hostapd: add support for 256-QAM on 802.11n
5 |
6 | ---
7 | .../files/lib/netifd/wireless/mac80211.sh | 4 +--
8 | .../ath/983-ath10k-allow-vht-on-2g.patch | 10 ++++++
9 | .../subsys/600-mac80211-allow-vht-on-2g.patch | 36 +++++++++++++++++++
10 | .../network/services/hostapd/files/hostapd.sh | 4 ++-
11 | 4 files changed, 51 insertions(+), 3 deletions(-)
12 | create mode 100644 package/kernel/mac80211/patches/ath/983-ath10k-allow-vht-on-2g.patch
13 | create mode 100644 package/kernel/mac80211/patches/subsys/600-mac80211-allow-vht-on-2g.patch
14 |
15 | diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
16 | index 42144375b4..92adf67ca9 100644
17 | --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
18 | +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
19 | @@ -107,7 +107,7 @@ mac80211_hostapd_setup_base() {
20 | [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] &&
21 | append base_cfg "acs_exclude_dfs=1" "$N"
22 |
23 | - json_get_vars noscan ht_coex
24 | + json_get_vars noscan ht_coex vendor_vht
25 | json_get_values ht_capab_list ht_capab tx_burst
26 | json_get_values channel_list channels
27 |
28 | @@ -230,7 +230,7 @@ mac80211_hostapd_setup_base() {
29 | esac
30 | [ "$hwmode" = "a" ] || enable_ac=0
31 |
32 | - if [ "$enable_ac" != "0" ]; then
33 | + if [ "$enable_ac" != "0" -o "$vendor_vht" = "1" ]; then
34 | json_get_vars \
35 | rxldpc:1 \
36 | short_gi_80:1 \
37 | diff --git a/package/kernel/mac80211/patches/ath/983-ath10k-allow-vht-on-2g.patch b/package/kernel/mac80211/patches/ath/983-ath10k-allow-vht-on-2g.patch
38 | new file mode 100644
39 | index 0000000000..eeca88a613
40 | --- /dev/null
41 | +++ b/package/kernel/mac80211/patches/ath/983-ath10k-allow-vht-on-2g.patch
42 | @@ -0,0 +1,10 @@
43 | +--- a/drivers/net/wireless/ath/ath10k/mac.c
44 | ++++ b/drivers/net/wireless/ath/ath10k/mac.c
45 | +@@ -4718,6 +4718,7 @@ static void ath10k_mac_setup_ht_vht_cap(
46 | + if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
47 | + band = &ar->mac.sbands[NL80211_BAND_2GHZ];
48 | + band->ht_cap = ht_cap;
49 | ++ band->vht_cap = vht_cap;
50 | + }
51 | + if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
52 | + band = &ar->mac.sbands[NL80211_BAND_5GHZ];
53 | diff --git a/package/kernel/mac80211/patches/subsys/600-mac80211-allow-vht-on-2g.patch b/package/kernel/mac80211/patches/subsys/600-mac80211-allow-vht-on-2g.patch
54 | new file mode 100644
55 | index 0000000000..da9fcd2185
56 | --- /dev/null
57 | +++ b/package/kernel/mac80211/patches/subsys/600-mac80211-allow-vht-on-2g.patch
58 | @@ -0,0 +1,36 @@
59 | +--- a/net/mac80211/vht.c
60 | ++++ b/net/mac80211/vht.c
61 | +@@ -135,7 +135,8 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(stru
62 | + have_80mhz = false;
63 | + for (i = 0; i < sband->n_channels; i++) {
64 | + if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED |
65 | +- IEEE80211_CHAN_NO_80MHZ))
66 | ++ IEEE80211_CHAN_NO_80MHZ) &&
67 | ++ (sband->band != NL80211_BAND_2GHZ))
68 | + continue;
69 | +
70 | + have_80mhz = true;
71 | +--- a/net/mac80211/util.c
72 | ++++ b/net/mac80211/util.c
73 | +@@ -1769,7 +1769,8 @@ static int ieee80211_build_preq_ies_band
74 | + /* Check if any channel in this sband supports at least 80 MHz */
75 | + for (i = 0; i < sband->n_channels; i++) {
76 | + if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED |
77 | +- IEEE80211_CHAN_NO_80MHZ))
78 | ++ IEEE80211_CHAN_NO_80MHZ) &&
79 | ++ (sband->band != NL80211_BAND_2GHZ))
80 | + continue;
81 | +
82 | + have_80mhz = true;
83 | +--- a/net/mac80211/mlme.c
84 | ++++ b/net/mac80211/mlme.c
85 | +@@ -4824,7 +4824,8 @@ static int ieee80211_prep_channel(struct
86 | + have_80mhz = false;
87 | + for (i = 0; i < sband->n_channels; i++) {
88 | + if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED |
89 | +- IEEE80211_CHAN_NO_80MHZ))
90 | ++ IEEE80211_CHAN_NO_80MHZ) &&
91 | ++ (sband->band != NL80211_BAND_2GHZ))
92 | + continue;
93 | +
94 | + have_80mhz = true;
95 | diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
96 | index 3290358ed2..c2ecd27677 100644
97 | --- a/package/network/services/hostapd/files/hostapd.sh
98 | +++ b/package/network/services/hostapd/files/hostapd.sh
99 | @@ -98,6 +98,7 @@ hostapd_common_add_device_config() {
100 | config_add_int local_pwr_constraint
101 | config_add_string require_mode
102 | config_add_boolean legacy_rates
103 | + config_add_boolean vendor_vht
104 |
105 | config_add_string acs_chan_bias
106 | config_add_array hostapd_options
107 | @@ -113,7 +114,7 @@ hostapd_prepare_device_config() {
108 | local base_cfg=
109 |
110 | json_get_vars country country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \
111 | - acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode
112 | + acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode vendor_vht
113 |
114 | hostapd_set_log_options base_cfg
115 |
116 | @@ -149,6 +150,7 @@ hostapd_prepare_device_config() {
117 | [ "$hwmode" = "g" ] && {
118 | [ "$legacy_rates" -eq 0 ] && set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000"
119 | [ -n "$require_mode" ] && set_default basic_rate_list "6000 12000 24000"
120 | + [ -n "$vendor_vht" ] && append base_cfg "vendor_vht=$vendor_vht" "$N"
121 | }
122 |
123 | case "$require_mode" in
124 | --
125 | 2.28.0
126 |
--------------------------------------------------------------------------------
/configs/patches/0002-kernel-generic-5.15-config-hardening.patch:
--------------------------------------------------------------------------------
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 | From: Tad
3 | Date: Thu, 3 Dec 2020 04:31:48 -0500
4 | Subject: [PATCH] kernel: generic 5.15: config hardening
5 |
6 | Enables various security options.
7 | Disables various high-risk bits.
8 |
9 | Signed-off-by: Tad
10 | ---
11 | target/linux/generic/config-5.15 | 164 +++++++++++++++++++++++++++++++
12 | 1 file changed, 164 insertions(+)
13 |
14 | diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15
15 | index bc5ecb4d72..21d6402f78 100644
16 | --- a/target/linux/generic/config-5.15
17 | +++ b/target/linux/generic/config-5.15
18 | @@ -7501,3 +7501,167 @@ CONFIG_ZONE_DMA=y
19 | # CONFIG_ZRAM_MEMORY_TRACKING is not set
20 | # CONFIG_ZSMALLOC is not set
21 | # CONFIG_ZX_TDM is not set
22 | +CONFIG_ARM64_BTI_KERNEL=y
23 | +CONFIG_ARM64_EPAN=y
24 | +CONFIG_ARM64_MTE=y
25 | +CONFIG_ARM64_PAN=y
26 | +CONFIG_ARM64_PTR_AUTH=y
27 | +CONFIG_ARM64_SW_TTBR0_PAN=y
28 | +CONFIG_ARM64_UAO=y
29 | +CONFIG_BUG_ON_DATA_CORRUPTION=y
30 | +CONFIG_BUG=y
31 | +CONFIG_CC_STACKPROTECTOR_STRONG=y
32 | +CONFIG_CC_STACKPROTECTOR=y
33 | +CONFIG_CPU_SW_DOMAIN_PAN=y
34 | +CONFIG_DEBUG_CREDENTIALS=y
35 | +CONFIG_DEBUG_KERNEL=y
36 | +CONFIG_DEBUG_LIST=y
37 | +CONFIG_DEBUG_NOTIFIERS=y
38 | +CONFIG_DEBUG_RODATA=y
39 | +CONFIG_DEBUG_SET_MODULE_RONX=y
40 | +CONFIG_DEBUG_SG=y
41 | +CONFIG_DEBUG_VIRTUAL=y
42 | +CONFIG_DEBUG_WX=y
43 | +CONFIG_FORTIFY_SOURCE=y
44 | +CONFIG_HARDEN_BRANCH_HISTORY=y
45 | +CONFIG_HARDEN_BRANCH_PREDICTOR=y
46 | +CONFIG_HARDENED_USERCOPY=y
47 | +CONFIG_HARDEN_EL2_VECTORS=y
48 | +CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
49 | +CONFIG_INIT_ON_FREE_DEFAULT_ON=y
50 | +CONFIG_INIT_STACK_ALL=y
51 | +CONFIG_INIT_STACK_ALL_ZERO=y
52 | +CONFIG_IOMMU_DEFAULT_DMA_STRICT=y
53 | +CONFIG_IO_STRICT_DEVMEM=y
54 | +CONFIG_IPV6_PRIVACY=y
55 | +CONFIG_LEGACY_VSYSCALL_NONE=y
56 | +CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY=y
57 | +CONFIG_MMC_SECDISCARD=y
58 | +CONFIG_PAGE_POISONING_NO_SANITY=y
59 | +CONFIG_PAGE_POISONING=y
60 | +CONFIG_PAGE_POISONING_ZERO=y
61 | +CONFIG_PAGE_TABLE_ISOLATION=y
62 | +CONFIG_PANIC_ON_OOPS=y
63 | +CONFIG_RANDOMIZE_BASE=y
64 | +CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y
65 | +CONFIG_RANDOMIZE_MEMORY=y
66 | +CONFIG_REFCOUNT_FULL=y
67 | +CONFIG_RESET_ATTACK_MITIGATION=y
68 | +CONFIG_RETPOLINE=y
69 | +CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
70 | +CONFIG_SCHED_STACK_END_CHECK=y
71 | +CONFIG_SECCOMP_FILTER=y
72 | +CONFIG_SECCOMP=y
73 | +CONFIG_SECURITY_DMESG_RESTRICT=y
74 | +CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y
75 | +CONFIG_SECURITY=y
76 | +CONFIG_SECURITY_YAMA_STACKED=y
77 | +CONFIG_SECURITY_YAMA=y
78 | +CONFIG_SHUFFLE_PAGE_ALLOCATOR=y
79 | +CONFIG_SLAB_FREELIST_HARDENED=y
80 | +CONFIG_SLAB_FREELIST_RANDOM=y
81 | +CONFIG_SLUB_DEBUG=y
82 | +CONFIG_STACKPROTECTOR_PER_TASK=y
83 | +CONFIG_STACKPROTECTOR_STRONG=y
84 | +CONFIG_STACKPROTECTOR=y
85 | +CONFIG_STRICT_DEVMEM=y
86 | +CONFIG_STRICT_KERNEL_RWX=y
87 | +CONFIG_STRICT_MEMORY_RWX=y
88 | +CONFIG_STRICT_MODULE_RWX=y
89 | +CONFIG_SYN_COOKIES=y
90 | +CONFIG_TEST_DEBUG_VIRTUAL=n
91 | +CONFIG_THREAD_INFO_IN_TASK=y
92 | +CONFIG_UNMAP_KERNEL_AT_EL0=y
93 | +CONFIG_VMAP_STACK=y
94 | +CONFIG_ZERO_CALL_USED_REGS=y
95 | +CONFIG_ACPI_APEI_EINJ=n
96 | +CONFIG_ACPI_CUSTOM_METHOD=n
97 | +CONFIG_ACPI_TABLE_UPGRADE=n
98 | +CONFIG_BINFMT_AOUT=n
99 | +CONFIG_BINFMT_MISC=n
100 | +CONFIG_BLK_DEV_FD=n
101 | +CONFIG_BLK_DEV_IO_TRACE=n
102 | +CONFIG_BT_HS=n
103 | +CONFIG_CHECKPOINT_RESTORE=n
104 | +CONFIG_COMPAT_BRK=n
105 | +CONFIG_COMPAT_VDSO=n
106 | +CONFIG_CORESIGHT=n
107 | +CONFIG_CP_ACCESS64=n
108 | +CONFIG_DEBUG_ATOMIC_SLEEP=n
109 | +CONFIG_DEBUG_BUS_VOTER=n
110 | +CONFIG_DEBUG_KMEMLEAK=n
111 | +CONFIG_DEBUG_MUTEXES=n
112 | +CONFIG_DEBUG_PAGEALLOC=n
113 | +CONFIG_DEBUG_SPINLOCK=n
114 | +CONFIG_DEBUG_STACK_USAGE=n
115 | +CONFIG_DEVKMEM=n
116 | +CONFIG_DEVMEM=n
117 | +CONFIG_DEVPORT=n
118 | +CONFIG_DYNAMIC_DEBUG=n
119 | +CONFIG_EARJACK_DEBUGGER=n
120 | +CONFIG_FAIL_FUTEX=n
121 | +CONFIG_FB_VIRTUAL=n
122 | +CONFIG_FTRACE=n
123 | +CONFIG_FUNCTION_TRACER=n
124 | +CONFIG_GENERIC_TRACER=n
125 | +CONFIG_HARDENED_USERCOPY_FALLBACK=n
126 | +CONFIG_HARDENED_USERCOPY_PAGESPAN=n
127 | +CONFIG_HAVE_DEBUG_BUGVERBOSE=n
128 | +CONFIG_HAVE_DEBUG_KMEMLEAK=n
129 | +CONFIG_HIBERNATION=n
130 | +CONFIG_HIST_TRIGGERS=n
131 | +CONFIG_HWPOISON_INJECT=n
132 | +CONFIG_IA32_EMULATION=n
133 | +CONFIG_INPUT_EVBUG=n
134 | +CONFIG_IOMMU_DEBUG=n
135 | +CONFIG_IOMMU_DEBUG_TRACKING=n
136 | +CONFIG_IOMMU_NON_SECURE=n
137 | +CONFIG_IOMMU_TESTS=n
138 | +CONFIG_IO_URING=n
139 | +CONFIG_IP_DCCP=n
140 | +CONFIG_IP_SCTP=n
141 | +CONFIG_KEXEC_FILE=n
142 | +CONFIG_KEXEC=n
143 | +CONFIG_KPROBE_EVENTS=n
144 | +CONFIG_KSM=n
145 | +CONFIG_L2TP_DEBUGFS=n
146 | +CONFIG_LDISC_AUTOLOAD=n
147 | +CONFIG_LEGACY_PTYS=n
148 | +CONFIG_LIVEPATCH=n
149 | +CONFIG_LOCKUP_DETECTOR=n
150 | +CONFIG_LOG_BUF_MAGIC=n
151 | +CONFIG_MEM_SOFT_DIRTY=n
152 | +CONFIG_MMIOTRACE=n
153 | +CONFIG_MMIOTRACE_TEST=n
154 | +CONFIG_MODIFY_LDT_SYSCALL=n
155 | +CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG=n
156 | +CONFIG_NOTIFIER_ERROR_INJECTION=n
157 | +CONFIG_OABI_COMPAT=n
158 | +CONFIG_PAGE_OWNER=n
159 | +CONFIG_PREEMPT_TRACER=n
160 | +CONFIG_PROC_KCORE=n
161 | +CONFIG_PROC_VMCORE=n
162 | +CONFIG_RDS=n
163 | +CONFIG_RDS_TCP=n
164 | +CONFIG_SECURITY_SELINUX_DISABLE=n
165 | +CONFIG_SECURITY_WRITABLE_HOOKS=n
166 | +CONFIG_SLAB_MERGE_DEFAULT=n
167 | +CONFIG_STACKLEAK_METRICS=n
168 | +CONFIG_STACKLEAK_RUNTIME_DISABLE=n
169 | +CONFIG_STACK_TRACER=n
170 | +CONFIG_TIMER_STATS=n
171 | +CONFIG_TSC=n
172 | +CONFIG_TSPP2=n
173 | +CONFIG_UKSM=n
174 | +CONFIG_UPROBE_EVENTS=n
175 | +CONFIG_UPROBES=n
176 | +CONFIG_USELIB=n
177 | +CONFIG_USERFAULTFD=n
178 | +CONFIG_VIDEO_VIVID=n
179 | +CONFIG_WLAN_FEATURE_MEMDUMP=n
180 | +CONFIG_X86_IOPL_IOPERM=n
181 | +CONFIG_X86_PTDUMP=n
182 | +CONFIG_X86_VSYSCALL_EMULATION=n
183 | +CONFIG_ZSMALLOC_STAT=n
184 | +CONFIG_DEFAULT_MMAP_MIN_ADDR=32768
185 | +CONFIG_LSM_MMAP_MIN_ADDR=32768
186 |
--------------------------------------------------------------------------------