diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 7f6cba2b8..77550d5c3 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,6 +1,4 @@ { - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [{ "label": "Copy to target", diff --git a/.vscode/vsbuild.sh b/.vscode/vsbuild.sh index 162f93da2..7bb188b8e 100755 --- a/.vscode/vsbuild.sh +++ b/.vscode/vsbuild.sh @@ -3,42 +3,70 @@ ## Compile sync-settings and install if no errors. ## TARGET=$1 +PORT=22 + +GREEN=$'\e[0;32m' +NC=$'\e[0m' # Break target down by commas into an array. TARGET_ADDRESSES=() while IFS=',' read -ra ADDRESSES; do - for address in "${ADDRESSES[@]}"; do - TARGET_ADDRESSES+=($address) - done -done <<< "$TARGET" + for address in "${ADDRESSES[@]}"; do + TARGET_ADDRESSES+=("$address") + done +done <<<"$TARGET" for target_address in "${TARGET_ADDRESSES[@]}"; do - echo "Copying to $target_address..." - ssh-copy-id root@$target_address - - rsync=$(ssh root@$target_address "which rsync") - if [ "$rsync" = "" ] ; then - ssh root@$target_address "opkg update; opkg install rsync" - fi - - rsync -r -a -v --chown=root:root wan-manager/files/* root@$target_address:/usr/bin - rsync -r -a -v --chown=root:root credentials/files/credentials.json root@$target_address:/etc/config/credentials.json - # rsync -r -a -v --chown=root:root pyconnector/files/* root@$target_address:/usr/bin - # rsync -r -a -v --chown=root:root strongswan-full/files/override.ipsec.init root@$target_address:/etc/init.d/ipsec - # rsync -r -a -v --chown=root:root pyconnector/files/pyconnector root@$target_address:/usr/bin/pyconnector - # rsync -r -a -v --chown=root:root pyconnector/files/pyconnector.init root@$target_address:/etc/init.d/pyconnector - rsync -r -a -v --chown=root:root sync-settings/files/speedtest.sh root@$target_address:/usr/bin/speedtest.sh - # rsync -r -a -v --chown=root:root speedtest-cli-dbg root@$target_address:/root/speedtest-cli-dbg - - # Tests - target_sync_path=$(ssh root@$target_address "find /usr -name tests | grep '\(site-packages\|dist-packages\)/tests' | head -1") - if [ "$target_sync_path" != "" ] ; then - rsync -r -a -v runtests/files/usr/lib/python/tests/* root@$target_address:$target_sync_path - fi - - # Restd - target_sync_path=$(ssh root@$target_address "find /usr -name restd | grep '\(site-packages\|dist-packages\)/restd' | head -1") - if [ "$target_sync_path" != "" ] ; then - rsync -r -a -v restd/files/usr/lib/python/restd/* root@$target_address:$target_sync_path - fi + + echo "${GREEN}Copying to $target_address ...${NC}" + + ssh-copy-id root@"$target_address" + + isEos=true + if ! ssh -p "$PORT" root@"$target_address" "ls /etc/Eos-release"; then + isEos=false + echo "${GREEN}Bare MFW found${NC}" + else + echo "${GREEN}MFW in EOS found${NC}" + fi + + target_sync_path="" + mfw_dir="" + if [ "$isEos" != true ]; then + # bare MFW target + rsync=$(ssh -p "$PORT" root@"$target_address" "which rsync") + if [ "$rsync" = "" ]; then + ssh -p "$PORT" root@"$target_address" "opkg update; opkg install rsync" + fi + + target_sync_path="/usr/bin" + else + target_sync_path="/mfw/usr/bin" + mfw_dir="/mfw" + fi + + echo "${GREEN}Copying to $target_sync_path... ${NC}" + + rsync -r -a -v --chown=root:root wan-manager/files/* root@"$target_address":"$target_sync_path" + rsync -r -a -v --chown=root:root credentials/files/credentials.json root@"$target_address":"$mfw_dir"/etc/config/credentials.json + # rsync -r -a -v --chown=root:root pyconnector/files/* root@$target_address:/usr/bin + # rsync -r -a -v --chown=root:root strongswan-full/files/override.ipsec.init root@$target_address:/etc/init.d/ipsec + # rsync -r -a -v --chown=root:root pyconnector/files/pyconnector root@$target_address:/usr/bin/pyconnector + # rsync -r -a -v --chown=root:root pyconnector/files/pyconnector.init root@$target_address:/etc/init.d/pyconnector + rsync -r -a -v --chown=root:root sync-settings/files/speedtest.sh root@"$target_address":"$target_sync_path"/speedtest.sh + # rsync -r -a -v --chown=root:root speedtest-cli-dbg root@$target_address:/root/speedtest-cli-dbg + + # Tests + target_site_packages=$(ssh root@"$target_address" "find $mfw_dir/usr -name tests | grep '\(site-packages\|dist-packages\)/tests' | head -1") + if [ "$target_site_packages" != "" ]; then + echo "${GREEN}Copying to $target_site_packages... ${NC}" + rsync -r -a -v runtests/files/usr/lib/python/tests/* root@"$target_address":$target_site_packages + fi + + # Restd + target_site_packages=$(ssh root@"$target_address" "find $mfw_dir/usr -name restd | grep '\(site-packages\|dist-packages\)/restd' | head -1") + if [ "$target_site_packages" != "" ]; then + echo "${GREEN}Copying to $target_site_packages... ${NC}" + rsync -r -a -v restd/files/usr/lib/python/restd/* root@"$target_address":"$target_site_packages" + fi done diff --git a/backup-scripts/files/upload-backup.sh b/backup-scripts/files/upload-backup.sh index 5b1a9ace1..8da6a1e15 100755 --- a/backup-scripts/files/upload-backup.sh +++ b/backup-scripts/files/upload-backup.sh @@ -31,8 +31,17 @@ function createBackup() { debug "Backing up settings to gunzipped tar archive file" TEMP_DIR=`mktemp -d -t ut-backup.XXXXXXX` TEMP_DIR_NAME=$(basename $TEMP_DIR) + CP_DIR="/etc/config/captive_portal" cp /etc/config/settings.json $TEMP_DIR +# TODO: Directory check is added for cases where upgrade from older builds +# to newer may not have the directory present. This check should probably +# be removed in future builds. + if [ -d "$CP_DIR" ] ; then + cp $CP_DIR/* $TEMP_DIR + rm -f $TEMP_DIR/captive_portal_settings + fi + tar -C /tmp -zcf $BACKUP_FILE $TEMP_DIR_NAME rm -r $TEMP_DIR } diff --git a/bctid/Makefile b/bctid/Makefile index 99f4ba9a4..ab151006d 100644 --- a/bctid/Makefile +++ b/bctid/Makefile @@ -34,6 +34,10 @@ endef TMP_BUILD_DIR:=$(PKG_BUILD_DIR)/tmp/ define Package/bctid/install + # Copy bctid categories file + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_BIN) files/categories.json $(1)/etc/config/categories.json + $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/bctid $(1)/usr/share/bctid $(INSTALL_BIN) $(TMP_BUILD_DIR)/src/bin/bctid $(1)/usr/bin/ $(CP) $(TMP_BUILD_DIR)/src/bin/bcti.cfg $(1)/usr/share/bctid/ diff --git a/bctid/files/categories.json b/bctid/files/categories.json new file mode 100644 index 000000000..76cebe6e0 --- /dev/null +++ b/bctid/files/categories.json @@ -0,0 +1,530 @@ +[ + { + "catid": 0, + "catremap": 0, + "catname": "Uncategorized", + "catgroup": "Misc" + }, + { + "catid": 1, + "catremap": 1, + "catname": "Real Estate", + "catgroup": "Productivity" + }, + { + "catid": 2, + "catremap": 2, + "catname": "Computer and Internet Security", + "catgroup": "Productivity" + }, + { + "catid": 3, + "catremap": 3, + "catname": "Financial Services", + "catgroup": "Privacy" + }, + { + "catid": 4, + "catremap": 4, + "catname": "Business and Economy", + "catgroup": "Productivity" + }, + { + "catid": 5, + "catremap": 5, + "catname": "Computer and Internet Info", + "catgroup": "Productivity" + }, + { + "catid": 6, + "catremap": 6, + "catname": "Auctions", + "catgroup": "Productivity" + }, + { + "catid": 7, + "catremap": 7, + "catname": "Shopping", + "catgroup": "Productivity" + }, + { + "catid": 8, + "catremap": 8, + "catname": "Cult and Occult", + "catgroup": "Sensitive" + }, + { + "catid": 9, + "catremap": 9, + "catname": "Travel", + "catgroup": "Productivity" + }, + { + "catid": 10, + "catremap": 10, + "catname": "Abused Drugs", + "catgroup": "Sensitive" + }, + { + "catid": 11, + "catremap": 11, + "catname": "Adult and Pornography", + "catgroup": "Sensitive" + }, + { + "catid": 12, + "catremap": 12, + "catname": "Home and Garden", + "catgroup": "Productivity" + }, + { + "catid": 13, + "catremap": 13, + "catname": "Military", + "catgroup": "Productivity" + }, + { + "catid": 14, + "catremap": 14, + "catname": "Social Networking", + "catgroup": "Productivity" + }, + { + "catid": 15, + "catremap": 15, + "catname": "Dead Sites", + "catgroup": "Misc" + }, + { + "catid": 16, + "catremap": 16, + "catname": "Individual Stock Advice and Tools", + "catgroup": "Productivity" + }, + { + "catid": 17, + "catremap": 17, + "catname": "Training and Tools", + "catgroup": "Productivity" + }, + { + "catid": 18, + "catremap": 18, + "catname": "Dating", + "catgroup": "Sensitive" + }, + { + "catid": 19, + "catremap": 19, + "catname": "Sex Education", + "catgroup": "Sensitive" + }, + { + "catid": 20, + "catremap": 20, + "catname": "Religion", + "catgroup": "Sensitive" + }, + { + "catid": 21, + "catremap": 21, + "catname": "Entertainment and Arts", + "catgroup": "Productivity" + }, + { + "catid": 22, + "catremap": 22, + "catname": "Personal sites and Blogs", + "catgroup": "Productivity" + }, + { + "catid": 23, + "catremap": 23, + "catname": "Legal", + "catgroup": "Privacy" + }, + { + "catid": 24, + "catremap": 24, + "catname": "Local Information", + "catgroup": "Productivity" + }, + { + "catid": 25, + "catremap": 25, + "catname": "Streaming Media", + "catgroup": "IT Resources" + }, + { + "catid": 26, + "catremap": 26, + "catname": "Job Search", + "catgroup": "Productivity" + }, + { + "catid": 27, + "catremap": 27, + "catname": "Gambling", + "catgroup": "Sensitive" + }, + { + "catid": 28, + "catremap": 28, + "catname": "Translation", + "catgroup": "Sensitive" + }, + { + "catid": 29, + "catremap": 29, + "catname": "Reference and Research", + "catgroup": "Productivity" + }, + { + "catid": 30, + "catremap": 30, + "catname": "Shareware and Freeware", + "catgroup": "IT Resources" + }, + { + "catid": 31, + "catremap": 31, + "catname": "Peer to Peer", + "catgroup": "IT Resources" + }, + { + "catid": 32, + "catremap": 32, + "catname": "Marijuana", + "catgroup": "Sensitive" + }, + { + "catid": 33, + "catremap": 33, + "catname": "Hacking", + "catgroup": "Sensitive" + }, + { + "catid": 34, + "catremap": 34, + "catname": "Games", + "catgroup": "Productivity" + }, + { + "catid": 35, + "catremap": 35, + "catname": "Philosophy and Political Advocacy", + "catgroup": "Productivity" + }, + { + "catid": 36, + "catremap": 36, + "catname": "Weapons", + "catgroup": "Sensitive" + }, + { + "catid": 37, + "catremap": 37, + "catname": "Pay to Surf", + "catgroup": "Productivity" + }, + { + "catid": 38, + "catremap": 38, + "catname": "Hunting and Fishing", + "catgroup": "Productivity" + }, + { + "catid": 39, + "catremap": 39, + "catname": "Society", + "catgroup": "Productivity" + }, + { + "catid": 40, + "catremap": 40, + "catname": "Educational Institutions", + "catgroup": "Productivity" + }, + { + "catid": 41, + "catremap": 41, + "catname": "Online Greeting Cards", + "catgroup": "IT Resources" + }, + { + "catid": 42, + "catremap": 42, + "catname": "Sports", + "catgroup": "Productivity" + }, + { + "catid": 43, + "catremap": 43, + "catname": "Swimsuits and Intimate Apparel", + "catgroup": "Sensitive" + }, + { + "catid": 44, + "catremap": 44, + "catname": "Questionable", + "catgroup": "Sensitive" + }, + { + "catid": 45, + "catremap": 45, + "catname": "Kids", + "catgroup": "Productivity" + }, + { + "catid": 46, + "catremap": 46, + "catname": "Hate and Racism", + "catgroup": "Sensitive" + }, + { + "catid": 47, + "catremap": 47, + "catname": "Personal Storage", + "catgroup": "IT Resources" + }, + { + "catid": 48, + "catremap": 48, + "catname": "Violence", + "catgroup": "Sensitive" + }, + { + "catid": 49, + "catremap": 49, + "catname": "Keyloggers and Monitoring", + "catgroup": "Security" + }, + { + "catid": 50, + "catremap": 50, + "catname": "Search Engines", + "catgroup": "Productivity" + }, + { + "catid": 51, + "catremap": 51, + "catname": "Internet Portals", + "catgroup": "Productivity" + }, + { + "catid": 52, + "catremap": 52, + "catname": "Web Advertisements", + "catgroup": "IT Resources" + }, + { + "catid": 53, + "catremap": 53, + "catname": "Cheating", + "catgroup": "Sensitive" + }, + { + "catid": 54, + "catremap": 54, + "catname": "Gross", + "catgroup": "Sensitive" + }, + { + "catid": 55, + "catremap": 55, + "catname": "Web-based Email", + "catgroup": "Privacy" + }, + { + "catid": 56, + "catremap": 56, + "catname": "Malware Sites", + "catgroup": "Security" + }, + { + "catid": 57, + "catremap": 57, + "catname": "Phishing and Other Frauds", + "catgroup": "Security" + }, + { + "catid": 58, + "catremap": 58, + "catname": "Proxy Avoidance and Anonymizers", + "catgroup": "Security" + }, + { + "catid": 59, + "catremap": 59, + "catname": "Spyware and Adware", + "catgroup": "Security" + }, + { + "catid": 60, + "catremap": 60, + "catname": "Music", + "catgroup": "Productivity" + }, + { + "catid": 61, + "catremap": 61, + "catname": "Government", + "catgroup": "Privacy" + }, + { + "catid": 62, + "catremap": 62, + "catname": "Nudity", + "catgroup": "Sensitive" + }, + { + "catid": 63, + "catremap": 63, + "catname": "News and Media", + "catgroup": "Productivity" + }, + { + "catid": 64, + "catremap": 64, + "catname": "Illegal", + "catgroup": "Sensitive" + }, + { + "catid": 65, + "catremap": 65, + "catname": "Content Delivery Networks", + "catgroup": "IT Resources" + }, + { + "catid": 66, + "catremap": 66, + "catname": "Internet Communications", + "catgroup": "IT Resources" + }, + { + "catid": 67, + "catremap": 67, + "catname": "Bot Nets", + "catgroup": "Security" + }, + { + "catid": 68, + "catremap": 68, + "catname": "Abortion", + "catgroup": "Sensitive" + }, + { + "catid": 69, + "catremap": 69, + "catname": "Health and Medicine", + "catgroup": "Privacy" + }, + { + "catid": 70, + "catremap": 70, + "catname": "Confirmed SPAM Sources", + "catgroup": "Unmaintained" + }, + { + "catid": 71, + "catremap": 71, + "catname": "SPAM URLs", + "catgroup": "Security" + }, + { + "catid": 72, + "catremap": 72, + "catname": "Unconfirmed SPAM Sources", + "catgroup": "Unmaintained" + }, + { + "catid": 73, + "catremap": 73, + "catname": "Open HTTP Proxies", + "catgroup": "Unmaintained" + }, + { + "catid": 74, + "catremap": 74, + "catname": "Dynamically Generated Content", + "catgroup": "Productivity" + }, + { + "catid": 75, + "catremap": 75, + "catname": "Parked Domains", + "catgroup": "Sensitive" + }, + { + "catid": 76, + "catremap": 76, + "catname": "Alcohol and Tobacco", + "catgroup": "Sensitive" + }, + { + "catid": 77, + "catremap": 77, + "catname": "Private IP Addresses", + "catgroup": "Unmaintained" + }, + { + "catid": 78, + "catremap": 78, + "catname": "Image and Video Search", + "catgroup": "Sensitive" + }, + { + "catid": 79, + "catremap": 79, + "catname": "Fashion and Beauty", + "catgroup": "Productivity" + }, + { + "catid": 80, + "catremap": 80, + "catname": "Recreation and Hobbies", + "catgroup": "Productivity" + }, + { + "catid": 81, + "catremap": 81, + "catname": "Motor Vehicles", + "catgroup": "Productivity" + }, + { + "catid": 82, + "catremap": 82, + "catname": "Web Hosting", + "catgroup": "IT Resources" + }, + { + "catid": 83, + "catremap": 83, + "catname": "Food and Dining", + "catgroup": "Unmaintained" + }, + { + "catid": 85, + "catremap": 48, + "catname": "Self Harm", + "catgroup": "Sensitive" + }, + { + "catid": 86, + "catremap": 58, + "catname": "DNS Over HTTPS", + "catgroup": "Security" + }, + { + "catid": 87, + "catremap": 32, + "catname": "Low-THC Cannabis Products", + "catgroup": "Sensitive" + }, + { + "catid": 88, + "catremap": 5, + "catname": "Generative AI", + "catgroup": "Productivity" + } +] diff --git a/classd/Makefile b/classd/Makefile index ee3f17741..ff8c3f7f6 100644 --- a/classd/Makefile +++ b/classd/Makefile @@ -30,6 +30,8 @@ define Package/classd/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/classd $(1)/usr/bin/ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnavl.so* $(1)/usr/lib/ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/untangle-classd/protolist.csv $(1)/usr/share/untangle-classd/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) files/classd.init $(1)/etc/init.d/classd endef $(eval $(call BuildPackage,classd)) diff --git a/classd/files/classd.init b/classd/files/classd.init new file mode 100755 index 000000000..b49824d08 --- /dev/null +++ b/classd/files/classd.init @@ -0,0 +1,31 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=92 +STOP=02 + +USE_PROCD=1 + +start_service() { + procd_open_instance classd + + # procd_set_param env GODEBUG=schedtrace=30000 + # procd_set_param env GODEBUG=schedtrace=30000,scheddetail=1 + + # if not hybrid mode, start the packetd + if [ -e /etc/config/hybrid ] + then + # procd command to run + procd_set_param command /usr/bin/classd -mfw -w65536 -d + fi + + # restart indefinitely if crashed, 5 seconds between attempts + procd_set_param respawn 3600 5 0 + + # stdout to system log + procd_set_param stdout 1 + # stderr to system log + procd_set_param stderr 1 + + procd_close_instance +} diff --git a/mfw-eu/files/settings_uri.js b/mfw-eu/files/settings_uri.js index ab7955e12..bb4efd54d 100644 --- a/mfw-eu/files/settings_uri.js +++ b/mfw-eu/files/settings_uri.js @@ -18,6 +18,9 @@ },{ "uri": "https://cmd.untangle.com/", "host": "cmd-eu.untangle.com" + },{ + "uri": "https://launchpad.edge.arista.com", + "host": "eu.edge.arista.com" }] } } diff --git a/packetd/files/packetd.init b/packetd/files/packetd.init index 3230804e9..700e4cb96 100755 --- a/packetd/files/packetd.init +++ b/packetd/files/packetd.init @@ -18,12 +18,9 @@ start_service() { # --logfile to specify a logfile manually # as output goes to logd which will add timestamps - if [ -e /etc/config/dpdk ] + # if not hybrid mode, start the packetd + if [ ! -e /etc/config/hybrid ] then - # TODO if dpdk/bess is enabled we load packetd from bess as a dynamic library. - # But for not just start it normally. - procd_set_param command /usr/bin/packetd --no-timestamp - else procd_set_param command /usr/bin/packetd --no-timestamp fi # procd_set_param command /usr/bin/packetd --logfile /tmp/log/packetd.log diff --git a/pyconnector/files/pyconnector b/pyconnector/files/pyconnector index 54e890b4c..f312717a0 100755 --- a/pyconnector/files/pyconnector +++ b/pyconnector/files/pyconnector @@ -337,5 +337,5 @@ if __name__ == "__main__": # check_pid_file() while True: - debug("") + debug("Attempting to read from cmd") read_from_cmd() diff --git a/restd/Makefile b/restd/Makefile index a623a0e97..64fa9ac08 100644 --- a/restd/Makefile +++ b/restd/Makefile @@ -19,8 +19,6 @@ include $(INCLUDE_DIR)/package.mk # Package/packetd/install include $(INCLUDE_DIR)/../feeds/packages/lang/golang/golang-package.mk -include $(TOPDIR)/feeds/packages/lang/python/python3-package.mk - define Package/restd SECTION:=utils CATEGORY:=Utilities diff --git a/sync-settings/Makefile b/sync-settings/Makefile index d8159611f..eafe635a0 100644 --- a/sync-settings/Makefile +++ b/sync-settings/Makefile @@ -33,10 +33,15 @@ define Py3Package/sync-settings/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sync-settings $(1)/usr/bin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/load-eos-config $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/updateSysdbSignal $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/run-eos-command $(1)/usr/bin $(INSTALL_BIN) files/speedtest.sh $(1)/usr/bin $(INSTALL_BIN) files/wwan_status.sh $(1)/usr/bin $(INSTALL_BIN) files/nft_debug $(1)/usr/bin $(INSTALL_BIN) files/check-for-usb-reset.sh $(1)/usr/bin + $(INSTALL_BIN) files/set_affinity.sh $(1)/usr/bin + $(INSTALL_BIN) files/set_rpsxps.sh $(1)/usr/bin + $(INSTALL_BIN) files/quota_cron.sh $(1)/usr/bin # init.d $(INSTALL_DIR) $(1)/etc/init.d diff --git a/sync-settings/files/load-eos-config.init b/sync-settings/files/load-eos-config.init index cc99eec89..89a6e8928 100644 --- a/sync-settings/files/load-eos-config.init +++ b/sync-settings/files/load-eos-config.init @@ -7,7 +7,7 @@ STOP=17 start() { if [ -f /etc/Eos-release ] ; then - load-eos-config + load-eos-config --save-boot-config fi } diff --git a/sync-settings/files/product-board-name.init b/sync-settings/files/product-board-name.init index 5dccdc4c1..e6c3b5e0d 100755 --- a/sync-settings/files/product-board-name.init +++ b/sync-settings/files/product-board-name.init @@ -3,57 +3,90 @@ # Copyright (C) 2016 LEDE-Project.org START=12 + +In_eos_board_name() { + # running under EOS + + platform=$(cat /proc/cmdline | xargs -n1 | grep platform | cut -d '=' -f2) + + case "$platform" in + councilbluffs) + echo "Council Bluffs" >/tmp/sysinfo/product_board_name + exit 0 + ;; + independence) + Ind_version=$(cat /etc/prefdl | grep HwApi | awk -F ': ' '{print $2}' | cut -d '.' -f1) + case "$Ind_version" in + 03) + echo "Independence P3" >/tmp/sysinfo/product_board_name + exit 0 + ;; + 02) + echo "Independence P2" >/tmp/sysinfo/product_board_name + exit 0 + ;; + esac + ;; + esac + + # Not exiting here, since we want VMs to overwrite. +} + boot() { - . /lib/functions.sh - - if [ -f /tmp/sysinfo/product_board_name ] ; then - exit - fi - - SERIAL=$(cat /etc/config/serial | tr -d '[ \t\r\n]') - # Q series serial pattern CTWYYWWSSSS - # YYWWSSSS is a series of digits representing the year, number of weeks, and a sequence number - qSerialPattern="^CTW([1-9][0-9])(0[1-9]|[1-4][0-9]|5[0-3])([0-9]{4})$" - - case $(board_name) in - globalscale,espressobin-v7-emmc) - product_board_name="e3" - if [ -L /sys/class/ieee80211/phy0 ] ; then - product_board_name=$product_board_name"w" - fi - echo $product_board_name > /tmp/sysinfo/product_board_name - ;; - caswell-caf-0262|untangle-inc-default-string|arista-networks-inc-default-string) - if [[ $SERIAL =~ $qSerialPattern ]]; - then - # Handle Q series board name. - product_board_name="Q6E" - else - # Handle NON Q series board name. - product_board_name="e6" - fi - - if [ -L /sys/class/ieee80211/phy0 ] ; then - product_board_name=$product_board_name"w" - fi - - if [ -L /sys/class/net/wwan0 ] ; then - product_board_name=$product_board_name"l" - fi - - echo $product_board_name > /tmp/sysinfo/product_board_name - ;; - vmware-inc-vmware-virtual-platform) - echo "VMware" > /tmp/sysinfo/product_board_name - ;; - innotek-gmbh-virtualbox) - echo "VirtualBox" > /tmp/sysinfo/product_board_name - ;; - microsoft-corporation-virtual-machine) - echo "HyperV" > /tmp/sysinfo/product_board_name - ;; - *) - echo "Custom" > /tmp/sysinfo/product_board_name - ;; - esac + . /lib/functions.sh + + if [ -f /tmp/sysinfo/product_board_name ]; then + exit + fi + + # EOS additions + if [ -f /etc/Eos-release ]; then + In_eos_board_name + fi + + SERIAL=$(cat /etc/config/serial | tr -d '[ \t\r\n]') + # Q series serial pattern CTWYYWWSSSS + # YYWWSSSS is a series of digits representing the year, number of weeks, and a sequence number + qSerialPattern="^CTW([1-9][0-9])(0[1-9]|[1-4][0-9]|5[0-3])([0-9]{4})$" + + case $(board_name) in + globalscale,espressobin-v7-emmc) + product_board_name="e3" + if [ -L /sys/class/ieee80211/phy0 ]; then + product_board_name=$product_board_name"w" + fi + echo $product_board_name >/tmp/sysinfo/product_board_name + ;; + caswell-caf-0262 | untangle-inc-default-string | arista-networks-inc-default-string) + if [[ $SERIAL =~ $qSerialPattern ]]; then + # Handle Q series board name. + product_board_name="Q6E" + else + # Handle NON Q series board name. + product_board_name="e6" + fi + + if [ -L /sys/class/ieee80211/phy0 ]; then + product_board_name=$product_board_name"w" + fi + + if [ -L /sys/class/net/wwan0 ]; then + product_board_name=$product_board_name"l" + fi + + echo $product_board_name >/tmp/sysinfo/product_board_name + ;; + vmware-inc-vmware-virtual-platform) + echo "VMware" >/tmp/sysinfo/product_board_name + ;; + innotek-gmbh-virtualbox) + echo "VirtualBox" >/tmp/sysinfo/product_board_name + ;; + microsoft-corporation-virtual-machine) + echo "HyperV" >/tmp/sysinfo/product_board_name + ;; + *) + echo "Custom" >/tmp/sysinfo/product_board_name + ;; + esac } diff --git a/sync-settings/files/quota_cron.sh b/sync-settings/files/quota_cron.sh new file mode 100644 index 000000000..994545cd3 --- /dev/null +++ b/sync-settings/files/quota_cron.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +export CMD_MATCH=$1 +export FULL_CMD=$2 +c_temp=$(nft list chain inet shaping quota-rules -a | grep "$CMD_MATCH") +c_tmp=${c_temp#*handle} +nft delete rule inet shaping quota-rules handle $c_tmp +$FULL_CMD diff --git a/sync-settings/files/set_affinity.sh b/sync-settings/files/set_affinity.sh new file mode 100755 index 000000000..9b72a3f8e --- /dev/null +++ b/sync-settings/files/set_affinity.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +if [ -z "$NCPUS" ]; then + NCPUS=$(grep processor /proc/cpuinfo | wc -l) +fi + +if [ -z "$DEVLIST" ]; then + DEVLIST=$(cd /sys/class/net; ls -1d et1_* | sort -t_ -k2n) +fi + +case $1 in +show) + for d in $DEVLIST + do + irqs=$(grep "iavf-$d-" /proc/interrupts | awk -F: '{print $1}') + printf "%s irqs: " $d + aflist= + for irq in $irqs + do + al=$(cat /proc/irq/$irq/smp_affinity_list) + aflist="$aflist $al" + printf "%5d" $irq + done + printf "\n\tcore: " + for al in $aflist + do + printf "%5d" $al + done + printf "\n" + done + ;; + +set) + af=0 + for d in $DEVLIST + do + # Setup CPU affinity + irqs=$(grep "iavf-$d-" /proc/interrupts | awk -F: '{print $1}') + for irq in $irqs + do + # echo "Set smp_affinity: $d irq=$irq $af" + echo $af > /proc/irq/$irq/smp_affinity_list + af=$((af+1)) + [ $af -eq $NCPUS ] && af=0 + done + done + ;; + +*) + echo "Usage: set_affinity show|set" + exit 1 +esac + +exit 0 diff --git a/sync-settings/files/set_rpsxps.sh b/sync-settings/files/set_rpsxps.sh new file mode 100755 index 000000000..af105a0df --- /dev/null +++ b/sync-settings/files/set_rpsxps.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +if [ -z "$DEVLIST" ]; then + DEVLIST=$(cd /sys/class/net; ls -1d et1_* | sort -t_ -k2n) +fi + +# 40 CPUs +CPUMASK_ALL="ff,ffffffff" + +case $1 in +show) + for d in $DEVLIST + do + for rx in $(cd /sys/class/net/$d/queues; ls -1d rx-*) + do + mask=$(cat /sys/class/net/$d/queues/$rx/rps_cpus) + echo $d $rx $mask + done + for tx in $(cd /sys/class/net/$d/queues; ls -1d tx-*) + do + mask=$(cat /sys/class/net/$d/queues/$tx/xps_cpus) + echo $d $tx $mask + done + done + ;; +set|revert) + [ $1 = revert ] && CPUMASK_ALL=0 + + for d in $DEVLIST + do + for rx in $(cd /sys/class/net/$d/queues; ls -1d rx-*) + do + echo $CPUMASK_ALL > /sys/class/net/$d/queues/$rx/rps_cpus + done + for tx in $(cd /sys/class/net/$d/queues; ls -1d tx-*) + do + echo $CPUMASK_ALL > /sys/class/net/$d/queues/$tx/xps_cpus + done + done + ;; +*) + echo "Usage: set_rpsxps show|set|revert" + exit 1 + ;; +esac + +exit 0 diff --git a/sync-settings/files/sync-settings.init b/sync-settings/files/sync-settings.init index 75f0c71ad..076132f1e 100755 --- a/sync-settings/files/sync-settings.init +++ b/sync-settings/files/sync-settings.init @@ -5,17 +5,25 @@ START=14 STOP=14 boot() { - # check if we should reset settings - /usr/bin/check-for-usb-reset.sh && rm /etc/config/settings.json + # check if we should reset settings + /usr/bin/check-for-usb-reset.sh && rm /etc/config/settings.json - if [ ! -f /etc/config/settings.json ] ; then - logger -t "sync-settings" "Creating /etc/config/settings.json" - /usr/bin/sync-settings -c -n -v force=true | logger -t "sync-settings" - else - /usr/bin/sync-settings -u -n -v force=true | logger -t "sync-settings" - fi + if [ ! -f /etc/config/settings.json ]; then + logger -t "sync-settings" "Creating /etc/config/settings.json" + /usr/bin/sync-settings -c -n -v force=true | logger -t "sync-settings" + else + /usr/bin/sync-settings -u -n -v force=true | logger -t "sync-settings" + fi - # ensure we have an up to date defaults.json file - /usr/bin/sync-settings -c -s -f /tmp/settings.json - mv /tmp/settings.json /etc/config/defaults.json + # ensure we have an up to date defaults.json file + /usr/bin/sync-settings -c -s -f /tmp/settings.json + mv /tmp/settings.json /etc/config/defaults.json + + # Run sysctl on 9* prio files if present + CUSTOM_COMMANDS="/etc/sysctl.d/9*" + + if ls $CUSTOM_COMMANDS; then + sysctl -p $CUSTOM_COMMANDS + + fi } diff --git a/version.mk b/version.mk index 938a40809..462fd7ea1 100644 --- a/version.mk +++ b/version.mk @@ -15,8 +15,23 @@ PKG_VERSION := $(call MFW_COMMIT,$(PKG_SOURCE_URL),$(PKG_SOURCE_VERSION)) # use historical "go mod vendor" approach export MFW_GOFLAGS="-mod=vendor -buildvcs=false" else # use source tree already checked out on disk -USE_SOURCE_DIR := $(LOCAL_SOURCE_PATH)/$(subst git@,,$(subst :,/,$(subst .git,,$(PKG_SOURCE_URL)))) +PKG_SOURCE_PATH := $(subst git@,,$(subst :,/,$(subst .git,,$(PKG_SOURCE_URL)))) +USE_SOURCE_DIR := $(LOCAL_SOURCE_PATH)/$(PKG_SOURCE_PATH) +HASH := \# +# we want to extract the version that barney stashed inside an +# environment variable; we select it based first on a pattern for +# the variable name, and then filter some more on its value. +# This is not exactly a walk in the park, as a simple $(shell env | +# perl ...) unfortunately dies with the dreaded "argument list too +# long", so we resort to using .VARIABLES instead +PKG_VERSION := $(strip $(foreach V,$(.VARIABLES), \ + $(if $(filter SRC_%, $V), \ + $(if $(filter $(PKG_SOURCE_PATH)%, $($V)), \ + $(subst $(PKG_SOURCE_PATH)$(HASH),,$($V)))))) +# if we couldn't extract a version, go with "local" +ifeq ($(PKG_VERSION),) PKG_VERSION := local +endif # undefine those 2 so there is no fetch attempt undefine PKG_SOURCE_PROTO undefine PKG_SOURCE_URL @@ -31,6 +46,7 @@ PKG_SOURCE := $(PKG_NAME)-$(PKG_SOURCE_VERSION)-$(PKG_VERSION).tar.xz test-mfw-version: @echo "PKG_NAME: $(PKG_NAME)" @echo "PKG_NAME_NO_DASH: $(PKG_NAME_NO_DASH)" + @echo "PKG_SOURCE_PATH: $(PKG_SOURCE_PATH)" @echo "PKG_SOURCE_PROTO: $(PKG_SOURCE_PROTO)" @echo "PKG_SOURCE_URL: $(PKG_SOURCE_URL)" @echo "USE_SOURCE_DIR: $(USE_SOURCE_DIR)"