mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-26 23:42:51 +08:00
update 2026-09-17 11:00:22
This commit is contained in:
1 parent
e08f1e1181
commit
c191464ab9
1955 files changed
+1523218
No files matched your search
@@ -0,0 +1,76 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=adbyby
|
||||
PKG_VERSION:=2.7
|
||||
PKG_RELEASE:=20200315
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/adbyby
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Powerful adblock module to block ad.
|
||||
DEPENDS:=@(i386||x86_64||arm||mipsel||mips||aarch64)
|
||||
URL:=http://www.adbyby.com/
|
||||
endef
|
||||
|
||||
define Package/adbyby/description
|
||||
Adbyby is a powerful adblock module to block ad,just like adblock.
|
||||
endef
|
||||
|
||||
ifeq ($(ARCH),x86_64)
|
||||
ADBYBY_DIR:=amd64
|
||||
endif
|
||||
ifeq ($(ARCH),mipsel)
|
||||
ADBYBY_DIR:=mipsle
|
||||
endif
|
||||
ifeq ($(ARCH),mips)
|
||||
ADBYBY_DIR:=mips
|
||||
endif
|
||||
ifeq ($(ARCH),i386)
|
||||
ADBYBY_DIR:=x86
|
||||
endif
|
||||
ifeq ($(ARCH),arm)
|
||||
ADBYBY_DIR:=armv7
|
||||
ifeq ($(BOARD),bcm53xx)
|
||||
ADBYBY_DIR:=arm
|
||||
endif
|
||||
ifeq ($(BOARD),kirkwood)
|
||||
ADBYBY_DIR:=arm
|
||||
endif
|
||||
endif
|
||||
ifeq ($(ARCH),aarch64)
|
||||
ADBYBY_DIR:=armv7
|
||||
endif
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/adbyby/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/adbyby
|
||||
$(INSTALL_BIN) ./files/adbyby.sh $(1)/usr/share/adbyby/
|
||||
$(INSTALL_CONF) ./files/adhook.ini $(1)/usr/share/adbyby/
|
||||
$(INSTALL_CONF) ./files/user.action $(1)/usr/share/adbyby/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/adbyby/data
|
||||
$(INSTALL_DATA) ./files/data/* $(1)/usr/share/adbyby/data/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/adbyby/doc
|
||||
$(INSTALL_DATA) ./files/doc/* $(1)/usr/share/adbyby/doc/
|
||||
|
||||
$(INSTALL_BIN) ./files/$(ADBYBY_DIR)/adbyby $(1)/usr/share/adbyby/adbyby
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,adbyby))
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
PROG_PATH=/usr/share/adbyby
|
||||
err=0
|
||||
until [ $err -ge 5 ]; do
|
||||
if [ -n "$(pgrep $PROG_PATH/adbyby)" ]; then
|
||||
iptables-save | grep ADBYBY >/dev/null || \
|
||||
/etc/init.d/adbyby add_rule
|
||||
sleep 10
|
||||
err=0
|
||||
else
|
||||
$PROG_PATH/adbyby --no-daemon &>/dev/null &
|
||||
sleep 1
|
||||
err=$((err+1))
|
||||
fi
|
||||
done
|
||||
/etc/init.d/adbyby del_rule
|
||||
@@ -0,0 +1,14 @@
|
||||
[cfg]
|
||||
### 2.1 ###
|
||||
listen-address=0.0.0.0:8118
|
||||
buffer-limit=1024
|
||||
keep-alive-timeout=30
|
||||
socket-timeout=60
|
||||
### 2.5 ###
|
||||
max_client_connections=0
|
||||
### 2.6 ###
|
||||
stack_size=200
|
||||
auto_restart=0
|
||||
### 2.7 ###
|
||||
debug=0
|
||||
ipset=0
|
||||
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
! -----¸üÐÂʱ¼ä: 2018-10-08 23:07:52 by:xwhyc-----
|
||||
.php?ad=
|
||||
/99rejs/js
|
||||
/agetsou.js^
|
||||
/c@*!25.js|$script
|
||||
/cococ-66/$script
|
||||
/defaultts.tc.qq.com/*.ts?index=0&start=0&
|
||||
/defaultts.tc.qq.com/*.ts?index=0&start=0&end=*&ver=4
|
||||
/gg_js/
|
||||
/imgs.js?t=
|
||||
/js/adtop.js|
|
||||
/js/guanggao_gg.js?d=
|
||||
/js/sss/ad.js
|
||||
/static/js/aall.js
|
||||
/unionjs/$script
|
||||
/variety.tc.qq.com/*.mp4^*fmt=hd
|
||||
/variety.tc.qq.com/*.mp4^*fmt=shd
|
||||
/video.dispatch.tc.qq.com/*.mp4^*sdtfrom=
|
||||
/view/image/QT_HY.jpg?t=
|
||||
/view/js/slade.js|$script
|
||||
/vlive.qqvideo.tc.qq.com/*.mp4^*fmt=hd
|
||||
/vlive.qqvideo.tc.qq.com/*.mp4^*fmt=shd
|
||||
/vmind.qqvideo.tc.qq.com/*.mp4^*sdtfrom=
|
||||
/vmindhls.tc.qq.com/*ugc=0&ga=0&gv=0&start=
|
||||
/zzhzgg.js
|
||||
@@ -0,0 +1,15 @@
|
||||
! ------------------------------ ADByby 自定义过滤语法简表---------------------------------
|
||||
! -------------- 规则基于abp规则,并进行了字符替换部分的扩展-----------------------------
|
||||
! ABP规则请参考https://adblockplus.org/zh_CN/filters,下面为大致摘要
|
||||
! "!" 为行注释符,注释行以该符号起始作为一行注释语义,用于规则描述
|
||||
! "*" 为字符通配符,能够匹配0长度或任意长度的字符串,该通配符不能与正则语法混用。
|
||||
! "^" 为分隔符,可以是除了字母、数字或者 _ - . % 之外的任何字符。
|
||||
! "|" 为管线符号,来表示地址的最前端或最末端
|
||||
! "||" 为子域通配符,方便匹配主域名下的所有子域。
|
||||
! "~" 为排除标识符,通配符能过滤大多数广告,但同时存在误杀, 可以通过排除标识符修正误杀链接。
|
||||
! "##" 为元素选择器标识符,后面跟需要隐藏元素的CSS样式例如 #ad_id .ad_class
|
||||
!! 元素隐藏暂不支持全局规则和排除规则
|
||||
!! 字符替换扩展
|
||||
! 文本替换选择器标识符,后面跟需要替换的文本数据,格式:$s@模式字符串@替换后的文本@
|
||||
! 支持通配符*和?
|
||||
! -------------------------------------------------------------------------------------------
|
||||
Whitespace-only changes.
@@ -0,0 +1,30 @@
|
||||
! -----更新时间: 2018-10-08 23:06:11 by:xwhyc-----------------------------------------------
|
||||
! -----广告反馈:http://www.adbyby.com/help.htm QQ群: 79547134(满), 364066294(满),470705224(满),534897434,438394572--------------
|
||||
|
||||
|
||||
!-------------------------------------------
|
||||
/showadv/
|
||||
3199.cn###ad640,[id^="ad0"]
|
||||
76fengyun.com###down_box{display:block!important;}.gggg,.ggao
|
||||
9553.com##[class="zm"]
|
||||
962.net##.show_ad,.g-962-ad
|
||||
amazon.cn##.adv-float-div
|
||||
downsx.rocks##.adbox,.Left-ad3_fixed,.google-ad2_fixed
|
||||
edu-acc.cn###doyoo_monitor
|
||||
fx678.com##[class^="adv-"]
|
||||
||76fengyun.com/body22233.js
|
||||
||76fengyun.com/file/$s@onclick="window.open('*');startWait();"@onclick="window.open(document.getElementById('downpage_link').href);startWait();"@
|
||||
||atanx.alicdn.com/t/tanxssp.js?_v=
|
||||
||biquguan.com/guan/$script
|
||||
||djv99sxoqpv11.cloudfront.net
|
||||
||jmxlaser.com
|
||||
||jump2.bdimg.com/p/$s@<div class="l_post l_post_bright j_l_post clearfix ?????????? "@<div style="display:none"@
|
||||
||nxkycx.com
|
||||
||res.jklan.cn/wp-content/themes/tt/js/system.js?ver=$s@function goto()@function xxx()@
|
||||
||tieba.com/p/$s@<div class="l_post l_post_bright j_l_post clearfix ?????????? "@<div style="display:none"@
|
||||
||ychap.com
|
||||
!-----------------------
|
||||
/qkostn.js|
|
||||
|http://mark.l.qq.com/fcgi-bin/get_video_mark_all*&strAdParam=
|
||||
!---------adbyby---------
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
(function(global){var DOC=global.document,w3c_css=global.getComputedStyle,undef=void 0,reg_combinator=/^\s*([>+~,\s])\s*(\*|(?:[-\w*]|[^\x00-\xa0]|\\.)*)/,trimLeft=/^\s+/,trimRight=/\s+$/,reg_comma=/^\s*,\s*/,reg_sequence=/^([#\.:]|\[\s*)((?:[-\w]|[^\x00-\xa0]|\\.)+)/,reg_pseudo=/^\(\s*("([^"]*)"|'([^']*)'|[^\(\)]*(\([^\(\)]*\))?)\s*\)/,reg_attrib=/^\s*(?:(\S?=)\s*(?:(['"])(.*?)\2|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,reg_attrval=/\\([0-9a-fA-F]{2,2})/g,reg_sensitive=/^(?:title|id|name|class|for|href|src)$/,reg_backslash=/\\/g,reg_tag=/^((?:[-\w\*]|[^\x00-\xa0]|\\.)+)/,reg_parse_pseudo=/(-?)(\d*)n([-+]?\d*)/,reg_quick=/^(^|[#.])((?:[-\w]|[^\x00-\xa0]|\\.)+)$/,has_in=function(a,b){return(a in b)},dom={html:DOC.documentElement,mix:function(target,source){var args=[].slice.call(arguments),key,ride=typeof args[args.length-1]=="boolean"?args.pop():true;target=target||{};for(var i=1;source=args[i++];){for(key in source){if(ride||!has_in(key,target)){target[key]=source[key]}}}return target},rword:/[^, ]+/g,uuid:1,getUid:w3c_css?function(node){return node.uniqueNumber||(node.uniqueNumber=dom.uuid++)}:function(node){var uid=node.getAttribute("uniqueNumber");if(!uid){uid=dom.uuid++;node.setAttribute("uniqueNumber",uid)}return uid},oneObject:function(array,val){if(typeof array=="string"){array=array.match(dom.rword)||[]}var result={},value=val!==undef?val:1;for(var i=0,n=array.length;i<n;i++){result[array[i]]=value}return result}},hash_operator={"=":1,"!=":2,"|=":3,"~=":4,"^=":5,"$=":6,"*=":7},slice=Array.prototype.slice,attrURL=dom.oneObject("action,cite,codebase,data,href,longdesc,lowsrc,src,usemap",2),bools=dom["@bools"]="autofocus,autoplay,async,checked,controls,declare,disabled,defer,defaultchecked,contenteditable,ismap,loop,multiple,noshade,open,noresize,readonly,selected",boolOne=dom.oneObject(bools),fixGetAttribute,fixHasAttribute,fixById,fixByTag,filterPseudoHasExp=function(strchild,strsibling,type){return{exec:function(flags,lastResult,args){var result=[],flag_not=flags.not,child=strchild,sibling=strsibling,ofType=type,cache={},lock={},a=args.a,b=args.b,i=0,ri=0,el,found,diff,count;if(!ofType&&a===1&&b===0){return flag_not?[]:lastResult}for(var checkName=ofType?"nodeName":"nodeType",parent,pid,checkValue;el=lastResult[i++];){parent=el.parentNode;pid=dom.getUid(parent);if(!lock[pid]){count=lock[pid]=1;checkValue=ofType?el.nodeName:1;for(var node=parent[child];node;node=node[sibling]){if(node[checkName]===checkValue){pid=dom.getUid(node);cache[pid]=count++}}}diff=cache[dom.getUid(el)]-b;found=a===0?diff===0:(diff%a===0&&diff/a>=0);(found^flag_not)&&(result[ri++]=el)}return result}}},onePosition=dom.oneObject("eq,gt,lt,first,last,even,odd"),siblingCheck=function(a,b,ret){if(a===b){return ret}var cur=a.nextSibling;while(cur){if(cur===b){return -1}cur=cur.nextSibling}return 1},sortOrder1=function(a,b){if(a===b){sortOrder1.hasDuplicate=true;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition){return a.compareDocumentPosition?-1:1}return a.compareDocumentPosition(b)&4?-1:1},sortOrder2=function(a,b){if(a===b){sortOrder2.hasDuplicate=true;return 0}var al,bl,ap=[],bp=[],aup=a.parentNode,bup=b.parentNode,cur=aup;if(aup===bup){return siblingCheck(a,b)}else{if(!aup){return -1}else{if(!bup){return 1}}}while(cur){ap.unshift(cur);cur=cur.parentNode}cur=bup;while(cur){bp.unshift(cur);cur=cur.parentNode}al=ap.length;bl=bp.length;for(var i=0;i<al&&i<bl;i++){if(ap[i]!==bp[i]){return siblingCheck(ap[i],bp[i])}}return i===al?siblingCheck(a,bp[i],-1):siblingCheck(ap[i],b,1)},_toHex=function(x,y){return String.fromCharCode(parseInt(y,16))},parse_pseudo=function(key,match){var expr=match[3]||match[2];expr=expr?expr.replace(reg_attrval,_toHex):match[1];if(!key.indexOf("nth")){expr=expr.replace(/^\+|\s*/g,"");match=(expr==="even"&&"2n"||expr==="odd"&&"2n+1"||!/\D/.test(expr)&&"0n+"+expr||expr).match(reg_parse_pseudo);return{a:(match[1]+(match[2]||1))-0,b:match[3]-0}}return expr},makeArray=function(nodes,result,flag_multi){nodes=slice.call(nodes,0);if(result){result.push.apply(result,nodes)}else{result=nodes}return flag_multi?dom.unique(result):result},getElementsByTagName=function(tagName,els,flag_xml){var method="getElementsByTagName",elems=[],uniqResult={},prefix;if(flag_xml&&tagName.indexOf(":")>0&&els.length&&els[0].lookupNamespaceURI){var arr=tagName.split(":");prefix=arr[0];tagName=arr[1];method="getElementsByTagNameNS";prefix=els[0].lookupNamespaceURI(prefix)}switch(els.length){case 0:return elems;case 1:var all=prefix?els[0][method](prefix,tagName):els[0][method](tagName);for(var i=0,ri=0,el;el=all[i++];){if(el.nodeType===1){elems[ri++]=el}}return elems;default:for(var nodes,i=0,ri=0;el=els[i++];){nodes=prefix?el[method](prefix,tagName):el[method](tagName);for(var uid,j=0,node;node=nodes[j++];){uid=dom.getUid(node);if(!uniqResult[uid]){uniqResult[uid]=elems[ri++]=node}}}return elems}},getElementsByXPath=function(xpath,context,doc){var result=[];try{if(global.DOMParser){var nodes=doc.evaluate(xpath,context,Line truncated
|
||||
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,10 @@
|
||||
;¸üйæÔòurl,dir,size,reverse,reverse
|
||||
http://update.adbyby.com/rule3/lazy.jpg \data\lazy.txt 385337 4 0
|
||||
http://update.adbyby.com/rule3/video.jpg \data\video.txt 1028 4 0
|
||||
http://update.adbyby.com/rule3/user.action \user.action 512 5 0
|
||||
http://update.adbyby.com/rule3/clean.ini \data\clean.ini 2167 0 0
|
||||
http://update.adbyby.com/rule3/adclear.ini \data\adclear.ini 4901 0 0
|
||||
https://github.com/gchangchen/suho/raw/master/adhook.dll \adhook.dll 117248 0 0 2.4.3.2
|
||||
https://github.com/gchangchen/suho/raw/master/adhook64.dll \adhook64.dll 142848 0 0 2.4.3.2
|
||||
https://github.com/gchangchen/suho/raw/master/adbyby.exe \adbyby.exe 1004183 1 0 2.4.4.0
|
||||
|
||||
Whitespace-only changes.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,84 @@
|
||||
#
|
||||
# Copyright (C) 2010-2023 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=autocore
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/target.mk
|
||||
|
||||
define Package/autocore-arm
|
||||
TITLE:=Arm auto core loadbalance script
|
||||
DEPENDS:=@(arm||aarch64) \
|
||||
+TARGET_bcm27xx:bcm27xx-userland \
|
||||
+TARGET_bcm53xx:nvram +ethtool
|
||||
VARIANT:=arm
|
||||
endef
|
||||
|
||||
define Package/autocore-loongarch64
|
||||
TITLE:=Loongarch64 auto core loadbalance script
|
||||
DEPENDS:=@loongarch64 +bc +ethtool +pciutils
|
||||
VARIANT:=loongarch64
|
||||
endef
|
||||
|
||||
define Package/autocore-x86
|
||||
TITLE:=x86/64 auto core loadbalance script
|
||||
DEPENDS:=@TARGET_x86 +bc +ethtool +lm-sensors +pciutils
|
||||
VARIANT:=x86
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/autocore-arm/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/arm/index.htm $(1)/etc/index.htm
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/60-autocore-reload-rpcd $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/arm/090-cover-index_htm $(1)/etc/uci-defaults/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) ./files/arm/sbin/cpuinfo $(1)/sbin/cpuinfo
|
||||
$(INSTALL_BIN) ./files/arm/sbin/ethinfo $(1)/sbin/ethinfo
|
||||
$(INSTALL_BIN) ./files/arm/sbin/usage $(1)/sbin/usage
|
||||
ifneq ($(filter ipq% %filogic qualcommax%, $(TARGETID)),)
|
||||
$(INSTALL_BIN) ./files/arm/sbin/tempinfo $(1)/sbin/tempinfo
|
||||
endif
|
||||
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
|
||||
$(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
|
||||
endef
|
||||
|
||||
define Package/autocore-loongarch64/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/loongarch64/autocore $(1)/etc/init.d/autocore
|
||||
$(INSTALL_BIN) ./files/60-autocore-reload-rpcd $(1)/etc/uci-defaults/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) ./files/loongarch64/sbin/cpuinfo $(1)/sbin/cpuinfo
|
||||
$(INSTALL_BIN) ./files/loongarch64/sbin/tempinfo $(1)/sbin/tempinfo
|
||||
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
|
||||
$(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
|
||||
endef
|
||||
|
||||
define Package/autocore-x86/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/autocore
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/x86/index.htm $(1)/etc/index.htm
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/60-autocore-reload-rpcd $(1)/etc/uci-defaults/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(CP) ./files/x86/sbin/* $(1)/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
|
||||
$(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,autocore-arm))
|
||||
$(eval $(call BuildPackage,autocore-loongarch64))
|
||||
$(eval $(call BuildPackage,autocore-x86))
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
/etc/init.d/rpcd restart
|
||||
|
||||
exit 0
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -f /etc/index.htm ] && mv /etc/index.htm /usr/lib/lua/luci/view/admin_status/index.htm
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,857 @@
|
||||
<%#
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
|
||||
Licensed to the public under the Apache License 2.0.
|
||||
-%>
|
||||
|
||||
<%
|
||||
local fs = require "nixio.fs"
|
||||
local util = require "luci.util"
|
||||
local stat = require "luci.tools.status"
|
||||
local ver = require "luci.version"
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
|
||||
local has_ipv6 = fs.access("/usr/sbin/ip6tables")
|
||||
local has_dhcp = fs.access("/etc/config/dhcp")
|
||||
local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0)
|
||||
local has_switch = false
|
||||
|
||||
uci:foreach("network", "switch",
|
||||
function(s)
|
||||
has_switch = true
|
||||
return false
|
||||
end)
|
||||
|
||||
local sysinfo = luci.util.ubus("system", "info") or { }
|
||||
local boardinfo = luci.util.ubus("system", "board") or { }
|
||||
local unameinfo = nixio.uname() or { }
|
||||
|
||||
local meminfo = sysinfo.memory or {
|
||||
total = 0,
|
||||
free = 0,
|
||||
buffered = 0,
|
||||
shared = 0
|
||||
}
|
||||
|
||||
local mem_cached = luci.sys.exec("sed -e '/^Cached: /!d; s#Cached: *##; s# kB##g' /proc/meminfo")
|
||||
|
||||
local swapinfo = sysinfo.swap or {
|
||||
total = 0,
|
||||
free = 0
|
||||
}
|
||||
|
||||
local has_dsl = fs.access("/etc/init.d/dsl_control")
|
||||
|
||||
if luci.http.formvalue("status") == "1" then
|
||||
local ntm = require "luci.model.network".init()
|
||||
local wan = ntm:get_wannet()
|
||||
local wan6 = ntm:get_wan6net()
|
||||
|
||||
local conn_count = tonumber(
|
||||
fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0
|
||||
|
||||
local conn_max = tonumber(luci.sys.exec(
|
||||
"sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max"
|
||||
):match("%d+")) or 4096
|
||||
|
||||
local user_info = luci.sys.exec("cat /proc/net/arp | grep 'br-lan' | grep '0x2' | wc -l")
|
||||
|
||||
local cpu_usage = luci.sys.exec("/sbin/usage") or "6%"
|
||||
local cpu_info = luci.sys.exec("/sbin/cpuinfo") or "?"
|
||||
local eth_info = luci.sys.exec("ethinfo")
|
||||
|
||||
local rv = {
|
||||
cpuinfo = cpu_info,
|
||||
cpuusage = cpu_usage,
|
||||
ethinfo = eth_info,
|
||||
userinfo = user_info,
|
||||
uptime = sysinfo.uptime or 0,
|
||||
localtime = os.date(),
|
||||
loadavg = sysinfo.load or { 0, 0, 0 },
|
||||
memory = meminfo,
|
||||
memcached = mem_cached,
|
||||
swap = swapinfo,
|
||||
connmax = conn_max,
|
||||
conncount = conn_count,
|
||||
leases = stat.dhcp_leases(),
|
||||
leases6 = stat.dhcp6_leases(),
|
||||
wifinets = stat.wifi_networks()
|
||||
}
|
||||
|
||||
if wan then
|
||||
rv.wan = {
|
||||
ipaddr = wan:ipaddr(),
|
||||
gwaddr = wan:gwaddr(),
|
||||
netmask = wan:netmask(),
|
||||
dns = wan:dnsaddrs(),
|
||||
expires = wan:expires(),
|
||||
uptime = wan:uptime(),
|
||||
proto = wan:proto(),
|
||||
ifname = wan:ifname(),
|
||||
link = wan:adminlink()
|
||||
}
|
||||
end
|
||||
|
||||
if wan6 then
|
||||
rv.wan6 = {
|
||||
ip6addr = wan6:ip6addr(),
|
||||
gw6addr = wan6:gw6addr(),
|
||||
dns = wan6:dns6addrs(),
|
||||
ip6prefix = wan6:ip6prefix(),
|
||||
uptime = wan6:uptime(),
|
||||
proto = wan6:proto(),
|
||||
ifname = wan6:ifname(),
|
||||
link = wan6:adminlink()
|
||||
}
|
||||
end
|
||||
|
||||
if has_dsl then
|
||||
local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat")
|
||||
local dsl_func = loadstring(dsl_stat)
|
||||
if dsl_func then
|
||||
rv.dsl = dsl_func()
|
||||
end
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(rv)
|
||||
|
||||
return
|
||||
elseif luci.http.formvalue("hosts") == "1" then
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(luci.sys.net.host_hints())
|
||||
|
||||
return
|
||||
end
|
||||
-%>
|
||||
|
||||
<%+header%>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function progressbar(v, m)
|
||||
{
|
||||
var vn = parseInt(v) || 0;
|
||||
var mn = parseInt(m) || 100;
|
||||
var pc = Math.floor((100 / mn) * vn);
|
||||
|
||||
return String.format(
|
||||
'<div style="width:200px; position:relative; border:1px solid #999999">' +
|
||||
'<div style="background-color:#CCCCCC; width:%d%%; height:15px">' +
|
||||
'<div style="position:absolute; left:0; top:0; text-align:center; width:100%%; color:#000000">' +
|
||||
'<small>%s / %s (%d%%)</small>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>', pc, v, m, pc
|
||||
);
|
||||
}
|
||||
|
||||
function wifirate(bss, rx) {
|
||||
var p = rx ? 'rx_' : 'tx_',
|
||||
s = '%.1f <%:Mbit/s%>, %d<%:MHz%>'
|
||||
.format(bss[p+'rate'] / 1000, bss[p+'mhz']),
|
||||
ht = bss[p+'ht'], vht = bss[p+'vht'],
|
||||
mhz = bss[p+'mhz'], nss = bss[p+'nss'],
|
||||
mcs = bss[p+'mcs'], sgi = bss[p+'short_gi'],
|
||||
he = bss[p+'he'], he_gi = bss[p+'he_gi'],
|
||||
he_dcm = bss[p+'he_dcm'];
|
||||
|
||||
if (ht || vht) {
|
||||
if (vht) s += ', VHT-MCS %d'.format(mcs);
|
||||
if (nss) s += ', VHT-NSS %d'.format(nss);
|
||||
if (ht) s += ', MCS %s'.format(mcs);
|
||||
if (sgi) s += ', <%:Short GI%>';
|
||||
}
|
||||
|
||||
if (he) {
|
||||
s += ', HE-MCS %d'.format(mcs);
|
||||
if (nss) s += ', HE-NSS %d'.format(nss);
|
||||
if (he_gi) s += ', HE-GI %d'.format(he_gi);
|
||||
if (he_dcm) s += ', HE-DCM %d'.format(he_dcm);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function duid2mac(duid) {
|
||||
// DUID-LLT / Ethernet
|
||||
if (duid.length === 28 && duid.substr(0, 8) === '00010001')
|
||||
return duid.substr(16).replace(/(..)(?=..)/g, '$1:').toUpperCase();
|
||||
|
||||
// DUID-LL / Ethernet
|
||||
if (duid.length === 20 && duid.substr(0, 8) === '00030001')
|
||||
return duid.substr(8).replace(/(..)(?=..)/g, '$1:').toUpperCase();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var npoll = 1;
|
||||
var hosts = <%=luci.http.write_json(luci.sys.net.host_hints())%>;
|
||||
|
||||
function updateHosts() {
|
||||
XHR.get('<%=REQUEST_URI%>', { hosts: 1 }, function(x, data) {
|
||||
hosts = data;
|
||||
});
|
||||
}
|
||||
|
||||
XHR.poll(5, '<%=REQUEST_URI%>', { status: 1 },
|
||||
function(x, info)
|
||||
{
|
||||
if (!(npoll++ % 5))
|
||||
updateHosts();
|
||||
|
||||
var si = document.getElementById('wan4_i');
|
||||
var ss = document.getElementById('wan4_s');
|
||||
var ifc = info.wan;
|
||||
|
||||
if (ifc && ifc.ifname && ifc.proto != 'none')
|
||||
{
|
||||
var s = String.format(
|
||||
'<strong><%:Type%>: </strong>%s<br />' +
|
||||
'<strong><%:Address%>: </strong>%s<br />' +
|
||||
'<strong><%:Netmask%>: </strong>%s<br />' +
|
||||
'<strong><%:Gateway%>: </strong>%s<br />',
|
||||
ifc.proto,
|
||||
(ifc.ipaddr) ? ifc.ipaddr : '0.0.0.0',
|
||||
(ifc.netmask && ifc.netmask != ifc.ipaddr) ? ifc.netmask : '255.255.255.255',
|
||||
(ifc.gwaddr) ? ifc.gwaddr : '0.0.0.0'
|
||||
);
|
||||
|
||||
for (var i = 0; i < ifc.dns.length; i++)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:DNS%> %d: </strong>%s<br />',
|
||||
i + 1, ifc.dns[i]
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc.expires > -1)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Expires%>: </strong>%t<br />',
|
||||
ifc.expires
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc.uptime > 0)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Connected%>: </strong>%t<br />',
|
||||
ifc.uptime
|
||||
);
|
||||
}
|
||||
|
||||
ss.innerHTML = String.format('<small>%s</small>', s);
|
||||
si.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small><a href="%s">%s</a></small>',
|
||||
ifc.link, ifc.ifname
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
si.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
|
||||
ss.innerHTML = '<em><%:Not connected%></em>';
|
||||
}
|
||||
|
||||
<% if has_ipv6 then %>
|
||||
var si6 = document.getElementById('wan6_i');
|
||||
var ss6 = document.getElementById('wan6_s');
|
||||
var ifc6 = info.wan6;
|
||||
|
||||
if (ifc6 && ifc6.ifname && ifc6.proto != 'none')
|
||||
{
|
||||
var s = String.format(
|
||||
'<strong><%:Type%>: </strong>%s%s<br />',
|
||||
ifc6.proto, (ifc6.ip6prefix) ? '-pd' : ''
|
||||
);
|
||||
|
||||
if (!ifc6.ip6prefix)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Address%>: </strong>%s<br />',
|
||||
(ifc6.ip6addr) ? ifc6.ip6addr : '::'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Prefix Delegated%>: </strong>%s<br />',
|
||||
ifc6.ip6prefix
|
||||
);
|
||||
if (ifc6.ip6addr)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Address%>: </strong>%s<br />',
|
||||
ifc6.ip6addr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
s += String.format(
|
||||
'<strong><%:Gateway%>: </strong>%s<br />',
|
||||
(ifc6.gw6addr) ? ifc6.gw6addr : '::'
|
||||
);
|
||||
|
||||
for (var i = 0; i < ifc6.dns.length; i++)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:DNS%> %d: </strong>%s<br />',
|
||||
i + 1, ifc6.dns[i]
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc6.uptime > 0)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Connected%>: </strong>%t<br />',
|
||||
ifc6.uptime
|
||||
);
|
||||
}
|
||||
|
||||
ss6.innerHTML = String.format('<small>%s</small>', s);
|
||||
si6.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small><a href="%s">%s</a></small>',
|
||||
ifc6.link, ifc6.ifname
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
si6.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
|
||||
ss6.innerHTML = '<em><%:Not connected%></em>';
|
||||
}
|
||||
<% end %>
|
||||
|
||||
<% if has_dsl then %>
|
||||
var dsl_i = document.getElementById('dsl_i');
|
||||
var dsl_s = document.getElementById('dsl_s');
|
||||
|
||||
var s = String.format(
|
||||
'<strong><%:Status%>: </strong>%s<br />' +
|
||||
'<strong><%:Line State%>: </strong>%s [0x%x]<br />' +
|
||||
'<strong><%:Line Mode%>: </strong>%s<br />' +
|
||||
'<strong><%:Annex%>: </strong>%s<br />' +
|
||||
'<strong><%:Profile%>: </strong>%s<br />' +
|
||||
'<strong><%:Data Rate%>: </strong>%s/s / %s/s<br />' +
|
||||
'<strong><%:Max. Attainable Data Rate (ATTNDR)%>: </strong>%s/s / %s/s<br />' +
|
||||
'<strong><%:Latency%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Line Attenuation (LATN)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Signal Attenuation (SATN)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Noise Margin (SNR)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Aggregate Transmit Power(ACTATP)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Forward Error Correction Seconds (FECS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Errored seconds (ES)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Severely Errored Seconds (SES)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Loss of Signal Seconds (LOSS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Unavailable Seconds (UAS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Header Error Code Errors (HEC)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Non Pre-emtive CRC errors (CRC_P)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Pre-emtive CRC errors (CRCP_P)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Line Uptime%>: </strong>%s<br />' +
|
||||
'<strong><%:ATU-C System Vendor ID%>: </strong>%s<br />' +
|
||||
'<strong><%:Power Management Mode%>: </strong>%s<br />',
|
||||
info.dsl.line_state, info.dsl.line_state_detail,
|
||||
info.dsl.line_state_num,
|
||||
info.dsl.line_mode_s,
|
||||
info.dsl.annex_s,
|
||||
info.dsl.profile_s,
|
||||
info.dsl.data_rate_down_s, info.dsl.data_rate_up_s,
|
||||
info.dsl.max_data_rate_down_s, info.dsl.max_data_rate_up_s,
|
||||
info.dsl.latency_num_down, info.dsl.latency_num_up,
|
||||
info.dsl.line_attenuation_down, info.dsl.line_attenuation_up,
|
||||
info.dsl.signal_attenuation_down, info.dsl.signal_attenuation_up,
|
||||
info.dsl.noise_margin_down, info.dsl.noise_margin_up,
|
||||
info.dsl.actatp_down, info.dsl.actatp_up,
|
||||
info.dsl.errors_fec_near, info.dsl.errors_fec_far,
|
||||
info.dsl.errors_es_near, info.dsl.errors_es_far,
|
||||
info.dsl.errors_ses_near, info.dsl.errors_ses_far,
|
||||
info.dsl.errors_loss_near, info.dsl.errors_loss_far,
|
||||
info.dsl.errors_uas_near, info.dsl.errors_uas_far,
|
||||
info.dsl.errors_hec_near, info.dsl.errors_hec_far,
|
||||
info.dsl.errors_crc_p_near, info.dsl.errors_crc_p_far,
|
||||
info.dsl.errors_crcp_p_near, info.dsl.errors_crcp_p_far,
|
||||
info.dsl.line_uptime_s,
|
||||
info.dsl.atuc_vendor_id,
|
||||
info.dsl.power_mode_s
|
||||
);
|
||||
|
||||
dsl_s.innerHTML = String.format('<small>%s</small>', s);
|
||||
dsl_i.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small>DSL</small>'
|
||||
);
|
||||
<% end %>
|
||||
|
||||
<% if has_dhcp then %>
|
||||
var ls = document.getElementById('lease_status_table');
|
||||
if (ls)
|
||||
{
|
||||
/* clear all rows */
|
||||
while( ls.rows.length > 1 )
|
||||
ls.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
for( var i = 0; i < info.leases.length; i++ )
|
||||
{
|
||||
var timestr;
|
||||
|
||||
if (info.leases[i].expires === false)
|
||||
timestr = '<em><%:unlimited%></em>';
|
||||
else if (info.leases[i].expires <= 0)
|
||||
timestr = '<em><%:expired%></em>';
|
||||
else
|
||||
timestr = String.format('%t', info.leases[i].expires);
|
||||
|
||||
var tr = ls.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].hostname ? info.leases[i].hostname : '?';
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].ipaddr;
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].macaddr;
|
||||
tr.insertCell(-1).innerHTML = timestr;
|
||||
}
|
||||
|
||||
if( ls.rows.length == 1 )
|
||||
{
|
||||
var tr = ls.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 4;
|
||||
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
||||
}
|
||||
}
|
||||
|
||||
var ls6 = document.getElementById('lease6_status_table');
|
||||
if (ls6 && info.leases6)
|
||||
{
|
||||
ls6.parentNode.style.display = 'block';
|
||||
|
||||
/* clear all rows */
|
||||
while( ls6.rows.length > 1 )
|
||||
ls6.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
for( var i = 0; i < info.leases6.length; i++ )
|
||||
{
|
||||
var timestr;
|
||||
|
||||
if (info.leases6[i].expires === false)
|
||||
timestr = '<em><%:unlimited%></em>';
|
||||
else if (info.leases6[i].expires <= 0)
|
||||
timestr = '<em><%:expired%></em>';
|
||||
else
|
||||
timestr = String.format('%t', info.leases6[i].expires);
|
||||
|
||||
var tr = ls6.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
|
||||
var host = hosts[duid2mac(info.leases6[i].duid)];
|
||||
if (!info.leases6[i].hostname)
|
||||
tr.insertCell(-1).innerHTML =
|
||||
(host && (host.name || host.ipv4 || host.ipv6))
|
||||
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">? (%h)</div>'.format(host.name || host.ipv4 || host.ipv6)
|
||||
: '?';
|
||||
else
|
||||
tr.insertCell(-1).innerHTML =
|
||||
(host && host.name && info.leases6[i].hostname != host.name)
|
||||
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">%h (%h)</div>'.format(info.leases6[i].hostname, host.name)
|
||||
: info.leases6[i].hostname;
|
||||
|
||||
tr.insertCell(-1).innerHTML = info.leases6[i].ip6addr;
|
||||
tr.insertCell(-1).innerHTML = info.leases6[i].duid;
|
||||
tr.insertCell(-1).innerHTML = timestr;
|
||||
}
|
||||
|
||||
if( ls6.rows.length == 1 )
|
||||
{
|
||||
var tr = ls6.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 4;
|
||||
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
||||
}
|
||||
}
|
||||
<% end %>
|
||||
|
||||
<% if has_wifi then %>
|
||||
var assoclist = [ ];
|
||||
|
||||
var ws = document.getElementById('wifi_status_table');
|
||||
if (ws)
|
||||
{
|
||||
var wsbody = ws.rows[0].parentNode;
|
||||
while (ws.rows.length > 0)
|
||||
wsbody.deleteRow(0);
|
||||
|
||||
for (var didx = 0; didx < info.wifinets.length; didx++)
|
||||
{
|
||||
var dev = info.wifinets[didx];
|
||||
|
||||
var tr = wsbody.insertRow(-1);
|
||||
var td;
|
||||
|
||||
td = tr.insertCell(-1);
|
||||
td.width = "33%";
|
||||
td.innerHTML = dev.name;
|
||||
td.style.verticalAlign = "top";
|
||||
|
||||
td = tr.insertCell(-1);
|
||||
|
||||
var s = '';
|
||||
|
||||
for (var nidx = 0; nidx < dev.networks.length; nidx++)
|
||||
{
|
||||
var net = dev.networks[nidx];
|
||||
var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel && !net.disabled);
|
||||
|
||||
var icon;
|
||||
if (!is_assoc)
|
||||
icon = "<%=resource%>/icons/signal-none.png";
|
||||
else if (net.quality == 0)
|
||||
icon = "<%=resource%>/icons/signal-0.png";
|
||||
else if (net.quality < 25)
|
||||
icon = "<%=resource%>/icons/signal-0-25.png";
|
||||
else if (net.quality < 50)
|
||||
icon = "<%=resource%>/icons/signal-25-50.png";
|
||||
else if (net.quality < 75)
|
||||
icon = "<%=resource%>/icons/signal-50-75.png";
|
||||
else
|
||||
icon = "<%=resource%>/icons/signal-75-100.png";
|
||||
|
||||
s += String.format(
|
||||
'<table><tr><td style="text-align:center; width:32px; padding:3px">' +
|
||||
'<img src="%s" title="<%:Signal%>: %d dBm / <%:Noise%>: %d dBm" />' +
|
||||
'<br /><small>%d%%</small>' +
|
||||
'</td><td style="text-align:left; padding:3px"><small>' +
|
||||
'<strong><%:SSID%>:</strong> <a href="%s">%h</a><br />' +
|
||||
'<strong><%:Mode%>:</strong> %s<br />' +
|
||||
'<strong><%:Channel%>:</strong> %d (%.3f <%:GHz%>)<br />' +
|
||||
'<strong><%:Bitrate%>:</strong> %s <%:Mbit/s%><br />',
|
||||
icon, net.signal, net.noise,
|
||||
net.quality,
|
||||
net.link, net.ssid || '?',
|
||||
net.mode,
|
||||
net.channel, net.frequency,
|
||||
net.bitrate || '?'
|
||||
);
|
||||
|
||||
if (is_assoc)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:BSSID%>:</strong> %s<br />' +
|
||||
'<strong><%:Encryption%>:</strong> %s',
|
||||
net.bssid || '?',
|
||||
net.encryption
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
s += '<em><%:Wireless is disabled or not associated%></em>';
|
||||
}
|
||||
|
||||
s += '</small></td></tr></table>';
|
||||
|
||||
for (var bssid in net.assoclist)
|
||||
{
|
||||
var bss = net.assoclist[bssid];
|
||||
|
||||
bss.bssid = bssid;
|
||||
bss.link = net.link;
|
||||
bss.name = net.name;
|
||||
bss.ifname = net.ifname;
|
||||
bss.radio = dev.name;
|
||||
|
||||
assoclist.push(bss);
|
||||
}
|
||||
}
|
||||
|
||||
if (!s)
|
||||
s = '<em><%:No information available%></em>';
|
||||
|
||||
td.innerHTML = s;
|
||||
}
|
||||
}
|
||||
|
||||
var ac = document.getElementById('wifi_assoc_table');
|
||||
if (ac)
|
||||
{
|
||||
/* clear all rows */
|
||||
while( ac.rows.length > 1 )
|
||||
ac.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
assoclist.sort(function(a, b) {
|
||||
return (a.name == b.name)
|
||||
? (a.bssid < b.bssid)
|
||||
: (a.name > b.name )
|
||||
;
|
||||
});
|
||||
|
||||
for( var i = 0; i < assoclist.length; i++ )
|
||||
{
|
||||
var tr = ac.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + (1 + (i % 2));
|
||||
|
||||
var icon;
|
||||
var q = (-1 * (assoclist[i].noise - assoclist[i].signal)) / 5;
|
||||
if (q < 1)
|
||||
icon = "<%=resource%>/icons/signal-0.png";
|
||||
else if (q < 2)
|
||||
icon = "<%=resource%>/icons/signal-0-25.png";
|
||||
else if (q < 3)
|
||||
icon = "<%=resource%>/icons/signal-25-50.png";
|
||||
else if (q < 4)
|
||||
icon = "<%=resource%>/icons/signal-50-75.png";
|
||||
else
|
||||
icon = "<%=resource%>/icons/signal-75-100.png";
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<span class="ifacebadge" title="%q"><img src="<%=resource%>/icons/wifi.png" /> %h</span>',
|
||||
assoclist[i].radio, assoclist[i].ifname
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<a href="%s">%s</a>',
|
||||
assoclist[i].link,
|
||||
'%h'.format(assoclist[i].name).nobr()
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = assoclist[i].bssid;
|
||||
|
||||
var host = hosts[assoclist[i].bssid];
|
||||
if (host)
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis">%s</div>',
|
||||
((host.name && (host.ipv4 || host.ipv6))
|
||||
? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6)
|
||||
: '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr()
|
||||
);
|
||||
else
|
||||
tr.insertCell(-1).innerHTML = '?';
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%> / <%:SNR%>: %d"><img src="%s" /> %d / %d <%:dBm%></span>',
|
||||
assoclist[i].signal, assoclist[i].noise, assoclist[i].signal - assoclist[i].noise,
|
||||
icon,
|
||||
assoclist[i].signal, assoclist[i].noise
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = wifirate(assoclist[i], true).nobr() + '<br />' + wifirate(assoclist[i], false).nobr();
|
||||
}
|
||||
|
||||
if (ac.rows.length == 1)
|
||||
{
|
||||
var tr = ac.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 7;
|
||||
td.innerHTML = '<br /><em><%:No information available%></em>';
|
||||
}
|
||||
}
|
||||
<% end %>
|
||||
|
||||
var e;
|
||||
|
||||
if (e = document.getElementById('ethinfo')) {
|
||||
var ports = eval('(' + info.ethinfo + ')');
|
||||
var tmp = "";
|
||||
for (var i in ports)
|
||||
{
|
||||
tmp = tmp + String.format(
|
||||
'<td style="text-align:center"><span style="line-height:25px">%s</span><br /><small><img src="<%=resource%>/icons/%s" /><br />%s<br />%s</small></td>', ports[i].name,
|
||||
ports[i].status ? 'port_up.png' : 'port_down.png',
|
||||
ports[i].speed,
|
||||
ports[i].duplex ? '<%:full-duplex%>' : '<%:half-duplex%>');
|
||||
};
|
||||
e.innerHTML = "<tr>" + tmp + "</tr>";
|
||||
}
|
||||
|
||||
if (e = document.getElementById('localtime'))
|
||||
e.innerHTML = info.localtime;
|
||||
|
||||
if (e = document.getElementById('uptime'))
|
||||
e.innerHTML = String.format('%t', info.uptime);
|
||||
|
||||
if (e = document.getElementById('userinfo'))
|
||||
e.innerHTML = info.userinfo;
|
||||
|
||||
if (e = document.getElementById('cpuusage'))
|
||||
e.innerHTML = info.cpuusage;
|
||||
|
||||
if (e = document.getElementById('cpuinfo'))
|
||||
e.innerHTML = info.cpuinfo;
|
||||
|
||||
if (e = document.getElementById('loadavg'))
|
||||
e.innerHTML = String.format(
|
||||
'%.02f, %.02f, %.02f',
|
||||
info.loadavg[0] / 65535.0,
|
||||
info.loadavg[1] / 65535.0,
|
||||
info.loadavg[2] / 65535.0
|
||||
);
|
||||
|
||||
if (e = document.getElementById('memtotal'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(((info.memory.free + info.memory.buffered) / 1048576) + (info.memcached / 1024)) + " <%:MB%>",
|
||||
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('membuff'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.memory.buffered / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('swaptotal'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('swapfree'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('conns'))
|
||||
e.innerHTML = progressbar(info.conncount, info.connmax);
|
||||
|
||||
}
|
||||
);
|
||||
//]]></script>
|
||||
|
||||
<h2 name="content"><%:Status%></h2>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:System%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Hostname%></td><td><%=luci.sys.hostname() or "?"%></td></tr>
|
||||
<tr><td width="33%"><%:Model%></td><td><%=pcdata(boardinfo.model or "?")%> <%=luci.sys.exec("cat /etc/bench.log") or ""%></td></tr>
|
||||
<tr><td width="33%"><%:Architecture%></td><td id="cpuinfo">-</td></tr>
|
||||
<tr><td width="33%"><%:Firmware Version%></td><td>
|
||||
<%=pcdata(ver.distname)%> <%=pcdata(ver.distversion)%> /
|
||||
<%=pcdata(ver.luciname)%> (<%=pcdata(ver.luciversion)%>)
|
||||
</td></tr>
|
||||
<tr><td width="33%"><%:Kernel Version%></td><td><%=luci.sys.exec("uname -r | awk -F '-' '{print $1}'") or "?"%></td></tr>
|
||||
<tr><td width="33%"><%:Local Time%></td><td id="localtime">-</td></tr>
|
||||
<tr><td width="33%"><%:Uptime%></td><td id="uptime">-</td></tr>
|
||||
<tr><td width="33%"><%:Load Average%></td><td id="loadavg">-</td></tr>
|
||||
<tr><td width="33%"><%:CPU usage%></td><td id="cpuusage">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Memory%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Total Available%></td><td id="memtotal">-</td></tr>
|
||||
<tr><td width="33%"><%:Buffered%></td><td id="membuff">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if swapinfo.total > 0 then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Swap%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Total Available%></td><td id="swaptotal">-</td></tr>
|
||||
<tr><td width="33%"><%:Free%></td><td id="swapfree">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% if not has_switch then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Interfaces%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10" id="ethinfo">
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Network%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%" style="vertical-align:top"><%:IPv4 WAN Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="wan4_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="wan4_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<% if has_ipv6 then %>
|
||||
<tr><td width="33%" style="vertical-align:top"><%:IPv6 WAN Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="wan6_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="wan6_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<% end %>
|
||||
<tr><td width="33%"><%:Online Users%></td><td id="userinfo">0</td></tr>
|
||||
<tr><td width="33%"><%:Active Connections%></td><td id="conns">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if has_dhcp then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:DHCP Leases%></legend>
|
||||
|
||||
<table class="cbi-section-table" id="lease_status_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Hostname%></th>
|
||||
<th class="cbi-section-table-cell"><%:IPv4-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:MAC-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if has_ipv6 then %>
|
||||
<fieldset class="cbi-section" style="display:none">
|
||||
<legend><%:DHCPv6 Leases%></legend>
|
||||
|
||||
<table class="cbi-section-table" id="lease6_status_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Host%></th>
|
||||
<th class="cbi-section-table-cell"><%:IPv6-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:DUID%></th>
|
||||
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if has_dsl then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:DSL%></legend>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%" style="vertical-align:top"><%:DSL Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="dsl_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="dsl_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% if has_wifi then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Wireless%></legend>
|
||||
|
||||
<table id="wifi_status_table" width="100%" cellspacing="10">
|
||||
<tr><td><em><%:Collecting data...%></em></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<%+footer%>
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
cpu_arch="$(cat "/proc/cpuinfo" | grep "model name" | sed -n "1p" | awk -F ': ' '{print $2}')"
|
||||
[ -z "${cpu_arch}" ] && cpu_arch="ARMv8 Processor"
|
||||
cpu_cores="$(cat "/proc/cpuinfo" | grep "processor" | wc -l)"
|
||||
|
||||
if grep -q "bcm27xx" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(expr $(vcgencmd measure_clock arm | awk -F '=' '{print $2}') / 1000000)Mhz"
|
||||
elif grep -q "bcm53xx" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(nvram get clkfreq | awk -F ',' '{print $1}')MHz"
|
||||
elif grep -q "mvebu" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(cat "/proc/cpuinfo" | grep "BogoMIPS" | sed -n "1p" | awk -F ': ' '{print $2}')MHz"
|
||||
elif grep -q "filogic" "/etc/openwrt_release"; then
|
||||
[ -f "/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq" ] && big_cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq) / 1000)MHz"
|
||||
elif grep -q "rockchip" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq) / 1000)MHz"
|
||||
big_cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq 2>"/dev/null") / 1000 2>"/dev/null")"
|
||||
[ -n "${big_cpu_freq}" ] && big_cpu_freq="${big_cpu_freq}MHz "
|
||||
else
|
||||
cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq) / 1000)MHz"
|
||||
fi
|
||||
|
||||
if grep -q "ipq" "/etc/openwrt_release"; then
|
||||
if grep -q "ipq40xx" "/etc/openwrt_release"; then
|
||||
sys_temp="$(awk '{ printf("%.1f°C ", $0 / 1000) }' /sys/class/ieee80211/phy*/device/hwmon/hwmon*/temp1_input)"
|
||||
else
|
||||
sys_temp="$(awk '{ printf("%.1f°C ", $0 / 1000) }' /sys/class/thermal/thermal_zone0/temp)"
|
||||
fi
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq}, ${sys_temp})"
|
||||
else
|
||||
if grep -q "bcm27xx" "/etc/openwrt_release"; then
|
||||
cpu_temp="$(vcgencmd measure_temp | awk -F '=' '{print $2}' | awk -F "'" '{print $1}')°C"
|
||||
else
|
||||
cpu_temp="$(awk "BEGIN{printf (\"%.1f\n\",$(cat /sys/class/thermal/thermal_zone0/temp)/1000) }")°C"
|
||||
fi
|
||||
if grep -q "filogic" "/etc/openwrt_release"; then
|
||||
if [ -n "${big_cpu_freq}" ] ; then
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${big_cpu_freq}, ${cpu_temp})"
|
||||
else
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_temp})"
|
||||
fi
|
||||
else
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${big_cpu_freq}${cpu_freq}, ${cpu_temp})"
|
||||
fi
|
||||
fi
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/lua
|
||||
-- Copyright (C) 2022 ImmortalWrt.org
|
||||
|
||||
local util = require "luci.util"
|
||||
local jsonc = require "luci.jsonc"
|
||||
|
||||
local eth_info = {}
|
||||
local ifname, stat
|
||||
|
||||
for ifname, stat in pairs(util.ubus("network.device", "status")) do
|
||||
while true do
|
||||
if (ifname:match("^(br-.+)$")) == ifname then
|
||||
break
|
||||
else
|
||||
local status, speed, duplex
|
||||
|
||||
if(stat.speed ~= nil) then
|
||||
status = stat.carrier and 1 or 0
|
||||
|
||||
if stat.speed:sub(1, 1) == "-" then
|
||||
speed = " - "
|
||||
else
|
||||
speed = stat.speed:sub(1, -2) .. "Mb/s"
|
||||
end
|
||||
|
||||
if stat.carrier and stat.speed:sub(-1) == "F" then
|
||||
duplex = 1
|
||||
else
|
||||
duplex = 0
|
||||
end
|
||||
|
||||
eth_info[#eth_info+1] = { name = ifname, status = status,
|
||||
speed = speed, duplex = duplex }
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(eth_info,
|
||||
function(a, b)
|
||||
return a.name < b.name
|
||||
end)
|
||||
|
||||
print(jsonc.stringify(eth_info))
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /etc/openwrt_release
|
||||
|
||||
IEEE_PATH="/sys/class/ieee80211"
|
||||
THERMAL_PATH="/sys/class/thermal"
|
||||
|
||||
case "$DISTRIB_TARGET" in
|
||||
ipq40xx/*|ipq806x/*)
|
||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/device/hwmon/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
|
||||
;;
|
||||
mediatek/mt7622)
|
||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/wl*/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
|
||||
;;
|
||||
*)
|
||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$DISTRIB_TARGET" in
|
||||
ipq40xx/*)
|
||||
if [ -e "$IEEE_PATH/phy0/hwmon0/temp1_input" ]; then
|
||||
mt76_temp="$(awk -F ': ' '{print $2}' "$IEEE_PATH/phy0/hwmon0/temp1_input" 2>"/dev/null")°C"
|
||||
fi
|
||||
[ -z "$mt76_temp" ] || wifi_temp="${wifi_temp:+$wifi_temp }$mt76_temp"
|
||||
;;
|
||||
*)
|
||||
cpu_temp="$(awk '{printf("%.1f°C", $0 / 1000)}' "$THERMAL_PATH/thermal_zone0/temp" 2>"/dev/null")"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$cpu_temp" ] && [ -z "$wifi_temp" ]; then
|
||||
echo -n "CPU: $cpu_temp"
|
||||
elif [ -z "$cpu_temp" ] && [ -n "$wifi_temp" ]; then
|
||||
echo -n "WiFi: $wifi_temp"
|
||||
elif [ -n "$cpu_temp" ] && [ -n "$wifi_temp" ]; then
|
||||
echo -n "CPU: $cpu_temp, WiFi: $wifi_temp"
|
||||
else
|
||||
echo -n "No temperature info"
|
||||
fi
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
NSS_PATH="/sys/kernel/debug/qca-nss-drv/stats"
|
||||
|
||||
cpu_usage="$(busybox top -n1 | awk '/^CPU/ {printf("%d%", 100 - $8)}')"
|
||||
|
||||
[ ! -d "$NSS_PATH" ] || \
|
||||
npu_usage="$(grep '%' "$NSS_PATH"/cpu_load_ubi | awk -F ' ' '{print $2}')"
|
||||
|
||||
if [ -d "$NSS_PATH" ]; then
|
||||
echo -n "CPU: ${cpu_usage}, NPU: ${npu_usage}"
|
||||
else
|
||||
echo -n "CPU: ${cpu_usage}"
|
||||
fi
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2025 lean <coolsnowwolf@gmail.com>
|
||||
|
||||
START=99
|
||||
|
||||
start()
|
||||
{
|
||||
a=$(cat /proc/cpuinfo | grep 'Model Name' | cut -f2 -d: | head -n 1)
|
||||
b=$(echo -n ' : ')
|
||||
c=$(cat /proc/cpuinfo | grep 'core' | sort -u | wc -l)
|
||||
d=$(echo -n 'C')
|
||||
e=$(cat /proc/cpuinfo | grep 'global_id' | sort -u | wc -l)
|
||||
f=$(echo -n 'T ')
|
||||
g=$(cat /proc/cpuinfo | grep 'CPU Family' | cut -f2 -d: | head -n 1)
|
||||
|
||||
h=${g}' - '${a}${b}${c}${d}${e}${f}
|
||||
|
||||
mkdir -p /tmp/sysinfo
|
||||
echo $h > /tmp/sysinfo/model
|
||||
}
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
MHz=`grep 'MHz' /proc/cpuinfo | cut -c13- |sed -n '1p'`
|
||||
|
||||
echo "$MHz MHz"
|
||||
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/lua
|
||||
-- Copyright (C) 2022 ImmortalWrt.org
|
||||
|
||||
local util = require "luci.util"
|
||||
local jsonc = require "luci.jsonc"
|
||||
|
||||
local eth_info = {}
|
||||
local ifname, stat
|
||||
|
||||
for ifname, stat in pairs(util.ubus("network.device", "status")) do
|
||||
while true do
|
||||
if (ifname:match("^(br-.+)$")) == ifname then
|
||||
break
|
||||
else
|
||||
local status, speed, duplex
|
||||
|
||||
if(stat.speed ~= nil) then
|
||||
status = stat.carrier and 1 or 0
|
||||
|
||||
if stat.speed:sub(1, 1) == "-" then
|
||||
speed = " - "
|
||||
else
|
||||
speed = stat.speed:sub(1, -2) .. "Mb/s"
|
||||
end
|
||||
|
||||
if stat.carrier and stat.speed:sub(-1) == "F" then
|
||||
duplex = 1
|
||||
else
|
||||
duplex = 0
|
||||
end
|
||||
|
||||
eth_info[#eth_info+1] = { name = ifname, status = status,
|
||||
speed = speed, duplex = duplex }
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(eth_info,
|
||||
function(a, b)
|
||||
return a.name < b.name
|
||||
end)
|
||||
|
||||
print(jsonc.stringify(eth_info))
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
TEMP=`awk '{printf("%.1f°C", $0 / 1000)}' "/sys/class/thermal/thermal_zone0/temp" 2>"/dev/null"`
|
||||
|
||||
echo "$TEMP "
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"luci-mod-status-autocore": {
|
||||
"description": "Grant access to autocore",
|
||||
"read": {
|
||||
"ubus": {
|
||||
"luci": [ "getCPUInfo", "getCPUUsage", "getTempInfo" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2017 lean <coolsnowwolf@gmail.com>
|
||||
|
||||
START=99
|
||||
|
||||
start()
|
||||
{
|
||||
rfc=4096
|
||||
cc=$(grep -c processor /proc/cpuinfo)
|
||||
cpu_mask=$(printf '%x' "$(( (1 << cc) - 1 ))")
|
||||
rsfe=$(echo $cc*$rfc | bc)
|
||||
sysctl -w net.core.rps_sock_flow_entries=$rsfe >/dev/null
|
||||
for fileRps in $(ls /sys/class/net/eth*/queues/rx-*/rps_cpus)
|
||||
do
|
||||
echo "$cpu_mask" > "$fileRps"
|
||||
done
|
||||
|
||||
for fileRfc in $(ls /sys/class/net/eth*/queues/rx-*/rps_flow_cnt)
|
||||
do
|
||||
echo $rfc > $fileRfc
|
||||
done
|
||||
|
||||
uci set network.@globals[0].packet_steering=1
|
||||
uci commit network
|
||||
|
||||
all_pcis=`lspci | grep -i 'eth' | grep -i 'x550' | cut -d ' ' -f 1`
|
||||
all_ifs=`cat /proc/net/dev | grep -i 'eth' | cut -d : -f 1 | sed 's/^[ \t]*//g'`
|
||||
|
||||
for ifname in ${all_ifs}
|
||||
do
|
||||
if_pci=`ethtool -i ${ifname} | grep -i 'bus-info' | cut -d : -f 3-`
|
||||
if [[ "$all_pcis" =~ "$if_pci" ]]
|
||||
then
|
||||
ethtool -s ${ifname} advertise 0x1800000001028
|
||||
fi
|
||||
done
|
||||
|
||||
a=$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -v "@" | grep -v "\.")
|
||||
b=$(echo "$a" | wc -l)
|
||||
for i in $(seq 1 $b)
|
||||
do
|
||||
c=$(echo "$a" | sed -n ${i}p)
|
||||
ethtool -K $c rx-checksum on >/dev/null 2>&1
|
||||
ethtool -K $c tx-checksum-ip-generic on >/dev/null 2>&1 || (
|
||||
ethtool -K $c tx-checksum-ipv4 on >/dev/null 2>&1
|
||||
ethtool -K $c tx-checksum-ipv6 on >/dev/null 2>&1)
|
||||
ethtool -K $c tx-scatter-gather on >/dev/null 2>&1
|
||||
ethtool -K $c tso on >/dev/null 2>&1
|
||||
done
|
||||
|
||||
[ -f /etc/index.htm ] && mv /etc/index.htm /usr/lib/lua/luci/view/admin_status/index.htm
|
||||
}
|
||||
@@ -0,0 +1,864 @@
|
||||
<%#
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
|
||||
Licensed to the public under the Apache License 2.0.
|
||||
-%>
|
||||
|
||||
<%
|
||||
local fs = require "nixio.fs"
|
||||
local util = require "luci.util"
|
||||
local stat = require "luci.tools.status"
|
||||
local ver = require "luci.version"
|
||||
|
||||
local has_ipv6 = fs.access("/usr/sbin/ip6tables")
|
||||
local has_dhcp = fs.access("/etc/config/dhcp")
|
||||
local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0)
|
||||
|
||||
local sysinfo = luci.util.ubus("system", "info") or { }
|
||||
local boardinfo = luci.util.ubus("system", "board") or { }
|
||||
local unameinfo = nixio.uname() or { }
|
||||
|
||||
local meminfo = sysinfo.memory or {
|
||||
total = 0,
|
||||
free = 0,
|
||||
buffered = 0,
|
||||
shared = 0
|
||||
}
|
||||
|
||||
local mem_cached = luci.sys.exec("sed -e '/^Cached: /!d; s#Cached: *##; s# kB##g' /proc/meminfo")
|
||||
|
||||
local swapinfo = sysinfo.swap or {
|
||||
total = 0,
|
||||
free = 0
|
||||
}
|
||||
|
||||
local has_dsl = fs.access("/etc/init.d/dsl_control")
|
||||
|
||||
if luci.http.formvalue("status") == "1" then
|
||||
local ntm = require "luci.model.network".init()
|
||||
local wan = ntm:get_wannet()
|
||||
local wan6 = ntm:get_wan6net()
|
||||
|
||||
local conn_count = tonumber(
|
||||
fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0
|
||||
|
||||
local conn_max = tonumber(luci.sys.exec(
|
||||
"sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max"
|
||||
):match("%d+")) or 4096
|
||||
|
||||
local cpu_info = luci.sys.exec("cpuinfo")
|
||||
|
||||
local eth_info = luci.sys.exec("ethinfo")
|
||||
|
||||
local user_info = luci.sys.exec("cat /proc/net/arp | grep '0x2' | wc -l") or 0
|
||||
|
||||
local cpu_usage = (luci.sys.exec("expr 100 - $(top -n 1 | grep -E '^CPU:' | awk -F '%' '{print$4}' | awk -F ' ' '{print$2}' | awk '{print int($1 + 0.5)}')") or "6") .. "%"
|
||||
|
||||
local rv = {
|
||||
cpuusage = cpu_usage,
|
||||
cpuinfo = cpu_info,
|
||||
ethinfo = eth_info,
|
||||
userinfo = user_info,
|
||||
uptime = sysinfo.uptime or 0,
|
||||
localtime = os.date(),
|
||||
loadavg = sysinfo.load or { 0, 0, 0 },
|
||||
memory = meminfo,
|
||||
memcached = mem_cached,
|
||||
swap = swapinfo,
|
||||
connmax = conn_max,
|
||||
conncount = conn_count,
|
||||
leases = stat.dhcp_leases(),
|
||||
leases6 = stat.dhcp6_leases(),
|
||||
wifinets = stat.wifi_networks()
|
||||
}
|
||||
|
||||
if wan then
|
||||
rv.wan = {
|
||||
ipaddr = wan:ipaddr(),
|
||||
gwaddr = wan:gwaddr(),
|
||||
netmask = wan:netmask(),
|
||||
dns = wan:dnsaddrs(),
|
||||
expires = wan:expires(),
|
||||
uptime = wan:uptime(),
|
||||
proto = wan:proto(),
|
||||
ifname = wan:ifname(),
|
||||
link = wan:adminlink()
|
||||
}
|
||||
end
|
||||
|
||||
if wan6 then
|
||||
rv.wan6 = {
|
||||
ip6addr = wan6:ip6addr(),
|
||||
gw6addr = wan6:gw6addr(),
|
||||
dns = wan6:dns6addrs(),
|
||||
ip6prefix = wan6:ip6prefix(),
|
||||
uptime = wan6:uptime(),
|
||||
proto = wan6:proto(),
|
||||
ifname = wan6:ifname(),
|
||||
link = wan6:adminlink()
|
||||
}
|
||||
end
|
||||
|
||||
if has_dsl then
|
||||
local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat")
|
||||
local dsl_func = loadstring(dsl_stat)
|
||||
if dsl_func then
|
||||
rv.dsl = dsl_func()
|
||||
end
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(rv)
|
||||
|
||||
return
|
||||
elseif luci.http.formvalue("hosts") == "1" then
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(luci.sys.net.host_hints())
|
||||
|
||||
return
|
||||
end
|
||||
-%>
|
||||
|
||||
<%+header%>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-19.167.54478-71e2af4"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function progressbar(v, m)
|
||||
{
|
||||
var vn = parseInt(v) || 0;
|
||||
var mn = parseInt(m) || 100;
|
||||
var pc = Math.floor((100 / mn) * vn);
|
||||
|
||||
return String.format(
|
||||
'<div style="width:200px; position:relative; border:1px solid #999999">' +
|
||||
'<div style="background-color:#CCCCCC; width:%d%%; height:15px">' +
|
||||
'<div style="position:absolute; left:0; top:0; text-align:center; width:100%%; color:#000000">' +
|
||||
'<small>%s / %s (%d%%)</small>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>', pc, v, m, pc
|
||||
);
|
||||
}
|
||||
|
||||
function wifirate(bss, rx) {
|
||||
var p = rx ? 'rx_' : 'tx_',
|
||||
s = '%.1f <%:Mbit/s%>, %d<%:MHz%>'
|
||||
.format(bss[p+'rate'] / 1000, bss[p+'mhz']),
|
||||
ht = bss[p+'ht'], vht = bss[p+'vht'],
|
||||
mhz = bss[p+'mhz'], nss = bss[p+'nss'],
|
||||
mcs = bss[p+'mcs'], sgi = bss[p+'short_gi'],
|
||||
he = bss[p+'he'], he_gi = bss[p+'he_gi'],
|
||||
he_dcm = bss[p+'he_dcm'];
|
||||
|
||||
if (ht || vht) {
|
||||
if (vht) s += ', VHT-MCS %d'.format(mcs);
|
||||
if (nss) s += ', VHT-NSS %d'.format(nss);
|
||||
if (ht) s += ', MCS %s'.format(mcs);
|
||||
if (sgi) s += ', <%:Short GI%>';
|
||||
}
|
||||
|
||||
if (he) {
|
||||
s += ', HE-MCS %d'.format(mcs);
|
||||
if (nss) s += ', HE-NSS %d'.format(nss);
|
||||
if (he_gi) s += ', HE-GI %d'.format(he_gi);
|
||||
if (he_dcm) s += ', HE-DCM %d'.format(he_dcm);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function duid2mac(duid) {
|
||||
// DUID-LLT / Ethernet
|
||||
if (duid.length === 28 && duid.substr(0, 8) === '00010001')
|
||||
return duid.substr(16).replace(/(..)(?=..)/g, '$1:').toUpperCase();
|
||||
|
||||
// DUID-LL / Ethernet
|
||||
if (duid.length === 20 && duid.substr(0, 8) === '00030001')
|
||||
return duid.substr(8).replace(/(..)(?=..)/g, '$1:').toUpperCase();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var npoll = 1;
|
||||
var hosts = <%=luci.http.write_json(luci.sys.net.host_hints())%>;
|
||||
|
||||
function updateHosts() {
|
||||
XHR.get('<%=REQUEST_URI%>', { hosts: 1 }, function(x, data) {
|
||||
hosts = data;
|
||||
});
|
||||
}
|
||||
|
||||
var compare = function (prop) {
|
||||
return function (obj1, obj2) {
|
||||
var val1 = Number(obj1[prop].replaceAll(".",""));
|
||||
var val2 = Number(obj2[prop].replaceAll(".",""));
|
||||
if (val1 < val2) {
|
||||
return -1;
|
||||
} else if (val1 > val2) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
XHR.poll(1, '<%=REQUEST_URI%>', { status: 1 },
|
||||
function(x, info)
|
||||
{
|
||||
if (!(npoll++ % 5))
|
||||
updateHosts();
|
||||
|
||||
var si = document.getElementById('wan4_i');
|
||||
var ss = document.getElementById('wan4_s');
|
||||
var ifc = info.wan;
|
||||
|
||||
if (ifc && ifc.ifname && ifc.proto != 'none')
|
||||
{
|
||||
var s = String.format(
|
||||
'<strong><%:Type%>: </strong>%s<br />' +
|
||||
'<strong><%:Address%>: </strong>%s<br />' +
|
||||
'<strong><%:Netmask%>: </strong>%s<br />' +
|
||||
'<strong><%:Gateway%>: </strong>%s<br />',
|
||||
ifc.proto,
|
||||
(ifc.ipaddr) ? ifc.ipaddr : '0.0.0.0',
|
||||
(ifc.netmask && ifc.netmask != ifc.ipaddr) ? ifc.netmask : '255.255.255.255',
|
||||
(ifc.gwaddr) ? ifc.gwaddr : '0.0.0.0'
|
||||
);
|
||||
|
||||
for (var i = 0; i < ifc.dns.length; i++)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:DNS%> %d: </strong>%s<br />',
|
||||
i + 1, ifc.dns[i]
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc.expires > -1)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Expires%>: </strong>%t<br />',
|
||||
ifc.expires
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc.uptime > 0)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Connected%>: </strong>%t<br />',
|
||||
ifc.uptime
|
||||
);
|
||||
}
|
||||
|
||||
ss.innerHTML = String.format('<small>%s</small>', s);
|
||||
si.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small><a href="%s">%s</a></small>',
|
||||
ifc.link, ifc.ifname
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
si.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
|
||||
ss.innerHTML = '<em><%:Not connected%></em>';
|
||||
}
|
||||
|
||||
<% if has_ipv6 then %>
|
||||
var si6 = document.getElementById('wan6_i');
|
||||
var ss6 = document.getElementById('wan6_s');
|
||||
var ifc6 = info.wan6;
|
||||
|
||||
if (ifc6 && ifc6.ifname && ifc6.proto != 'none')
|
||||
{
|
||||
var s = String.format(
|
||||
'<strong><%:Type%>: </strong>%s%s<br />',
|
||||
ifc6.proto, (ifc6.ip6prefix) ? '-pd' : ''
|
||||
);
|
||||
|
||||
if (!ifc6.ip6prefix)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Address%>: </strong>%s<br />',
|
||||
(ifc6.ip6addr) ? ifc6.ip6addr : '::'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Prefix Delegated%>: </strong>%s<br />',
|
||||
ifc6.ip6prefix
|
||||
);
|
||||
if (ifc6.ip6addr)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Address%>: </strong>%s<br />',
|
||||
ifc6.ip6addr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
s += String.format(
|
||||
'<strong><%:Gateway%>: </strong>%s<br />',
|
||||
(ifc6.gw6addr) ? ifc6.gw6addr : '::'
|
||||
);
|
||||
|
||||
for (var i = 0; i < ifc6.dns.length; i++)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:DNS%> %d: </strong>%s<br />',
|
||||
i + 1, ifc6.dns[i]
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc6.uptime > 0)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Connected%>: </strong>%t<br />',
|
||||
ifc6.uptime
|
||||
);
|
||||
}
|
||||
|
||||
ss6.innerHTML = String.format('<small>%s</small>', s);
|
||||
si6.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small><a href="%s">%s</a></small>',
|
||||
ifc6.link, ifc6.ifname
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
si6.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
|
||||
ss6.innerHTML = '<em><%:Not connected%></em>';
|
||||
}
|
||||
<% end %>
|
||||
|
||||
<% if has_dsl then %>
|
||||
var dsl_i = document.getElementById('dsl_i');
|
||||
var dsl_s = document.getElementById('dsl_s');
|
||||
|
||||
var s = String.format(
|
||||
'<strong><%:Status%>: </strong>%s<br />' +
|
||||
'<strong><%:Line State%>: </strong>%s [0x%x]<br />' +
|
||||
'<strong><%:Line Mode%>: </strong>%s<br />' +
|
||||
'<strong><%:Annex%>: </strong>%s<br />' +
|
||||
'<strong><%:Profile%>: </strong>%s<br />' +
|
||||
'<strong><%:Data Rate%>: </strong>%s/s / %s/s<br />' +
|
||||
'<strong><%:Max. Attainable Data Rate (ATTNDR)%>: </strong>%s/s / %s/s<br />' +
|
||||
'<strong><%:Latency%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Line Attenuation (LATN)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Signal Attenuation (SATN)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Noise Margin (SNR)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Aggregate Transmit Power(ACTATP)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Forward Error Correction Seconds (FECS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Errored seconds (ES)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Severely Errored Seconds (SES)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Loss of Signal Seconds (LOSS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Unavailable Seconds (UAS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Header Error Code Errors (HEC)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Non Pre-emtive CRC errors (CRC_P)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Pre-emtive CRC errors (CRCP_P)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Line Uptime%>: </strong>%s<br />' +
|
||||
'<strong><%:ATU-C System Vendor ID%>: </strong>%s<br />' +
|
||||
'<strong><%:Power Management Mode%>: </strong>%s<br />',
|
||||
info.dsl.line_state, info.dsl.line_state_detail,
|
||||
info.dsl.line_state_num,
|
||||
info.dsl.line_mode_s,
|
||||
info.dsl.annex_s,
|
||||
info.dsl.profile_s,
|
||||
info.dsl.data_rate_down_s, info.dsl.data_rate_up_s,
|
||||
info.dsl.max_data_rate_down_s, info.dsl.max_data_rate_up_s,
|
||||
info.dsl.latency_num_down, info.dsl.latency_num_up,
|
||||
info.dsl.line_attenuation_down, info.dsl.line_attenuation_up,
|
||||
info.dsl.signal_attenuation_down, info.dsl.signal_attenuation_up,
|
||||
info.dsl.noise_margin_down, info.dsl.noise_margin_up,
|
||||
info.dsl.actatp_down, info.dsl.actatp_up,
|
||||
info.dsl.errors_fec_near, info.dsl.errors_fec_far,
|
||||
info.dsl.errors_es_near, info.dsl.errors_es_far,
|
||||
info.dsl.errors_ses_near, info.dsl.errors_ses_far,
|
||||
info.dsl.errors_loss_near, info.dsl.errors_loss_far,
|
||||
info.dsl.errors_uas_near, info.dsl.errors_uas_far,
|
||||
info.dsl.errors_hec_near, info.dsl.errors_hec_far,
|
||||
info.dsl.errors_crc_p_near, info.dsl.errors_crc_p_far,
|
||||
info.dsl.errors_crcp_p_near, info.dsl.errors_crcp_p_far,
|
||||
info.dsl.line_uptime_s,
|
||||
info.dsl.atuc_vendor_id,
|
||||
info.dsl.power_mode_s
|
||||
);
|
||||
|
||||
dsl_s.innerHTML = String.format('<small>%s</small>', s);
|
||||
dsl_i.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small>DSL</small>'
|
||||
);
|
||||
<% end %>
|
||||
|
||||
<% if has_dhcp then %>
|
||||
var ls = document.getElementById('lease_status_table');
|
||||
if (ls)
|
||||
{
|
||||
info.leases = info.leases.sort(compare("ipaddr"));
|
||||
/* clear all rows */
|
||||
while( ls.rows.length > 1 )
|
||||
ls.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
for( var i = 0; i < info.leases.length; i++ )
|
||||
{
|
||||
var timestr;
|
||||
|
||||
if (info.leases[i].expires === false)
|
||||
timestr = '<em><%:unlimited%></em>';
|
||||
else if (info.leases[i].expires <= 0)
|
||||
timestr = '<em><%:expired%></em>';
|
||||
else
|
||||
timestr = String.format('%t', info.leases[i].expires);
|
||||
|
||||
var tr = ls.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].hostname ? info.leases[i].hostname : '?';
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].ipaddr;
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].macaddr;
|
||||
tr.insertCell(-1).innerHTML = timestr;
|
||||
}
|
||||
|
||||
if( ls.rows.length == 1 )
|
||||
{
|
||||
var tr = ls.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 4;
|
||||
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
||||
}
|
||||
}
|
||||
|
||||
var ls6 = document.getElementById('lease6_status_table');
|
||||
if (ls6 && info.leases6)
|
||||
{
|
||||
ls6.parentNode.style.display = 'block';
|
||||
|
||||
/* clear all rows */
|
||||
while( ls6.rows.length > 1 )
|
||||
ls6.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
for( var i = 0; i < info.leases6.length; i++ )
|
||||
{
|
||||
var timestr;
|
||||
|
||||
if (info.leases6[i].expires === false)
|
||||
timestr = '<em><%:unlimited%></em>';
|
||||
else if (info.leases6[i].expires <= 0)
|
||||
timestr = '<em><%:expired%></em>';
|
||||
else
|
||||
timestr = String.format('%t', info.leases6[i].expires);
|
||||
|
||||
var tr = ls6.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
|
||||
var host = hosts[duid2mac(info.leases6[i].duid)];
|
||||
if (!info.leases6[i].hostname)
|
||||
tr.insertCell(-1).innerHTML =
|
||||
(host && (host.name || host.ipv4 || host.ipv6))
|
||||
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">? (%h)</div>'.format(host.name || host.ipv4 || host.ipv6)
|
||||
: '?';
|
||||
else
|
||||
tr.insertCell(-1).innerHTML =
|
||||
(host && host.name && info.leases6[i].hostname != host.name)
|
||||
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">%h (%h)</div>'.format(info.leases6[i].hostname, host.name)
|
||||
: info.leases6[i].hostname;
|
||||
|
||||
tr.insertCell(-1).innerHTML = info.leases6[i].ip6addr;
|
||||
tr.insertCell(-1).innerHTML = info.leases6[i].duid;
|
||||
tr.insertCell(-1).innerHTML = timestr;
|
||||
}
|
||||
|
||||
if( ls6.rows.length == 1 )
|
||||
{
|
||||
var tr = ls6.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 4;
|
||||
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
||||
}
|
||||
}
|
||||
<% end %>
|
||||
|
||||
<% if has_wifi then %>
|
||||
var assoclist = [ ];
|
||||
|
||||
var ws = document.getElementById('wifi_status_table');
|
||||
if (ws)
|
||||
{
|
||||
var wsbody = ws.rows[0].parentNode;
|
||||
while (ws.rows.length > 0)
|
||||
wsbody.deleteRow(0);
|
||||
|
||||
for (var didx = 0; didx < info.wifinets.length; didx++)
|
||||
{
|
||||
var dev = info.wifinets[didx];
|
||||
|
||||
var tr = wsbody.insertRow(-1);
|
||||
var td;
|
||||
|
||||
td = tr.insertCell(-1);
|
||||
td.width = "33%";
|
||||
td.innerHTML = dev.name;
|
||||
td.style.verticalAlign = "top";
|
||||
|
||||
td = tr.insertCell(-1);
|
||||
|
||||
var s = '';
|
||||
|
||||
for (var nidx = 0; nidx < dev.networks.length; nidx++)
|
||||
{
|
||||
var net = dev.networks[nidx];
|
||||
var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel && !net.disabled);
|
||||
|
||||
var icon;
|
||||
if (!is_assoc)
|
||||
icon = "<%=resource%>/icons/signal-none.png";
|
||||
else if (net.quality == 0)
|
||||
icon = "<%=resource%>/icons/signal-0.png";
|
||||
else if (net.quality < 25)
|
||||
icon = "<%=resource%>/icons/signal-0-25.png";
|
||||
else if (net.quality < 50)
|
||||
icon = "<%=resource%>/icons/signal-25-50.png";
|
||||
else if (net.quality < 75)
|
||||
icon = "<%=resource%>/icons/signal-50-75.png";
|
||||
else
|
||||
icon = "<%=resource%>/icons/signal-75-100.png";
|
||||
|
||||
s += String.format(
|
||||
'<table><tr><td style="text-align:center; width:32px; padding:3px">' +
|
||||
'<img src="%s" title="<%:Signal%>: %d dBm / <%:Noise%>: %d dBm" />' +
|
||||
'<br /><small>%d%%</small>' +
|
||||
'</td><td style="text-align:left; padding:3px"><small>' +
|
||||
'<strong><%:SSID%>:</strong> <a href="%s">%h</a><br />' +
|
||||
'<strong><%:Mode%>:</strong> %s<br />' +
|
||||
'<strong><%:Channel%>:</strong> %d (%.3f <%:GHz%>)<br />' +
|
||||
'<strong><%:Bitrate%>:</strong> %s <%:Mbit/s%><br />',
|
||||
icon, net.signal, net.noise,
|
||||
net.quality,
|
||||
net.link, net.ssid || '?',
|
||||
net.mode,
|
||||
net.channel, net.frequency,
|
||||
net.bitrate || '?'
|
||||
);
|
||||
|
||||
if (is_assoc)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:BSSID%>:</strong> %s<br />' +
|
||||
'<strong><%:Encryption%>:</strong> %s',
|
||||
net.bssid || '?',
|
||||
net.encryption
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
s += '<em><%:Wireless is disabled or not associated%></em>';
|
||||
}
|
||||
|
||||
s += '</small></td></tr></table>';
|
||||
|
||||
for (var bssid in net.assoclist)
|
||||
{
|
||||
var bss = net.assoclist[bssid];
|
||||
|
||||
bss.bssid = bssid;
|
||||
bss.link = net.link;
|
||||
bss.name = net.name;
|
||||
bss.ifname = net.ifname;
|
||||
bss.radio = dev.name;
|
||||
|
||||
assoclist.push(bss);
|
||||
}
|
||||
}
|
||||
|
||||
if (!s)
|
||||
s = '<em><%:No information available%></em>';
|
||||
|
||||
td.innerHTML = s;
|
||||
}
|
||||
}
|
||||
|
||||
var ac = document.getElementById('wifi_assoc_table');
|
||||
if (ac)
|
||||
{
|
||||
/* clear all rows */
|
||||
while( ac.rows.length > 1 )
|
||||
ac.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
assoclist.sort(function(a, b) {
|
||||
return (a.name == b.name)
|
||||
? (a.bssid < b.bssid)
|
||||
: (a.name > b.name )
|
||||
;
|
||||
});
|
||||
|
||||
for( var i = 0; i < assoclist.length; i++ )
|
||||
{
|
||||
var tr = ac.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + (1 + (i % 2));
|
||||
|
||||
var icon;
|
||||
var q = (-1 * (assoclist[i].noise - assoclist[i].signal)) / 5;
|
||||
if (q < 1)
|
||||
icon = "<%=resource%>/icons/signal-0.png";
|
||||
else if (q < 2)
|
||||
icon = "<%=resource%>/icons/signal-0-25.png";
|
||||
else if (q < 3)
|
||||
icon = "<%=resource%>/icons/signal-25-50.png";
|
||||
else if (q < 4)
|
||||
icon = "<%=resource%>/icons/signal-50-75.png";
|
||||
else
|
||||
icon = "<%=resource%>/icons/signal-75-100.png";
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<span class="ifacebadge" title="%q"><img src="<%=resource%>/icons/wifi.png" /> %h</span>',
|
||||
assoclist[i].radio, assoclist[i].ifname
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<a href="%s">%s</a>',
|
||||
assoclist[i].link,
|
||||
'%h'.format(assoclist[i].name).nobr()
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = assoclist[i].bssid;
|
||||
|
||||
var host = hosts[assoclist[i].bssid];
|
||||
if (host)
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis">%s</div>',
|
||||
((host.name && (host.ipv4 || host.ipv6))
|
||||
? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6)
|
||||
: '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr()
|
||||
);
|
||||
else
|
||||
tr.insertCell(-1).innerHTML = '?';
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%> / <%:SNR%>: %d"><img src="%s" /> %d / %d <%:dBm%></span>',
|
||||
assoclist[i].signal, assoclist[i].noise, assoclist[i].signal - assoclist[i].noise,
|
||||
icon,
|
||||
assoclist[i].signal, assoclist[i].noise
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = wifirate(assoclist[i], true).nobr() + '<br />' + wifirate(assoclist[i], false).nobr();
|
||||
}
|
||||
|
||||
if (ac.rows.length == 1)
|
||||
{
|
||||
var tr = ac.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 7;
|
||||
td.innerHTML = '<br /><em><%:No information available%></em>';
|
||||
}
|
||||
}
|
||||
<% end %>
|
||||
|
||||
var e;
|
||||
|
||||
if (e = document.getElementById('ethinfo')) {
|
||||
var ports = eval('(' + info.ethinfo + ')');
|
||||
var tmp = "";
|
||||
for (var i in ports)
|
||||
{
|
||||
tmp = tmp + String.format(
|
||||
'<td style="text-align:center"><span style="line-height:25px">%s</span><br /><small><img src="<%=resource%>/icons/%s" /><br />%s<br />%s</small></td>', ports[i].name,
|
||||
ports[i].status ? 'port_up.png' : 'port_down.png',
|
||||
ports[i].speed,
|
||||
ports[i].duplex ? '<%:full-duplex%>' : '<%:half-duplex%>');
|
||||
};
|
||||
e.innerHTML = "<tr>" + tmp + "</tr>";
|
||||
}
|
||||
|
||||
if (e = document.getElementById('localtime'))
|
||||
e.innerHTML = info.localtime;
|
||||
|
||||
if (e = document.getElementById('uptime'))
|
||||
e.innerHTML = String.format('%t', info.uptime);
|
||||
|
||||
if (e = document.getElementById('userinfo'))
|
||||
e.innerHTML = info.userinfo;
|
||||
|
||||
if (e = document.getElementById('cpuinfo'))
|
||||
e.innerHTML = info.cpuinfo;
|
||||
|
||||
if (e = document.getElementById('cpuusage'))
|
||||
e.innerHTML = info.cpuusage;
|
||||
|
||||
if (e = document.getElementById('loadavg'))
|
||||
e.innerHTML = String.format(
|
||||
'%.02f, %.02f, %.02f',
|
||||
info.loadavg[0] / 65535.0,
|
||||
info.loadavg[1] / 65535.0,
|
||||
info.loadavg[2] / 65535.0
|
||||
);
|
||||
|
||||
if (e = document.getElementById('memtotal'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(((info.memory.free + info.memory.buffered) / 1048576) + (info.memcached / 1024)) + " <%:MB%>",
|
||||
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('membuff'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.memory.buffered / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('swaptotal'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('swapfree'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('conns'))
|
||||
e.innerHTML = progressbar(info.conncount, info.connmax);
|
||||
|
||||
}
|
||||
);
|
||||
//]]></script>
|
||||
|
||||
<h2 name="content"><%:Status%></h2>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:System%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Hostname%></td><td><%=luci.sys.hostname() or "?"%></td></tr>
|
||||
<tr><td width="33%"><%:Model%></td><td><%=pcdata(boardinfo.model or "?")%> <%=luci.sys.exec("cat /etc/bench.log") or " "%></td></tr>
|
||||
<tr><td width="33%"><%:CPU Info%></td><td id="cpuinfo">-</td></tr>
|
||||
<tr><td width="33%"><%:Firmware Version%></td><td>
|
||||
<%=pcdata(ver.distname)%> <%=pcdata(ver.distversion)%> /
|
||||
<%=pcdata(ver.luciname)%> (<%=pcdata(ver.luciversion)%>)
|
||||
</td></tr>
|
||||
<tr><td width="33%"><%:Kernel Version%></td><td><%=unameinfo.release or "?"%></td></tr>
|
||||
<tr><td width="33%"><%:Local Time%></td><td id="localtime">-</td></tr>
|
||||
<tr><td width="33%"><%:Uptime%></td><td id="uptime">-</td></tr>
|
||||
<tr><td width="33%"><%:Load Average%></td><td id="loadavg">-</td></tr>
|
||||
<tr><td width="33%"><%:CPU usage (%)%></td><td id="cpuusage">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Memory%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Total Available%></td><td id="memtotal">-</td></tr>
|
||||
<tr><td width="33%"><%:Buffered%></td><td id="membuff">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if swapinfo.total > 0 then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Swap%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Total Available%></td><td id="swaptotal">-</td></tr>
|
||||
<tr><td width="33%"><%:Free%></td><td id="swapfree">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Interfaces%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10" id="ethinfo">
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Network%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%" style="vertical-align:top"><%:IPv4 WAN Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="wan4_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="wan4_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<% if has_ipv6 then %>
|
||||
<tr><td width="33%" style="vertical-align:top"><%:IPv6 WAN Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="wan6_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="wan6_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<% end %>
|
||||
<tr><td width="33%"><%:Online Users%></td><td id="userinfo">0</td></tr>
|
||||
<tr><td width="33%"><%:Active Connections%></td><td id="conns">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if has_dhcp then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:DHCP Leases%></legend>
|
||||
|
||||
<table class="cbi-section-table" id="lease_status_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Hostname%></th>
|
||||
<th class="cbi-section-table-cell"><%:IPv4-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:MAC-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if has_ipv6 then %>
|
||||
<fieldset class="cbi-section" style="display:none">
|
||||
<legend><%:DHCPv6 Leases%></legend>
|
||||
|
||||
<table class="cbi-section-table" id="lease6_status_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Host%></th>
|
||||
<th class="cbi-section-table-cell"><%:IPv6-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:DUID%></th>
|
||||
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if has_dsl then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:DSL%></legend>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%" style="vertical-align:top"><%:DSL Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="dsl_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="dsl_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% if has_wifi then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Wireless%></legend>
|
||||
|
||||
<table id="wifi_status_table" width="100%" cellspacing="10">
|
||||
<tr><td><em><%:Collecting data...%></em></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<%+footer%>
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
arch="$(awk -F ': ' '/model name/ {print $2}' "/proc/cpuinfo" | head -n1)"
|
||||
|
||||
core="$(grep "core id" "/proc/cpuinfo" | sort -u | wc -l)C $(grep -c "processor" "/proc/cpuinfo")T"
|
||||
|
||||
freq="$(awk -F ': ' '/MHz/ {print $2}' "/proc/cpuinfo" | head -n1)MHz"
|
||||
|
||||
# Intel
|
||||
temp="$(sensors "coretemp-*" 2>"/dev/null" | grep -E "(Package id |Core )" | grep -Eo "\+[0-9.]*°C" | head -n1 | tr -d "+")"
|
||||
# AMD
|
||||
[ -n "${temp}" ] || temp="$(sensors "k*temp-*" 2>"/dev/null" | awk '/Tdie/ {print $2}' | head -n1 | tr -d "+")"
|
||||
|
||||
echo -n "$arch x $core ($freq, ${temp})"
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
a=$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -v "@" | grep -v "\.")
|
||||
b=$(echo "$a" | wc -l)
|
||||
rm -f /tmp/state/ethinfo
|
||||
|
||||
echo -n "[" > /tmp/state/ethinfo
|
||||
|
||||
for i in $(seq 1 $b)
|
||||
do
|
||||
h=$(echo '{"name":' )
|
||||
c=$(echo "$a" | sed -n ${i}p)
|
||||
d=$(ethtool $c)
|
||||
|
||||
e=$(echo "$d" | grep "Link detected" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g')
|
||||
if [ $e = yes ]; then
|
||||
l=1
|
||||
else
|
||||
l=0
|
||||
fi
|
||||
|
||||
f=$(echo "$d" | grep "Speed" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g' | tr -d "Unknown!")
|
||||
[ -z "$f" ] && f=" - "
|
||||
|
||||
g=$(echo "$d" | grep "Duplex" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g')
|
||||
if [ "$g" == "Full" ]; then
|
||||
x=1
|
||||
else
|
||||
x=0
|
||||
fi
|
||||
|
||||
echo -n "$h \"$c\", \"status\": $l, \"speed\": \"$f\", \"duplex\": $x}," >> /tmp/state/ethinfo
|
||||
done
|
||||
|
||||
sed -i 's/.$//' /tmp/state/ethinfo
|
||||
|
||||
echo -n "]" >> /tmp/state/ethinfo
|
||||
|
||||
cat /tmp/state/ethinfo
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $(busybox ps -w | grep getcpu | grep -v grep | wc -l) -le 2 ]; then
|
||||
AT=$(cat /proc/stat | grep "^cpu " | awk '{print $2+$3+$4+$5+$6+$7+$8 " " $2+$3+$4+$7+$8}')
|
||||
sleep 1
|
||||
BT=$(cat /proc/stat | grep "^cpu " | awk '{print $2+$3+$4+$5+$6+$7+$8 " " $2+$3+$4+$7+$8}')
|
||||
printf "%.01f%%" $(echo $AT $BT | awk '{print (($4-$2)/($3-$1))*100}') >/tmp/cpuusage
|
||||
fi
|
||||
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# Copyright (C) 2010-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=automount
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=41
|
||||
PKG_ARCH:=all
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/automount
|
||||
TITLE:=Mount autoconfig hotplug script.
|
||||
MAINTAINER:=Lean
|
||||
DEPENDS:=+block-mount +kmod-fs-exfat +kmod-fs-ext4 +kmod-fs-vfat +libblkid \
|
||||
+kmod-usb-storage +kmod-usb-storage-extras +!TARGET_ramips:kmod-usb-storage-uas +kmod-fs-ntfs3
|
||||
endef
|
||||
|
||||
define Package/automount/description
|
||||
A usb autoconfig hotplug script.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/automount/install
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/15-automount $(1)/etc/15-automount
|
||||
$(INSTALL_BIN) ./files/zzz-move-automount $(1)/etc/uci-defaults/zzz-move-automount
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,automount))
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
|
||||
# 0 yes blockdevice handles this - 1 no it is not there
|
||||
blkdev=`dirname $DEVPATH`
|
||||
basename=`basename $blkdev`
|
||||
device=`basename $DEVPATH`
|
||||
|
||||
grep -qs "^/dev/$device " /proc/mounts && exit 0
|
||||
|
||||
skip=`block info | grep -vE '(f2fs|kernel|squashfs)' | sed 's/\(.*\): .*/\1/' | grep -q $device ; echo $?`
|
||||
path=$DEVPATH
|
||||
|
||||
if [ $basename != "block" ] && [ -z "${device##sd*}" ] && [ $skip -eq 1 ]; then
|
||||
mntpnt=$device
|
||||
case "$ACTION" in
|
||||
add)
|
||||
mkdir -p /mnt/$mntpnt
|
||||
chmod 777 /mnt/$mntpnt
|
||||
# Try to be gentle on solid state devices
|
||||
mount -o rw,noatime,discard /dev/$device /mnt/$mntpnt
|
||||
;;
|
||||
remove)
|
||||
# Once the device is removed, the /dev entry disappear. We need mountpoint
|
||||
mountpoint=`mount |grep /dev/$device | sed 's/.* on \(.*\) type.*/\1/'`
|
||||
umount -l $mountpoint
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
sleep 15
|
||||
mv /etc/15-automount /etc/hotplug.d/block/
|
||||
@@ -0,0 +1,30 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2024 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=cpufreq
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/cpufreq
|
||||
TITLE:=CPU Frequency Scaling adjustment tool
|
||||
DEPENDS:=@(arm||aarch64)
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/cpufreq/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(CURDIR)/files/cpufreq.config $(1)/etc/config/cpufreq
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(CURDIR)/files/cpufreq.init $(1)/etc/init.d/cpufreq
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) $(CURDIR)/files/cpufreq.uci $(1)/etc/uci-defaults/10-cpufreq
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,cpufreq))
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
config settings 'cpufreq'
|
||||
|
||||
config settings 'global'
|
||||
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=15
|
||||
USE_PROCD=1
|
||||
|
||||
NAME="cpufreq"
|
||||
CPUFREQ_PATH="/sys/devices/system/cpu/cpufreq"
|
||||
|
||||
extra_command "get_policies" "Get CPU scaling governors and frequencies"
|
||||
|
||||
get_policies() {
|
||||
json_init
|
||||
for policy in $(ls -d "$CPUFREQ_PATH"/policy[0-9]* 2>"/dev/null"); do
|
||||
[ -s "$policy/scaling_available_frequencies" ] || continue
|
||||
json_add_object "$(basename "$policy")"
|
||||
json_add_string "index" "$(basename "$policy" | grep -Eo "[0-9]*$")"
|
||||
json_add_string "cpus" "$(cat "$policy/affected_cpus")"
|
||||
json_add_array "freqs"
|
||||
for freq in $(cat "$policy/scaling_available_frequencies"); do
|
||||
json_add_string "" "$freq"
|
||||
done
|
||||
json_close_array
|
||||
json_add_array "governors"
|
||||
for governor in $(cat "$policy/scaling_available_governors"); do
|
||||
json_add_string "" "$governor"
|
||||
done
|
||||
json_close_array
|
||||
json_close_object
|
||||
done
|
||||
json_dump
|
||||
}
|
||||
|
||||
write_cpufreq_config() {
|
||||
local value
|
||||
config_get value "$NAME" "$1"
|
||||
[ -z "$value" ] || echo -n "$value" > "$2"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load "$NAME"
|
||||
|
||||
for i in $(ls -d "$CPUFREQ_PATH"/policy[0-9]* 2>"/dev/null" | grep -Eo "[0-9]*$")
|
||||
do
|
||||
[ -z "$(config_get "$NAME" "governor$i")" ] && return
|
||||
|
||||
write_cpufreq_config "governor$i" "$CPUFREQ_PATH/policy$i/scaling_governor"
|
||||
write_cpufreq_config "minfreq$i" "$CPUFREQ_PATH/policy$i/scaling_min_freq"
|
||||
write_cpufreq_config "maxfreq$i" "$CPUFREQ_PATH/policy$i/scaling_max_freq"
|
||||
if [ "$(config_get "$NAME" "governor$i")" = "ondemand" ]; then
|
||||
write_cpufreq_config "sdfactor$i" "$CPUFREQ_PATH/ondemand/sampling_down_factor"
|
||||
write_cpufreq_config "upthreshold$i" "$CPUFREQ_PATH/ondemand/up_threshold"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "$NAME"
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci_write_config() {
|
||||
uci -q set "cpufreq.cpufreq.governor$1"="$2"
|
||||
uci -q set "cpufreq.cpufreq.minfreq$1"="$3"
|
||||
uci -q set "cpufreq.cpufreq.maxfreq$1"="$4"
|
||||
[ -n "$5" ] && uci -q set "cpufreq.cpufreq.sdfactor$1"="$5"
|
||||
[ -n "$6" ] && uci -q set "cpufreq.cpufreq.upthreshold$1"="$6"
|
||||
uci -q commit cpufreq
|
||||
}
|
||||
|
||||
[ "$(uci -q get cpufreq.global.set)" -eq "1" ] && exit 0
|
||||
|
||||
CPU_FREQS="$(cat '/sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies')"
|
||||
CPU_MIN_FREQ="$(cat '/sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq')"
|
||||
CPU_MAX_FREQ="$(cat '/sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq')"
|
||||
CPU_POLICYS="$(find '/sys/devices/system/cpu/cpufreq/policy'* -maxdepth 0 | grep -Eo '[0-9]+')"
|
||||
|
||||
source "/etc/openwrt_release"
|
||||
case "$DISTRIB_TARGET" in
|
||||
"bcm27xx/bcm2710"|\
|
||||
"bcm27xx/bcm2711")
|
||||
uci_write_config 0 ondemand 600000 "$CPU_MAX_FREQ" 10 50
|
||||
;;
|
||||
"ipq40xx/generic")
|
||||
uci_write_config 0 performance 200000 "$CPU_MAX_FREQ"
|
||||
;;
|
||||
"ipq806x/generic")
|
||||
uci_write_config 0 performance 600000 "$CPU_MAX_FREQ"
|
||||
# IPQ8064/5
|
||||
echo "$CPU_POLICYS" | grep -q "1" && uci_write_config 1 performance 600000 1200000
|
||||
;;
|
||||
"mediatek/mt7622")
|
||||
uci_write_config 0 ondemand 600000 1350000 10 50
|
||||
;;
|
||||
"qualcommax/ipq60xx"|\
|
||||
"qualcommax/ipq807x")
|
||||
uci_write_config 0 schedutil "$CPU_MIN_FREQ" "$CPU_MAX_FREQ"
|
||||
;;
|
||||
"rockchip/armv8")
|
||||
if echo "$CPU_POLICYS" | grep -q "6"; then
|
||||
# RK3588/S
|
||||
uci_write_config 0 schedutil 1008000 1800000
|
||||
uci_write_config 4 schedutil 816000 2208000
|
||||
uci_write_config 6 schedutil 816000 2208000
|
||||
elif echo "$CPU_POLICYS" | grep -q "4"; then
|
||||
# RK3399
|
||||
uci_write_config 0 schedutil 600000 1608000
|
||||
uci_write_config 4 schedutil 600000 2016000
|
||||
else
|
||||
if ! echo "$CPU_FREQS" | grep -q "1992000"; then
|
||||
# RK3328
|
||||
CPU_MAX_FREQ="1512000"
|
||||
fi
|
||||
uci_write_config 0 schedutil 816000 "$CPU_MAX_FREQ"
|
||||
fi
|
||||
;;
|
||||
"sunxi/cortexa53")
|
||||
if echo "$CPU_FREQS" | grep -q "1800000"; then
|
||||
# H6
|
||||
uci_write_config 0 schedutil "888000" "$CPU_MAX_FREQ"
|
||||
elif echo "$CPU_FREQS" | grep -q "1512000"; then
|
||||
# H616/8
|
||||
uci_write_config 0 schedutil "936000" "1512000"
|
||||
elif echo "$CPU_FREQS" | grep -q "1296000"; then
|
||||
# H5
|
||||
uci_write_config 0 ondemand "$CPU_MIN_FREQ" "1296000" 10 50
|
||||
else
|
||||
# A64
|
||||
uci_write_config 0 ondemand "$CPU_MIN_FREQ" "$CPU_MAX_FREQ" 10 50
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,73 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddns-scripts_aliyun
|
||||
PKG_VERSION:=1.0.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=Sense <sensec@gmail.com>
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ddns-scripts_aliyun
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
TITLE:=DDNS extension for AliYun.com
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+ddns-scripts +wget-ssl +openssl-util
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_aliyun/description
|
||||
Dynamic DNS Client scripts extension for AliYun.com
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(CP) ./*.sh $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_aliyun/preinst
|
||||
#!/bin/sh
|
||||
# if NOT run buildroot then stop service
|
||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_aliyun/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns $(1)/usr/share/ddns/default
|
||||
$(INSTALL_BIN) $(CURDIR)/update_aliyun_com.sh $(1)/usr/lib/ddns
|
||||
$(INSTALL_DATA) $(CURDIR)/aliyun.com.json $(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_aliyun/postinst
|
||||
#!/bin/sh
|
||||
# remove old services file entries
|
||||
/bin/sed -i '/aliyun\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/aliyun\.com/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
# and create new
|
||||
printf "%s\\t\\t%s\\n" '"aliyun.com"' '"update_aliyun_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
|
||||
printf "%s\\t\\t%s\\n" '"aliyun.com"' '"update_aliyun_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
|
||||
# on real system restart service if enabled
|
||||
[ -z "$${IPKG_INSTROOT}" ] && {
|
||||
/etc/init.d/ddns enabled && \
|
||||
/etc/init.d/ddns start >/dev/null 2>&1
|
||||
}
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_aliyun/prerm
|
||||
#!/bin/sh
|
||||
# if NOT run buildroot then stop service
|
||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
||||
# remove services file entries
|
||||
/bin/sed -i '/aliyun\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/aliyun\.com/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ddns-scripts_aliyun))
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "aliyun.com",
|
||||
"ipv4": {
|
||||
"url": "update_aliyun_com.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_aliyun_com.sh"
|
||||
}
|
||||
}
|
||||
+248
@@ -0,0 +1,248 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# 用于阿里云解析的DNS更新脚本
|
||||
# 2017-2018 Sense <sensec at gmail dot com>
|
||||
# 阿里云解析API文档 https://help.aliyun.com/document_detail/29739.html
|
||||
#
|
||||
# 本脚本由 dynamic_dns_functions.sh 内的函数 send_update() 调用
|
||||
#
|
||||
# 需要在 /etc/config/ddns 中设置的选项
|
||||
# option username - 阿里云API访问账号 Access Key ID。可通过 aliyun.com 帐号管理的 accesskeys 获取, 或者访问 https://ak-console.aliyun.com
|
||||
# option password - 阿里云API访问密钥 Access Key Secret
|
||||
# option domain - 完整的域名。建议主机与域名之间使用 @符号 分隔,否则将以第一个 .符号 之前的内容作为主机名
|
||||
#
|
||||
|
||||
# 检查传入参数
|
||||
[ -z "$username" ] && write_log 14 "配置错误!保存阿里云API访问账号的'用户名'不能为空"
|
||||
[ -z "$password" ] && write_log 14 "配置错误!保存阿里云API访问密钥的'密码'不能为空"
|
||||
|
||||
# 检查外部调用工具
|
||||
WGET_SSL='wget'
|
||||
[ -n "$WGET_SSL" ] || write_log 13 "使用阿里云API需要 GNU Wget 支持,请先安装"
|
||||
command -v sed >/dev/null 2>&1 || write_log 13 "使用阿里云API需要 sed 支持,请先安装"
|
||||
command -v openssl >/dev/null 2>&1 || write_log 13 "使用阿里云API需要 openssl-util 支持,请先安装"
|
||||
|
||||
# 包含用于解析 JSON 格式返回值的函数
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
# 变量声明
|
||||
local __HOST __DOMAIN __TYPE __URLBASE __CMDBASE __URLARGS __SEPARATOR __RECID
|
||||
[ $use_https -eq 0 ] && __URLBASE="http://alidns.aliyuncs.com/" || __URLBASE="https://alidns.aliyuncs.com/"
|
||||
__SEPARATOR="&"
|
||||
|
||||
# 从 $domain 分离主机和域名
|
||||
[ "${domain:0:2}" == "@." ] && domain="${domain/./}" # 主域名处理
|
||||
[ "$domain" == "${domain/@/}" ] && domain="${domain/./@}" # 未找到分隔符,兼容常用域名格式
|
||||
__HOST="${domain%%@*}"
|
||||
__DOMAIN="${domain#*@}"
|
||||
[ -z "$__HOST" -o "$__HOST" == "$__DOMAIN" ] && __HOST="@"
|
||||
|
||||
# 设置记录类型
|
||||
[ $use_ipv6 -eq 0 ] && __TYPE="A" || __TYPE="AAAA"
|
||||
|
||||
# 构造基本通信命令
|
||||
build_command() {
|
||||
__CMDBASE="$WGET_SSL --no-hsts -nv -t 1 -O $DATFILE -o $ERRFILE"
|
||||
# 绑定用于通信的主机/IP
|
||||
if [ -n "$bind_network" ]; then
|
||||
local bind_ip run_prog
|
||||
[ $use_ipv6 -eq 0 ] && run_prog="network_get_ipaddr" || run_prog="network_get_ipaddr6"
|
||||
eval "$run_prog bind_ip $bind_network" || \
|
||||
write_log 13 "无法使用 '$run_prog $bind_network' 获取本地IP地址 - 错误代码: '$?'"
|
||||
write_log 7 "强制使用IP '$bind_ip' 通信"
|
||||
__CMDBASE="$__CMDBASE --bind-address=$bind_ip"
|
||||
fi
|
||||
# 强制设定IP版本
|
||||
if [ $force_ipversion -eq 1 ]; then
|
||||
[ $use_ipv6 -eq 0 ] && __CMDBASE="$__CMDBASE -4" || __CMDBASE="$__CMDBASE -6"
|
||||
fi
|
||||
# 设置CA证书参数
|
||||
if [ $use_https -eq 1 ]; then
|
||||
if [ "$cacert" = "IGNORE" ]; then
|
||||
__CMDBASE="$__CMDBASE --no-check-certificate"
|
||||
elif [ -f "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-certificate=${cacert}"
|
||||
elif [ -d "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-directory=${cacert}"
|
||||
elif [ -n "$cacert" ]; then
|
||||
write_log 14 "在 '$cacert' 中未找到用于 HTTPS 通信的有效证书"
|
||||
fi
|
||||
fi
|
||||
# 如果没有设置,禁用代理 (这可能是 .wgetrc 或环境设置错误)
|
||||
[ -z "$proxy" ] && __CMDBASE="$__CMDBASE --no-proxy"
|
||||
}
|
||||
|
||||
# 用于阿里云API的通信函数
|
||||
aliyun_transfer() {
|
||||
local __PARAM=$*
|
||||
local __CNT=0
|
||||
local __RUNPROG __ERR PID_SLEEP
|
||||
|
||||
[ $# -eq 0 ] && write_log 12 "'aliyun_transfer()' 出错 - 参数数量错误"
|
||||
|
||||
while : ; do
|
||||
build_Request $__PARAM
|
||||
__RUNPROG="$__CMDBASE '${__URLBASE}?${__URLARGS}'"
|
||||
|
||||
write_log 7 "#> $__RUNPROG"
|
||||
eval $__RUNPROG
|
||||
__ERR=$?
|
||||
[ $__ERR -eq 0 ] && return 0
|
||||
|
||||
write_log 3 "wget 错误代码: '$__ERR'"
|
||||
write_log 7 "$(cat $ERRFILE)"
|
||||
|
||||
if [ $VERBOSE -gt 1 ]; then
|
||||
write_log 4 "传输失败 - 详细模式: $VERBOSE - 出错后不再重试"
|
||||
return 1
|
||||
fi
|
||||
|
||||
__CNT=$(( $__CNT + 1 ))
|
||||
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \
|
||||
write_log 14 "$retry_count 次重试后传输还是失败"
|
||||
|
||||
write_log 4 "传输失败 - $__CNT/$retry_count 在 $RETRY_SECONDS 秒后重试"
|
||||
sleep $RETRY_SECONDS &
|
||||
PID_SLEEP=$!
|
||||
wait $PID_SLEEP
|
||||
PID_SLEEP=0
|
||||
done
|
||||
}
|
||||
|
||||
# 百分号编码
|
||||
percentEncode() {
|
||||
if [ -z "${1//[A-Za-z0-9_.~-]/}" ]; then
|
||||
echo -n "$1"
|
||||
else
|
||||
local string=$1; local i=0; local ret chr
|
||||
while [ $i -lt ${#string} ]; do
|
||||
chr=${string:$i:1}
|
||||
[ -z "${chr#[^A-Za-z0-9_.~-]}" ] && chr=$(printf '%%%02X' "'$chr")
|
||||
ret="$ret$chr"
|
||||
i=$(( $i + 1 ))
|
||||
done
|
||||
echo -n "$ret"
|
||||
fi
|
||||
}
|
||||
|
||||
# 构造阿里云解析请求参数
|
||||
build_Request() {
|
||||
local args=$*; local string
|
||||
local HTTP_METHOD="GET"
|
||||
|
||||
# 添加请求参数
|
||||
__URLARGS=
|
||||
for string in $args; do
|
||||
case "${string%%=*}" in
|
||||
Format|TTL|Version|AccessKeyId|SignatureMethod|Timestamp|SignatureVersion|SignatureNonce|Signature) ;; # 过滤公共参数
|
||||
*) __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}");;
|
||||
esac
|
||||
done
|
||||
__URLARGS="${__URLARGS:1}"
|
||||
|
||||
# 附加公共参数
|
||||
string="Format=JSON"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="TTL=600";__URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="Version=2015-01-09"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="AccessKeyId=$username"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="SignatureMethod=HMAC-SHA1"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="Timestamp="$(date -u '+%Y-%m-%dT%H:%M:%SZ'); __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="SignatureVersion=1.0"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="SignatureNonce="$(cat '/proc/sys/kernel/random/uuid'); __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
|
||||
# 对请求参数进行排序,用于生成签名
|
||||
string=$(echo -n "$__URLARGS" | sed 's/\'"${__SEPARATOR}"'/\n/g' | sort | sed ':label; N; s/\n/\'"${__SEPARATOR}"'/g; b label')
|
||||
# 构造用于计算签名的字符串
|
||||
string="${HTTP_METHOD}${__SEPARATOR}"$(percentEncode "/")"${__SEPARATOR}"$(percentEncode "$string")
|
||||
# 字符串计算签名HMAC值
|
||||
local signature=$(echo -n "$string" | openssl dgst -sha1 -hmac "${password}&" -binary)
|
||||
# HMAC值编码成字符串,得到签名值
|
||||
signature=$(echo -n "$signature" | openssl base64)
|
||||
|
||||
# 附加签名参数
|
||||
string="Signature=$signature"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
}
|
||||
|
||||
# 添加解析记录
|
||||
add_domain() {
|
||||
local value
|
||||
aliyun_transfer "Action=AddDomainRecord" "DomainName=${__DOMAIN}" "RR=${__HOST}" "Type=${__TYPE}" "Value=${__IP}" || write_log 14 "服务器通信失败"
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_get_var value "RecordId"
|
||||
[ -z "$value" ] && write_log 14 "添加新解析记录失败"
|
||||
write_log 7 "添加新解析记录成功"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 修改解析记录
|
||||
update_domain() {
|
||||
local value
|
||||
aliyun_transfer "Action=UpdateDomainRecord" "RecordId=${__RECID}" "RR=${__HOST}" "Type=${__TYPE}" "Value=${__IP}" || write_log 14 "服务器通信失败"
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_get_var value "RecordId"
|
||||
[ -z "$value" ] && write_log 14 "修改解析记录失败"
|
||||
write_log 7 "修改解析记录成功"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 启用解析记录
|
||||
enable_domain() {
|
||||
local value
|
||||
aliyun_transfer "Action=SetDomainRecordStatus" "RecordId=${__RECID}" "Status=Enable" || write_log 14 "服务器通信失败"
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_get_var value "Status"
|
||||
[ "$value" != "Enable" ] && write_log 14 "启用解析记录失败"
|
||||
write_log 7 "启用解析记录成功"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 获取子域名解析记录列表
|
||||
describe_domain() {
|
||||
local count value; local ret=0
|
||||
aliyun_transfer "Action=DescribeSubDomainRecords" "SubDomain=${__HOST}.${__DOMAIN}" "DomainName=${__DOMAIN}" "Line=default" || write_log 14 "服务器通信失败"
|
||||
write_log 7 "获取到解析记录: $(cat "$DATFILE" 2> /dev/null)"
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_get_var count "TotalCount"
|
||||
if [ $count -eq 0 ]; then
|
||||
write_log 7 "解析记录不存在"
|
||||
ret=1
|
||||
else
|
||||
local i=1;
|
||||
while [ $i -le $count ]; do
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_select "DomainRecords" >/dev/null 2>&1
|
||||
json_select "Record" >/dev/null 2>&1
|
||||
json_select $i >/dev/null 2>&1
|
||||
i=$(( $i + 1 ))
|
||||
json_get_var value "Type"
|
||||
if [ "$value" != "${__TYPE}" ]; then
|
||||
write_log 7 "当前解析类型: ${__TYPE}, 获得不匹配类型: $value"
|
||||
ret=1; continue
|
||||
else
|
||||
ret=0
|
||||
json_get_var __RECID "RecordId"
|
||||
write_log 7 "获得解析记录ID: ${__RECID}, 类型: $value"
|
||||
json_get_var value "Locked"
|
||||
[ $value -ne 0 ] && write_log 14 "解析记录被锁定"
|
||||
json_get_var value "Status"
|
||||
[ "$value" != "ENABLE" ] && ret=$(( $ret | 2 )) && write_log 7 "解析记录被禁用"
|
||||
json_get_var value "Value"
|
||||
[ "$value" != "${__IP}" ] && ret=$(( $ret | 4 )) && write_log 7 "地址需要修改"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
|
||||
build_command
|
||||
describe_domain
|
||||
ret=$?
|
||||
if [ $ret -eq 1 ]; then
|
||||
sleep 3 && add_domain
|
||||
else
|
||||
[ $(( $ret & 2 )) -ne 0 ] && sleep 3 && enable_domain
|
||||
[ $(( $ret & 4 )) -ne 0 ] && sleep 3 && update_domain
|
||||
fi
|
||||
|
||||
return 0
|
||||
@@ -0,0 +1,78 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddns-scripts_dnspod
|
||||
PKG_VERSION:=1.0.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=Small_5
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ddns-scripts_dnspod
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
TITLE:=DDNS extension for Dnspod.com/Dnspod.cn
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+ddns-scripts +wget-ssl +ca-bundle
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_dnspod/description
|
||||
Dynamic DNS Client scripts extension for Dnspod.com/Dnspod.cn
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_dnspod/preinst
|
||||
#!/bin/sh
|
||||
# if NOT run buildroot then stop service
|
||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_dnspod/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns $(1)/usr/share/ddns/default
|
||||
$(INSTALL_BIN) $(CURDIR)/*.sh $(1)/usr/lib/ddns
|
||||
$(INSTALL_DATA) $(CURDIR)/*.json $(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_dnspod/postinst
|
||||
#!/bin/sh
|
||||
# remove old services file entries
|
||||
/bin/sed -i '/dnspod\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.cn/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.com/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.cn/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
# and create new
|
||||
printf "%s\\t\\t%s\\n" '"dnspod.com"' '"update_dnspod_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
|
||||
printf "%s\\t\\t%s\\n" '"dnspod.cn"' '"update_dnspod_cn.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
|
||||
printf "%s\\t\\t%s\\n" '"dnspod.com"' '"update_dnspod_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
|
||||
printf "%s\\t\\t%s\\n" '"dnspod.cn"' '"update_dnspod_cn.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
|
||||
# on real system restart service if enabled
|
||||
[ -z "$${IPKG_INSTROOT}" ] && {
|
||||
/etc/init.d/ddns enabled && \
|
||||
/etc/init.d/ddns start >/dev/null 2>&1
|
||||
}
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_dnspod/prerm
|
||||
#!/bin/sh
|
||||
# if NOT run buildroot then stop service
|
||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
||||
# remove services file entries
|
||||
/bin/sed -i '/dnspod\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.cn/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.com/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.cn/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ddns-scripts_dnspod))
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "dnspod.com",
|
||||
"ipv4": {
|
||||
"url": "update_dnspod_cn.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_dnspod_cn.sh"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "dnspod.com",
|
||||
"ipv4": {
|
||||
"url": "update_dnspod_com.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_dnspod_com.sh"
|
||||
}
|
||||
}
|
||||
Executable
+155
@@ -0,0 +1,155 @@
|
||||
#!/bin/sh
|
||||
|
||||
#检查传入参数
|
||||
[ -z "$username" ] && write_log 14 "Configuration error! [User name] cannot be empty"
|
||||
[ -z "$password" ] && write_log 14 "Configuration error! [Password] cannot be empty"
|
||||
|
||||
#检查外部调用工具
|
||||
WGET_SSL='wget'
|
||||
[ -n "$WGET_SSL" ] || write_log 13 "GNU Wget support is required to use dnspod API. Please install first"
|
||||
|
||||
# 变量声明
|
||||
local __URLBASE __HOST __DOMAIN __TYPE __CMDBASE __POST __POST1 __RECIP __RECID __value __TTL
|
||||
__URLBASE="https://dnsapi.cn/"
|
||||
|
||||
# 从 $domain 分离主机和域名
|
||||
[ "${domain:0:2}" == "@." ] && domain="${domain/./}" # 主域名处理
|
||||
[ "$domain" == "${domain/@/}" ] && domain="${domain/./@}" # 未找到分隔符,兼容常用域名格式
|
||||
__HOST="${domain%%@*}"
|
||||
__DOMAIN="${domain#*@}"
|
||||
[ -z "$__HOST" -o "$__HOST" == "$__DOMAIN" ] && __HOST="@"
|
||||
|
||||
# 设置记录类型
|
||||
[ $use_ipv6 -eq 0 ] && __TYPE="A" || __TYPE="AAAA"
|
||||
|
||||
# 构造基本通信命令
|
||||
build_command() {
|
||||
__CMDBASE="$WGET_SSL --no-hsts -nv -t 1 -O $DATFILE -o $ERRFILE"
|
||||
# 绑定用于通信的主机/IP
|
||||
if [ -n "$bind_network" ]; then
|
||||
local bind_ip run_prog
|
||||
[ $use_ipv6 -eq 0 ] && run_prog="network_get_ipaddr" || run_prog="network_get_ipaddr6"
|
||||
eval "$run_prog bind_ip $bind_network" || \
|
||||
write_log 13 "Unable to get local IP address with '$run_prog $ bind_network' - error code: '$?'"
|
||||
write_log 7 "Forced use of IP '$bind_ip' communication"
|
||||
__CMDBASE="$__CMDBASE --bind-address=$bind_ip"
|
||||
fi
|
||||
# 强制设定IP版本
|
||||
if [ $force_ipversion -eq 1 ]; then
|
||||
[ $use_ipv6 -eq 0 ] && __CMDBASE="$__CMDBASE -4" || __CMDBASE="$__CMDBASE -6"
|
||||
fi
|
||||
# 设置CA证书参数
|
||||
if [ $use_https -eq 1 ]; then
|
||||
if [ "$cacert" = "IGNORE" ]; then
|
||||
__CMDBASE="$__CMDBASE --no-check-certificate"
|
||||
elif [ -f "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-certificate=${cacert}"
|
||||
elif [ -d "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-directory=${cacert}"
|
||||
elif [ -n "$cacert" ]; then
|
||||
write_log 14 "A valid certificate for HTTPS communication was not found in '$cacert'"
|
||||
fi
|
||||
fi
|
||||
# 如果没有设置,禁用代理 (这可能是 .wgetrc 或环境设置错误)
|
||||
[ -z "$proxy" ] && __CMDBASE="$__CMDBASE --no-proxy"
|
||||
__CMDBASE="$__CMDBASE --post-data"
|
||||
}
|
||||
|
||||
# 用于Dnspod API的通信函数
|
||||
dnspod_transfer() {
|
||||
local __A=$1
|
||||
local __CNT=0
|
||||
local __ERR=0
|
||||
local __B PID_SLEEP
|
||||
case "$__A" in
|
||||
0)
|
||||
__B="$__CMDBASE '$__POST' ${__URLBASE}Record.List"
|
||||
;;
|
||||
1)
|
||||
__B="$__CMDBASE '$__POST1' ${__URLBASE}Record.Create"
|
||||
;;
|
||||
2)
|
||||
__B="$__CMDBASE '$__POST1&record_id=$__RECID&ttl=$__TTL' ${__URLBASE}Record.Modify"
|
||||
;;
|
||||
esac
|
||||
|
||||
while : ; do
|
||||
write_log 7 "#> $__B"
|
||||
eval $__B
|
||||
__ERR=`jsonfilter -i $DATFILE -e "@.status.code"`
|
||||
|
||||
[ $__ERR -eq 1 ] && return 0
|
||||
[ $__A -eq 0 ] && [ $__ERR -eq 10 ] && return 0
|
||||
write_log 3 "Error message:[$(jsonfilter -i $DATFILE -e "@.status.message")]"
|
||||
|
||||
if [ $VERBOSE -gt 1 ]; then
|
||||
write_log 4 "Transfer failed - detailed mode: $VERBOSE - Do not try again after an error"
|
||||
return 1
|
||||
fi
|
||||
|
||||
__CNT=$(( $__CNT + 1 ))
|
||||
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && write_log 14 "Transfer failed after $retry_count retries"
|
||||
|
||||
write_log 4 "Transfer failed - $__CNT Try again in $RETRY_SECONDS seconds"
|
||||
sleep $RETRY_SECONDS &
|
||||
PID_SLEEP=$!
|
||||
wait $PID_SLEEP
|
||||
PID_SLEEP=0
|
||||
done
|
||||
}
|
||||
|
||||
#添加解析记录
|
||||
add_domain() {
|
||||
dnspod_transfer 1
|
||||
write_log 7 "Add new parsing record [${__HOST}.${__DOMAIN}],[type:$__TYPE],[ip:$__IP] successfully!"
|
||||
return 0
|
||||
}
|
||||
|
||||
#修改解析记录
|
||||
update_domain() {
|
||||
dnspod_transfer 2
|
||||
write_log 7 "Modify new parsing record [${__HOST}.${__DOMAIN}],[type:$__TYPE],[ip:$__IP],[TTL:$__TTL] successfully!"
|
||||
return 0
|
||||
}
|
||||
|
||||
#获取域名解析记录
|
||||
describe_domain() {
|
||||
ret=0
|
||||
__POST="login_token=$username,$password&format=json&domain=$__DOMAIN&sub_domain=$__HOST&record_type=$__TYPE"
|
||||
__POST1="$__POST&value=$__IP&record_type=$__TYPE&record_line_id=0"
|
||||
dnspod_transfer 0
|
||||
__TMP=`jsonfilter -i $DATFILE -e "@.records[@.type!='NS']"`
|
||||
__value=`jsonfilter -s "$__TMP" -e "@.name"`
|
||||
if [ "$__value" == "" ]; then
|
||||
write_log 7 "Parsing record:[${__HOST}.${__DOMAIN}] does not exist"
|
||||
ret=1
|
||||
else
|
||||
__RECID=`jsonfilter -s "$__TMP" -e "@.id"`
|
||||
__value=`jsonfilter -s "$__TMP" -e "@.type"`
|
||||
__TTL=`jsonfilter -s "$__TMP" -e "@.ttl"`
|
||||
write_log 7 "Get parsing recordID:[$__RECID]"
|
||||
if [ "$__value" != "$__TYPE" ]; then
|
||||
write_log 7 "Current parsing [type:$__TYPE], get mismatched [type:$__value]"
|
||||
write_log 7 "Address needs to be modified, local address:[$__IP]"
|
||||
ret=2
|
||||
else
|
||||
__RECIP=`jsonfilter -s "$__TMP" -e "@.value"`
|
||||
if [ "$__RECIP" != "$__IP" ]; then
|
||||
write_log 7 "Address needs to be modified, local address:[$__IP]"
|
||||
ret=2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
build_command
|
||||
describe_domain
|
||||
if [ $ret == 1 ];then
|
||||
sleep 3 && add_domain
|
||||
elif [ $ret == 2 ];then
|
||||
sleep 3 && update_domain
|
||||
else
|
||||
write_log 7 "Local IP:[$__IP] parsing records IP:[$__RECIP] address does not need to be modified"
|
||||
fi
|
||||
|
||||
return 0
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
#!/bin/sh
|
||||
|
||||
#检查传入参数
|
||||
[ -z "$username" ] && write_log 14 "Configuration error! [User name] cannot be empty"
|
||||
[ -z "$password" ] && write_log 14 "Configuration error! [Password] cannot be empty"
|
||||
|
||||
#检查外部调用工具
|
||||
WGET_SSL='wget'
|
||||
[ -n "$WGET_SSL" ] || write_log 13 "GNU Wget support is required to use dnspod API. Please install first"
|
||||
|
||||
# 变量声明
|
||||
local __URLBASE __HOST __DOMAIN __TYPE __CMDBASE __POST __POST1 __RECIP __RECID __value __TTL
|
||||
__URLBASE="https://api.dnspod.com/"
|
||||
|
||||
# 从 $domain 分离主机和域名
|
||||
[ "${domain:0:2}" == "@." ] && domain="${domain/./}" # 主域名处理
|
||||
[ "$domain" == "${domain/@/}" ] && domain="${domain/./@}" # 未找到分隔符,兼容常用域名格式
|
||||
__HOST="${domain%%@*}"
|
||||
__DOMAIN="${domain#*@}"
|
||||
[ -z "$__HOST" -o "$__HOST" == "$__DOMAIN" ] && __HOST="@"
|
||||
|
||||
# 设置记录类型
|
||||
[ $use_ipv6 -eq 0 ] && __TYPE="A" || __TYPE="AAAA"
|
||||
|
||||
# 构造基本通信命令
|
||||
build_command() {
|
||||
__CMDBASE="$WGET_SSL --no-hsts -nv -t 1 -O $DATFILE -o $ERRFILE"
|
||||
# 绑定用于通信的主机/IP
|
||||
if [ -n "$bind_network" ]; then
|
||||
local bind_ip run_prog
|
||||
[ $use_ipv6 -eq 0 ] && run_prog="network_get_ipaddr" || run_prog="network_get_ipaddr6"
|
||||
eval "$run_prog bind_ip $bind_network" || \
|
||||
write_log 13 "Unable to get local IP address with '$run_prog $ bind_network' - error code: '$?'"
|
||||
write_log 7 "Forced use of IP '$bind_ip' communication"
|
||||
__CMDBASE="$__CMDBASE --bind-address=$bind_ip"
|
||||
fi
|
||||
# 强制设定IP版本
|
||||
if [ $force_ipversion -eq 1 ]; then
|
||||
[ $use_ipv6 -eq 0 ] && __CMDBASE="$__CMDBASE -4" || __CMDBASE="$__CMDBASE -6"
|
||||
fi
|
||||
# 设置CA证书参数
|
||||
if [ $use_https -eq 1 ]; then
|
||||
if [ "$cacert" = "IGNORE" ]; then
|
||||
__CMDBASE="$__CMDBASE --no-check-certificate"
|
||||
elif [ -f "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-certificate=${cacert}"
|
||||
elif [ -d "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-directory=${cacert}"
|
||||
elif [ -n "$cacert" ]; then
|
||||
write_log 14 "A valid certificate for HTTPS communication was not found in '$cacert'"
|
||||
fi
|
||||
fi
|
||||
# 如果没有设置,禁用代理 (这可能是 .wgetrc 或环境设置错误)
|
||||
[ -z "$proxy" ] && __CMDBASE="$__CMDBASE --no-proxy"
|
||||
__CMDBASE="$__CMDBASE --post-data"
|
||||
}
|
||||
|
||||
# 用于Dnspod API的通信函数
|
||||
dnspod_transfer() {
|
||||
local __A=$1
|
||||
local __CNT=0
|
||||
local __ERR=0
|
||||
local __B PID_SLEEP
|
||||
case "$__A" in
|
||||
0)
|
||||
__B="$__CMDBASE '$__POST' ${__URLBASE}Record.List"
|
||||
;;
|
||||
1)
|
||||
__B="$__CMDBASE '$__POST1' ${__URLBASE}Record.Create"
|
||||
;;
|
||||
2)
|
||||
__B="$__CMDBASE '$__POST1&record_id=$__RECID&ttl=$__TTL' ${__URLBASE}Record.Modify"
|
||||
;;
|
||||
esac
|
||||
|
||||
while : ; do
|
||||
write_log 7 "#> $__B"
|
||||
eval $__B
|
||||
__ERR=`jsonfilter -i $DATFILE -e "@.status.code"`
|
||||
|
||||
[ $__ERR -eq 1 ] && return 0
|
||||
[ $__A -eq 0 ] && [ $__ERR -eq 10 ] && return 0
|
||||
write_log 3 "Error message:[$(jsonfilter -i $DATFILE -e "@.status.message")]"
|
||||
|
||||
if [ $VERBOSE -gt 1 ]; then
|
||||
write_log 4 "Transfer failed - detailed mode: $VERBOSE - Do not try again after an error"
|
||||
return 1
|
||||
fi
|
||||
|
||||
__CNT=$(( $__CNT + 1 ))
|
||||
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && write_log 14 "Transfer failed after $retry_count retries"
|
||||
|
||||
write_log 4 "Transfer failed - $__CNT Try again in $RETRY_SECONDS seconds"
|
||||
sleep $RETRY_SECONDS &
|
||||
PID_SLEEP=$!
|
||||
wait $PID_SLEEP
|
||||
PID_SLEEP=0
|
||||
done
|
||||
}
|
||||
|
||||
#添加解析记录
|
||||
add_domain() {
|
||||
dnspod_transfer 1
|
||||
write_log 7 "Add new parsing record [${__HOST}.${__DOMAIN}],[type:$__TYPE],[ip:$__IP] successfully!"
|
||||
return 0
|
||||
}
|
||||
|
||||
#修改解析记录
|
||||
update_domain() {
|
||||
dnspod_transfer 2
|
||||
write_log 7 "Modify new parsing record [${__HOST}.${__DOMAIN}],[type:$__TYPE],[ip:$__IP],[TTL:$__TTL] successfully!"
|
||||
return 0
|
||||
}
|
||||
|
||||
#获取域名解析记录
|
||||
describe_domain() {
|
||||
ret=0
|
||||
__POST="login_token=$username,$password&format=json&domain=$__DOMAIN&sub_domain=$__HOST&record_type=$__TYPE"
|
||||
__POST1="$__POST&value=$__IP&record_type=$__TYPE&record_line_id=0"
|
||||
dnspod_transfer 0
|
||||
__TMP=`jsonfilter -i $DATFILE -e "@.records[@.type!='NS']"`
|
||||
__value=`jsonfilter -s "$__TMP" -e "@.name"`
|
||||
if [ "$__value" == "" ]; then
|
||||
write_log 7 "Parsing record:[${__HOST}.${__DOMAIN}] does not exist"
|
||||
ret=1
|
||||
else
|
||||
__RECID=`jsonfilter -s "$__TMP" -e "@.id"`
|
||||
__value=`jsonfilter -s "$__TMP" -e "@.type"`
|
||||
__TTL=`jsonfilter -s "$__TMP" -e "@.ttl"`
|
||||
write_log 7 "Get parsing recordID:[$__RECID]"
|
||||
if [ "$__value" != "$__TYPE" ]; then
|
||||
write_log 7 "Current parsing [type:$__TYPE], get mismatched [type:$__value]"
|
||||
write_log 7 "Address needs to be modified, local address:[$__IP]"
|
||||
ret=2
|
||||
else
|
||||
__RECIP=`jsonfilter -s "$__TMP" -e "@.value"`
|
||||
if [ "$__RECIP" != "$__IP" ]; then
|
||||
write_log 7 "Address needs to be modified, local address:[$__IP]"
|
||||
ret=2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
build_command
|
||||
describe_domain
|
||||
if [ $ret == 1 ];then
|
||||
sleep 3 && add_domain
|
||||
elif [ $ret == 2 ];then
|
||||
sleep 3 && update_domain
|
||||
else
|
||||
write_log 7 "Local IP:[$__IP] parsing records IP:[$__RECIP] address does not need to be modified"
|
||||
fi
|
||||
|
||||
return 0
|
||||
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# Copyright (C) 2016-2023 GitHub
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=default-settings
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/default-settings
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
TITLE:=LuCI support for Default Settings
|
||||
PKGARCH:=all
|
||||
DEPENDS:= +luci-compat +@LUCI_LANG_zh-cn +@LUCI_LANG_zh_Hans +@LUCI_LANG_en
|
||||
endef
|
||||
|
||||
define Package/default-settings/description
|
||||
Language Support Packages.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/default-settings/install
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/zzz-default-settings $(1)/etc/uci-defaults/99-default-settings
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
po2lmo ./po/zh-cn/default.po $(1)/usr/lib/lua/luci/i18n/default.zh-cn.lmo
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,default-settings))
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF
|
||||
set system.@system[0].timezone='CST-8'
|
||||
set system.@system[0].zonename='Asia/Shanghai'
|
||||
|
||||
delete system.ntp.server
|
||||
add_list system.ntp.server='ntp1.aliyun.com'
|
||||
add_list system.ntp.server='ntp.tencent.com'
|
||||
add_list system.ntp.server='ntp.ntsc.ac.cn'
|
||||
add_list system.ntp.server='time.apple.com'
|
||||
EOF
|
||||
uci commit system
|
||||
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/mwan.htm
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/upnp.htm
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/ddns.htm
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/minidlna.htm
|
||||
|
||||
rm -f /www/luci-static/resources/view/status/include/70_ddns.js
|
||||
rm -f /www/luci-static/resources/view/status/include/80_upnp.js
|
||||
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/aria2.lua
|
||||
sed -i 's/services/nas/g' /usr/lib/lua/luci/view/aria2/overview_status.htm
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/hd_idle.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/samba.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/samba4.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/minidlna.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/transmission.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/mjpg-streamer.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/p910nd.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/usb_printer.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/xunlei.lua
|
||||
sed -i 's/services/nas/g' /usr/lib/lua/luci/view/minidlna_status.htm
|
||||
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/share/luci/menu.d/luci-app-samba4.json
|
||||
|
||||
sed -i 's#downloads.openwrt.org#mirrors.tencent.com/lede#g' /etc/opkg/distfeeds.conf
|
||||
sed -i 's#downloads.openwrt.org#mirrors.tencent.com/lede#g' /etc/apk/repositories.d/distfeeds.list
|
||||
sed -i 's/root::0:0:99999:7:::/root:$1$V4UetPzk$CYXluq4wUazHjmCDBCqXF.:0:0:99999:7:::/g' /etc/shadow
|
||||
sed -i 's/root:::0:99999:7:::/root:$1$V4UetPzk$CYXluq4wUazHjmCDBCqXF.:0:0:99999:7:::/g' /etc/shadow
|
||||
|
||||
sed -i "s/# //g" /etc/opkg/distfeeds.conf
|
||||
sed -i '/helloworld/d' /etc/opkg/distfeeds.conf
|
||||
sed -i '/openwrt_luci/ { s/snapshots/releases\/18.06.9/g; }' /etc/opkg/distfeeds.conf
|
||||
|
||||
sed -i '/check_signature/d' /etc/opkg.conf
|
||||
|
||||
sed -i '/REDIRECT --to-ports 53/d' /etc/firewall.user
|
||||
|
||||
sed -i '/DISTRIB_REVISION/d' /etc/openwrt_release
|
||||
echo "DISTRIB_REVISION='R26.05.20'" >> /etc/openwrt_release
|
||||
sed -i '/DISTRIB_DESCRIPTION/d' /etc/openwrt_release
|
||||
echo "DISTRIB_DESCRIPTION='LEDE '" >> /etc/openwrt_release
|
||||
|
||||
sed -i '/OPENWRT_RELEASE/d' /usr/lib/os-release
|
||||
echo 'OPENWRT_RELEASE="LEDE R26.05.20"' >> /usr/lib/os-release
|
||||
|
||||
sed -i '/log-facility/d' /etc/dnsmasq.conf
|
||||
echo "log-facility=/dev/null" >> /etc/dnsmasq.conf
|
||||
|
||||
rm -rf /tmp/luci-modulecache/
|
||||
rm -f /tmp/luci-indexcache
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,70 @@
|
||||
msgid "Swap"
|
||||
msgstr "虚拟内存"
|
||||
|
||||
msgid "Processor"
|
||||
msgstr "处理器"
|
||||
|
||||
msgid "Architecture"
|
||||
msgstr "架构"
|
||||
|
||||
msgid "CPU Temperature"
|
||||
msgstr "CPU 温度"
|
||||
|
||||
msgid "CPU Info"
|
||||
msgstr "CPU 信息"
|
||||
|
||||
msgid "CPU Model"
|
||||
msgstr "处理器型号"
|
||||
|
||||
msgid "CPU usage"
|
||||
msgstr "CPU 使用率"
|
||||
|
||||
msgid "CPU frequency"
|
||||
msgstr "CPU 频率"
|
||||
|
||||
msgid "RAM frequency"
|
||||
msgstr "RAM 频率"
|
||||
|
||||
msgid "Flash Size"
|
||||
msgstr "闪存大小"
|
||||
|
||||
msgid "Free Memory"
|
||||
msgstr "释放内存"
|
||||
|
||||
msgid "RUNNING"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "NOT RUNNING"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "ZRam Settings"
|
||||
msgstr "ZRam 设置"
|
||||
|
||||
msgid "ZRam Compression Algorithm"
|
||||
msgstr "ZRam 压缩算法"
|
||||
|
||||
msgid "ZRam Compression Streams"
|
||||
msgstr "ZRam 压缩数据流线程数"
|
||||
|
||||
msgid "ZRam Size"
|
||||
msgstr "ZRam 大小"
|
||||
|
||||
msgid "Size of the ZRam device in megabytes"
|
||||
msgstr "划分给 ZRam 分区的内存大小(MB),推荐留空由系统自动管理"
|
||||
|
||||
msgid "Number of parallel threads used for compression"
|
||||
msgstr "用于压缩内存数据的CPU并发线程数"
|
||||
|
||||
msgid "Force 40MHz mode"
|
||||
msgstr "强制 40MHz 频宽"
|
||||
|
||||
msgid ""
|
||||
"Always use 40MHz channels even if the secondary channel overlaps. Using this "
|
||||
"option does not comply with IEEE 802.11n-2009!"
|
||||
msgstr "强制启用 40MHz 频宽并忽略辅助信道重叠。此选项可能不兼容某些无线硬件导致无法启用!"
|
||||
|
||||
msgid "Disassociate On Low Acknowledgement"
|
||||
msgstr "弱信号剔除"
|
||||
|
||||
msgid "Allow AP mode to disconnect STAs based on low ACK condition"
|
||||
msgstr "允许 AP 模式基于低 ACK 条件判断剔除弱信号的客户端"
|
||||
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dsmboot
|
||||
PKG_VERSION:=5.2
|
||||
PKG_RELEASE:=5967.1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/dsmboot
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Synology DSM pxeboot from TFTP
|
||||
DEPENDS:=
|
||||
endef
|
||||
|
||||
define Package/dsmboot/description
|
||||
DSM 5.2 boot from TFTP
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/dsmboot/install
|
||||
$(INSTALL_DIR) $(1)/root
|
||||
$(INSTALL_DATA) ./files/* $(1)/root/
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/dsmboot $(1)/etc/uci-defaults/yyy-dsmboot
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dsmboot))
|
||||
Binary file not shown.
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set dhcp.@dnsmasq[0].enable_tftp='1'
|
||||
set dhcp.@dnsmasq[0].dhcp_boot='pxelinux.0'
|
||||
set dhcp.@dnsmasq[0].tftp_root='/root'
|
||||
commit dhcp
|
||||
EOF
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,9 @@
|
||||
default 0
|
||||
timeout 0
|
||||
fallback 0
|
||||
|
||||
title Synology DSM
|
||||
map --mem (pd)/dsm.iso (hd32)
|
||||
map --hook
|
||||
chainloader (hd32)
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,53 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/target.mk
|
||||
|
||||
PKG_NAME:=fogvdn
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=1
|
||||
PKG_HASH:=skip
|
||||
|
||||
ifeq ($(ARCH),x86_64)
|
||||
PKG_ARCH:=X64
|
||||
else ifeq ($(ARCH),arm)
|
||||
PKG_ARCH:=ARM
|
||||
else ifeq ($(ARCH),aarch64)
|
||||
PKG_ARCH:=ARM64
|
||||
endif
|
||||
|
||||
PKG_SOURCE:=fogvdn_PEAR_$(PKG_ARCH)_LINUX_latest.tar.gz
|
||||
PKG_SOURCE_URL:=https://download.openfogos.com/release/
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR)/root --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
|
||||
|
||||
define Package/fogvdn
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=OpenFog Pear P2P CDN
|
||||
DEPENDS:=@(aarch64||arm||x86_64) \
|
||||
+bash +getopt +jq +ntpdate +whereis \
|
||||
+smartmontools +zoneinfo-all +coreutils \
|
||||
+coreutils-install +coreutils-df +coreutils-nohup
|
||||
endef
|
||||
|
||||
define Package/fogvdn/description
|
||||
OpenFog Pear Peer-to-Peer Content Delivery Network
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)/root
|
||||
$(PKG_UNPACK)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/fogvdn/install
|
||||
$(CP) $(PKG_BUILD_DIR)/root/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fogvdn))
|
||||
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt-dist
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ipv6helper
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=LEAN
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ipv6helper
|
||||
SECTION:=ipv6
|
||||
TITLE:=IPv6 Helper and Dynamic Update he.net of ip
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+luci-proto-ipv6 +wget +ip6tables +libip6tc +kmod-ipt-nat6 +odhcpd-ipv6only +odhcp6c +6in4
|
||||
endef
|
||||
|
||||
define Package/ipv6helper/description
|
||||
IPv6 Helper and Dynamic Update he.net of ip
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/ipv6helper/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
chmod 755 /etc/hotplug.d/iface/60-6in4 >/dev/null 2>&1
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ipv6helper/install
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) ./files/root/etc/hotplug.d/iface/60-6in4 $(1)/etc/hotplug.d/iface/60-6in4
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,ipv6helper))
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
. /lib/functions.sh
|
||||
if [ "$ACTION" != "ifup" ]; then
|
||||
exit
|
||||
fi
|
||||
config_load network
|
||||
config_get tunnelid $INTERFACE tunnelid
|
||||
config_get username $INTERFACE username
|
||||
config_get password $INTERFACE password
|
||||
if [ "$tunnelid" != "" ]; then
|
||||
wget -O - https://$username:$password@ipv4.tunnelbroker.net/nic/update?hostname=$tunnelid --no-check-certificate
|
||||
fi
|
||||
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=k3wifi
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/k3wifi
|
||||
TITLE:=k3 wifi fw
|
||||
DEPENDS:=@TARGET_bcm53xx
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/k3wifi/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/brcm
|
||||
$(INSTALL_BIN) ./files/brcmfmac4366c-pcie.bin $(1)/lib/firmware/brcm/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,k3wifi))
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,47 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=k3screenctrl
|
||||
PKG_VERSION:=0.10
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/updateing/k3screenctrl.git
|
||||
PKG_SOURCE_VERSION:=dd05ce9a5cb0cb6cebfc6b3b5823c7f6d75796ff
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.xz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||
PKG_MAINTAINER:=Hamster Tian <haotia@gmail.com>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS+= -D_GNU_SOURCE
|
||||
|
||||
define Package/k3screenctrl
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=@TARGET_bcm53xx_generic_DEVICE_phicomm_k3 +@KERNEL_DEVMEM
|
||||
TITLE:=LCD screen controller on PHICOMM K3
|
||||
URL:=https://github.com/updateing/k3-screen-ctrl
|
||||
endef
|
||||
|
||||
define Package/k3screenctrl/description
|
||||
K3 Screen Controller (k3screenctrl) is a program utilizing
|
||||
the LCD screen on PHICOMM K3 to display some stats.
|
||||
endef
|
||||
|
||||
define Package/k3screenctrl/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/lib/k3screenctrl
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/k3screenctrl $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/wan.sh $(1)/lib/k3screenctrl/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/wifi.sh $(1)/lib/k3screenctrl/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/port.sh $(1)/lib/k3screenctrl/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/basic.sh $(1)/lib/k3screenctrl/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/host.sh $(1)/lib/k3screenctrl/
|
||||
|
||||
$(INSTALL_BIN) ./files/k3screenctrl.init $(1)/etc/init.d/k3screenctrl
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,k3screenctrl))
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=99
|
||||
|
||||
SCRIPTS_BASE=/lib/k3screenctrl/
|
||||
|
||||
start() {
|
||||
/usr/bin/k3screenctrl &
|
||||
}
|
||||
|
||||
stop() {
|
||||
killall k3screenctrl
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
diff -Nuar a/src/infocenter.c b/src/infocenter.c
|
||||
--- a/src/infocenter.c 2017-05-02 19:49:08.000000000 +0800
|
||||
+++ b/src/infocenter.c 2021-12-29 17:37:00.837529076 +0800
|
||||
@@ -116,9 +116,10 @@
|
||||
* be malformatted and the results are not reliable.
|
||||
*/
|
||||
const char *stopped_at = tokenize_and_store(out, '\n', stores, store_len);
|
||||
+ int ret = *stopped_at == 0 ? SUCCESS : FAILURE;
|
||||
+
|
||||
free((void *)out);
|
||||
-
|
||||
- return *stopped_at == 0 ? SUCCESS : FAILURE;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
BASIC_INFO g_basic_info;
|
||||
@@ -0,0 +1,68 @@
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libcryptopp
|
||||
PKG_VERSION:=8.5.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=cryptopp$(subst .,,$(PKG_VERSION)).zip
|
||||
PKG_SOURCE_URL:=https://github.com/weidai11/cryptopp/releases/download/CRYPTOPP_$(subst .,_,$(PKG_VERSION))/
|
||||
PKG_HASH:=95fc50d59488ebf61a735cce2b2ec2c2561fc682077c7b496273d65a1ed93d9e
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
UNZIP_CMD:=unzip -q -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
|
||||
|
||||
define Package/libcryptopp
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Free C++ class library of cryptographic schemes
|
||||
URL:=https://packages.debian.org/sid/libcrypto++-dev
|
||||
DEPENDS:=+libpthread +libstdcpp
|
||||
endef
|
||||
|
||||
define Package/libcryptopp/description
|
||||
Crypto++ is library for creating C++ programs which use cryptographic
|
||||
algorithms. The library uses a Pipes & Filters architecture with heavy
|
||||
use of templates and abstract base classes.
|
||||
endef
|
||||
|
||||
PKG_BUILD_FILE:=cryptopp-autotools$(subst .,,$(PKG_VERSION)).zip
|
||||
define Download/autotools
|
||||
URL:=https://github.com/noloader/cryptopp-autotools/releases/download/CRYPTOPP_$(subst .,_,$(PKG_VERSION))/
|
||||
FILE:=$(PKG_BUILD_FILE)
|
||||
HASH:=91e06c53b517753f0ba02b92bb259e0ee929ebc6ad4f8b5c190d39ba407d3fbe
|
||||
endef
|
||||
$(eval $(call Download,autotools))
|
||||
|
||||
define Build/Prepare
|
||||
$(PKG_UNPACK)
|
||||
unzip -q -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_BUILD_FILE)
|
||||
cd $(PKG_BUILD_DIR); rm -f GNUmakefile GNUmakefile-cross
|
||||
$(Build/Patch)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/cryptopp
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/cryptopp/* $(1)/usr/include/cryptopp/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcryptopp.{a,so*} $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libcryptopp/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcryptopp.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libcryptopp))
|
||||
@@ -0,0 +1,24 @@
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -458,14 +458,13 @@ testvector_FILES = \
|
||||
TestVectors/lea.txt TestVectors/sosemanuk.txt \
|
||||
TestVectors/mars.txt TestVectors/speck.txt \
|
||||
TestVectors/nr.txt TestVectors/tea.txt \
|
||||
- TestVectors/ocb.txt TestVectors/threefish.txt \
|
||||
- TestVectors/panama.txt TestVectors/ttmac.txt \
|
||||
- TestVectors/poly1305aes.txt TestVectors/vmac.txt \
|
||||
- TestVectors/poly1305_tls.txt TestVectors/wake.txt \
|
||||
- TestVectors/rabbit.txt TestVectors/whrlpool.txt \
|
||||
- TestVectors/Readme.txt TestVectors/xchacha.txt \
|
||||
- TestVectors/rsa_oaep.txt TestVectors/xts.txt \
|
||||
- TestVectors/rsa_pkcs1_1_5.txt
|
||||
+ TestVectors/panama.txt TestVectors/threefish.txt \
|
||||
+ TestVectors/poly1305aes.txt TestVectors/ttmac.txt \
|
||||
+ TestVectors/poly1305_tls.txt TestVectors/vmac.txt \
|
||||
+ TestVectors/rabbit.txt TestVectors/wake.txt \
|
||||
+ TestVectors/Readme.txt TestVectors/whrlpool.txt \
|
||||
+ TestVectors/rsa_oaep.txt TestVectors/xchacha.txt \
|
||||
+ TestVectors/rsa_pkcs1_1_5.txt TestVectors/xts.txt
|
||||
|
||||
# Create with 'ls TestPrograms/test_*.cxx'. These files do not get installed.
|
||||
# They exist so the feature tests can be run from the configure directory.
|
||||
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
LLUCI_TITLE:=Luci for OpenFog Pear P2P CDN
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=7
|
||||
PKG_RELEASE:=1
|
||||
LUCI_DEPENDS:=+luci-compat +fogvdn +jq +lsblk
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -0,0 +1,30 @@
|
||||
module("luci.controller.pearpcdn", package.seeall)
|
||||
fs = require "nixio.fs"
|
||||
I18N = require "luci.i18n"
|
||||
translate = I18N.translate
|
||||
json = require "luci.jsonc"
|
||||
function index()
|
||||
entry({"admin", "pcdn"}, firstchild(), _("PCDN"), 28).dependent = true
|
||||
entry({"admin", "pcdn","pear_pcdn"}, cbi("pearpcdn/fogvdn"),_("FOGVDN"),1).dependent = true
|
||||
entry({"admin", "pcdn","pear_pcdn", "get_act_status"}, call("get_act_status"),nil).leaf = true
|
||||
end
|
||||
|
||||
function get_act_status()
|
||||
data = {}
|
||||
data["status"] = "0"
|
||||
|
||||
--pid file
|
||||
pid_file="/run/pear_restart.pid"
|
||||
--if not exist, return 0
|
||||
if fs.access(pid_file) then
|
||||
--if dir /proc/pid exist, return 1
|
||||
--trim \n
|
||||
pid = fs.readfile(pid_file)
|
||||
pid = string.gsub(pid, "\n", "")
|
||||
if fs.access("/proc/"..pid) then
|
||||
data["status"] = "1"
|
||||
end
|
||||
end
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(data)
|
||||
end
|
||||
@@ -0,0 +1,203 @@
|
||||
uci = require "luci.model.uci".cursor()
|
||||
local fs = require "nixio.fs"
|
||||
local json = require "luci.jsonc"
|
||||
m = Map("fogvdn", translate("FOGVDN Node"))
|
||||
s = m:section(NamedSection, "main", "main", translate("Main"))
|
||||
|
||||
act_status = s:option(DummyValue, "act_status", translate("Status"))
|
||||
act_status.template = "pcdn/act_status"
|
||||
|
||||
enabled = s:option(Flag, "enable", translate("Enable"))
|
||||
enabled.default = 0
|
||||
|
||||
node_info_file = "/etc/pear/pear_monitor/node_info.json"
|
||||
if fs.access(node_info_file) then
|
||||
local node_info = fs.readfile(node_info_file)
|
||||
node_info = json.parse(node_info)
|
||||
for k,v in pairs(node_info) do
|
||||
|
||||
node_info_file = "/etc/pear/pear_monitor/node_info.json"
|
||||
if fs.access(node_info_file) then
|
||||
local node_info = fs.readfile(node_info_file)
|
||||
node_info = json.parse(node_info)
|
||||
for k,v in pairs(node_info) do
|
||||
if k == "node_id" then
|
||||
option = s:option(DummyValue, "_"..k,translate(k))
|
||||
option.value = v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
storage_info_file = "/etc/pear/pear_monitor/storage_info.json"
|
||||
if fs.access(storage_info_file) then
|
||||
local storage_info = fs.readfile(storage_info_file)
|
||||
storage_info = json.parse(storage_info)
|
||||
for k,v in pairs(storage_info) do
|
||||
if k == "os_drive_serial" then
|
||||
option = s:option(DummyValue, "_"..k,translate(k))
|
||||
option.value = v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
openfog_link=s:option(DummyValue, "openfog_link", translate("<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"Openfogos.com\" onclick=\"window.open('https://openfogos.com/')\" />"))
|
||||
openfog_link.description = translate("OpenFogOS Official Website")
|
||||
|
||||
s = m:section(TypedSection, "instance", translate("Settings"))
|
||||
s.anonymous = true
|
||||
s.description = translate("Fogvdn Settings")
|
||||
|
||||
username = s:option(Value, "username", translate("username"))
|
||||
username.description = translate("<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"Register\" onclick=\"window.open('https://account.openfogos.com/signup?source%3Dopenfogos.com%26')\" />")
|
||||
|
||||
region = s:option(Value, "region", translate("Region"))
|
||||
region.optional = true
|
||||
region.template="cbi/city"
|
||||
|
||||
isp = s:option(Value, "isp", translate("ISP"))
|
||||
isp.optional = true
|
||||
isp:value("电信", translate("China Telecom"))
|
||||
isp:value("移动", translate("China Mobile"))
|
||||
isp:value("联通", translate("China Unicom"))
|
||||
|
||||
per_line_up_bw = s:option(Value, "per_line_up_bw", translate("Per Line Up BW"))
|
||||
per_line_up_bw.template = "cbi/digitonlyvalue"
|
||||
per_line_up_bw.datatype = "uinteger"
|
||||
|
||||
per_line_down_bw = s:option(Value, "per_line_down_bw", translate("Per Line Down BW"))
|
||||
per_line_down_bw.template = "cbi/digitonlyvalue"
|
||||
per_line_down_bw.datatype = "uinteger"
|
||||
|
||||
limited_memory = s:option(Value, "limited_memory", translate("Limited Memory"))
|
||||
limited_memory.optional = true
|
||||
limited_memory.template = "cbi/digitonlyvalue"
|
||||
limited_memory.datatype = "range(0, 100)"
|
||||
-- 0-100%
|
||||
limited_storage = s:option(Value, "limited_storage", translate("Limited Storage"))
|
||||
limited_storage.optional = true
|
||||
limited_storage.template = "cbi/digitonlyvalue"
|
||||
limited_storage.datatype = "range(0, 100)"
|
||||
-- 0-100%
|
||||
|
||||
limited_area = s:option(Value, "limited_area", translate("Limited Area"))
|
||||
limited_area.default = "2"
|
||||
limited_area:value("-1", "不设置:若不确定运营商对流量出省的限制情况,建议选择该项")
|
||||
limited_area:value("0", "全国调度:流量将会向全国调度,出省比例较高,可能会导致运营商的限制")
|
||||
limited_area:value("1", "本省调度:流量只会向所在省份内调度,是比较安全的调度模式,但跑量可能会降低")
|
||||
limited_area:value("2", "大区调度:流量只会向所在大区内调度,出省比例较低,是安全性和跑量之间较为均衡的模式")
|
||||
-- 限制地区 -1 不设置(采用openfogos默认) 0 全国调度,1 省份调度,2 大区调度
|
||||
|
||||
nics = s:option(DynamicList,"nics",translate("netdev"))
|
||||
-- uci:foreach("multiwan","multiwan",function (instance)
|
||||
-- nics:value(instance["tag"])
|
||||
-- end
|
||||
-- )
|
||||
--list /sys/class/net, filter bridge device
|
||||
cmd="/usr/share/pcdn/check_netdev get_netdevs"
|
||||
json_dump=luci.sys.exec(cmd)
|
||||
devs=json.parse(json_dump)
|
||||
for k,v in pairs(devs) do
|
||||
nics:value(k,k.." ["..v.."]")
|
||||
end
|
||||
|
||||
storage = s:option(DynamicList, "storage", translate("Storage"))
|
||||
storage.default = "/opt/openfogos"
|
||||
storage.description = translate("Warnning: System directory is not allowed!")
|
||||
--filter start with /etc /usr /root /var /tmp /dev /proc /sys /overlay /rom and root
|
||||
mount_point = {}
|
||||
cmd="/usr/share/pcdn/check_mount_ponit mount_point"
|
||||
json_dump=luci.sys.exec(cmd)
|
||||
mount_point=json.parse(json_dump)
|
||||
for k,v in pairs(mount_point) do
|
||||
storage:value(k,k.."("..v..")")
|
||||
end
|
||||
|
||||
btn = s:option(Button, "_filter", "")
|
||||
btn.inputtitle = "应用最佳存储设置"
|
||||
btn.description = "为避免木桶效应,点击估算最佳设置"
|
||||
btn.inputstyle = "apply"
|
||||
|
||||
-- 获取表中元素的索引
|
||||
table.indexOf = function(tbl, value)
|
||||
for i, v in ipairs(tbl) do
|
||||
if v == value then return i end
|
||||
end
|
||||
return -1
|
||||
end
|
||||
|
||||
-- 拷贝表
|
||||
table.copy = function(tbl)
|
||||
local copy = {}
|
||||
for k, v in pairs(tbl) do
|
||||
copy[k] = v
|
||||
end
|
||||
return copy
|
||||
end
|
||||
|
||||
-- 解析并转换大小单位
|
||||
function parseSize(size)
|
||||
if type(size) ~= "string" then return 0 end
|
||||
|
||||
local unit = {"B", "K", "M", "G", "T"}
|
||||
|
||||
local num, u = string.match(size, "^(%d+%.?%d*)([KMGT]?)$")
|
||||
if not num then return 0 end
|
||||
|
||||
local i = table.indexOf(unit, u)
|
||||
|
||||
-- 如果没有找到单位,默认为字节
|
||||
if i == -1 then
|
||||
return tonumber(num)
|
||||
else
|
||||
return tonumber(num) * (1024 ^ i)
|
||||
end
|
||||
end
|
||||
|
||||
-- 获取最佳存储方案
|
||||
function getOptimalSolution(numsObjArray)
|
||||
if type(numsObjArray) ~= "table" or #numsObjArray == 0 then return {} end
|
||||
|
||||
-- 拷贝并按大小排序
|
||||
local nums = {}
|
||||
for _, v in ipairs(numsObjArray) do
|
||||
table.insert(nums, {name = v.name, size = v.size})
|
||||
end
|
||||
table.sort(nums, function(a, b)
|
||||
return parseSize(a.size) < parseSize(b.size)
|
||||
end)
|
||||
|
||||
local max = 0
|
||||
local optimal = {}
|
||||
|
||||
while #nums > 0 do
|
||||
local temp = parseSize(nums[1].size) * #nums
|
||||
if temp > max then
|
||||
max = temp
|
||||
optimal = table.copy(nums)
|
||||
end
|
||||
table.remove(nums, 1) -- 移除第一个元素
|
||||
end
|
||||
|
||||
-- 提取名称并排序
|
||||
local result = {}
|
||||
for _, v in ipairs(optimal) do
|
||||
table.insert(result, v.name)
|
||||
end
|
||||
table.sort(result)
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function btn.write(self, section)
|
||||
local numsObjArray = {}
|
||||
|
||||
for k,v in pairs(mount_point) do
|
||||
table.insert(numsObjArray, {name = k, size = v})
|
||||
end
|
||||
|
||||
local optimalStorage = getOptimalSolution(numsObjArray)
|
||||
|
||||
self.map:set(section, "storage", optimalStorage)
|
||||
end
|
||||
|
||||
return m
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,23 @@
|
||||
<%+cbi/valueheader%>
|
||||
<input data-update="change"<%=
|
||||
attr("id", cbid) ..
|
||||
attr("name", cbid) ..
|
||||
attr("type", self.password and "password" or "text") ..
|
||||
attr("class", self.password and "cbi-input-password" or "cbi-input-text") ..
|
||||
attr("value", self:cfgvalue(section) or self.default) ..
|
||||
ifattr(self.size, "size") ..
|
||||
ifattr(self.placeholder, "placeholder") ..
|
||||
ifattr(self.readonly, "readonly") ..
|
||||
ifattr(self.maxlength, "maxlength") ..
|
||||
ifattr(self.datatype, "data-type", self.datatype) ..
|
||||
ifattr(self.datatype, "data-optional", self.optional or self.rmempty) ..
|
||||
ifattr(self.combobox_manual, "data-manual", self.combobox_manual) ..
|
||||
ifattr(#self.keylist > 0, "data-choices", { self.keylist, self.vallist })
|
||||
%> />
|
||||
<% if self.password then %><img src="<%=resource%>/cbi/reload.gif" style="vertical-align:middle" title="<%:Reveal/hide password%>" onclick="var e = document.getElementById('<%=cbid%>'); e.type = (e.type=='password') ? 'text' : 'password';" /><% end %>
|
||||
<script>
|
||||
document.getElementById('<%=cbid%>').onkeyup = function () {
|
||||
this.value = this.value.replace(/[^0-9]/g, '');
|
||||
}
|
||||
</script>
|
||||
<%+cbi/valuefooter%>
|
||||
@@ -0,0 +1,87 @@
|
||||
<%+cbi/valueheader%>
|
||||
|
||||
<%-
|
||||
local utl = require "luci.util"
|
||||
local nwm = require "luci.model.network".init()
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local net, iface
|
||||
local networks = nwm:get_networks()
|
||||
local value = self:formvalue(section)
|
||||
|
||||
self.cast = nil
|
||||
|
||||
if not value or value == "-" then
|
||||
value = self:cfgvalue(section) or self.default
|
||||
end
|
||||
|
||||
local checked = { }
|
||||
for value in utl.imatch(value) do
|
||||
checked[value] = true
|
||||
end
|
||||
|
||||
-%>
|
||||
|
||||
<ul style="margin:0; list-style-type:none; text-align:left">
|
||||
<% for _, net in ipairs(networks) do
|
||||
if (net:name() ~= "loopback") and
|
||||
(net:name() ~= self.exclude) and
|
||||
(net:name() ~= "lan") and
|
||||
(not self.novirtual or not net:is_virtual())
|
||||
then %>
|
||||
<li style="padding:0.25em 0">
|
||||
<input class="cbi-input-<%=self.widget or "radio"%>" data-update="click change"<%=
|
||||
attr("type", self.widget or "radio") ..
|
||||
attr("id", cbid .. "." .. net:name()) ..
|
||||
attr("name", cbid) .. attr("value", net:name()) ..
|
||||
ifattr(checked[net:name()], "checked", "checked")
|
||||
%> />  
|
||||
<label<%=attr("for", cbid .. "." .. net:name())%>>
|
||||
<span class="ifacebadge"><%=net:name()%>:
|
||||
<%
|
||||
local empty = true
|
||||
for _, iface in ipairs(net:is_bridge() and net:get_interfaces() or { net:get_interface() }) do
|
||||
if not iface:is_bridge() then
|
||||
empty = false
|
||||
%>
|
||||
<img<%=attr("title", iface:get_i18n())%> style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" />
|
||||
<% end end %>
|
||||
<% if empty then %><em><%:(no interfaces attached)%></em><% end %>
|
||||
</span>
|
||||
</label>
|
||||
</li>
|
||||
<% end end %>
|
||||
|
||||
<% if not self.nocreate then %>
|
||||
<li style="padding:0.25em 0">
|
||||
<input class="cbi-input-<%=self.widget or "radio"%>" data-update="click change"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "_new") .. attr("name", cbid) .. attr("value", "-") .. ifattr(not value and self.widget ~= "checkbox", "checked", "checked")%> />  
|
||||
<%- if not self.widget or self.widget == "checkbox" or self.widget == "radio" then -%>
|
||||
<label<%=attr("for", cbid .. "_new")%>></label>
|
||||
<%- end -%>
|
||||
<div style="padding:0.5em; display:inline">
|
||||
<label<%=attr("for", cbid .. "_new")%>><em>
|
||||
<%- if self.widget == "checkbox" then -%>
|
||||
<%:create:%>
|
||||
<%- else -%>
|
||||
<%:unspecified -or- create:%>
|
||||
<%- end -%> </em></label>
|
||||
<input style="display:none" type="password" />
|
||||
<input style="width:6em" type="text"<%=attr("name", cbid .. ".newnet")%> onfocus="document.getElementById('<%=cbid%>_new').checked=true" />
|
||||
</div>
|
||||
</li>
|
||||
<% elseif self.widget ~= "checkbox" and self.unspecified then %>
|
||||
<li style="padding:0.25em 0">
|
||||
<input class="cbi-input-<%=self.widget or "radio"%>" data-update="click change"<%=
|
||||
attr("type", self.widget or "radio") ..
|
||||
attr("id", cbid .. "_uns") ..
|
||||
attr("name", cbid) ..
|
||||
attr("value", "") ..
|
||||
ifattr(not value or #value == 0, "checked", "checked")
|
||||
%> />  
|
||||
<div style="padding:0.5em; display:inline">
|
||||
<label<%=attr("for", cbid .. "_uns")%>><em><%:unspecified%></em></label>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<%+cbi/valuefooter%>
|
||||
@@ -0,0 +1,27 @@
|
||||
<%+cbi/valueheader%>
|
||||
|
||||
<span id="<%=cbid%>"><%:Please Wait%></span>
|
||||
<script>
|
||||
XHR.poll(3,'<%=luci.dispatcher.build_url("admin","pcdn","pear_pcdn","get_act_status")%>',null,
|
||||
(x,data)=>{
|
||||
var status = data.status;
|
||||
if (status == 0){
|
||||
document.getElementById('<%=cbid%>').innerHTML = "<%:Not Running%>";
|
||||
//set color to red
|
||||
document.getElementById('<%=cbid%>').style.color = "red";
|
||||
}
|
||||
else if (status == 1){
|
||||
document.getElementById('<%=cbid%>').innerHTML = "<%:Running%>";
|
||||
//set color to green
|
||||
document.getElementById('<%=cbid%>').style.color = "green";
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById('<%=cbid%>').innerHTML = "<%:Please Wait%>";
|
||||
//set color to yellow
|
||||
document.getElementById('<%=cbid%>').style.color = "yellow";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<%+cbi/valuefooter%>
|
||||
@@ -0,0 +1,77 @@
|
||||
msgid "FOGVDN"
|
||||
msgstr "OpenFog"
|
||||
|
||||
msgid "FOGVDN Node"
|
||||
msgstr "OpenFog 节点"
|
||||
|
||||
msgid "OpenFogOS"
|
||||
msgstr "OpenFogOS"
|
||||
|
||||
msgid "Main"
|
||||
msgstr "主设置"
|
||||
|
||||
msgid "Fogvdn Settings"
|
||||
msgstr "OpenFog 设置"
|
||||
|
||||
msgid "username"
|
||||
msgstr "用户名"
|
||||
|
||||
msgid "Region"
|
||||
msgstr "地区"
|
||||
|
||||
msgid "ISP"
|
||||
msgstr "运营商"
|
||||
|
||||
msgid "Per Line Up BW"
|
||||
msgstr "每条线路上行带宽(Mbps)"
|
||||
|
||||
msgid "Per Line Down BW"
|
||||
msgstr "每条线路下行带宽(Mbps)"
|
||||
|
||||
msgid "Limited Memory"
|
||||
msgstr "内存限制(%)"
|
||||
|
||||
msgid "Limited Storage"
|
||||
msgstr "存储限制(%)"
|
||||
|
||||
msgid "Limited Area"
|
||||
msgstr "地区限制"
|
||||
|
||||
msgid "netdev"
|
||||
msgstr "网络设备"
|
||||
|
||||
msgid "Storage"
|
||||
msgstr "存储"
|
||||
|
||||
msgid "Warnning: System directory is not allowed! "
|
||||
msgstr "警告: 系统目录不允许使用! "
|
||||
|
||||
msgid "Please Wait"
|
||||
msgstr "请稍等"
|
||||
|
||||
msgid "Running"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "Not Running"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"Openfogos.com\" onclick=\"window.open('https://openfogos.com/')\" />"
|
||||
msgstr "<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"Openfogos官网\" onclick=\"window.open('https://openfogos.com/')\" />"
|
||||
|
||||
msgid "<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"Register\" onclick=\"window.open('https://account.openfogos.com/signup?source%3Dopenfogos.com%26')\" />"
|
||||
msgstr "<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"前往注册\" onclick=\"window.open('https://account.openfogos.com/signup?source%3Dopenfogos.com%26')\" />"
|
||||
|
||||
msgid "China Telecom"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "China Unicom"
|
||||
msgstr "中国联通"
|
||||
|
||||
msgid "China Mobile"
|
||||
msgstr "中国移动"
|
||||
|
||||
msgid "OpenFogOS Official Website"
|
||||
msgstr "OpenFogOS 官网"
|
||||
|
||||
msgid "Warnning: System directory is not allowed!"
|
||||
msgstr "警告: 请勿使用系统目录! "
|
||||
@@ -0,0 +1,77 @@
|
||||
msgid "FOGVDN"
|
||||
msgstr "OpenFog"
|
||||
|
||||
msgid "FOGVDN Node"
|
||||
msgstr "OpenFog 节点"
|
||||
|
||||
msgid "OpenFogOS"
|
||||
msgstr "OpenFogOS"
|
||||
|
||||
msgid "Main"
|
||||
msgstr "主设置"
|
||||
|
||||
msgid "Fogvdn Settings"
|
||||
msgstr "OpenFog 设置"
|
||||
|
||||
msgid "username"
|
||||
msgstr "用户名"
|
||||
|
||||
msgid "Region"
|
||||
msgstr "地区"
|
||||
|
||||
msgid "ISP"
|
||||
msgstr "运营商"
|
||||
|
||||
msgid "Per Line Up BW"
|
||||
msgstr "每条线路上行带宽(Mbps)"
|
||||
|
||||
msgid "Per Line Down BW"
|
||||
msgstr "每条线路下行带宽(Mbps)"
|
||||
|
||||
msgid "Limited Memory"
|
||||
msgstr "内存限制(%)"
|
||||
|
||||
msgid "Limited Storage"
|
||||
msgstr "存储限制(%)"
|
||||
|
||||
msgid "Limited Area"
|
||||
msgstr "地区限制"
|
||||
|
||||
msgid "netdev"
|
||||
msgstr "网络设备"
|
||||
|
||||
msgid "Storage"
|
||||
msgstr "存储"
|
||||
|
||||
msgid "Warnning: System directory is not allowed! "
|
||||
msgstr "警告: 系统目录不允许使用! "
|
||||
|
||||
msgid "Please Wait"
|
||||
msgstr "请稍等"
|
||||
|
||||
msgid "Running"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "Not Running"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"Openfogos.com\" onclick=\"window.open('https://openfogos.com/')\" />"
|
||||
msgstr "<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"Openfogos官网\" onclick=\"window.open('https://openfogos.com/')\" />"
|
||||
|
||||
msgid "<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"Register\" onclick=\"window.open('https://account.openfogos.com/signup?source%3Dopenfogos.com%26')\" />"
|
||||
msgstr "<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"前往注册\" onclick=\"window.open('https://account.openfogos.com/signup?source%3Dopenfogos.com%26')\" />"
|
||||
|
||||
msgid "China Telecom"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "China Unicom"
|
||||
msgstr "中国联通"
|
||||
|
||||
msgid "China Mobile"
|
||||
msgstr "中国移动"
|
||||
|
||||
msgid "OpenFogOS Official Website"
|
||||
msgstr "OpenFogOS 官网"
|
||||
|
||||
msgid "Warnning: System directory is not allowed!"
|
||||
msgstr "警告: 请勿使用系统目录! "
|
||||
@@ -0,0 +1,5 @@
|
||||
config main 'main'
|
||||
option enable '0'
|
||||
|
||||
config instance
|
||||
list storage '/opt/openfogos'
|
||||
Executable
+136
@@ -0,0 +1,136 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
USE_PROCD=1
|
||||
START=99
|
||||
STOP=1
|
||||
|
||||
CONFIG_PATH=/etc/pear/pear_monitor
|
||||
target_config_path=${CONFIG_PATH}/config.json
|
||||
|
||||
|
||||
function run_instance()
|
||||
{
|
||||
if [ -f $target_config_path ];then
|
||||
user_marked=$(cat $target_config_path |jq .user_marked)
|
||||
if [ -n "$user_marked" ] && [ "$user_marked" != "null" ];then
|
||||
json="$(cat $target_config_path)"
|
||||
else
|
||||
json="{}"
|
||||
fi
|
||||
else
|
||||
json="{}"
|
||||
fi
|
||||
|
||||
config_get username $1 username
|
||||
config_get isp $1 isp
|
||||
config_get region $1 region
|
||||
config_get per_line_up_bw $1 per_line_up_bw null
|
||||
config_get per_line_down_bw $1 per_line_down_bw null
|
||||
config_get limited_memory $1 limited_memory null
|
||||
config_get limited_storage $1 limited_storage null
|
||||
config_get limited_area $1 limited_area null
|
||||
country="中国"
|
||||
province=$(echo $region | awk -F'-' '{print $1}')
|
||||
city=$(echo $region | awk -F'-' '{print $2}')
|
||||
mtime=$(date +%s)
|
||||
json=$(echo "$json" | jq --arg username "$username" \
|
||||
--arg isp "$isp" \
|
||||
--arg country "$country" \
|
||||
--arg province "$province" \
|
||||
--arg city "$city" \
|
||||
--argjson per_line_up_bw "$per_line_up_bw" \
|
||||
--argjson per_line_down_bw "$per_line_down_bw" \
|
||||
--argjson limited_memory "$limited_memory" \
|
||||
--argjson limited_storage "$limited_storage" \
|
||||
--argjson limited_area "$limited_area" \
|
||||
--argjson mtime "$mtime" \
|
||||
'.user_marked.username = $username |
|
||||
.user_marked.isp = $isp |
|
||||
.user_marked.country = $country |
|
||||
.user_marked.province = $province |
|
||||
.user_marked.city = $city |
|
||||
.user_marked.per_line_up_bw = $per_line_up_bw |
|
||||
.user_marked.per_line_down_bw = $per_line_down_bw |
|
||||
.user_marked.limited_memory = $limited_memory |
|
||||
.user_marked.limited_storage = $limited_storage |
|
||||
.user_marked.limited_area = $limited_area |
|
||||
.user_marked.mtime = $mtime |
|
||||
del(.user_marked[] | select(. == null))'
|
||||
)
|
||||
json=$(echo "$json" | jq '.storage = []')
|
||||
json=$(echo "$json" | jq '.nics = []')
|
||||
config_list_foreach $1 storage storage_hd
|
||||
config_list_foreach $1 nics nics_hd
|
||||
# Save modified JSON back to target_config_path
|
||||
echo "$json" > $target_config_path
|
||||
instance=$1
|
||||
/etc/init.d/openfog.sh stop
|
||||
procd_open_instance ${instance}_check_alive
|
||||
procd_set_param command "/usr/share/pcdn/check_alive.sh"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
function storage_hd()
|
||||
{
|
||||
json=$(echo "$json" | jq --arg item "$1" '.storage += [$item]')
|
||||
[ ! -d "$1" ] && mkdir -p $1
|
||||
}
|
||||
|
||||
function nics_hd()
|
||||
{
|
||||
# config=$1
|
||||
# # check if vw$config exists
|
||||
# config_1=$(uci get network.vw$config)
|
||||
# # check if $config exists
|
||||
# config_2=$(uci get network.$config)
|
||||
# if [ -z "$config_1" ] && [ -z "$config_2" ];then
|
||||
# res=$(echo $json | jq '.nics | index(["'${config}'"])')
|
||||
# [ "$res" == "null" ] && json=$(echo "$json" | jq --arg item "$config" '.nics += [$item]')
|
||||
# return
|
||||
# fi
|
||||
# if [ "$config_1" != "interface" ];then
|
||||
# config=$config
|
||||
# else
|
||||
# config=vw$config
|
||||
# fi
|
||||
# l2_device=$(uci get network.$config.ifname)
|
||||
# proto=$(uci get network.$config.proto)
|
||||
# if [ "$proto" == "pppoe" ];then
|
||||
# nic_name=pppoe-$config
|
||||
# else
|
||||
# nic_name=$l2_device
|
||||
# fi
|
||||
nic_name=$1
|
||||
res=$(echo $json | jq '.nics | index(["'${nic_name}'"])')
|
||||
[ "$res" == "null" ] && json=$(echo "$json" | jq --arg item "$nic_name" '.nics += [$item]')
|
||||
}
|
||||
|
||||
function stop_instance()
|
||||
{
|
||||
instance=$1
|
||||
service_stop ${instance}_check_alive
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
config_load fogvdn
|
||||
config_get enable main enable
|
||||
[ "$enable" == "1" ] && config_foreach run_instance instance || stop
|
||||
}
|
||||
|
||||
stop_service()
|
||||
{
|
||||
config_foreach stop_instance instance
|
||||
/etc/init.d/openfog.sh stop
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "fogvdn"
|
||||
}
|
||||
|
||||
reload_servie()
|
||||
{
|
||||
stop
|
||||
start
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
mkdir /run
|
||||
/etc/pear/pear_update/post_command.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
rm -f /tmp/luci-indexcache
|
||||
#uci track
|
||||
cfg_id=$(uci add ucitrack fogvdn)
|
||||
uci set ucitrack.$cfg_id.init="fogvdn"
|
||||
uci commit ucitrack
|
||||
exit 0
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
pid_file="/run/pear_restart.pid"
|
||||
while true; do
|
||||
if [ -f $pid_file ]; then
|
||||
pid=$(cat $pid_file)
|
||||
if [ -n "$pid" ]; then
|
||||
if [ ! -d /proc/$pid ]; then
|
||||
logger -t "fogvdn" "fogvdn is not running, restart it"
|
||||
/etc/init.d/openfog.sh start
|
||||
fi
|
||||
fi
|
||||
else
|
||||
logger -t "fogvdn" "pid file not found, restart it"
|
||||
/etc/init.d/openfog.sh start
|
||||
fi
|
||||
sleep 10
|
||||
done
|
||||
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
# 脚本功能:json方式返回 大于某个容量的磁盘挂载点及其大小
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
get_disk_info() {
|
||||
disk_info=$(lsblk |grep disk)
|
||||
IFS=$'\n'
|
||||
for disk in `echo -e "$disk_info"`; do
|
||||
disk_name=$(echo $disk |awk '{print $1}')
|
||||
disk_capacity=$(echo $disk |awk '{print $4}')
|
||||
json_add_string "$disk_name" "$disk_capacity"
|
||||
done
|
||||
}
|
||||
|
||||
get_part_info() {
|
||||
part_info=$(lsblk |grep part)
|
||||
IFS=$'\n'
|
||||
for part in `echo -e "$part_info"`; do
|
||||
part_name=$(echo $part |awk '{print $1}')
|
||||
part_capacity=$(echo $part |awk '{print $4}')
|
||||
json_add_string "$part_name" "$part_capacity"
|
||||
done
|
||||
}
|
||||
|
||||
get_mount_point_info() {
|
||||
mount_point_info=$(lsblk -o SIZE,MOUNTPOINT |grep -v MOUNTPOINT)
|
||||
#filter /rom /overlay [SWAP]
|
||||
mount_point_info=$(echo -e "$mount_point_info" |grep -v -E "/rom|/overlay|\[SWAP\]")
|
||||
#filter capacity that unit is M or K
|
||||
mount_point_info=$(echo -e "$mount_point_info" |grep -v -E "M|K")
|
||||
|
||||
IFS=$'\n'
|
||||
#filter start with /mnt
|
||||
for mount_point in `echo -e "$mount_point_info"`; do
|
||||
mount_point_name=$(echo $mount_point |awk '{print $2}')
|
||||
mount_point_capacity=$(echo $mount_point |awk '{print $1}')
|
||||
if [ -z "$mount_point_capacity" ] || [ -z "$mount_point_name" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
json_add_string "$mount_point_name/openfogos" "$mount_point_capacity"
|
||||
done
|
||||
}
|
||||
|
||||
json_init
|
||||
case $1 in
|
||||
disk)
|
||||
get_disk_info
|
||||
;;
|
||||
part)
|
||||
get_part_info
|
||||
;;
|
||||
mount_point)
|
||||
get_mount_point_info
|
||||
;;
|
||||
esac
|
||||
json_dump
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
# 脚本功能:json方式返回 网络物理设备
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
function get_netdevs()
|
||||
{
|
||||
# 过滤条件:无ip, bridge, wlan, lo 设备
|
||||
for netdev in `ls /sys/class/net`;do
|
||||
if [ -d "/sys/class/net/$netdev" ] && [ -n "$netdev" ];then
|
||||
filter=0
|
||||
unset DEVTYPE
|
||||
. /sys/class/net/$netdev/uevent
|
||||
cdir4=`ip addr show dev $netdev|grep "inet " | grep -E -o '([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}' | sed ':a;N;$!ba;s/\n/;/g'`
|
||||
|
||||
[ -z "$cdir4" ] && filter=1
|
||||
[ "$DEVTYPE" == "bridge" ] && filter=1
|
||||
[ "$DEVTYPE" == "wlan" ] && filter=1
|
||||
[ "$netdev" == "lo" ] && filter=1
|
||||
if [ "$filter" -eq 0 ];then
|
||||
macaddr=`cat /sys/class/net/$netdev/address`
|
||||
#format $netdev (ip:cdir4 mac:address)
|
||||
netdev_info="IP: $cdir4;"
|
||||
[ -n "$macaddr" ] && netdev_info="$netdev_info MAC:$macaddr"
|
||||
[ -n "$DEVTYPE" ] && netdev_info="$netdev_info TYPE:$DEVTYPE"
|
||||
json_add_string $netdev "$netdev_info"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
json_init
|
||||
case $1 in
|
||||
get_netdevs)
|
||||
get_netdevs
|
||||
;;
|
||||
esac
|
||||
json_dump
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"luci-app-fogvdn": {
|
||||
"description": "Grant UCI access for luci-app-fogvdn",
|
||||
"read": {
|
||||
"file": {
|
||||
"/etc/pear/pear_monitor/*": [ "read" ]
|
||||
},
|
||||
"uci": ["fogvdn"]
|
||||
},
|
||||
"write": {
|
||||
"file": {
|
||||
"/etc/pear/pear_monitor/*": [ "write" ]
|
||||
},
|
||||
"uci": ["fogvdn"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
#
|
||||
# Copyright (C) 2014-2015 KyleRicardo
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mentohust
|
||||
PKG_VERSION:=0.3.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/KyleRicardo/MentoHUST-OpenWrt-ipk.git
|
||||
PKG_SOURCE_VERSION:=557cffca8032b6d8ac948be8a79255dc64a1915d
|
||||
PKG_MIRROR_HASH:=1db6cd4402ea3e1fa2adc3adcc1490fffdac224ae83024d883429b8b67fb9c74
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/mentohust
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=A Ruijie Client Daemon
|
||||
URL:=https://github.com/KyleRicardo/MentoHUST-OpenWrt-ipk
|
||||
DEPENDS:=+libpcap
|
||||
endef
|
||||
|
||||
define Package/mentohust/description
|
||||
A Ruijie Client Daemon, most usually used in China collages.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/src \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
CPPFLAGS="$(TARGET_CPPFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS) -ldl"
|
||||
endef
|
||||
|
||||
define Package/mentohust/conffiles
|
||||
/etc/mentohust.conf
|
||||
endef
|
||||
|
||||
define Package/mentohust/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mentohust $(1)/usr/sbin/mentohust
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/src/mentohust.conf $(1)/etc/mentohust.conf
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,mentohust))
|
||||
@@ -0,0 +1,63 @@
|
||||
# All rights reserved.
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=mt7603e
|
||||
P4REV:=2
|
||||
PKG_VERSION:=4.1.2.0
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/mt7603_wifi
|
||||
PKG_KCONFIG:= \
|
||||
RALINK_MT7620 RALINK_RT7621 RLT_WIFI MT_WIFI_PATH FIRST_IF_MT7603E\
|
||||
FIRST_IF_EEPROM_PROM FIRST_IF_EEPROM_EFUSE FIRST_IF_EEPROM_FLASH RT_FIRST_CARD_EEPROM WIFI_BASIC_FUNC\
|
||||
MULTI_INF_SUPPORT WSC_INCLUDED WSC_V2_SUPPORT DOT11N_DRAFT3 DOT11_VHT_AC DOT11W_PMF_SUPPORT\
|
||||
TXBF_SUPPORT WMM_ACM_SUPPORT QOS_DLS_SUPPORT WAPI_SUPPORT CARRIER_DETECTION_SUPPORT\
|
||||
IGMP_SNOOP_SUPPORT BLOCK_NET_IF RATE_ADAPTION NEW_RATE_ADAPT_SUPPORT AGS_SUPPORT\
|
||||
IDS_SUPPORT WIFI_WORK_QUEUE WIFI_SKB_RECYCLE RTMP_FLASH_SUPPORT LED_CONTROL_SUPPORT\
|
||||
SINGLE_SKU_V2 HW_ANTENNA_DIVERSITY ATE_SUPPORT RT2860V2_AP_V24_DATA_STRUCTURE RT2860V2_AP_32B_DESC\
|
||||
MEMORY_OPTIMIZATION HOTSPOT HOTSPOT_R2 ACL_V2_SUPPORT UAPSD PA_LNA RLT_BBP RLT_RF RTMP_BBP RTMP_RF RLT_MAC RLT_BBP RLT_RF RTMP_MAC RTMP_BBP RTMP_RF \
|
||||
RTMP_PCI_SUPPORT RTMP_USB_SUPPORT RTMP_RBUS_SUPPORT RLT_AP_SUPPORT RALINK_MT7603E MT_MAC AP_SUPPORT\
|
||||
WDS_SUPPORT MBSS_SUPPORT NEW_MBSSID_MODE ENHANCE_NEW_MBSSID_MODE APCLI_SUPPORT MULTI_APCLI_SUPPORT \
|
||||
AIRPLAY_SUPPORT MAC_REPEATER_SUPPORT DFS_SUPPORT NINTENDO_AP DOT11K_RRM_SUPPORT RT2860V2_SNMP\
|
||||
LLTD_SUPPORT NINTENDO_AP COC_SUPPORT MULTI_CORE_SUPPORT MCAST_RATE_SPECIFIC PREVENT_ARP_SPOOFING_SUPPORT \
|
||||
EXT_BUILD_CHANNEL_LIST AUTO_CH_SELECT_ENHANCE MEMORY_OPTIMIZATION RTMP_TEMPERATURE_CALIBRATION\
|
||||
SNIFFER_SUPPORT CFG80211_SUPPORT SNIFFER_MIB_CMD ALL_NET_EVENT
|
||||
|
||||
|
||||
PKG_CONFIG_DEPENDS:=$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),CONFIG_$(c)))
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TAR_CMD=$(HOST_TAR) -C $(1)/ $(TAR_OPTIONS)
|
||||
|
||||
define KernelPackage/mt7603e
|
||||
CATEGORY:=Kernel modules
|
||||
TITLE:=MTK wifi AP driver
|
||||
DEPENDS:=@TARGET_ramips
|
||||
CONFLICTS:=kmod-mt7603
|
||||
FILES:=$(PKG_BUILD_DIR)/mt7603_wifi_ap/mt7603e.ko
|
||||
SUBMENU:=Wireless Drivers
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define KernelPackage/mt7603e/config
|
||||
source "$(SOURCE)/config.in"
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(LINUX_DIR)" V=1 \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
M="$(PKG_BUILD_DIR)/mt7603_wifi_ap" \
|
||||
$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_MT7603E_$c),CONFIG_$(c)=$(CONFIG_MT7603E_$(c)))) \
|
||||
modules
|
||||
endef
|
||||
|
||||
define KernelPackage/mt7603e/install
|
||||
$(INSTALL_DIR) $(1)/etc/wireless/mt7603/
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,mt7603e))
|
||||
@@ -0,0 +1,523 @@
|
||||
if PACKAGE_kmod-mt7603e
|
||||
|
||||
#if FIRST_IF_MT7603E || SECOND_IF_MT7603E
|
||||
config MT7603E_FIRST_IF_MT7603E
|
||||
bool
|
||||
default y
|
||||
depends on PACKAGE_kmod-mt7603e
|
||||
|
||||
config MT7603E_RLT_WIFI
|
||||
tristate "MT WIFI Driver"
|
||||
default y
|
||||
|
||||
config MT7603E_MT_WIFI_PATH
|
||||
string
|
||||
depends on MT7603E_RLT_WIFI
|
||||
default "rlt_wifi"
|
||||
|
||||
if MT7603E_RLT_WIFI
|
||||
menu "WiFi Generic Feature Options"
|
||||
|
||||
if MT7603E_FIRST_IF_MT7603E
|
||||
choice
|
||||
prompt "EEPROM Type of 1st Card"
|
||||
default MT7603E_FIRST_IF_EEPROM_FLASH
|
||||
#depends on ! FIRST_IF_NONE
|
||||
|
||||
config MT7603E_FIRST_IF_EEPROM_FLASH
|
||||
bool "FLASH"
|
||||
|
||||
config MT7603E_FIRST_IF_EEPROM_PROM
|
||||
bool "EEPROM"
|
||||
|
||||
config MT7603E_FIRST_IF_EEPROM_EFUSE
|
||||
bool "EFUSE"
|
||||
endchoice
|
||||
|
||||
config MT7603E_RT_FIRST_CARD_EEPROM
|
||||
string
|
||||
#depends on ! FIRST_IF_NONE
|
||||
default "prom" if MT7603E_FIRST_IF_EEPROM_PROM
|
||||
default "efuse" if MT7603E_FIRST_IF_EEPROM_EFUSE
|
||||
default "flash" if MT7603E_FIRST_IF_EEPROM_FLASH
|
||||
endif
|
||||
|
||||
config MT7603E_MULTI_INF_SUPPORT
|
||||
bool
|
||||
#default y if !FIRST_IF_NONE && !SECOND_IF_NONE
|
||||
default y
|
||||
|
||||
#config MT7603E_WIFI_BASIC_FUNC
|
||||
# bool "Basic Functions"
|
||||
# select WIRELESS_EXT
|
||||
# select WEXT_SPY
|
||||
# select WEXT_PRIV
|
||||
|
||||
config MT7603E_WSC_INCLUDED
|
||||
bool "WSC (WiFi Simple Config)"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_WSC_V2_SUPPORT
|
||||
bool "WSC V2(WiFi Simple Config Version 2.0)"
|
||||
depends on MT7603E_MMT_WSC_INCLUDED
|
||||
default y
|
||||
config MT7603E_WSC_NFC_SUPPORT
|
||||
bool "WSC out-of-band(NFC)"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
config MT7603E_DOT11N_DRAFT3
|
||||
bool "802.11n Draft3"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
#config MT7603E_DOT11_VHT_AC
|
||||
# bool "802.11 ac"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_DOT11W_PMF_SUPPORT
|
||||
bool "PMF Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_TXBF_SUPPORT
|
||||
bool "Tx Bean Forming Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT7603E_WMM_ACM_SUPPORT
|
||||
# bool "WMM ACM"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_LLTD_SUPPORT
|
||||
bool "LLTD (Link Layer Topology Discovery Protocol)"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_QOS_DLS_SUPPORT
|
||||
bool "802.11e DLS ((Direct-Link Setup) Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_WAPI_SUPPORT
|
||||
bool "WAPI Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_CARRIER_DETECTION_SUPPORT
|
||||
bool "Carrier Detect"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_IGMP_SNOOP_SUPPORT
|
||||
bool "IGMP Snooping"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_BLOCK_NET_IF
|
||||
bool "NETIF Block"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
help
|
||||
Support Net interface block while Tx-Sw queue full
|
||||
|
||||
#config MT7603E_MT_TXBF_SUPPORT
|
||||
# bool "Tx Bean Forming Support (Only 3883)"
|
||||
# depends on WIFI_DRIVER
|
||||
# depends on RALINK_RT2883 || RALINK_RT3883
|
||||
# default n
|
||||
|
||||
#config MT7603E_MT_VIDEO_TURBINE_SUPPORT
|
||||
# bool "Video Turbine support"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
#config MT7603E_RATE_ADAPTION
|
||||
# tristate "Ralink Flow Classifier"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_NEW_RATE_ADAPT_SUPPORT
|
||||
bool "New Rate Adaptation support"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_MT_NEW_RATE_ADAPT_SUPPORT
|
||||
bool "Intelligent Rate Adaption"
|
||||
# depends on WIFI_DRIVER && MT_RATE_ADAPTION
|
||||
default y
|
||||
|
||||
config MT7603E_AGS_SUPPORT
|
||||
bool "Adaptive Group Switching"
|
||||
depends on MT7603E_MT_RATE_ADAPTION
|
||||
default n
|
||||
|
||||
config MT7603E_IDS_SUPPORT
|
||||
bool "IDS (Intrusion Detection System) Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_WIFI_WORK_QUEUE
|
||||
bool "Work Queue"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_WIFI_SKB_RECYCLE
|
||||
bool "SKB Recycle(Linux)"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_RTMP_FLASH_SUPPORT
|
||||
bool "Flash Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_LED_CONTROL_SUPPORT
|
||||
bool "LED Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_SINGLE_SKU
|
||||
bool "Single SKU"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_SINGLE_SKU_V2
|
||||
bool "Single SKU V2"
|
||||
depends on MT7603E_SINGLE_SKU && RALINK_RT6352
|
||||
default n
|
||||
|
||||
config MT7603E_HW_ANTENNA_DIVERSITY
|
||||
bool "Antenna Diversity Support"
|
||||
depends on MT7603E_RLT_AP_SUPPORT || MT7603E_RLT_STA_SUPPORT
|
||||
depends on RALINK_RT5350
|
||||
default n
|
||||
|
||||
config MT7603E_ATE_SUPPORT
|
||||
bool "ATE/QA Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_RT2860V2_AP_V24_DATA_STRUCTURE
|
||||
bool
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_RT2860V2_AP_32B_DESC
|
||||
bool "32 Byte Descriptor Support"
|
||||
# depends on WIFI_DRIVER
|
||||
depends on RALINK_RT6352 || RALINK_MT7620
|
||||
default n
|
||||
|
||||
config MT7603E_MEMORY_OPTIMIZATION
|
||||
bool "Memory Optimization"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT7603E_RTMP_INTERNAL_TX_ALC
|
||||
# bool "TSSI Compensation"
|
||||
# depends on WIFI_DRIVER
|
||||
# depends on RALINK_RT3350 || RALINK_RT3352 || RALINK_RT5350 || RALINK_RT6352
|
||||
# default n
|
||||
|
||||
#config MT7603E_RTMP_TEMPERATURE_CALIBRATION
|
||||
# bool "Temperature Calibration"
|
||||
# depends on WIFI_DRIVER
|
||||
# depends on RALINK_RT6352
|
||||
# default n
|
||||
|
||||
config MT7603E_HOTSPOT
|
||||
bool "Passpoint-R1"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_MT_HOTSPOT_R2
|
||||
bool "Passpoint Release-2 Support"
|
||||
depends on HOTSPOT
|
||||
select MT7603E_MT_DOT11W_PMF_SUPPORT
|
||||
default n
|
||||
|
||||
config MT7603E_MT_RTMP_TEMPERATURE_TX_ALC
|
||||
bool "Temperature Tx Power Compensation"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_UAPSD
|
||||
bool "UAPSD support"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
|
||||
#
|
||||
# Section for chip architectures
|
||||
#
|
||||
# "RLT MAC Support"
|
||||
config MT7603E_RLT_MAC
|
||||
bool
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_RLT_BBP
|
||||
bool
|
||||
|
||||
config MT7603E_RLT_RF
|
||||
bool
|
||||
|
||||
# "RTMP MAC Support"
|
||||
config MT7603E_RTMP_MAC
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_RTMP_BBP
|
||||
bool
|
||||
|
||||
config MT7603E_RTMP_RF
|
||||
bool
|
||||
|
||||
#config MT7603E_MT_EPA_ELNA
|
||||
# bool "ePAeLNA"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
#choice
|
||||
# prompt "PA,LNA Type"
|
||||
# depends on MT7603E_MT_WIFI
|
||||
#
|
||||
# config MT7603E_MT_IPA_ILNA
|
||||
# bool "iPAiLNA"
|
||||
#
|
||||
# config MT7603E_MT_IPA_ELNA
|
||||
# bool "iPAeLNA"
|
||||
#
|
||||
# config MT7603E_MT_EPA_ILNA
|
||||
# bool "ePAiLNA"
|
||||
#
|
||||
# config MT7603E_MT_EPA_ELNA
|
||||
# bool "ePAeLNA"
|
||||
#endchoice
|
||||
#
|
||||
#config MT7603E_MT_PA_LNA
|
||||
# string
|
||||
# depends on MT7603E_MT_WIFI
|
||||
# default "iPAiLNA" if MT7603E_MT_IPA_ILNA
|
||||
# default "iPAeLNA" if MT7603E_MT_IPA_ELNA
|
||||
# default "ePAiLNA" if MT7603E_MT_EPA_ILNA
|
||||
# default "ePAeLNA" if MT7603E_MT_EPA_ELNA
|
||||
#
|
||||
#
|
||||
# Section for chip architectures
|
||||
#
|
||||
# "RLT MAC Support"
|
||||
#config MT7603E_RLT_MAC
|
||||
# bool
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
#config MT7603E_RLT_BBP
|
||||
# bool
|
||||
|
||||
#config MT7603E_RLT_RF
|
||||
# bool
|
||||
|
||||
# "RTMP MAC Support"
|
||||
#config MT7603E_RTMP_MAC
|
||||
# bool
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
#config MT7603E_RTMP_BBP
|
||||
# bool
|
||||
|
||||
#config MT7603E_RTMP_RF
|
||||
# bool
|
||||
|
||||
#
|
||||
# Section for interfaces
|
||||
#
|
||||
config MT7603E_RTMP_PCI_SUPPORT
|
||||
bool
|
||||
|
||||
config MT7603E_RTMP_USB_SUPPORT
|
||||
bool
|
||||
|
||||
config MT7603E_RTMP_RBUS_SUPPORT
|
||||
bool
|
||||
|
||||
endmenu
|
||||
|
||||
menu "WiFi Operation Modes"
|
||||
choice
|
||||
prompt "Main Mode"
|
||||
default MT7603E_MT_WIFI_MODE_AP
|
||||
|
||||
config MT7603E_MT_WIFI_MODE_AP
|
||||
bool "AP"
|
||||
|
||||
config MT7603E_MT_WIFI_MODE_STA
|
||||
bool "STA"
|
||||
|
||||
config MT7603E_MT_WIFI_MODE_BOTH
|
||||
bool "APSTA"
|
||||
endchoice
|
||||
|
||||
if MT7603E_MT_WIFI_MODE_AP || MT7603E_MT_WIFI_MODE_BOTH
|
||||
|
||||
config MT7603E_RLT_AP_SUPPORT
|
||||
tristate "UnifyMAC 802.11n AP support"
|
||||
default y
|
||||
# depends on NET_RADIO
|
||||
select WIRELESS_EXT
|
||||
select WEXT_SPY
|
||||
select WEXT_PRIV
|
||||
|
||||
config MT7603E_WDS_SUPPORT
|
||||
bool "WDS"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default n
|
||||
|
||||
config MT7603E_MBSS_SUPPORT
|
||||
bool "MBSSID"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default y
|
||||
|
||||
config MT7603E_NEW_MBSSID_MODE
|
||||
bool "New MBSSID MODE"
|
||||
depends on MT7603E_RLT_AP_SUPPORT && MT7603E_MBSS_SUPPORT
|
||||
# depends on RALINK_RT3883 || RALINK_RT3352 || RALINK_RT5350 || RALINK_RT6352 || RALINK_MT7620 || RALINK_MT7621
|
||||
default n
|
||||
|
||||
config MT7603E_ENHANCE_NEW_MBSSID_MODE
|
||||
bool "Enhanced MBSSID mode"
|
||||
depends on MT7603E_NEW_MBSSID_MODE
|
||||
default n
|
||||
config MT7603E_CFG80211_SUPPORT
|
||||
bool "CFG80211"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default n
|
||||
|
||||
config MT7603E_SNIFFER_MIB_CMD
|
||||
bool "SNIFFER_MIB_CMD"
|
||||
depends on MT7603E_SNIFFER_SUPPORT
|
||||
default n
|
||||
|
||||
config MT7603E_ALL_NET_EVENT
|
||||
bool "ALL_NET_EVENT"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default n
|
||||
|
||||
config MT7603E_ACL_V2_SUPPORT
|
||||
bool "ACL_V2"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
|
||||
config MT7603E_APCLI_SUPPORT
|
||||
bool "AP-Client Support"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default y
|
||||
config MT7603E_MULTI_APCLI_SUPPORT
|
||||
bool "MULTI AP-Client Support"
|
||||
depends on MT7603E_APCLI_SUPPORT
|
||||
default y
|
||||
config MT7603E_MAC_REPEATER_SUPPORT
|
||||
bool "MAC Repeater Support"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
depends on MT7603E_APCLI_SUPPORT
|
||||
depends on RALINK_RT6352 || RALINK_MT7620 || MT7603E_RALINK_MT7603E
|
||||
default y
|
||||
config MT7603E_AIRPLAY_SUPPORT
|
||||
bool "AirPlay Support"
|
||||
depends on MT7603E_APCLI_SUPPORT
|
||||
|
||||
#config MT7603E_MT_MESH_SUPPORT
|
||||
# bool "MESH Support"
|
||||
# depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
config MT7603E_DFS_SUPPORT
|
||||
bool "DFS"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
select RALINK_TIMER_DFS
|
||||
|
||||
#config MT7603E_DOT11R_FT_SUPPORT
|
||||
# bool "802.11r Fast BSS Transition"
|
||||
# depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
#config MT7603E_DOT11K_RRM_SUPPORT
|
||||
# bool "802.11k Radio Resource Management"
|
||||
# depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
config MT7603E_LLTD_SUPPORT
|
||||
bool "LLTD (Link Layer Topology Discovery Protocol)"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default y
|
||||
|
||||
config MT7603E_NINTENDO_AP
|
||||
bool "Nintendo AP"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
config MT7603E_COC_SUPPORT
|
||||
bool "CoC Support"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default n
|
||||
|
||||
#config MT7603E_ RT2860V2_SNMP
|
||||
# bool "Net-SNMP Support"
|
||||
# depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
config MT7603E_MCAST_RATE_SPECIFIC
|
||||
bool "User specific tx rate of mcast pkt"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
config MT7603E_PREVENT_ARP_SPOOFING_SUPPORT
|
||||
bool "Detect ARP spoof pkts attack"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
#config MT7603E_EXT_BUILD_CHANNEL_LIST
|
||||
# bool "Extension Channel List"
|
||||
# depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
#config MT7603E_AUTO_CH_SELECT_ENHANCE
|
||||
# bool "Auto Channel Selection Enhancement"
|
||||
# depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
config MT7603E_MULTI_CORE_SUPPORT
|
||||
bool "multi core support"
|
||||
depends on TARGET_ramips_mt7621
|
||||
default n
|
||||
|
||||
endif
|
||||
|
||||
source "./src/mt7603_wifi_ap/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
||||
#"MT7603E"
|
||||
config MT7603E_RALINK_MT7603E
|
||||
bool
|
||||
default y
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
endif
|
||||
|
||||
#if MT7603E_RLT_MAC
|
||||
# config MT7603E_RLT_MAC
|
||||
# bool
|
||||
# default y
|
||||
#endif
|
||||
|
||||
#if MT7603E_RTMP_MAC
|
||||
# config MT7603E_RTMP_MAC
|
||||
# bool
|
||||
# default y
|
||||
#endif
|
||||
|
||||
#if MT7603E_MT_MAC
|
||||
if MT7603E_RALINK_MT7603E
|
||||
config MT7603E_MT_MAC
|
||||
bool
|
||||
default y
|
||||
endif
|
||||
#endif MT7603E_MT_WIFI
|
||||
#endif
|
||||
#endif FIRST_IF_MT7603E || SECOND_IF_MT7603E
|
||||
endif
|
||||
@@ -0,0 +1,96 @@
|
||||
Release Note:
|
||||
|
||||
[V4.0.0.7]
|
||||
Host Driver:
|
||||
1. Bug fixed for TGn 4.2.12 PMK caching and 4.2.11 pre-authentication issue.
|
||||
2. Bug fixed for 802.1x issue of WEP encryption.
|
||||
3. Add UAPSD support.
|
||||
4. Add APCLI_AUTO_CONNECT_SUPPORT function.
|
||||
5. Fix MCU INT CR read/write issue.
|
||||
6. modify rate retry rule.
|
||||
7. Fix QA tool: check the writing length to write all to flash.
|
||||
8. Fix memory leak issue when command TxPwr send fail.
|
||||
9. Fix MT7603E load fw fail issue that need to adjust PCIe LDO setting to 1.2V.
|
||||
10. Fix the WSC config status( in beacon & probe resp ) is wrong when we key the wrong DUT's enrolee PIN.
|
||||
11. ATE tool:
|
||||
a. fix txpower can not be set at ATE mode issue.
|
||||
b. Add code for TxTone Power HQADLL command and iwpriv.
|
||||
12. Fix Makefile/Kconfig:
|
||||
a. we should use CONFIG_SINGLE_SKU_V2, not CONFIG_SINGLE_SKU.
|
||||
b. Remove RTMP_TEMPERATURE_TX_ALC because this driver flag is not valid. (controlled by FW)
|
||||
|
||||
F/W:
|
||||
1. Add EDCA and Slot time set command.
|
||||
2. Enable and update CCK_MRC fix.
|
||||
3. Enable TX PA dynamic GC
|
||||
4. Support negative TMAC PWR
|
||||
5. Set CR_TSSI_PA_OFFSET_HPA
|
||||
6. Lower WF0/WF1 TSSI ON TH to 0dBm
|
||||
|
||||
|
||||
[V4.0.0.6 ]
|
||||
Host Driver:
|
||||
1.Add tx power percentage function for iPA
|
||||
2. Modify AP PS, use CR replace AP PS CMD
|
||||
3.fix apcli vs DIR655 IOT can't set ba size to 21
|
||||
4.Set MSSID *7, iPhone5 connect then ping overnight, still ping fail (?¶çˆ¾PSE Redirection bit被è?èµ? STA ping fail)
|
||||
for ps retrieve function, rename "token_enq_fail" to "token_enq_all_fail" to let it more clear.
|
||||
5. MT7603 auto rate update
|
||||
6. Fix [AP][TGn]:4.2.47 Power Save, fail on step 8,each PS poll the station sends to the APUT, the APUT is expected to send only one directed data packet in response.
|
||||
7. Fix TGn 4.2.11 & 4.2.12 PMK cache is delete in Auth. Req.
|
||||
8. add PSE logical reset when detect pse abonormal condition
|
||||
9. add sw based PDMA watchdog to detect & recovery PDMA TX/RX hang
|
||||
|
||||
F/W:
|
||||
Fix PCIE FW download fail when sw reboot, reset HIF then trigger WDT.
|
||||
1. Add DMA scheduler workaround.
|
||||
2. Add Admission control.
|
||||
3. Add TX power % support.
|
||||
|
||||
|
||||
[MT7603E_DPA_LinuxAP_4.0.0.5_20140511]
|
||||
1. Fixed Cal Free IC eeprom endian issue.
|
||||
2. Fixed IOT issue with Linksys WUSB6300.
|
||||
3. AP-client repeater: fixed icv error when authmode/encryptype update.
|
||||
4. Fixed crash issue that tasklet for processing pci dma done for mcu cmd sometimes will execute after event tasklet.
|
||||
5. Update auto fall back config and algorithm.
|
||||
6. Update firmware to fixed FW re-download fail issue.
|
||||
7. Do 802.11 header endian swap for ps retrieve packet.
|
||||
8. Fixed LED command big endian issue.
|
||||
9. Fixed MlmeHardTransmitTxRing cache flush issue that will cause memory for dma and cache non sync at big endian platform.
|
||||
10. Modify check en/disable RTS/CTS conditions.
|
||||
11. Fixed radio on/off cmd parameters to correct value.
|
||||
12. Update patch for flash mode.
|
||||
13. Fixed LED RadioOff issue.
|
||||
14. ATE:
|
||||
a. fixed Tx/Rx antenna switch resulting wrong Tx power level work around.
|
||||
b. patch PCIE ASPM write efuse Add PCIe Compile flag.
|
||||
c. add iwpriv TXCONT
|
||||
d. add iwpriv for carrier suppression test TXCARR
|
||||
e. Initialize Tx power with EEPROM array when ATESTART
|
||||
f. Fix CONFIG_QA blocking setting power when only CONFIG_ATE is chosen
|
||||
|
||||
|
||||
[MT7603E_DPA_LinuxAP_4.0.0.4_20140411]
|
||||
1. Support IGMP Snooping function.
|
||||
2. Fix NewRateAdapt Error in STA mode.
|
||||
3. Fixed apcli ICV error issue to decrypt Broadcast packet from AP.
|
||||
4. Fixed BAR issues:
|
||||
a. Change SW BAR rate to CCK 1M.
|
||||
b. Send SW BAR for ap power saving to refresh peer sta side reordering buffer (Intel IOT).
|
||||
c. Add SW BAR mechanism which SN will control by wtbl per tid.
|
||||
d. Considering the BAR data rate in both 2.4G & 5G
|
||||
e. SendRefreshBar when recv. CmdPsClearRsp, this modify will make sure the 1st. packet in PSE is BAR after PS.
|
||||
5. Update new firmware for BBP issue.
|
||||
6. Upload E1/E2 default EEPROM bin file.
|
||||
7. Fixed ATE bugs for Tx power setting, BW40 channel control, and Rx issue.
|
||||
8. Change MAX_NUMBER_OF_MAC definition to support 32 association STAs.
|
||||
9. Correct ApCli entry setting to fix throughput issue.
|
||||
10. Fix sometimes software tx will stuck since Intel STA in ps mode is very frequently.
|
||||
11. Fine tune TXOP settings.
|
||||
12. Fixed the bug when spatial extension on/off.
|
||||
13. Fixed AP client TKIP/WEP connection issue with Broadcom AP.
|
||||
|
||||
|
||||
[MT7603E_DPA_LinuxAP_4.0.0.4_20140401]
|
||||
1. Init AP Driver version
|
||||
@@ -0,0 +1,533 @@
|
||||
if FIRST_IF_MT7603E || SECOND_IF_MT7603E
|
||||
config MT7603E_RLT_WIFI
|
||||
tristate "RLT 7603 WIFI Driver"
|
||||
select MT7603E_WIFI_BASIC_FUNC if MT7603E_RLT_WIFI
|
||||
|
||||
config MT7603E_MT_WIFI_PATH
|
||||
string
|
||||
depends on MT7603E_RLT_WIFI
|
||||
default "rlt_wifi"
|
||||
|
||||
if MT7603E_RLT_WIFI
|
||||
menu "WiFi Generic Feature Options"
|
||||
|
||||
if FIRST_IF_MT7603E
|
||||
choice
|
||||
prompt "EEPROM Type of 1st Card"
|
||||
depends on ! FIRST_IF_NONE
|
||||
|
||||
config MT7603E_FIRST_IF_EEPROM_PROM
|
||||
bool "EEPROM"
|
||||
|
||||
config MT7603E_FIRST_IF_EEPROM_EFUSE
|
||||
bool "EFUSE"
|
||||
|
||||
config MT7603E_FIRST_IF_EEPROM_FLASH
|
||||
bool "FLASH"
|
||||
endchoice
|
||||
|
||||
config MT7603E_RT_FIRST_CARD_EEPROM
|
||||
string
|
||||
depends on ! FIRST_IF_NONE
|
||||
default "prom" if MT7603E_FIRST_IF_EEPROM_PROM
|
||||
default "efuse" if MT7603E_FIRST_IF_EEPROM_EFUSE
|
||||
default "flash" if MT7603E_FIRST_IF_EEPROM_FLASH
|
||||
endif
|
||||
# endif FIRST_IF_MT7603E
|
||||
|
||||
if SECOND_IF_MT7603E
|
||||
choice
|
||||
prompt "EEPROM Type of 2nd Card"
|
||||
depends on ! SECOND_IF_NONE
|
||||
|
||||
config MT7603E_SECOND_IF_EEPROM_PROM
|
||||
bool "EEPROM"
|
||||
|
||||
config MT7603E_SECOND_IF_EEPROM_EFUSE
|
||||
bool "EFUSE"
|
||||
|
||||
config MT7603E_SECOND_IF_EEPROM_FLASH
|
||||
bool "FLASH"
|
||||
endchoice
|
||||
|
||||
config MT7603E_RT_SECOND_CARD_EEPROM
|
||||
string
|
||||
depends on ! SECOND_IF_NONE
|
||||
default "prom" if MT7603E_SECOND_IF_EEPROM_PROM
|
||||
default "efuse" if MT7603E_SECOND_IF_EEPROM_EFUSE
|
||||
default "flash" if MT7603E_SECOND_IF_EEPROM_FLASH
|
||||
endif
|
||||
#endif SECOND_IF_MT7603E
|
||||
|
||||
config MT7603E_MULTI_INF_SUPPORT
|
||||
bool
|
||||
default y if !FIRST_IF_NONE && !SECOND_IF_NONE
|
||||
|
||||
config MT7603E_WIFI_BASIC_FUNC
|
||||
bool "Basic Functions"
|
||||
select WIRELESS_EXT
|
||||
select WEXT_SPY
|
||||
select WEXT_PRIV
|
||||
|
||||
config MT7603E_WSC_INCLUDED
|
||||
bool "WSC (WiFi Simple Config)"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_WSC_V2_SUPPORT
|
||||
bool "WSC V2(WiFi Simple Config Version 2.0)"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_WSC_NFC_SUPPORT
|
||||
bool "WSC out-of-band(NFC)"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_DOT11N_DRAFT3
|
||||
bool "802.11n Draft3"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT7603E_DOT11_VHT_AC
|
||||
# bool "802.11 ac"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_DOT11W_PMF_SUPPORT
|
||||
bool "PMF"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
#config MT7603E_TXBF_SUPPORT
|
||||
# bool "Tx Bean Forming Support"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
#config MT7603E_WMM_ACM_SUPPORT
|
||||
# bool "WMM ACM"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_LLTD_SUPPORT
|
||||
bool "LLTD (Link Layer Topology Discovery Protocol)"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_QOS_DLS_SUPPORT
|
||||
bool "802.11e DLS ((Direct-Link Setup) Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
|
||||
config MT7603E_WAPI_SUPPORT
|
||||
bool "WAPI Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_CARRIER_DETECTION_SUPPORT
|
||||
bool "Carrier Detect"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_IGMP_SNOOP_SUPPORT
|
||||
bool "IGMP Snooping"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_BLOCK_NET_IF
|
||||
bool "NETIF Block"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
help
|
||||
Support Net interface block while Tx-Sw queue full
|
||||
|
||||
config MT7603E_TXBF_SUPPORT
|
||||
bool "Tx Bean Forming Support (Only 3883)"
|
||||
depends on WIFI_DRIVER
|
||||
depends on RALINK_RT2883 || RALINK_RT3883
|
||||
default n
|
||||
#
|
||||
# optimize dma cache mapping for internal mips platform
|
||||
#
|
||||
config MT7603E_DMA_CACHE_OPTIMIZE
|
||||
bool "optimize dma cache mapping for internal mips platform"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT7603E_VIDEO_TURBINE_SUPPORT
|
||||
# bool "Video Turbine support"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
#config MT7603E_RA_CLASSIFIER
|
||||
# tristate "Ralink Flow Classifier"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_RATE_ADAPTION
|
||||
bool "New Rate Adaptation support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_NEW_RATE_ADAPT_SUPPORT
|
||||
bool "Intelligent Rate Adaption"
|
||||
depends on WIFI_DRIVER && MT7603E_RATE_ADAPTION
|
||||
default y
|
||||
|
||||
config MT7603E_AGS_SUPPORT
|
||||
bool "Adaptive Group Switching"
|
||||
depends on WIFI_DRIVER && MT7603E_RATE_ADAPTION
|
||||
default n
|
||||
|
||||
config MT7603E_IDS_SUPPORT
|
||||
bool "IDS (Intrusion Detection System) Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_WIFI_WORK_QUEUE
|
||||
bool "Work Queue"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_WIFI_SKB_RECYCLE
|
||||
bool "SKB Recycle(Linux)"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_PUSH_SUPPORT
|
||||
bool "Config Push Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT7603E_EASY_SETUP_SUPPORT
|
||||
# bool "Whole Home Coverage - Easy Setup"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_EVENT_NOTIFIER_SUPPORT
|
||||
bool "Whole Home Coverage - Event Notifier"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_SMART_CARRIER_SENSE_SUPPORT
|
||||
bool "Smart Carrier Sense"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
config MT7603E_MBO_SUPPORT
|
||||
bool "MBO Support"
|
||||
depends on WIFI_DRIVER
|
||||
select INTERWORKING
|
||||
select WNM_SUPPORT
|
||||
select DOT11K_RRM_SUPPORT
|
||||
select DOT11R_FT_SUPPORT
|
||||
select DOT11W_PMF_SUPPORT
|
||||
select PASSPOINT_R2
|
||||
default n
|
||||
config MT7603E_RTMP_FLASH_SUPPORT
|
||||
bool "Flash Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_MWDS_SUPPORT
|
||||
bool "Mixed WDS(MWDS)"
|
||||
default n
|
||||
|
||||
config MT7603E_AIR_MONITOR_SUPPORT
|
||||
bool "Air Monitor Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_STA_FORCE_ROAM_SUPPORT
|
||||
bool "Sta Force Roam Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_ROAMING_ENHANCE_SUPPORT
|
||||
bool "Roaming Enhance Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_WIFI_FWD_UPDATED
|
||||
bool "Wifi Forwarding Support Update"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_BTCOEX_CONCURRENT
|
||||
bool "Coexisence Event Notify between BT and WiFi"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_LED_CONTROL_SUPPORT
|
||||
bool "LED Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_SINGLE_SKU_V2
|
||||
bool "Single SKU V2"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_HW_ANTENNA_DIVERSITY
|
||||
bool "Antenna Diversity Support"
|
||||
depends on MT7603E_RLT_AP_SUPPORT || RLT_STA_SUPPORT
|
||||
depends on RALINK_RT5350
|
||||
default n
|
||||
|
||||
config MT7603E_ATE_SUPPORT
|
||||
bool "ATE/QA Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_RT2860V2_AP_V24_DATA_STRUCTURE
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_RT2860V2_AP_32B_DESC
|
||||
bool "32 Byte Descriptor Support"
|
||||
depends on WIFI_DRIVER
|
||||
depends on MT7603E_RALINK_RT6352 || RALINK_MT7620
|
||||
default n
|
||||
|
||||
config MT7603E_MEMORY_OPTIMIZATION
|
||||
bool "Memory Optimization"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_RTMP_INTERNAL_TX_ALC
|
||||
bool "TSSI Compensation"
|
||||
depends on WIFI_DRIVER
|
||||
depends on RALINK_RT3350 || RALINK_RT3352 || RALINK_RT5350 || MT7603E_RALINK_RT6352
|
||||
default n
|
||||
|
||||
config MT7603E_RTMP_TEMPERATURE_CALIBRATION
|
||||
bool "Temperature Calibration"
|
||||
depends on WIFI_DRIVER
|
||||
depends on MT7603E_RALINK_RT6352
|
||||
default n
|
||||
|
||||
config MT7603E_HOTSPOT
|
||||
bool "Passpoint-R1"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_PASSPOINT_R2
|
||||
bool "Passpoint Release-2 Support"
|
||||
depends on MT7603E_HOTSPOT
|
||||
select MT7603E_DOT11W_PMF_SUPPORT
|
||||
default n
|
||||
|
||||
config MT7603E_UAPSD
|
||||
bool "MT7603E_UAPSD support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
#config MT7603E_EPA_ELNA
|
||||
# bool "ePAeLNA"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
choice
|
||||
prompt "PA,LNA Type"
|
||||
depends on MT7603E_RLT_WIFI
|
||||
|
||||
config MT7603E_IPA_ILNA
|
||||
bool "iPAiLNA"
|
||||
|
||||
config MT7603E_IPA_ELNA
|
||||
bool "iPAeLNA"
|
||||
|
||||
config MT7603E_EPA_ILNA
|
||||
bool "ePAiLNA"
|
||||
|
||||
config MT7603E_EPA_ELNA
|
||||
bool "ePAeLNA"
|
||||
endchoice
|
||||
|
||||
config MT7603E_PA_LNA
|
||||
string
|
||||
depends on MT7603E_RLT_WIFI
|
||||
default "iPAiLNA" if MT7603E_IPA_ILNA
|
||||
default "iPAeLNA" if MT7603E_IPA_ELNA
|
||||
default "ePAiLNA" if MT7603E_EPA_ILNA
|
||||
default "ePAeLNA" if MT7603E_EPA_ELNA
|
||||
|
||||
#
|
||||
# Section for chip architectures
|
||||
#
|
||||
# "RLT MAC Support"
|
||||
config MT7603E_RLT_MAC
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_RLT_BBP
|
||||
bool
|
||||
|
||||
config MT7603E_RLT_RF
|
||||
bool
|
||||
|
||||
# "RTMP MAC Support"
|
||||
config MT7603E_RTMP_MAC
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_RTMP_BBP
|
||||
bool
|
||||
|
||||
config MT7603E_RTMP_RF
|
||||
bool
|
||||
|
||||
#
|
||||
# Section for interfaces
|
||||
#
|
||||
config MT7603E_RTMP_PCI_SUPPORT
|
||||
bool
|
||||
|
||||
config MT7603E_RTMP_USB_SUPPORT
|
||||
bool
|
||||
|
||||
config MT7603E_RTMP_RBUS_SUPPORT
|
||||
bool
|
||||
|
||||
endmenu
|
||||
|
||||
menu "WiFi Operation Modes"
|
||||
choice
|
||||
prompt "Main Mode"
|
||||
default MT7603E_WIFI_MODE_AP
|
||||
|
||||
config MT7603E_WIFI_MODE_AP
|
||||
bool "AP"
|
||||
|
||||
config MT7603E_WIFI_MODE_STA
|
||||
bool "STA"
|
||||
|
||||
config MT7603E_WIFI_MODE_BOTH
|
||||
bool "APSTA"
|
||||
endchoice
|
||||
|
||||
if MT7603E_WIFI_MODE_AP || MT7603E_WIFI_MODE_BOTH
|
||||
source "drivers/net/wireless/mtk/mt7603e/mt7603_wifi_ap/Kconfig"
|
||||
endif
|
||||
|
||||
#if MT7603E_WIFI_MODE_STA || MT7603E_WIFI_MODE_BOTH
|
||||
# source "drivers/net/wireless/rlt_wifi_sta/Kconfig"
|
||||
#endif
|
||||
endmenu
|
||||
|
||||
#"RT2860 series"
|
||||
config MT7603E_RALINK_RT28XX
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"RT3092"
|
||||
config MT7603E_RALINK_RT3092
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"RT3572"
|
||||
config MT7603E_RALINK_RT3572
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_USB_SUPPORT
|
||||
|
||||
#"RT5392"
|
||||
config MT7603E_RALINK_RT5392
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"RT5572"
|
||||
config MT7603E_RALINK_RT5572
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_USB_SUPPORT
|
||||
|
||||
#"RT5592"
|
||||
config MT7603E_RALINK_RT5592
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7620/RT6352"
|
||||
config MT7603E_RALINK_RT6352
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_RBUS_SUPPORT
|
||||
# select MT7603E_RTMP_TEMPERATURE_CALIBRATION
|
||||
# select MT7603E_RTMP_INTERNAL_TX_ALC
|
||||
|
||||
#"MT7610E"
|
||||
config MT7603E_RALINK_MT7610E
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7610U"
|
||||
config MT7603E_RALINK_MT7610U
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_USB_SUPPORT
|
||||
|
||||
#"RT8592"
|
||||
config MT7603E_RALINK_RT8592
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7612E"
|
||||
config MT7603E_RALINK_MT7612E
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7612U"
|
||||
config MT7603E_RALINK_MT7612U
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_USB_SUPPORT
|
||||
|
||||
#"MT7603E"
|
||||
config MT7603E_RALINK_MT7603E
|
||||
bool
|
||||
default y
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7603U"
|
||||
config MT7603E_RALINK_MT7603U
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_USB_SUPPORT
|
||||
|
||||
endif
|
||||
|
||||
#if MT7603E_RLT_MAC
|
||||
# config MT7603E_RLT_MAC
|
||||
# bool
|
||||
# default y
|
||||
#endif
|
||||
|
||||
#if MT7603E_RTMP_MAC
|
||||
# config MT7603E_RTMP_MAC
|
||||
# bool
|
||||
# default y
|
||||
#endif
|
||||
|
||||
if MT7603E_RALINK_MT7603E
|
||||
config MT7603E_MT_MAC
|
||||
bool
|
||||
default y
|
||||
endif
|
||||
|
||||
if MT7603E_RALINK_MT7603U
|
||||
config MT7603E_MT_MAC
|
||||
bool
|
||||
default y
|
||||
endif
|
||||
endif
|
||||
#endif FIRST_IF_MT7603E || SECOND_IF_MT7603E
|
||||
@@ -0,0 +1,513 @@
|
||||
if FIRST_IF_MT7603E || SECOND_IF_MT7603E
|
||||
config MT_WIFI
|
||||
tristate "MT WIFI Driver"
|
||||
|
||||
config MT_WIFI_PATH
|
||||
string
|
||||
depends on MT_WIFI
|
||||
default "mt_wifi"
|
||||
|
||||
if MT_WIFI
|
||||
menu "WiFi Generic Feature Options"
|
||||
|
||||
if FIRST_IF_MT7603E
|
||||
choice
|
||||
prompt "EEPROM Type of 1st Card"
|
||||
depends on ! FIRST_IF_NONE
|
||||
|
||||
config FIRST_MT_IF_EEPROM_PROM
|
||||
bool "EEPROM"
|
||||
|
||||
config FIRST_MT_IF_EEPROM_EFUSE
|
||||
bool "EFUSE"
|
||||
|
||||
config FIRST_MT_IF_EEPROM_FLASH
|
||||
bool "FLASH"
|
||||
endchoice
|
||||
|
||||
config RT_FIRST_CARD_EEPROM
|
||||
string
|
||||
depends on ! FIRST_IF_NONE
|
||||
default "prom" if FIRST_MT_IF_EEPROM_PROM
|
||||
default "efuse" if FIRST_MT_IF_EEPROM_EFUSE
|
||||
default "flash" if FIRST_MT_IF_EEPROM_FLASH
|
||||
endif
|
||||
# endif FIRST_IF_MT7603E
|
||||
|
||||
if SECOND_IF_MT7603E
|
||||
choice
|
||||
prompt "EEPROM Type of 2nd Card"
|
||||
depends on ! SECOND_IF_NONE
|
||||
|
||||
config SECOND_MT_IF_EEPROM_PROM
|
||||
bool "EEPROM"
|
||||
|
||||
config SECOND_MT_IF_EEPROM_EFUSE
|
||||
bool "EFUSE"
|
||||
|
||||
config SECOND_MT_IF_EEPROM_FLASH
|
||||
bool "FLASH"
|
||||
endchoice
|
||||
|
||||
config RT_SECOND_CARD_EEPROM
|
||||
string
|
||||
depends on ! SECOND_IF_NONE
|
||||
default "prom" if SECOND_MT_IF_EEPROM_PROM
|
||||
default "efuse" if SECOND_MT_IF_EEPROM_EFUSE
|
||||
default "flash" if SECOND_MT_IF_EEPROM_FLASH
|
||||
endif
|
||||
#endif SECOND_IF_MT7603E
|
||||
|
||||
config MULTI_INF_SUPPORT
|
||||
bool
|
||||
default y if !FIRST_IF_NONE && !SECOND_IF_NONE
|
||||
|
||||
#config WIFI_BASIC_FUNC
|
||||
# bool "Basic Functions"
|
||||
# select WIRELESS_EXT
|
||||
# select WEXT_SPY
|
||||
# select WEXT_PRIV
|
||||
|
||||
config MT_WSC_INCLUDED
|
||||
bool "WSC (WiFi Simple Config)"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_WSC_V2_SUPPORT
|
||||
bool "WSC V2(WiFi Simple Config Version 2.0)"
|
||||
depends on MT_WSC_INCLUDED
|
||||
default y
|
||||
|
||||
config MT_DOT11N_DRAFT3
|
||||
bool "802.11n Draft3"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_DOT11_VHT_AC
|
||||
bool "802.11 ac"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config WSC_NFC_SUPPORT
|
||||
bool "WSC out-of-band(NFC)"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_DOT11W_PMF_SUPPORT
|
||||
bool "PMF Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_TXBF_SUPPORT
|
||||
bool "Tx Bean Forming Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT_WMM_ACM_SUPPORT
|
||||
# bool "WMM ACM"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT_LLTD_SUPPORT
|
||||
bool "LLTD (Link Layer Topology Discovery Protocol)"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_QOS_DLS_SUPPORT
|
||||
bool "802.11e DLS ((Direct-Link Setup) Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_WAPI_SUPPORT
|
||||
bool "WAPI Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_CARRIER_DETECTION_SUPPORT
|
||||
bool "Carrier Detect"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_MBO_SUPPORT
|
||||
bool "MBO Support"
|
||||
depends on WIFI_DRIVER
|
||||
select INTERWORKING
|
||||
select WNM_SUPPORT
|
||||
select DOT11K_RRM_SUPPORT
|
||||
select DOT11R_FT_SUPPORT
|
||||
select DOT11W_PMF_SUPPORT
|
||||
select PASSPOINT_R2
|
||||
default n
|
||||
|
||||
config MT_IGMP_SNOOP_SUPPORT
|
||||
bool "IGMP Snooping"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_BLOCK_NET_IF
|
||||
bool "NETIF Block"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
help
|
||||
Support Net interface block while Tx-Sw queue full
|
||||
|
||||
config MT_DMA_CACHE_OPTIMIZE
|
||||
bool "optimize dma cache mapping for internal mips platform"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT_TXBF_SUPPORT
|
||||
# bool "Tx Bean Forming Support (Only 3883)"
|
||||
# depends on WIFI_DRIVER
|
||||
# depends on RALINK_RT2883 || RALINK_RT3883
|
||||
# default n
|
||||
|
||||
#config MT_VIDEO_TURBINE_SUPPORT
|
||||
# bool "Video Turbine support"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
#config MT_RA_CLASSIFIER
|
||||
# tristate "Ralink Flow Classifier"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT_RATE_ADAPTION
|
||||
bool "New Rate Adaptation support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_NEW_RATE_ADAPT_SUPPORT
|
||||
bool "Intelligent Rate Adaption"
|
||||
depends on WIFI_DRIVER && MT_RATE_ADAPTION
|
||||
default y
|
||||
|
||||
config MT_AGS_SUPPORT
|
||||
bool "Adaptive Group Switching"
|
||||
depends on WIFI_DRIVER && MT_RATE_ADAPTION
|
||||
default n
|
||||
|
||||
config MT_IDS_SUPPORT
|
||||
bool "IDS (Intrusion Detection System) Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_WIFI_WORK_QUEUE
|
||||
bool "Work Queue"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_WIFI_SKB_RECYCLE
|
||||
bool "SKB Recycle(Linux)"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_RTMP_FLASH_SUPPORT
|
||||
bool "Flash Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config CONFIG_PUSH_SUPPORT
|
||||
bool "Config Push Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
config CONFIG_EASY_SETUP_SUPPORT
|
||||
bool "Whole Home Coverage - Easy Setup"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config EVENT_NOTIFIER_SUPPORT
|
||||
bool "Whole Home Coverage - Event Notifier"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
config MWDS_SUPPORT
|
||||
bool "Mixed WDS(MWDS)"
|
||||
default y
|
||||
config AIR_MONITOR_SUPPORT
|
||||
bool "Air Monitor Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config STA_FORCE_ROAM_SUPPORT
|
||||
bool "Sta Force Roam Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config ROAMING_ENHANCE_SUPPORT
|
||||
bool "Roaming Enhance Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config WIFI_FWD_UPDATED
|
||||
bool "Wifi Forwarding Support Update"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_BTCOEX_CONCURRENT
|
||||
bool "Coexisence Event Notify between BT and WiFi"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_LED_CONTROL_SUPPORT
|
||||
bool "LED Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_SINGLE_SKU_V2
|
||||
bool "Single SKU V2"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_HW_ANTENNA_DIVERSITY
|
||||
bool "Antenna Diversity Support"
|
||||
depends on RLT_AP_SUPPORT || RLT_STA_SUPPORT
|
||||
depends on RALINK_RT5350
|
||||
default n
|
||||
|
||||
config MT_ATE_SUPPORT
|
||||
bool "ATE/QA Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_RT2860V2_AP_V24_DATA_STRUCTURE
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_RT2860V2_AP_32B_DESC
|
||||
bool "32 Byte Descriptor Support"
|
||||
depends on WIFI_DRIVER
|
||||
depends on RALINK_RT6352 || RALINK_MT7620
|
||||
default n
|
||||
|
||||
config MT_MEMORY_OPTIMIZATION
|
||||
bool "Memory Optimization"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT_RTMP_INTERNAL_TX_ALC
|
||||
# bool "TSSI Compensation"
|
||||
# depends on WIFI_DRIVER
|
||||
# depends on RALINK_RT3350 || RALINK_RT3352 || RALINK_RT5350 || RALINK_RT6352
|
||||
# default n
|
||||
|
||||
#config MT_RTMP_TEMPERATURE_CALIBRATION
|
||||
# bool "Temperature Calibration"
|
||||
# depends on WIFI_DRIVER
|
||||
# depends on RALINK_RT6352
|
||||
# default n
|
||||
|
||||
config MT_HOTSPOT
|
||||
bool "Passpoint-R1"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_HOTSPOT_R2
|
||||
bool "Passpoint Release-2 Support"
|
||||
depends on HOTSPOT
|
||||
select MT_DOT11W_PMF_SUPPORT
|
||||
default n
|
||||
|
||||
config MT_UAPSD
|
||||
bool "UAPSD support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
#config MT_EPA_ELNA
|
||||
# bool "ePAeLNA"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
choice
|
||||
prompt "PA,LNA Type"
|
||||
depends on MT_WIFI
|
||||
|
||||
config MT_IPA_ILNA
|
||||
bool "iPAiLNA"
|
||||
|
||||
config MT_IPA_ELNA
|
||||
bool "iPAeLNA"
|
||||
|
||||
config MT_EPA_ILNA
|
||||
bool "ePAiLNA"
|
||||
|
||||
config MT_EPA_ELNA
|
||||
bool "ePAeLNA"
|
||||
endchoice
|
||||
|
||||
config MT_PA_LNA
|
||||
string
|
||||
depends on MT_WIFI
|
||||
default "iPAiLNA" if MT_IPA_ILNA
|
||||
default "iPAeLNA" if MT_IPA_ELNA
|
||||
default "ePAiLNA" if MT_EPA_ILNA
|
||||
default "ePAeLNA" if MT_EPA_ELNA
|
||||
|
||||
#
|
||||
# Section for chip architectures
|
||||
#
|
||||
# "RLT MAC Support"
|
||||
config RLT_MAC
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config RLT_BBP
|
||||
bool
|
||||
|
||||
config RLT_RF
|
||||
bool
|
||||
|
||||
# "RTMP MAC Support"
|
||||
config RTMP_MAC
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config RTMP_BBP
|
||||
bool
|
||||
|
||||
config RTMP_RF
|
||||
bool
|
||||
|
||||
#
|
||||
# Section for interfaces
|
||||
#
|
||||
config RTMP_PCI_SUPPORT
|
||||
bool
|
||||
|
||||
config RTMP_USB_SUPPORT
|
||||
bool
|
||||
|
||||
config RTMP_RBUS_SUPPORT
|
||||
bool
|
||||
|
||||
endmenu
|
||||
|
||||
menu "WiFi Operation Modes"
|
||||
choice
|
||||
prompt "Main Mode"
|
||||
default MT_WIFI_MODE_AP
|
||||
|
||||
config MT_WIFI_MODE_AP
|
||||
bool "AP"
|
||||
|
||||
config MT_WIFI_MODE_STA
|
||||
bool "STA"
|
||||
|
||||
config MT_WIFI_MODE_BOTH
|
||||
bool "APSTA"
|
||||
endchoice
|
||||
|
||||
if MT_WIFI_MODE_AP || MT_WIFI_MODE_BOTH
|
||||
source "drivers/net/wireless/mt_wifi_ap/Kconfig"
|
||||
endif
|
||||
|
||||
#if MT_WIFI_MODE_STA || MT_WIFI_MODE_BOTH
|
||||
# source "drivers/net/wireless/rlt_wifi_sta/Kconfig"
|
||||
#endif
|
||||
endmenu
|
||||
|
||||
#"RT2860 series"
|
||||
config RALINK_RT28XX
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"RT3092"
|
||||
config RALINK_RT3092
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"RT3572"
|
||||
config RALINK_RT3572
|
||||
bool
|
||||
default n
|
||||
select RTMP_USB_SUPPORT
|
||||
|
||||
#"RT5392"
|
||||
config RALINK_RT5392
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"RT5572"
|
||||
config RALINK_RT5572
|
||||
bool
|
||||
default n
|
||||
select RTMP_USB_SUPPORT
|
||||
|
||||
#"RT5592"
|
||||
config RALINK_RT5592
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7620/RT6352"
|
||||
config RALINK_RT6352
|
||||
bool
|
||||
default n
|
||||
select RTMP_RBUS_SUPPORT
|
||||
# select RTMP_TEMPERATURE_CALIBRATION
|
||||
# select RTMP_INTERNAL_TX_ALC
|
||||
|
||||
#"MT7610E"
|
||||
config RALINK_MT7610E
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7610U"
|
||||
config RALINK_MT7610U
|
||||
bool
|
||||
default n
|
||||
select RTMP_USB_SUPPORT
|
||||
|
||||
#"RT8592"
|
||||
config RALINK_RT8592
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7612E"
|
||||
config RALINK_MT7612E
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7612U"
|
||||
config RALINK_MT7612U
|
||||
bool
|
||||
default n
|
||||
select RTMP_USB_SUPPORT
|
||||
|
||||
#"MT7603E"
|
||||
config RALINK_MT7603E
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
endif
|
||||
|
||||
#if RLT_MAC
|
||||
# config RLT_MAC
|
||||
# bool
|
||||
# default y
|
||||
#endif
|
||||
|
||||
#if RTMP_MAC
|
||||
# config RTMP_MAC
|
||||
# bool
|
||||
# default y
|
||||
#endif
|
||||
|
||||
#if MT_MAC
|
||||
if RALINK_MT7603E
|
||||
config MT_MAC
|
||||
bool
|
||||
default y
|
||||
endif
|
||||
#endif MT_WIFI
|
||||
endif
|
||||
#endif FIRST_IF_MT7603E || SECOND_IF_MT7603E
|
||||
@@ -0,0 +1,678 @@
|
||||
RT28xx_MODE = AP
|
||||
|
||||
|
||||
|
||||
TARGET = LINUX
|
||||
|
||||
|
||||
# CHIPSET
|
||||
# rt2860, rt2870, rt2880, rt2070, rt3070, rt3090, rt3572, rt3062, rt3562, rt3593, rt3573
|
||||
# rt3562(for rt3592), rt3050, rt3350, rt3352, rt5350, rt5370, rt5390, rt5572, rt5592,
|
||||
# rt8592(for rt85592),
|
||||
# mt7601e, mt7601u,
|
||||
# mt7650e, mt7630e, mt7610e, mt7650u, mt7630u, mt7610u
|
||||
# mt7662e, mt7632e, mt7612e, mt7662u, mt7632u, mt7612u
|
||||
# mt7603e, mt7603u, mt7636u, mt7636s
|
||||
|
||||
|
||||
CHIPSET = mt7603e
|
||||
|
||||
|
||||
MODULE = $(word 1, $(CHIPSET))
|
||||
|
||||
#OS ABL - YES or NO
|
||||
OSABL = NO
|
||||
|
||||
#Build Prealloc ko
|
||||
PREALLOC = NO
|
||||
|
||||
ifneq ($(TARGET),THREADX)
|
||||
#RT28xx_DIR = home directory of RT28xx source code
|
||||
RT28xx_DIR = $(shell pwd)
|
||||
endif
|
||||
|
||||
include $(RT28xx_DIR)/os/linux/config.mk
|
||||
|
||||
RTMP_SRC_DIR = $(RT28xx_DIR)/RT$(MODULE)
|
||||
|
||||
#PLATFORM: Target platform
|
||||
PLATFORM = PC
|
||||
#PLATFORM = MT53XX
|
||||
#PLATFORM = PC_AUTO_BUILD
|
||||
#PLATFORM = BB_SOC
|
||||
#PLATFORM = 5VT
|
||||
#PLATFORM = IKANOS_V160
|
||||
#PLATFORM = IKANOS_V180
|
||||
#PLATFORM = SIGMA
|
||||
#PLATFORM = SIGMA_8622
|
||||
#PLATFORM = INIC
|
||||
#PLATFORM = STAR
|
||||
#PLATFORM = IXP
|
||||
#PLATFORM = INF_TWINPASS
|
||||
#PLATFORM = INF_DANUBE
|
||||
#PLATFORM = INF_AR9
|
||||
#PLATFORM = INF_VR9
|
||||
#PLATFORM = BRCM_6358
|
||||
#PLATFORM = INF_AMAZON_SE
|
||||
#PLATFORM = CAVM_OCTEON
|
||||
#PLATFORM = CMPC
|
||||
#PLATFORM = RALINK_2880
|
||||
#PLATFORM = RALINK_3052
|
||||
#PLATFORM = SMDK
|
||||
#PLATFORM = RMI
|
||||
#PLATFORM = RMI_64
|
||||
#PLATFORM = KODAK_DC
|
||||
#PLATFORM = DM6446
|
||||
#PLATFORM = FREESCALE8377
|
||||
#PLATFORM = BL2348
|
||||
#PLATFORM = BL23570
|
||||
#PLATFORM = BLUBB
|
||||
#PLATFORM = BLPMP
|
||||
#PLATFORM = MT85XX
|
||||
#PLATFORM = NXP_TV550
|
||||
#PLATFORM = MVL5
|
||||
#PLATFORM = RALINK_3352
|
||||
#PLATFORM = UBICOM_IPX8
|
||||
#PLATFORM = INTELP6
|
||||
#PLATFORM = MT7620
|
||||
#PLATFORM = MT7621
|
||||
#PLATFORM = MSTAR
|
||||
|
||||
#APSOC
|
||||
ifeq ($(MODULE),3050)
|
||||
PLATFORM = RALINK_3050
|
||||
endif
|
||||
ifeq ($(MODULE),3052)
|
||||
PLATFORM = RALINK_3052
|
||||
endif
|
||||
ifeq ($(MODULE),3350)
|
||||
PLATFORM = RALINK_3050
|
||||
endif
|
||||
ifeq ($(MODULE),3352)
|
||||
PLATFORM = RALINK_3352
|
||||
endif
|
||||
ifeq ($(CHIPSET),mt7628)
|
||||
PLATFORM = MT7628
|
||||
endif
|
||||
|
||||
#RELEASE Package
|
||||
RELEASE = DPA
|
||||
|
||||
|
||||
ifeq ($(TARGET),LINUX)
|
||||
MAKE = make
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), UCOS)
|
||||
MAKE = make
|
||||
endif
|
||||
ifeq ($(TARGET),THREADX)
|
||||
MAKE = gmake
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), ECOS)
|
||||
MAKE = make
|
||||
MODULE = $(shell pwd | sed "s/.*\///" ).o
|
||||
export MODULE
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),BB_SOC)
|
||||
LINUX_SRC = $(KERNEL_DIR)
|
||||
#CROSS_COMPILE = /opt/trendchip/mips-linux-uclibc/usr/bin/mips-linux-uclibc-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),5VT)
|
||||
LINUX_SRC = /home/ralink-2860-sdk-5vt-distribution/linux-2.6.17
|
||||
CROSS_COMPILE = /opt/crosstool/uClibc_v5te_le_gcc_4_1_1/bin/arm-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),UBICOM_IPX8)
|
||||
LINUX_SRC = /home/sample/Customers/UBICOM/ubicom-linux-dist-2.1.1/linux-2.6.x
|
||||
CROSS_COMPILE = ubicom32-elf-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),IKANOS_V160)
|
||||
LINUX_SRC = /home/sample/projects/LX_2618_RG_5_3_00r4_SRC/linux-2.6.18
|
||||
CROSS_COMPILE = mips-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),IKANOS_V180)
|
||||
LINUX_SRC = /home/sample/projects/LX_BSP_VX180_5_4_0r1_ALPHA_26DEC07/linux-2.6.18
|
||||
CROSS_COMPILE = mips-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),SIGMA)
|
||||
LINUX_SRC = /root/sigma/smp86xx_kernel_source_2.7.172.0/linux-2.6.15
|
||||
CROSS_COMPILE = /root/sigma/smp86xx_toolchain_2.7.172.0/build_mipsel_nofpu/staging_dir/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),SIGMA_8622)
|
||||
LINUX_SRC = /home/snowpin/armutils_2.5.120.1/build_arm/linux-2.4.22-em86xx
|
||||
CROSS_COMPILE = /home/snowpin/armutils_2.5.120.1/toolchain/bin/arm-elf-
|
||||
CROSS_COMPILE_INCLUDE = /home/snowpin/armutils_2.5.120.1/toolchain/lib/gcc-lib/arm-elf/2.95.3
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INIC)
|
||||
UCOS_SRC = /opt/uCOS/iNIC_rt2880
|
||||
CROSS_COMPILE = /usr/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),STAR)
|
||||
LINUX_SRC = /opt/star/kernel/linux-2.4.27-star
|
||||
CROSS_COMPILE = /opt/star/tools/arm-linux/bin/arm-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),RMI)
|
||||
LINUX_SRC = /opt/rmi/1.7.0/linux/src/
|
||||
CROSS_COMPILE = /opt/rmi/1.7.0/mipscross/nptl/bin/mips64-unknown-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),RMI_64)
|
||||
LINUX_SRC = /opt/rmi/1.7.0/linux_64/src/
|
||||
CROSS_COMPILE = /opt/rmi/1.7.0/mipscross/nptl/bin/mips64-unknown-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), RALINK_2880)
|
||||
LINUX_SRC = /project/stable/RT288x/RT288x_SDK/source/linux-2.4.x
|
||||
CROSS_COMPILE = /opt/buildroot-gdb/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),RALINK_3052)
|
||||
LINUX_SRC = /home/peter/ap_soc/SDK_3_3_0_0/RT288x_SDK/source/linux-2.6.21.x
|
||||
CROSS_COMPILE = /opt/buildroot-gcc342/bin/mipsel-linux-uclibc-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),FREESCALE8377)
|
||||
LINUX_SRC = /opt/ltib-mpc8377_rds-20090309/rpm/BUILD/linux-2.6.25
|
||||
CROSS_COMPILE = /opt/freescale/usr/local/gcc-4.2.187-eglibc-2.5.187/powerpc-linux-gnu/bin/powerpc-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),BL2348)
|
||||
LINUX_SRC = /home/sample/Customers/BroadLight/bl234x-linux-2.6.21-small-v29
|
||||
CROSS_COMPILE = mips-wrs-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),BL23570)
|
||||
LINUX_SRC = /home/FIBERHOME/linux-2.6.34.8
|
||||
CROSS_COMPILE = mips-wrs-linux-gnu-mips_74k_softfp-glibc_small-
|
||||
ARCH:=mips
|
||||
export $ARCH
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),BLUBB)
|
||||
LINUX_SRC = /home/sample/Customers/BroadLight/UBB/gmp20/linux-2.6.21-small
|
||||
CROSS_COMPILE = mips-wrs-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),BLPMP)
|
||||
LINUX_SRC = /home/sample/Customers/BroadLight/UBB/pmp16/bl234x-linux-2.6.21-small-v30.2
|
||||
CROSS_COMPILE = mips-wrs-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),PC)
|
||||
# Linux 2.6
|
||||
LINUX_SRC = /lib/modules/$(shell uname -r)/build
|
||||
# Linux 2.4 Change to your local setting
|
||||
#LINUX_SRC = /usr/src/linux-2.4
|
||||
LINUX_SRC_MODULE = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless/
|
||||
CROSS_COMPILE =
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INTELP6)
|
||||
LINUX_SRC = /tftpboot/IntelCE-20.0.11052.243193/project_build_i686/IntelCE/kernel-20.0.11024.238456/linux-2.6.35
|
||||
CROSS_COMPILE = /tftpboot/IntelCE-20.0.11052.243193/build_i686/i686-linux-elf/bin/i686-cm-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),IXP)
|
||||
LINUX_SRC = /project/stable/Gmtek/snapgear-uclibc/linux-2.6.x
|
||||
CROSS_COMPILE = arm-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INF_TWINPASS)
|
||||
# Linux 2.6
|
||||
#LINUX_SRC = /lib/modules/$(shell uname -r)/build
|
||||
# Linux 2.4 Change to your local setting
|
||||
LINUX_SRC = /project/stable/twinpass/release/2.0.1/source/kernel/opensource/linux-2.4.31/
|
||||
CROSS_COMPILE = mips-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INF_DANUBE)
|
||||
LINUX_SRC = /opt/danube/sdk/linux-2.6.16.x
|
||||
CROSS_COMPILE = mips-linux-
|
||||
ROOTDIR = /opt/danube/sdk
|
||||
export ROOTDIR
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INF_AR9)
|
||||
LINUX_SRC = /root/ar9/xR9_BSP1.2.2.0/source/kernel/opensource/linux-2.6.20/
|
||||
CROSS_COMPILE = /root/ar9/ifx-lxdb26-1.0.2/gcc-3.4.4/toolchain-mips/bin/
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INF_VR9)
|
||||
LINUX_SRC = /home/public/lantiq/VR9/UGW-4.2/build_dir/linux-ifxcpe_platform_vr9/linux-2.6.20.19
|
||||
CROSS_COMPILE = /home/public/lantiq/VR9/UGW-4.2/staging_dir/toolchain-mips_gcc-3.4.6_uClibc-0.9.29/bin/mips-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),BRCM_6358)
|
||||
LINUX_SRC =
|
||||
CROSS_COMPILE =
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INF_AMAZON_SE)
|
||||
# Linux 2.6
|
||||
#LINUX_SRC = /lib/modules/$(shell uname -r)/build
|
||||
# Linux 2.4 Change to your local setting
|
||||
LINUX_SRC = /backup/ifx/3.6.2.2/source/kernel/opensource/linux-2.4.31
|
||||
#CROSS_COMPILE = mips-linux-
|
||||
#LINUX_SRC = /project/Infineon/3.6.2.2/source/kernel/opensource/linux-2.4.31
|
||||
CROSS_COMPILE = /opt/uclibc-toolchain/ifx-lxdb-1-2-3-external/gcc-3.3.6/toolchain-mips/R0208V35/mips-linux-uclibc/bin/
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),ST)
|
||||
LINUX_SRC = /opt/STM/STLinux-2.2/devkit/sources/kernel/linux0039
|
||||
CROSS_COMPILE = /opt/STM/STLinux-2.2/devkit/sh4/bin/sh4-linux-
|
||||
ARCH := sh
|
||||
export ARCH
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),CAVM_OCTEON)
|
||||
OCTEON_ROOT = /usr/local/Cavium_Networks/OCTEON-SDK
|
||||
LINUX_SRC = $(OCTEON_ROOT)/linux/kernel_2.6/linux
|
||||
CROSS_COMPILE = mips64-octeon-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),CMPC)
|
||||
LINUX_SRC = /opt/fvt_11N_SDK_0807/fvt131x_SDK_11n/linux-2.6.17
|
||||
CROSS_COMPILE =
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),SMDK)
|
||||
LINUX_SRC = /home/bhushan/itcenter/may28/linux-2.6-samsung
|
||||
CROSS_COMPILE = /usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),RALINK_3352)
|
||||
LINUX_SRC = /home/sample/3352/RT288x_SDK/source/linux-2.6.21.x
|
||||
CROSS_COMPILE = /opt/buildroot-gcc342/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),KODAK_DC)
|
||||
SKD_SRC = C:/SigmaTel/DC1250_SDK_v1-9/sdk
|
||||
CROSS_COMPILE = $(cc)
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),DM6446)
|
||||
LINUX_SRC = /home/fonchi/work/soc/ti-davinci
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),MT85XX)
|
||||
ifeq ($(OSABL),YES)
|
||||
LINUX_SRC = $(RT28xx_DIR)/../../../../../build_linux
|
||||
else
|
||||
LINUX_SRC = $(RT28xx_DIR)/../../../../build_linux
|
||||
endif
|
||||
ifeq ($(CROSS_COMPILE),)
|
||||
CROSS_COMPILE=armv7a-mediatek451_001_vfp-linux-gnueabi-
|
||||
endif
|
||||
CC=$(CROSS_COMPILE)gcc
|
||||
$(warning =============================================)
|
||||
$(warning CC=$(CC) for wifi driver)
|
||||
$(warning =============================================)
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),MT53XX)
|
||||
TARGET = LINUX
|
||||
#****** For system auto build ******
|
||||
#LINUX_SRC=$(KERNEL_OBJ_ROOT)/$(KERNEL_VER)/$(KERNEL_CONFIG)_modules
|
||||
#****** For local build ******
|
||||
# uncomment the following lines
|
||||
VM_LINUX_ROOT ?= $(word 1, $(subst /vm_linux/,/vm_linux /, $(shell pwd)))
|
||||
LINUX_ROOT ?= $(VM_LINUX_ROOT)
|
||||
LINUX_SRC=$(VM_LINUX_ROOT)/output/mtk_android/mt5399_cn_android/rel/obj/kernel/chiling/kernel/linux-3.10/mt5399_android_smp_mod_defconfig_modules
|
||||
OBJ_ROOT ?= $(VM_LINUX_ROOT)/output/mtk_android/mt5399_cn_android/rel/obj
|
||||
export KERNEL_OBJ_ROOT=$(LINUX_SRC)/../..
|
||||
ifeq ($(CROSS_COMPILE),)
|
||||
CROSS_COMPILE=/mtkoss/gnuarm/vfp_4.5.1_2.6.27_cortex-a9-rhel4/i686/bin/armv7a-mediatek451_001_vfp-linux-gnueabi-
|
||||
endif
|
||||
ifeq "$(CC)" "gcc"
|
||||
CC ?= $(CROSS_COMPILE)gcc
|
||||
endif
|
||||
$(warning =============================================)
|
||||
$(warning CC=$(CC) for wifi driver LINUX_SRC=$(LINUX_SRC))
|
||||
$(warning TARGET=$(TARGET))
|
||||
$(warning =============================================)
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),NXP_TV550)
|
||||
LINUX_SRC = /data/tv550/kernel/linux-2.6.28.9
|
||||
LINUX_SRC_MODULE = /data/tv550/kernel/linux-2.6.28.9/drivers/net/wireless
|
||||
CROSS_COMPILE = /opt/embeddedalley/nxp_tv550/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),PC_AUTO_BUILD)
|
||||
LINUX_SRC=/proj/srv_wcnautobuild/external/linux-3.10.59/
|
||||
#CROSS_COMPILE=/proj/srv_wcnautobuild/external/gcc-4.9.2/bin/
|
||||
CROSS_COMPILE=
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),MVL5)
|
||||
LINUX_SRC = /home2/charlestu/AP-VT3426/linux-2.6.18
|
||||
CROSS_COMPILE = /opt/montavista/pro/devkit/arm/v5t_le_mvl5/bin/arm_v5t_le-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),MT7620)
|
||||
LINUX_SRC = /home/share/src/MT7601/AP/RT288x_SDK/source/linux-2.6.36.x
|
||||
CROSS_COMPILE = /opt/buildroot-gcc342/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),MT7621)
|
||||
LINUX_SRC = /root/SDK_4_2_0_0/RT288x_SDK/source/linux-2.6.36.x
|
||||
CROSS_COMPILE = /opt/buildroot-gcc463/usr/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),MT7628)
|
||||
LINUX_SRC = /root/Working/MT7628_SDK_2013_0912/RT288x_SDK/source/linux-2.6.36.x
|
||||
CROSS_COMPILE = /opt/buildroot-gcc342/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),MSTAR)
|
||||
PREALLOC = YES
|
||||
|
||||
#628 TV Platform
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/628/kernel/RedLion/3.1.10/
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/628/kernel/3.10.23/3.10.23/
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/628/kernel/3.1.10_Madison_TVOS/3.1.10/
|
||||
|
||||
#918 TV Android4.3 Platform
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/918_TV/android4.3/kernel/3.1.10_Napoli_tvos/3.1.10/
|
||||
|
||||
#918 Box Android4.4 Platform
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/toolchain/918_Box_android4.4/3.1.10_Napoli_tvos_0616_new_kernel/3.1.10/
|
||||
|
||||
#928 Box Android4.4 Platform
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/928/928_kernel_0716/3.10.23/
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/928/928_kernel_0722/3.10.23/
|
||||
LINUX_SRC = /proj/mtk05650/share/mstar/928/20140710_KERN-3.10.23-00911089/3.10.23/
|
||||
|
||||
#ToolChian Setting
|
||||
#CROSS_COMPILE = /proj/mtk05650/share/mstar/628/toolchain/arm-2012.09/bin/arm-none-linux-gnueabi-
|
||||
CROSS_COMPILE = /proj/mtk05650/share/mstar/toolchain/arm-2010.09/bin/arm-none-linux-gnueabi-
|
||||
#CROSS_COMPILE = /proj/mtk05650/share/mstar/toolchain/918_Box_android4.4/arm-2012.09/bin/arm-none-linux-gnueabi-
|
||||
#CROSS_COMPILE = /proj/mtk05650/share/mstar/toolchain/918_Box_android4.4/arm-2012.09/bin/arm-none-linux-gnueabi-
|
||||
endif
|
||||
|
||||
export OSABL RT28xx_DIR RT28xx_MODE LINUX_SRC CROSS_COMPILE CROSS_COMPILE_INCLUDE PLATFORM RELEASE CHIPSET MODULE RTMP_SRC_DIR LINUX_SRC_MODULE TARGET HAS_WOW_SUPPORT
|
||||
|
||||
# The targets that may be used.
|
||||
PHONY += all build_tools test UCOS THREADX LINUX release prerelease clean uninstall install libwapi osabl sdk_build_tools
|
||||
|
||||
ifeq ($(TARGET),LINUX)
|
||||
all: build_tools $(TARGET) plug_in
|
||||
else
|
||||
all: $(TARGET)
|
||||
endif
|
||||
|
||||
build_tools:
|
||||
$(MAKE) -C tools
|
||||
$(RT28xx_DIR)/tools/bin2h
|
||||
|
||||
sdk_build_tools:
|
||||
if [ -f $(RT28xx_DIR)/eeprom_log ]; then \
|
||||
rm -f $(RT28xx_DIR)/eeprom_log
|
||||
fi
|
||||
echo $(EE_TYPE) >> eeprom_log
|
||||
echo $(CHIPSET) >> eeprom_log
|
||||
if [ -f $(RT28xx_DIR)/eeprom/SA/MT7603E_EEPROM.bin ]; then \
|
||||
echo 'find SA/MT7603E_EEPROM.bin' >> eeprom_log ; \
|
||||
cp -f $(RT28xx_DIR)/eeprom/SA/MT7603E_EEPROM.bin $(RT28xx_DIR)/eeprom/MT7603E_EEPROM.bin ; \
|
||||
else \
|
||||
cp -f $(RT28xx_DIR)/eeprom/$(EE_TYPE)/MT7603E_EEPROM.bin $(RT28xx_DIR)/eeprom/MT7603E_EEPROM.bin ; \
|
||||
fi
|
||||
$(MAKE) -C tools
|
||||
$(RT28xx_DIR)/tools/bin2h
|
||||
# rm -f $(RT28xx_DIR)/eeprom/SA/MT7603E_EEPROM.bin
|
||||
|
||||
test:
|
||||
$(MAKE) -C tools test
|
||||
|
||||
UCOS:
|
||||
$(MAKE) -C os/ucos/ MODE=$(RT28xx_MODE)
|
||||
echo $(RT28xx_MODE)
|
||||
|
||||
ECOS:
|
||||
$(MAKE) -C os/ecos/ MODE=$(RT28xx_MODE)
|
||||
cp -f os/ecos/$(MODULE) $(MODULE)
|
||||
|
||||
THREADX:
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/Threadx -f $(RT28xx_DIR)/os/ThreadX/Makefile
|
||||
|
||||
LINUX:
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f os/linux/Makefile.4.util $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
endif
|
||||
|
||||
cp -f os/linux/Makefile.4 $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f os/linux/Makefile.4.netif $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
endif
|
||||
|
||||
ifeq ($(RT28xx_MODE),AP)
|
||||
ifneq ($(PLATFORM),BB_SOC)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_ap.o /tftpboot
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/rtutil$(MODULE)_ap.o /tftpboot
|
||||
cp -f $(RT28xx_DIR)/os/linux/rtnet$(MODULE)_ap.o /tftpboot
|
||||
endif
|
||||
ifeq ($(PLATFORM),INF_AMAZON_SE)
|
||||
cp -f /tftpboot/rt2870ap.o /backup/ifx/build/root_filesystem/lib/modules/2.4.31-Amazon_SE-3.6.2.2-R0416_Ralink/kernel/drivers/net
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(RT28xx_MODE),APSTA)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_apsta.o /tftpboot
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/rtutil$(MODULE)_apsta.o /tftpboot
|
||||
cp -f $(RT28xx_DIR)/os/linux/rtnet$(MODULE)_apsta.o /tftpboot
|
||||
endif
|
||||
else
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_sta.o /tftpboot
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/rtutil$(MODULE)_sta.o /tftpboot
|
||||
cp -f $(RT28xx_DIR)/os/linux/rtnet$(MODULE)_sta.o /tftpboot
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
else
|
||||
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f os/linux/Makefile.6.util $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
endif
|
||||
ifeq ($(PREALLOC), YES)
|
||||
cp -f PREALLOC/os/linux/Makefile.6.prealloc PREALLOC/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/PREALLOC/os/linux modules
|
||||
$(SHELL) cp_prealloc.sh
|
||||
endif
|
||||
cp -f os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile
|
||||
ifeq ($(PLATFORM),DM6446)
|
||||
$(MAKE) ARCH=arm CROSS_COMPILE=arm_v5t_le- -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
else
|
||||
ifeq ($(PLATFORM),FREESCALE8377)
|
||||
$(MAKE) ARCH=powerpc CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
else
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f os/linux/Makefile.6.netif $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
endif
|
||||
|
||||
ifeq ($(RT28xx_MODE),AP)
|
||||
ifneq ($(PLATFORM),BB_SOC)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_ap.ko /tftpboot
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_ap_util.ko /tftpboot
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_ap_net.ko /tftpboot
|
||||
endif
|
||||
else
|
||||
rm -f os/linux/$(MODULE)_ap.ko.lzma
|
||||
/root/bin/lzma e os/linux/$(MODULE)_ap.ko os/linux/$(MODULE)_ap.ko.lzma
|
||||
endif
|
||||
else
|
||||
ifeq ($(RT28xx_MODE),APSTA)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_apsta.ko /tftpboot
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_apsta_util.ko /tftpboot
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_apsta_net.ko /tftpboot
|
||||
endif
|
||||
else
|
||||
ifeq ($(PLATFORM),PC_AUTO_BUILD)
|
||||
else
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_sta.ko /tftpboot
|
||||
endif
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_sta_util.ko /tftpboot
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_sta_net.ko /tftpboot
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),MT85XX)
|
||||
mkdir -p $(RT28xx_DIR)/../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
|
||||
cp -f $(RT28xx_DIR)/os/linux/mt7603u_sta.ko $(RT28xx_DIR)/../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
|
||||
endif
|
||||
|
||||
plug_in:
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/tools/plug_in MODULE_FLAGS="$(WFLAGS)"
|
||||
|
||||
release: build_tools
|
||||
$(MAKE) -C $(RT28xx_DIR)/striptool -f Makefile.release clean
|
||||
$(MAKE) -C $(RT28xx_DIR)/striptool -f Makefile.release
|
||||
striptool/striptool.out
|
||||
ifeq ($(PLATFORM),MT85XX)
|
||||
cp -f tools/osabl_check.sh $(RELEASE)/
|
||||
endif
|
||||
ifeq ($(RELEASE), DPO)
|
||||
gcc -o striptool/banner striptool/banner.c
|
||||
./striptool/banner -b striptool/copyright.gpl -s DPO/ -d DPO_GPL -R
|
||||
./striptool/banner -b striptool/copyright.frm -s DPO_GPL/include/firmware.h
|
||||
endif
|
||||
|
||||
prerelease:
|
||||
ifeq ($(MODULE), 2880)
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.release.2880 prerelease
|
||||
else
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.release prerelease
|
||||
endif
|
||||
cp $(RT28xx_DIR)/os/linux/Makefile.DPB $(RTMP_SRC_DIR)/os/linux/.
|
||||
cp $(RT28xx_DIR)/os/linux/Makefile.DPA $(RTMP_SRC_DIR)/os/linux/.
|
||||
cp $(RT28xx_DIR)/os/linux/Makefile.DPC $(RTMP_SRC_DIR)/os/linux/.
|
||||
ifeq ($(RT28xx_MODE),STA)
|
||||
cp $(RT28xx_DIR)/os/linux/Makefile.DPD $(RTMP_SRC_DIR)/os/linux/.
|
||||
cp $(RT28xx_DIR)/os/linux/Makefile.DPO $(RTMP_SRC_DIR)/os/linux/.
|
||||
endif
|
||||
|
||||
clean:
|
||||
ifeq ($(TARGET), LINUX)
|
||||
cp -f os/linux/Makefile.clean os/linux/Makefile
|
||||
$(MAKE) -C os/linux clean
|
||||
rm -rf os/linux/Makefile
|
||||
ifeq ($(PREALLOC), YES)
|
||||
cp -f PREALLOC/os/linux/Makefile.clean PREALLOC/os/linux/Makefile
|
||||
$(MAKE) -C PREALLOC/os/linux clean
|
||||
rm -rf PREALLOC/os/linux/Makefile
|
||||
endif
|
||||
endif
|
||||
ifeq ($(TARGET), UCOS)
|
||||
$(MAKE) -C os/ucos clean MODE=$(RT28xx_MODE)
|
||||
endif
|
||||
ifeq ($(TARGET), ECOS)
|
||||
$(MAKE) -C os/ecos clean MODE=$(RT28xx_MODE)
|
||||
endif
|
||||
|
||||
uninstall:
|
||||
ifeq ($(TARGET), LINUX)
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.4 uninstall
|
||||
else
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.6 uninstall
|
||||
endif
|
||||
endif
|
||||
|
||||
install:
|
||||
ifeq ($(TARGET), LINUX)
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.4 install
|
||||
else
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.6 install
|
||||
endif
|
||||
endif
|
||||
|
||||
libwapi:
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
cp -f os/linux/Makefile.libwapi.4 $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
else
|
||||
cp -f os/linux/Makefile.libwapi.6 $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
endif
|
||||
|
||||
osutil:
|
||||
ifeq ($(OSABL),YES)
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
cp -f os/linux/Makefile.4.util $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
else
|
||||
cp -f os/linux/Makefile.6.util $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
ifeq ($(PLATFORM),MT85XX)
|
||||
cp -f $(RT28xx_DIR)/os/linux/mt7603u_sta.ko $(RT28xx_DIR)/../../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
osnet:
|
||||
ifeq ($(OSABL),YES)
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
cp -f os/linux/Makefile.4.netif $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
else
|
||||
cp -f os/linux/Makefile.6.netif $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
ifeq ($(PLATFORM),MT85XX)
|
||||
cp -f $(RT28xx_DIR)/os/linux/mt7603u_sta.ko $(RT28xx_DIR)/../../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
osdrv:
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
cp -f os/linux/Makefile.4 $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
else
|
||||
cp -f os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
ifeq ($(PLATFORM),MT85XX)
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/mt7603u_sta.ko $(RT28xx_DIR)/../../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Declare the contents of the .PHONY variable as phony. We keep that information in a variable
|
||||
.PHONY: $(PHONY)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
#The word of "Default" must not be removed
|
||||
Default
|
||||
ed_th_nonCE=52
|
||||
Cts2SelfTh=1500
|
||||
CountryRegion=5
|
||||
CountryRegionABand=7
|
||||
CountryCode=TW
|
||||
BssidNum=1
|
||||
SSID1=RT2860AP1
|
||||
SSID2=
|
||||
SSID3=
|
||||
SSID4=
|
||||
WirelessMode=9
|
||||
TxRate=0
|
||||
Channel=11
|
||||
BasicRate=15
|
||||
BeaconPeriod=100
|
||||
DtimPeriod=1
|
||||
TxPower=100
|
||||
DisableOLBC=0
|
||||
BGProtection=0
|
||||
MaxStaNum=0
|
||||
TxPreamble=0
|
||||
RTSThreshold=2347
|
||||
FragThreshold=2346
|
||||
TxBurst=1
|
||||
PktAggregate=0
|
||||
TurboRate=0
|
||||
WmmCapable=0
|
||||
APSDCapable=0
|
||||
DLSCapable=0
|
||||
APAifsn=3;7;1;1
|
||||
APCwmin=4;4;3;2
|
||||
APCwmax=6;10;4;3
|
||||
APTxop=0;0;94;47
|
||||
APACM=0;0;0;0
|
||||
BSSAifsn=3;7;2;2
|
||||
BSSCwmin=4;4;3;2
|
||||
BSSCwmax=10;10;4;3
|
||||
BSSTxop=0;0;94;47
|
||||
BSSACM=0;0;0;0
|
||||
AckPolicy=0;0;0;0
|
||||
NoForwarding=0
|
||||
NoForwardingBTNBSSID=0
|
||||
HideSSID=0
|
||||
StationKeepAlive=0
|
||||
ShortSlot=1
|
||||
AutoChannelSelect=0
|
||||
IEEE8021X=0
|
||||
IEEE80211H=0
|
||||
CSPeriod=10
|
||||
WirelessEvent=0
|
||||
IdsEnable=0
|
||||
AuthFloodThreshold=32
|
||||
AssocReqFloodThreshold=32
|
||||
ReassocReqFloodThreshold=32
|
||||
ProbeReqFloodThreshold=32
|
||||
DisassocFloodThreshold=32
|
||||
DeauthFloodThreshold=32
|
||||
EapReqFooldThreshold=32
|
||||
PreAuth=0
|
||||
AuthMode=OPEN
|
||||
EncrypType=NONE
|
||||
RekeyInterval=0
|
||||
RekeyMethod=DISABLE
|
||||
PMKCachePeriod=10
|
||||
WPAPSK1=
|
||||
WPAPSK2=
|
||||
WPAPSK3=
|
||||
WPAPSK4=
|
||||
DefaultKeyID=1
|
||||
Key1Type=0
|
||||
Key1Str1=
|
||||
Key1Str2=
|
||||
Key1Str3=
|
||||
Key1Str4=
|
||||
Key2Type=0
|
||||
Key2Str1=
|
||||
Key2Str2=
|
||||
Key2Str3=
|
||||
Key2Str4=
|
||||
Key3Type=0
|
||||
Key3Str1=
|
||||
Key3Str2=
|
||||
Key3Str3=
|
||||
Key3Str4=
|
||||
Key4Type=0
|
||||
Key4Str1=
|
||||
Key4Str2=
|
||||
Key4Str3=
|
||||
Key4Str4=
|
||||
HSCounter=0
|
||||
AccessPolicy0=0
|
||||
AccessControlList0=
|
||||
AccessPolicy1=0
|
||||
AccessControlList1=
|
||||
AccessPolicy2=0
|
||||
AccessControlList2=
|
||||
AccessPolicy3=0
|
||||
AccessControlList3=
|
||||
WdsEnable=0
|
||||
WdsEncrypType=NONE
|
||||
WdsList=
|
||||
WdsKey=
|
||||
RADIUS_Server=192.168.2.3
|
||||
RADIUS_Port=1812
|
||||
RADIUS_Key=ralink
|
||||
own_ip_addr=192.168.5.234
|
||||
EAPifname=br0
|
||||
PreAuthifname=br0
|
||||
HT_HTC=0
|
||||
HT_RDG=0
|
||||
HT_EXTCHA=0
|
||||
HT_LinkAdapt=0
|
||||
HT_OpMode=0
|
||||
HT_MpduDensity=5
|
||||
HT_BW=1
|
||||
HT_AutoBA=1
|
||||
HT_AMSDU=0
|
||||
HT_BAWinSize=64
|
||||
HT_GI=1
|
||||
HT_LDPC=0
|
||||
HT_MCS=33
|
||||
VHT_BW=1
|
||||
VHT_SGI=1
|
||||
VHT_STBC=0
|
||||
VHT_BW_SIGNAL=0
|
||||
VHT_DisallowNonVHT=0
|
||||
VHT_LDPC=0
|
||||
MeshId=MESH
|
||||
MeshAutoLink=1
|
||||
MeshAuthMode=OPEN
|
||||
MeshEncrypType=NONE
|
||||
MeshWPAKEY=
|
||||
MeshDefaultkey=1
|
||||
MeshWEPKEY=
|
||||
WscManufacturer=
|
||||
WscModelName=
|
||||
WscDeviceName=
|
||||
WscModelNumber=
|
||||
WscSerialNumber=
|
||||
RadioOn=1
|
||||
PMFMFPC=0
|
||||
PMFMFPR=0
|
||||
PMFSHA256=0
|
||||
LoadCodeMethod=0
|
||||
ed_th_nonCE=52
|
||||
@@ -0,0 +1,19 @@
|
||||
#The word of "Default" must not be removed, maximum 32 cards, 00 ~ 31
|
||||
Default
|
||||
|
||||
#CARDID, MAC, CARDTYPE
|
||||
SELECT=CARDTYPE
|
||||
|
||||
00CARDID=/etc/Wireless/RT2860AP/RT2860AP1.dat
|
||||
01CARDID=/etc/Wireless/RT2860AP/RT2860AP2.dat
|
||||
02CARDID=/etc/Wireless/RT2860AP/RT2860AP3.dat
|
||||
|
||||
00MAC00:0E:2E:C3:D0:48=/etc/Wireless/RT2860AP/RT2860AP1.dat
|
||||
01MAC00:40:F4:FF:AA:40=/etc/Wireless/RT2860AP/RT2860AP2.dat
|
||||
02MAC00:0C:43:10:11:5C=/etc/Wireless/RT2860AP/RT2860AP3.dat
|
||||
|
||||
00CARDTYPEbgn=/etc/Wireless/RT2860AP/RT2860AP1.dat
|
||||
01CARDTYPEbgn=/etc/Wireless/RT2860AP/RT2860AP2.dat
|
||||
02CARDTYPEabgn=/etc/Wireless/RT2860AP/RT2860AP3.dat
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,724 @@
|
||||
|
||||
#ifdef ACL_V2_SUPPORT
|
||||
|
||||
#include "rt_config.h"
|
||||
|
||||
// check http://www.coffer.com/mac_find/ not all can be found, need huawei to refine this table!!
|
||||
OUI_ENTRY OUI_ACL_TABLE[] =
|
||||
{
|
||||
{FBT_IOT_PEER_UNKNOWN, {0x00,0x00,0x00}},
|
||||
|
||||
/*Realtek why need 5 IDs ??, only 3 can be found*/
|
||||
{FBT_IOT_PEER_REALTEK, {0x00,0x48,0x54}}, //first three
|
||||
{FBT_IOT_PEER_REALTEK_92SE, {0x00,0xe0,0x4c}}, //first three
|
||||
{FBT_IOT_PEER_REALTEK_SOFTAP, {0x52,0x54,0x05}}, //first three
|
||||
//{FBT_IOT_PEER_RTK_APCLIENT, {0x00,0x00,0x00}}, //can't be found
|
||||
//{FBT_IOT_PEER_REALTEK_81XX, {0x00,0x00,0x00}}, //can't be found
|
||||
//{FBT_IOT_PEER_REALTEK_WOW, {0x00,0x00,0x00}}, //can't be found
|
||||
|
||||
{FBT_IOT_PEER_BROADCOM, {0x00,0x05,0xb5}},
|
||||
|
||||
{FBT_IOT_PEER_RALINK, {0x00,0x0c,0x43}},
|
||||
|
||||
{FBT_IOT_PEER_ATHEROS, {0x00,0x03,0x7f}},
|
||||
{FBT_IOT_PEER_ATHEROS, {0x00,0x13,0x74}},
|
||||
{FBT_IOT_PEER_ATHEROS, {0x88,0x12,0x4e}},
|
||||
|
||||
/*too many cisco OUIs, only keep 3*/
|
||||
{FBT_IOT_PEER_CISCO, {0x00,0x00,0x0c}},
|
||||
{FBT_IOT_PEER_CISCO, {0x00,0x01,0x42}},
|
||||
{FBT_IOT_PEER_CISCO, {0x00,0x01,0x43}},
|
||||
|
||||
{FBT_IOT_PEER_MERU, {0x00,0x0c,0xe6}},
|
||||
|
||||
{FBT_IOT_PEER_MARVEL, {0x00,0x50,0x43}},
|
||||
|
||||
//{FBT_IOT_PEER_SELF_SOFTAP, {000000}}, // can't be found
|
||||
|
||||
{FBT_IOT_PEER_AIRGO, {0x00,0x0a,0xf5}},
|
||||
|
||||
/*too many cisco OUIs, only keep 3*/
|
||||
{FBT_IOT_PEER_INTEL, {0x00,0x02,0xb3}},
|
||||
{FBT_IOT_PEER_INTEL, {0x00,0x03,0x47}},
|
||||
{FBT_IOT_PEER_INTEL, {0x00,0x04,0x23}},
|
||||
|
||||
/*too many , only keep 1! */
|
||||
{FBT_IOT_PEER_HTC, {0x00,0x04,0x23}},
|
||||
//{FBT_IOT_PEER_MAX, {0x00,0x00,0x00}}, // can't be found
|
||||
};
|
||||
|
||||
INT OUI_ACL_TABLE_NUM = (sizeof(OUI_ACL_TABLE)/sizeof(OUI_ENTRY));
|
||||
|
||||
|
||||
|
||||
VOID ACL_V2_Timeout(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3);
|
||||
|
||||
|
||||
BUILD_TIMER_FUNCTION(ACL_V2_Timeout);
|
||||
|
||||
|
||||
|
||||
VOID ACL_V2_CtrlInit(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
#ifdef CONFIG_AP_SUPPORT
|
||||
UCHAR APIndex;
|
||||
#endif /* CONFIG_AP_SUPPORT */
|
||||
|
||||
#ifdef CONFIG_AP_SUPPORT
|
||||
for (APIndex = 0; APIndex < MAX_MBSSID_NUM(pAd); APIndex++)
|
||||
{
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[APIndex].AccessControlList_V2;
|
||||
|
||||
NdisZeroMemory(pACLCtrl, sizeof(*pACLCtrl));
|
||||
pACLCtrl->BlockTime = 2; //spec is 2 seconds by default
|
||||
|
||||
pACLCtrl->pAd = pAd;
|
||||
|
||||
RTMPInitTimer(pAd, &pACLCtrl->AgeOutTimer,
|
||||
GET_TIMER_FUNCTION(ACL_V2_Timeout), pACLCtrl, FALSE);
|
||||
|
||||
pACLCtrl->AgeOutTimer_Running = FALSE;
|
||||
NdisAllocateSpinLock(pAd, &pACLCtrl->MAC_ListLock);
|
||||
NdisAllocateSpinLock(pAd, &pACLCtrl->OUI_ListLock);
|
||||
|
||||
DlListInit(&pACLCtrl->MAC_List);
|
||||
DlListInit(&pACLCtrl->OUI_List);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID ACL_V2_CtrlExit(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
UINT32 Ret;
|
||||
BOOLEAN Cancelled;
|
||||
|
||||
#ifdef CONFIG_AP_SUPPORT
|
||||
ACL_MAC_CTRL *pMACEntry, *pMACEntryTmp;
|
||||
ACL_OUI_CTRL *pOUIEntry, *pOUITmp;
|
||||
UCHAR APIndex;
|
||||
#endif /* CONFIG_AP_SUPPORT */
|
||||
|
||||
#ifdef CONFIG_AP_SUPPORT
|
||||
for (APIndex = 0; APIndex < MAX_MBSSID_NUM(pAd); APIndex++)
|
||||
{
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[APIndex].AccessControlList_V2;
|
||||
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
DlListForEachSafe(pMACEntry, pMACEntryTmp, &pACLCtrl->MAC_List, ACL_MAC_CTRL, List)
|
||||
{
|
||||
DlListDel(&pMACEntry->List);
|
||||
os_free_mem(NULL, pMACEntry);
|
||||
}
|
||||
DlListInit(&pACLCtrl->MAC_List);
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
DlListForEachSafe(pOUIEntry, pOUITmp, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
DlListDel(&pOUIEntry->List);
|
||||
os_free_mem(NULL, pOUIEntry);
|
||||
}
|
||||
DlListInit(&pACLCtrl->OUI_List);
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
if(pACLCtrl->AgeOutTimer_Running == TRUE)
|
||||
{
|
||||
RTMPCancelTimer(&pACLCtrl->AgeOutTimer, &Cancelled);
|
||||
pACLCtrl->AgeOutTimer_Running = FALSE;
|
||||
}
|
||||
RTMPReleaseTimer(&pACLCtrl->AgeOutTimer, &Cancelled);
|
||||
|
||||
NdisFreeSpinLock(&pACLCtrl->MAC_ListLock);
|
||||
NdisFreeSpinLock(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
}
|
||||
#endif /* CONFIG_AP_SUPPORT */
|
||||
}
|
||||
|
||||
INT Set_ACL_V2_DisConnectSta_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN RTMP_STRING *arg)
|
||||
{
|
||||
UCHAR macAddr[MAC_ADDR_LEN];
|
||||
RTMP_STRING *value;
|
||||
INT i;
|
||||
MAC_TABLE_ENTRY *pEntry = NULL;
|
||||
|
||||
if(strlen(arg) != 17) /*Mac address acceptable format 01:02:03:04:05:06 length 17 */
|
||||
return FALSE;
|
||||
|
||||
for (i=0, value = rstrtok(arg,":"); value; value = rstrtok(NULL,":"))
|
||||
{
|
||||
if((strlen(value) != 2) || (!isxdigit(*value)) || (!isxdigit(*(value+1))) )
|
||||
return FALSE; /*Invalid */
|
||||
|
||||
AtoH(value, (UCHAR *)&macAddr[i++], 1);
|
||||
}
|
||||
|
||||
pEntry = MacTableLookup(pAd, macAddr);
|
||||
|
||||
|
||||
Set_ACL_V2_AddSTAEntry_Proc(pAd, macAddr);
|
||||
|
||||
if (pEntry)
|
||||
{
|
||||
MlmeDeAuthAction(pAd, pEntry, REASON_DISASSOC_STA_LEAVING, FALSE);
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: MAC=%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,PRINT_MAC(macAddr)));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
INT Set_ACL_V2_DisConnectOUI_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN RTMP_STRING *arg)
|
||||
{
|
||||
INT i=0;
|
||||
INT32 Ret;
|
||||
BOOLEAN Cancelled;
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_OUI_CTRL *pOUIEntry, *pOUIEntryTmp;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
ULONG Value = (ULONG) simple_strtol(arg, 0, 16);
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
if(pACLCtrl->AgeOutTimer_Running == TRUE)
|
||||
{
|
||||
RTMPCancelTimer(&pACLCtrl->AgeOutTimer, &Cancelled);
|
||||
pACLCtrl->AgeOutTimer_Running = FALSE;
|
||||
}
|
||||
if (Value)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: OUI=0x%08x\n", __FUNCTION__,Value));
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
if(pACLCtrl->OUI_Enable)
|
||||
{
|
||||
DlListForEachSafe(pOUIEntry, pOUIEntryTmp, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
DlListDel(&pOUIEntry->List);
|
||||
pACLCtrl->OUI_ListNum --;
|
||||
if(pACLCtrl->OUI_ListNum == 0)
|
||||
{
|
||||
pACLCtrl->OUI_Enable = 0;
|
||||
}
|
||||
os_free_mem(NULL, pOUIEntry);
|
||||
}
|
||||
}
|
||||
|
||||
DlListInit(&pACLCtrl->OUI_List);
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
for (i=0; i <OUI_ACL_TABLE_NUM ; i++)
|
||||
{
|
||||
if(Value & OUI_ACL_TABLE[i].ID)
|
||||
{
|
||||
Set_ACL_V2_AddOUIEntry_Proc(pAd, OUI_ACL_TABLE[i].OUI);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
if(pACLCtrl->OUI_Enable)
|
||||
{
|
||||
DlListForEachSafe(pOUIEntry, pOUIEntryTmp, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
DlListDel(&pOUIEntry->List);
|
||||
pACLCtrl->OUI_ListNum --;
|
||||
if(pACLCtrl->OUI_ListNum == 0)
|
||||
{
|
||||
pACLCtrl->OUI_Enable = 0;
|
||||
}
|
||||
os_free_mem(NULL, pOUIEntry);
|
||||
}
|
||||
}
|
||||
|
||||
DlListInit(&pACLCtrl->OUI_List);
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
}
|
||||
|
||||
i=0;
|
||||
|
||||
//dump all OUI list
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
DlListForEach(pOUIEntry, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: OUI [%d]=%02x:%02x:%02x\n", __FUNCTION__,i++, pOUIEntry->OUI[0],pOUIEntry->OUI[1],pOUIEntry->OUI[2]));
|
||||
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
if(pACLCtrl->BlockTime)
|
||||
{
|
||||
RTMPSetTimer(&pACLCtrl->AgeOutTimer, pACLCtrl->BlockTime * 1000);
|
||||
pACLCtrl->AgeOutTimer_Running = TRUE;
|
||||
}
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: OUI count=%d\n", __FUNCTION__,i));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UINT32 Set_ACL_V2_AddSTAEntry_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pTargetMACAddr)
|
||||
{
|
||||
BOOLEAN find_list = FALSE;
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_MAC_CTRL *pMACEntry;
|
||||
ULONG Now32;
|
||||
INT32 Ret;
|
||||
BOOLEAN Cancelled;
|
||||
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
if (pACLCtrl->MAC_ListNum >= (MAX_NUM_OF_ACL_V2_MAC - 1))
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_WARN, ("%s : AccessControlList is full, and no more entry can join the list!\n",__FUNCTION__));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s\n", __FUNCTION__));
|
||||
|
||||
if(pACLCtrl->AgeOutTimer_Running == TRUE)
|
||||
{
|
||||
RTMPCancelTimer(&pACLCtrl->AgeOutTimer, &Cancelled);
|
||||
pACLCtrl->AgeOutTimer_Running = FALSE;
|
||||
}
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
DlListForEach(pMACEntry, &pACLCtrl->MAC_List, ACL_MAC_CTRL, List)
|
||||
{
|
||||
if (MAC_ADDR_EQUAL(pMACEntry->MACAddr, pTargetMACAddr))
|
||||
{
|
||||
find_list = TRUE;
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : duplicate mac =%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,PRINT_MAC(pTargetMACAddr)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
if (find_list == FALSE)
|
||||
os_alloc_mem(NULL, (UCHAR **)&pMACEntry, sizeof(*pMACEntry));
|
||||
|
||||
if (!pMACEntry)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s Not available memory\n", __FUNCTION__));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (find_list == FALSE)
|
||||
{
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
NdisMoveMemory(pMACEntry->MACAddr, pTargetMACAddr, 6);
|
||||
NdisGetSystemUpTime(&Now32);
|
||||
pMACEntry->SetTime = Now32;
|
||||
|
||||
DlListAddTail(&pACLCtrl->MAC_List, &pMACEntry->List);
|
||||
|
||||
pACLCtrl->MAC_ListNum ++;
|
||||
|
||||
if(pACLCtrl->MAC_ListNum)
|
||||
{
|
||||
pACLCtrl->MAC_Enable = 1;
|
||||
}
|
||||
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
}
|
||||
else
|
||||
{
|
||||
NdisGetSystemUpTime(&Now32);
|
||||
pMACEntry->SetTime = Now32;
|
||||
}
|
||||
if(pACLCtrl->BlockTime)
|
||||
{
|
||||
RTMPSetTimer(&pACLCtrl->AgeOutTimer, pACLCtrl->BlockTime * 1000);
|
||||
pACLCtrl->AgeOutTimer_Running = TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
INT Show_ACL_V2_OUI_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN RTMP_STRING *arg)
|
||||
{
|
||||
INT i=0;
|
||||
INT32 Ret;
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_OUI_CTRL *pOUIEntry;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
//dump all OUI list
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
DlListForEach(pOUIEntry, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: OUI [%d]=%02x:%02x:%02x\n", __FUNCTION__,i++, pOUIEntry->OUI[0],pOUIEntry->OUI[1],pOUIEntry->OUI[2]));
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: OUI count=%d\n", __FUNCTION__,i));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
INT Show_ACL_V2_STAEntry_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN RTMP_STRING *arg)
|
||||
{
|
||||
INT i=0;
|
||||
INT32 Ret;
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_MAC_CTRL *pMACEntry;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
//dump all OUI list
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
DlListForEach(pMACEntry, &pACLCtrl->MAC_List, ACL_MAC_CTRL, List)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: MAC [%d]=%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,i++, PRINT_MAC(pMACEntry->MACAddr)));
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: MAC count=%d\n", __FUNCTION__,i));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID Set_ACL_V2_DelSTAEntry_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pTargetMACAddr)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_MAC_CTRL *pMACEntry, *pMACEntryTmp;
|
||||
|
||||
INT32 Ret;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s\n", __FUNCTION__));
|
||||
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
DlListForEachSafe(pMACEntry, pMACEntryTmp, &pACLCtrl->MAC_List, ACL_MAC_CTRL, List)
|
||||
{
|
||||
if (!pMACEntry)
|
||||
break;
|
||||
|
||||
if (MAC_ADDR_EQUAL(pMACEntry->MACAddr, pTargetMACAddr))
|
||||
{
|
||||
DlListDel(&pMACEntry->List);
|
||||
|
||||
pACLCtrl->MAC_ListNum --;
|
||||
|
||||
if(pACLCtrl->MAC_ListNum == 0)
|
||||
{
|
||||
pACLCtrl->MAC_Enable = 0;
|
||||
}
|
||||
|
||||
os_free_mem(NULL, pMACEntry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
}
|
||||
|
||||
|
||||
UINT32 Set_ACL_V2_AddOUIEntry_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pTargetOUIAddr)
|
||||
{
|
||||
BOOLEAN find_list = FALSE;
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_OUI_CTRL *pOUIEntry;
|
||||
ULONG Now32;
|
||||
INT32 Ret;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
if (pACLCtrl->OUI_ListNum >= (MAX_NUM_OF_ACL_V2_OUI - 1))
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_WARN, ("%s : AccessControlList is full, and no more entry can join the list!\n",__FUNCTION__));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s\n", __FUNCTION__));
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
DlListForEach(pOUIEntry, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
if (RTMPEqualMemory(pOUIEntry->OUI, pTargetOUIAddr, OUI_LEN))
|
||||
{
|
||||
find_list = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
if (find_list == FALSE)
|
||||
os_alloc_mem(NULL, (UCHAR **)&pOUIEntry, sizeof(*pOUIEntry));
|
||||
|
||||
if (!pOUIEntry)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s Not available memory\n", __FUNCTION__));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (find_list == FALSE)
|
||||
{
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
NdisMoveMemory(pOUIEntry->OUI, pTargetOUIAddr, OUI_LEN);
|
||||
NdisGetSystemUpTime(&Now32);
|
||||
pOUIEntry->SetTime = Now32;
|
||||
|
||||
DlListAddTail(&pACLCtrl->OUI_List, &pOUIEntry->List);
|
||||
|
||||
pACLCtrl->OUI_ListNum ++;
|
||||
if (pACLCtrl->OUI_ListNum)
|
||||
{
|
||||
pACLCtrl->OUI_Enable = 1;
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
}
|
||||
else
|
||||
{ // only update timestamp
|
||||
NdisGetSystemUpTime(&Now32);
|
||||
pOUIEntry->SetTime = Now32;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID Set_ACL_V2_DelOUIEntry_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pTargetOUIAddr)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_OUI_CTRL *pOUIEntry, *pOUIEntryTmp;
|
||||
|
||||
INT32 Ret;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s\n", __FUNCTION__));
|
||||
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
DlListForEachSafe(pOUIEntry, pOUIEntryTmp, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
if (!pOUIEntry)
|
||||
break;
|
||||
|
||||
if (RTMPEqualMemory(pOUIEntry->OUI, pTargetOUIAddr, OUI_LEN))
|
||||
{
|
||||
DlListDel(&pOUIEntry->List);
|
||||
|
||||
pACLCtrl->OUI_ListNum --;
|
||||
if(pACLCtrl->OUI_ListNum == 0)
|
||||
{
|
||||
pACLCtrl->OUI_Enable = 0;
|
||||
}
|
||||
os_free_mem(NULL, pOUIEntry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
}
|
||||
|
||||
VOID Set_ACL_V2_EntryExpire_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN RTMP_STRING *arg)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ULONG Value;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
Value = (ULONG) simple_strtol(arg, 0, 10);
|
||||
pACLCtrl->BlockTime = Value;
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : pACLCtrl->BlockTime=%lu\n", __FUNCTION__,pACLCtrl->BlockTime));
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID Show_ACL_V2_EntryExpire_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN RTMP_STRING *arg)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : pACLCtrl->BlockTime=%lu\n", __FUNCTION__,pACLCtrl->BlockTime));
|
||||
|
||||
}
|
||||
|
||||
BOOLEAN ACL_V2_List_Check(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN UCHAR *pAddr,
|
||||
IN UCHAR Apidx)
|
||||
{
|
||||
BOOLEAN Result = TRUE;
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_MAC_CTRL *pMACEntry;
|
||||
ACL_OUI_CTRL *pOUIEntry;
|
||||
|
||||
INT32 Ret;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[Apidx].AccessControlList_V2;
|
||||
|
||||
|
||||
check_oui:
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
DlListForEach(pOUIEntry, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
if (RTMPEqualMemory(pOUIEntry->OUI, pAddr, OUI_LEN))
|
||||
{
|
||||
Result = FALSE;
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : hit OUI =%02x:%02x:%02x\n", __FUNCTION__,pOUIEntry->OUI[0],pOUIEntry->OUI[1],pOUIEntry->OUI[2]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
|
||||
if (Result == FALSE)
|
||||
goto done;
|
||||
|
||||
|
||||
check_mac:
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
DlListForEach(pMACEntry, &pACLCtrl->MAC_List, ACL_MAC_CTRL, List)
|
||||
{
|
||||
if (MAC_ADDR_EQUAL(pMACEntry->MACAddr, pAddr))
|
||||
{
|
||||
Result = FALSE;
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : hit mac =%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,PRINT_MAC(pAddr)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
done:
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
VOID ACL_V2_AgeOut(
|
||||
IN PACL_V2_CTRL pACLCtrl)
|
||||
{
|
||||
ACL_MAC_CTRL *pMACEntry, *pMACEntryTmp;
|
||||
ACL_OUI_CTRL *pOUIEntry, *pOUIEntryTmp;
|
||||
|
||||
INT32 Ret;
|
||||
UINT32 Now32;
|
||||
INT i = 0;
|
||||
|
||||
#ifdef CONFIG_AP_SUPPORT
|
||||
UCHAR Apidx;
|
||||
|
||||
NdisGetSystemUpTime(&Now32);
|
||||
{
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
if(pACLCtrl->OUI_Enable)
|
||||
{
|
||||
DlListForEachSafe(pOUIEntry, pOUIEntryTmp, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
if(RTMP_TIME_AFTER(Now32, pOUIEntry->SetTime + (pACLCtrl->BlockTime * OS_HZ)))
|
||||
{
|
||||
DlListDel(&pOUIEntry->List);
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : age OUI[%d] =%02x:%02x:%02x\n", __FUNCTION__, i, pOUIEntry->OUI[0], pOUIEntry->OUI[1], pOUIEntry->OUI[2]));
|
||||
i++;
|
||||
pACLCtrl->OUI_ListNum --;
|
||||
if(pACLCtrl->OUI_ListNum == 0)
|
||||
{
|
||||
pACLCtrl->OUI_Enable = 0;
|
||||
}
|
||||
os_free_mem(NULL, pOUIEntry);
|
||||
}
|
||||
}
|
||||
|
||||
DlListInit(&pACLCtrl->OUI_List);
|
||||
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
|
||||
i=0;
|
||||
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
if(pACLCtrl->MAC_Enable)
|
||||
{
|
||||
DlListForEachSafe(pMACEntry, pMACEntryTmp, &pACLCtrl->MAC_List, ACL_MAC_CTRL, List)
|
||||
{
|
||||
if(RTMP_TIME_AFTER(Now32, pMACEntry->SetTime + (pACLCtrl->BlockTime * OS_HZ)))
|
||||
{
|
||||
DlListDel(&pMACEntry->List);
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : age MAC[%d] =%02x:%02x:%02x,%02x:%02x:%02x\n", __FUNCTION__, i, PRINT_MAC(pMACEntry->MACAddr)));
|
||||
i++;
|
||||
|
||||
pACLCtrl->MAC_ListNum --;
|
||||
if(pACLCtrl->MAC_ListNum == 0)
|
||||
{
|
||||
pACLCtrl->MAC_Enable = 0;
|
||||
}
|
||||
os_free_mem(NULL, pMACEntry);
|
||||
}
|
||||
}
|
||||
|
||||
DlListInit(&pACLCtrl->MAC_List);
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void ACL_V2_Timeout(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl = (ACL_V2_CTRL *)FunctionContext;
|
||||
PRTMP_ADAPTER pAd = pACLCtrl->pAd;
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s\n", __FUNCTION__));
|
||||
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s: fRTMP_ADAPTER_HALT_IN_PROGRESS\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
ACL_V2_AgeOut(pACLCtrl);
|
||||
|
||||
}
|
||||
|
||||
#endif /* ACL_V2_SUPPORT */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
***************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* 4F, No. 2 Technology 5th Rd.
|
||||
* Science-based Industrial Park
|
||||
* Hsin-chu, Taiwan, R.O.C.
|
||||
*
|
||||
* (c) Copyright 2002-2006, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
***************************************************************************
|
||||
|
||||
Module Name:
|
||||
ap_apcli.c
|
||||
|
||||
Abstract:
|
||||
Support AP-Client function.
|
||||
|
||||
Note:
|
||||
1. Call RT28xx_ApCli_Init() in init function and
|
||||
call RT28xx_ApCli_Remove() in close function
|
||||
|
||||
2. MAC of ApCli-interface is initialized in RT28xx_ApCli_Init()
|
||||
|
||||
3. ApCli index (0) of different rx packet is got in
|
||||
|
||||
4. ApCli index (0) of different tx packet is assigned in
|
||||
|
||||
5. ApCli index (0) of different interface is got in APHardTransmit() by using
|
||||
|
||||
6. ApCli index (0) of IOCTL command is put in pAd->OS_Cookie->ioctl_if
|
||||
|
||||
8. The number of ApCli only can be 1
|
||||
|
||||
9. apcli convert engine subroutines, we should just take care data packet.
|
||||
Revision History:
|
||||
Who When What
|
||||
-------------- ---------- ----------------------------------------------
|
||||
Shiang, Fonchi 02-13-2007 created
|
||||
*/
|
||||
#define RTMP_MODULE_OS
|
||||
|
||||
#ifdef APCLI_SUPPORT
|
||||
|
||||
/*#include "rt_config.h" */
|
||||
#include "rtmp_comm.h"
|
||||
#include "rt_os_util.h"
|
||||
#include "rt_os_net.h"
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Init AP-Client function.
|
||||
|
||||
Arguments:
|
||||
pAd points to our adapter
|
||||
main_dev_p points to the main BSS network interface
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
1. Only create and initialize virtual network interfaces.
|
||||
2. No main network interface here.
|
||||
========================================================================
|
||||
*/
|
||||
VOID RT28xx_ApCli_Init(VOID *pAd, PNET_DEV main_dev_p)
|
||||
{
|
||||
RTMP_OS_NETDEV_OP_HOOK netDevOpHook;
|
||||
|
||||
/* init operation functions */
|
||||
NdisZeroMemory(&netDevOpHook, sizeof(RTMP_OS_NETDEV_OP_HOOK));
|
||||
netDevOpHook.open = ApCli_VirtualIF_Open;
|
||||
netDevOpHook.stop = ApCli_VirtualIF_Close;
|
||||
netDevOpHook.xmit = rt28xx_send_packets;
|
||||
netDevOpHook.ioctl = rt28xx_ioctl;
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_APC_INIT,
|
||||
0, &netDevOpHook, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Open a virtual network interface.
|
||||
|
||||
Arguments:
|
||||
dev_p which WLAN network interface
|
||||
|
||||
Return Value:
|
||||
0: open successfully
|
||||
otherwise: open fail
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT ApCli_VirtualIF_Open(PNET_DEV dev_p)
|
||||
{
|
||||
VOID *pAd;
|
||||
|
||||
/* increase MODULE use count */
|
||||
RT_MOD_INC_USE_COUNT();
|
||||
|
||||
pAd = RTMP_OS_NETDEV_GET_PRIV(dev_p);
|
||||
ASSERT(pAd);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s: ===> %s\n", __FUNCTION__, RTMP_OS_NETDEV_GET_DEVNAME(dev_p)));
|
||||
|
||||
if (VIRTUAL_IF_UP(pAd) != 0)
|
||||
return -1;
|
||||
|
||||
#ifdef CONFIG_RA_HW_NAT_WIFI_NEW_ARCH
|
||||
RT_MOD_HNAT_REG(dev_p);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_APC_OPEN, 0, dev_p, 0);
|
||||
|
||||
#ifdef MTFWD
|
||||
RTMP_OS_NETDEV_CARRIER_OFF(dev_p);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Close a virtual network interface.
|
||||
|
||||
Arguments:
|
||||
dev_p which WLAN network interface
|
||||
|
||||
Return Value:
|
||||
0: close successfully
|
||||
otherwise: close fail
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT ApCli_VirtualIF_Close(PNET_DEV dev_p)
|
||||
{
|
||||
VOID *pAd;
|
||||
|
||||
pAd = RTMP_OS_NETDEV_GET_PRIV(dev_p);
|
||||
ASSERT(pAd);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s: ===> %s\n", __FUNCTION__, RTMP_OS_NETDEV_GET_DEVNAME(dev_p)));
|
||||
|
||||
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_APC_CLOSE, 0, dev_p, 0);
|
||||
|
||||
#ifdef CONFIG_RA_HW_NAT_WIFI_NEW_ARCH
|
||||
RT_MOD_HNAT_DEREG(dev_p);
|
||||
#endif
|
||||
|
||||
VIRTUAL_IF_DOWN(pAd);
|
||||
|
||||
RT_MOD_DEC_USE_COUNT();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Remove ApCli-BSS network interface.
|
||||
|
||||
Arguments:
|
||||
pAd points to our adapter
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
VOID RT28xx_ApCli_Remove(VOID *pAd)
|
||||
{
|
||||
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_APC_REMOVE, 0, NULL, 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif /* APCLI_SUPPORT */
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Loaded 100 of 1955 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user