Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mirrors
openwrt
luci
提交
185eacba
L
luci
项目概览
mirrors
/
openwrt
/
luci
大约 1 年 前同步成功
通知
43
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
luci
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
185eacba
编写于
10月 30, 2010
作者:
J
Jo-Philipp Wich
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modules/admin-full: convert cbi maps to new network model
上级
ba84656d
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
364 addition
and
361 deletion
+364
-361
modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua
modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua
+14
-1
modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
+343
-351
modules/admin-full/luasrc/model/cbi/admin_network/wifi_add.lua
...es/admin-full/luasrc/model/cbi/admin_network/wifi_add.lua
+7
-9
未找到文件。
modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua
浏览文件 @
185eacba
...
...
@@ -34,6 +34,11 @@ m:chain("wireless")
nw
.
init
(
m
.
uci
)
fw
.
init
(
m
.
uci
)
--function m.on_commit(map)
-- nw.init(map.uci)
-- fw.init(map.uci)
--end
s
=
m
:
section
(
NamedSection
,
arg
[
1
],
"interface"
,
translate
(
"Common Configuration"
))
s
.
addremove
=
false
...
...
@@ -107,7 +112,15 @@ function ifname_single.write(self, s, val)
for
_
,
i
in
ipairs
(
n
:
get_interfaces
())
do
n
:
del_interface
(
i
)
end
n
:
add_interface
(
val
)
for
i
in
val
:
gmatch
(
"%S+"
)
do
n
:
add_interface
(
i
)
-- if this is not a bridge, only assign first interface
if
self
.
option
==
"ifname_single"
then
break
end
end
end
end
...
...
modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
浏览文件 @
185eacba
...
...
@@ -14,7 +14,6 @@ $Id$
local
wa
=
require
"luci.tools.webadmin"
local
nw
=
require
"luci.model.network"
local
ww
=
require
"luci.model.wireless"
local
fs
=
require
"nixio.fs"
arg
[
1
]
=
arg
[
1
]
or
""
...
...
@@ -31,19 +30,15 @@ m:chain("network")
local
ifsection
function
m
.
on_commit
(
map
)
nw
.
init
(
map
.
uci
)
ww
.
init
(
map
.
uci
)
local
wnet
=
ww
:
get_network
(
arg
[
2
])
local
wnet
=
nw
:
get_wifinet
(
arg
[
2
])
if
ifsection
and
wnet
then
ifsection
.
section
=
wnet
.
sid
end
end
nw
.
init
(
m
.
uci
)
ww
.
init
(
m
.
uci
)
local
wnet
=
ww
:
get_network
(
arg
[
2
])
local
wnet
=
nw
:
get_wifinet
(
arg
[
2
])
-- redirect to overview page if network does not exist anymore (e.g. after a revert)
if
not
wnet
then
...
...
@@ -51,7 +46,7 @@ if not wnet then
return
end
m
.
title
=
w
w
:
get_i18n
(
wnet
)
m
.
title
=
w
net
:
get_i18n
(
)
local
iw
=
luci
.
sys
.
wifi
.
getiwinfo
(
arg
[
1
])
...
...
@@ -276,40 +271,37 @@ end
----------------------- Interface -----------------------
local
wnet
=
ww
:
get_network
(
arg
[
2
])
if
wnet
then
s
=
m
:
section
(
NamedSection
,
wnet
.
sid
,
"wifi-iface"
,
translate
(
"Interface Configuration"
))
ifsection
=
s
s
.
addremove
=
false
s
.
anonymous
=
true
s
.
defaults
.
device
=
arg
[
1
]
s
=
m
:
section
(
NamedSection
,
wnet
.
sid
,
"wifi-iface"
,
translate
(
"Interface Configuration"
))
ifsection
=
s
s
.
addremove
=
false
s
.
anonymous
=
true
s
.
defaults
.
device
=
arg
[
1
]
s
:
tab
(
"general"
,
translate
(
"General Setup"
))
s
:
tab
(
"encryption"
,
translate
(
"Wireless Security"
))
s
:
tab
(
"macfilter"
,
translate
(
"MAC-Filter"
))
s
:
tab
(
"advanced"
,
translate
(
"Advanced Settings"
))
s
:
tab
(
"general"
,
translate
(
"General Setup"
))
s
:
tab
(
"encryption"
,
translate
(
"Wireless Security"
))
s
:
tab
(
"macfilter"
,
translate
(
"MAC-Filter"
))
s
:
tab
(
"advanced"
,
translate
(
"Advanced Settings"
))
s
:
taboption
(
"general"
,
Value
,
"ssid"
,
translate
(
"<abbr title=\"
Extended
Service
Set
Identifier
\
">ESSID</abbr>"
))
s
:
taboption
(
"general"
,
Value
,
"ssid"
,
translate
(
"<abbr title=\"
Extended
Service
Set
Identifier
\
">ESSID</abbr>"
))
mode
=
s
:
taboption
(
"general"
,
ListValue
,
"mode"
,
translate
(
"Mode"
))
mode
.
override_values
=
true
mode
:
value
(
"ap"
,
translate
(
"Access Point"
))
mode
:
value
(
"sta"
,
translate
(
"Client"
))
mode
:
value
(
"adhoc"
,
translate
(
"Ad-Hoc"
))
mode
=
s
:
taboption
(
"general"
,
ListValue
,
"mode"
,
translate
(
"Mode"
))
mode
.
override_values
=
true
mode
:
value
(
"ap"
,
translate
(
"Access Point"
))
mode
:
value
(
"sta"
,
translate
(
"Client"
))
mode
:
value
(
"adhoc"
,
translate
(
"Ad-Hoc"
))
bssid
=
s
:
taboption
(
"general"
,
Value
,
"bssid"
,
translate
(
"<abbr title=\"
Basic
Service
Set
Identifier
\
">BSSID</abbr>"
))
bssid
=
s
:
taboption
(
"general"
,
Value
,
"bssid"
,
translate
(
"<abbr title=\"
Basic
Service
Set
Identifier
\
">BSSID</abbr>"
))
network
=
s
:
taboption
(
"general"
,
Value
,
"network"
,
translate
(
"Network"
),
network
=
s
:
taboption
(
"general"
,
Value
,
"network"
,
translate
(
"Network"
),
translate
(
"Choose the network you want to attach to this wireless interface. "
..
"Select <em>unspecified</em> to not attach any network or fill out the "
..
"<em>create</em> field to define a new network."
))
network
.
rmempty
=
true
network
.
template
=
"cbi/network_netlist"
network
.
widget
=
"radio"
network
.
rmempty
=
true
network
.
template
=
"cbi/network_netlist"
network
.
widget
=
"radio"
function
network
.
write
(
self
,
section
,
value
)
function
network
.
write
(
self
,
section
,
value
)
local
i
=
nw
:
get_interface
(
section
)
if
i
then
if
value
==
'-'
then
...
...
@@ -329,11 +321,11 @@ if wnet then
end
end
end
end
end
-------------------- MAC80211 Interface ----------------------
-------------------- MAC80211 Interface ----------------------
if
hwtype
==
"mac80211"
then
if
hwtype
==
"mac80211"
then
if
fs
.
access
(
"/usr/sbin/iw"
)
then
mode
:
value
(
"mesh"
,
"802.11s"
)
end
...
...
@@ -377,13 +369,13 @@ if wnet then
hidden
=
s
:
taboption
(
"general"
,
Flag
,
"hidden"
,
translate
(
"Hide <abbr title=\"
Extended
Service
Set
Identifier
\
">ESSID</abbr>"
))
hidden
:
depends
({
mode
=
"ap"
})
hidden
:
depends
({
mode
=
"ap-wds"
})
end
end
-------------------- Madwifi Interface ----------------------
-------------------- Madwifi Interface ----------------------
if
hwtype
==
"atheros"
then
if
hwtype
==
"atheros"
then
mode
:
value
(
"ahdemo"
,
translate
(
"Pseudo Ad-Hoc (ahdemo)"
))
mode
:
value
(
"monitor"
,
translate
(
"Monitor"
))
mode
:
value
(
"ap-wds"
,
"%s (%s)"
%
{
translate
(
"Access Point"
),
translate
(
"WDS"
)})
...
...
@@ -468,12 +460,12 @@ if wnet then
local
probereq
=
s
:
taboption
(
"advanced"
,
Flag
,
"probereq"
,
translate
(
"Do not send probe responses"
))
probereq
.
enabled
=
"0"
probereq
.
disabled
=
"1"
end
end
-------------------- Broadcom Interface ----------------------
-------------------- Broadcom Interface ----------------------
if
hwtype
==
"broadcom"
then
if
hwtype
==
"broadcom"
then
mode
:
value
(
"wds"
,
translate
(
"WDS"
))
mode
:
value
(
"monitor"
,
translate
(
"Monitor"
))
...
...
@@ -491,12 +483,12 @@ if wnet then
bssid
:
depends
({
mode
=
"wds"
})
bssid
:
depends
({
mode
=
"adhoc"
})
end
end
----------------------- HostAP Interface ---------------------
----------------------- HostAP Interface ---------------------
if
hwtype
==
"prism2"
then
if
hwtype
==
"prism2"
then
mode
:
value
(
"wds"
,
translate
(
"WDS"
))
mode
:
value
(
"monitor"
,
translate
(
"Monitor"
))
...
...
@@ -518,27 +510,27 @@ if wnet then
s
:
taboption
(
"advanced"
,
Value
,
"rate"
,
translate
(
"Transmission Rate"
))
s
:
taboption
(
"advanced"
,
Value
,
"frag"
,
translate
(
"Fragmentation Threshold"
))
s
:
taboption
(
"advanced"
,
Value
,
"rts"
,
translate
(
"RTS/CTS Threshold"
))
end
end
------------------- WiFI-Encryption -------------------
------------------- WiFI-Encryption -------------------
encr
=
s
:
taboption
(
"encryption"
,
ListValue
,
"encryption"
,
translate
(
"Encryption"
))
encr
.
override_values
=
true
encr
.
override_depends
=
true
encr
:
depends
({
mode
=
"ap"
})
encr
:
depends
({
mode
=
"sta"
})
encr
:
depends
({
mode
=
"adhoc"
})
encr
:
depends
({
mode
=
"ahdemo"
})
encr
:
depends
({
mode
=
"ap-wds"
})
encr
:
depends
({
mode
=
"sta-wds"
})
encr
:
depends
({
mode
=
"mesh"
})
encr
=
s
:
taboption
(
"encryption"
,
ListValue
,
"encryption"
,
translate
(
"Encryption"
))
encr
.
override_values
=
true
encr
.
override_depends
=
true
encr
:
depends
({
mode
=
"ap"
})
encr
:
depends
({
mode
=
"sta"
})
encr
:
depends
({
mode
=
"adhoc"
})
encr
:
depends
({
mode
=
"ahdemo"
})
encr
:
depends
({
mode
=
"ap-wds"
})
encr
:
depends
({
mode
=
"sta-wds"
})
encr
:
depends
({
mode
=
"mesh"
})
encr
:
value
(
"none"
,
"No Encryption"
)
encr
:
value
(
"wep-open"
,
translate
(
"WEP Open System"
),
{
mode
=
"ap"
},
{
mode
=
"sta"
},
{
mode
=
"ap-wds"
},
{
mode
=
"sta-wds"
})
encr
:
value
(
"wep-shared"
,
translate
(
"WEP Shared Key"
),
{
mode
=
"ap"
},
{
mode
=
"sta"
},
{
mode
=
"ap-wds"
},
{
mode
=
"sta-wds"
})
encr
:
value
(
"none"
,
"No Encryption"
)
encr
:
value
(
"wep-open"
,
translate
(
"WEP Open System"
),
{
mode
=
"ap"
},
{
mode
=
"sta"
},
{
mode
=
"ap-wds"
},
{
mode
=
"sta-wds"
})
encr
:
value
(
"wep-shared"
,
translate
(
"WEP Shared Key"
),
{
mode
=
"ap"
},
{
mode
=
"sta"
},
{
mode
=
"ap-wds"
},
{
mode
=
"sta-wds"
})
if
hwtype
==
"atheros"
or
hwtype
==
"mac80211"
or
hwtype
==
"prism2"
then
if
hwtype
==
"atheros"
or
hwtype
==
"mac80211"
or
hwtype
==
"prism2"
then
local
supplicant
=
fs
.
access
(
"/usr/sbin/wpa_supplicant"
)
local
hostapd
=
fs
.
access
(
"/usr/sbin/hostapd"
)
...
...
@@ -574,46 +566,47 @@ if wnet then
"and ad-hoc mode) to be installed."
)
end
elseif
hwtype
==
"broadcom"
then
elseif
hwtype
==
"broadcom"
then
encr
:
value
(
"psk"
,
"WPA-PSK"
)
encr
:
value
(
"psk2"
,
"WPA2-PSK"
)
encr
:
value
(
"psk+psk2"
,
"WPA-PSK/WPA2-PSK Mixed Mode"
)
end
end
encr
:
depends
(
"mode"
,
"ap"
)
encr
:
depends
(
"mode"
,
"sta"
)
encr
:
depends
(
"mode"
,
"ap-wds"
)
encr
:
depends
(
"mode"
,
"sta-wds"
)
encr
:
depends
(
"mode"
,
"wds"
)
server
=
s
:
taboption
(
"encryption"
,
Value
,
"server"
,
translate
(
"Radius-Server"
))
server
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa"
})
server
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa2"
})
server
:
depends
({
mode
=
"ap-wds"
,
encryption
=
"wpa"
})
server
:
depends
({
mode
=
"ap-wds"
,
encryption
=
"wpa2"
})
server
.
rmempty
=
true
port
=
s
:
taboption
(
"encryption"
,
Value
,
"port"
,
translate
(
"Radius-Port"
))
port
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa"
})
port
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa2"
})
port
:
depends
({
mode
=
"ap-wds"
,
encryption
=
"wpa"
})
port
:
depends
({
mode
=
"ap-wds"
,
encryption
=
"wpa2"
})
port
.
rmempty
=
true
key
=
s
:
taboption
(
"encryption"
,
Value
,
"key"
,
translate
(
"Key"
))
key
:
depends
(
"encryption"
,
"wep"
)
key
:
depends
(
"encryption"
,
"psk"
)
key
:
depends
(
"encryption"
,
"psk2"
)
key
:
depends
(
"encryption"
,
"psk+psk2"
)
key
:
depends
(
"encryption"
,
"psk-mixed"
)
key
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa"
})
key
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa2"
})
key
:
depends
({
mode
=
"ap-wds"
,
encryption
=
"wpa"
})
key
:
depends
({
mode
=
"ap-wds"
,
encryption
=
"wpa2"
})
key
.
rmempty
=
true
key
.
password
=
true
if
hwtype
==
"atheros"
or
hwtype
==
"mac80211"
or
hwtype
==
"prism2"
then
encr
:
depends
(
"mode"
,
"ap"
)
encr
:
depends
(
"mode"
,
"sta"
)
encr
:
depends
(
"mode"
,
"ap-wds"
)
encr
:
depends
(
"mode"
,
"sta-wds"
)
encr
:
depends
(
"mode"
,
"wds"
)
server
=
s
:
taboption
(
"encryption"
,
Value
,
"server"
,
translate
(
"Radius-Server"
))
server
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa"
})
server
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa2"
})
server
:
depends
({
mode
=
"ap-wds"
,
encryption
=
"wpa"
})
server
:
depends
({
mode
=
"ap-wds"
,
encryption
=
"wpa2"
})
server
.
rmempty
=
true
port
=
s
:
taboption
(
"encryption"
,
Value
,
"port"
,
translate
(
"Radius-Port"
))
port
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa"
})
port
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa2"
})
port
:
depends
({
mode
=
"ap-wds"
,
encryption
=
"wpa"
})
port
:
depends
({
mode
=
"ap-wds"
,
encryption
=
"wpa2"
})
port
.
rmempty
=
true
key
=
s
:
taboption
(
"encryption"
,
Value
,
"key"
,
translate
(
"Key"
))
key
:
depends
(
"encryption"
,
"wep-open"
)
key
:
depends
(
"encryption"
,
"wep-shared"
)
key
:
depends
(
"encryption"
,
"psk"
)
key
:
depends
(
"encryption"
,
"psk2"
)
key
:
depends
(
"encryption"
,
"psk+psk2"
)
key
:
depends
(
"encryption"
,
"psk-mixed"
)
key
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa"
})
key
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa2"
})
key
:
depends
({
mode
=
"ap-wds"
,
encryption
=
"wpa"
})
key
:
depends
({
mode
=
"ap-wds"
,
encryption
=
"wpa2"
})
key
.
rmempty
=
true
key
.
password
=
true
if
hwtype
==
"atheros"
or
hwtype
==
"mac80211"
or
hwtype
==
"prism2"
then
nasid
=
s
:
taboption
(
"encryption"
,
Value
,
"nasid"
,
translate
(
"NAS ID"
))
nasid
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa"
})
nasid
:
depends
({
mode
=
"ap"
,
encryption
=
"wpa2"
})
...
...
@@ -663,7 +656,6 @@ if wnet then
password
:
depends
({
mode
=
"sta"
,
eap_type
=
"peap"
,
encryption
=
"wpa"
})
password
:
depends
({
mode
=
"sta"
,
eap_type
=
"ttls"
,
encryption
=
"wpa2"
})
password
:
depends
({
mode
=
"sta"
,
eap_type
=
"ttls"
,
encryption
=
"wpa"
})
end
end
return
m
modules/admin-full/luasrc/model/cbi/admin_network/wifi_add.lua
浏览文件 @
185eacba
...
...
@@ -14,7 +14,6 @@ $Id$
local
nw
=
require
"luci.model.network"
local
fw
=
require
"luci.model.firewall"
local
wl
=
require
"luci.model.wireless"
local
uci
=
require
"luci.model.uci"
.
cursor
()
local
http
=
require
"luci.http"
...
...
@@ -34,7 +33,6 @@ end
nw
.
init
(
uci
)
fw
.
init
(
uci
)
wl
.
init
(
uci
)
m
.
hidden
=
{
device
=
http
.
formvalue
(
"device"
),
...
...
@@ -145,14 +143,15 @@ function attachnet.parse(self, section)
if
not
net
then
self
.
error
=
{
[
section
]
=
"missing"
}
else
local
wdev
=
wl
:
get_device
(
m
.
hidden
.
device
)
wdev
:
disabled
(
false
)
wdev
:
channel
(
m
.
hidden
.
channel
)
local
wdev
=
nw
:
get_wifidev
(
m
.
hidden
.
device
)
wdev
:
set
(
"disabled"
,
false
)
wdev
:
set
(
"channel"
,
m
.
hidden
.
channel
)
if
replace
:
formvalue
(
section
)
then
local
n
for
_
,
n
in
ipairs
(
wdev
:
get_
network
s
())
do
w
l
:
del_network
(
n
:
name
()
)
for
_
,
n
in
ipairs
(
wdev
:
get_
wifinet
s
())
do
w
dev
:
del_wifinet
(
n
)
end
end
...
...
@@ -177,8 +176,7 @@ function attachnet.parse(self, section)
wconf
.
bssid
=
m
.
hidden
.
bssid
end
local
wnet
=
wl
:
add_network
(
wconf
)
local
wnet
=
wdev
:
add_wifinet
(
wconf
)
if
wnet
then
if
zone
then
fw
:
del_network
(
net
:
name
())
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录