Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mirrors
openwrt
luci
提交
bb2d7517
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,发现更多精彩内容 >>
提交
bb2d7517
编写于
4月 13, 2011
作者:
M
Manuel Munz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
luci-firewall: Add support for negations for ip addresses/nets (#218)
上级
5a1e9354
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
30 addition
and
6 deletion
+30
-6
applications/luci-firewall/luasrc/model/cbi/luci_fw/rrule.lua
...ications/luci-firewall/luasrc/model/cbi/luci_fw/rrule.lua
+1
-1
applications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua
...ications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua
+2
-2
applications/luci-firewall/luasrc/model/cbi/luci_fw/zone.lua
applications/luci-firewall/luasrc/model/cbi/luci_fw/zone.lua
+2
-2
libs/web/htdocs/luci-static/resources/cbi.js
libs/web/htdocs/luci-static/resources/cbi.js
+10
-0
libs/web/luasrc/cbi/datatypes.lua
libs/web/luasrc/cbi/datatypes.lua
+15
-1
未找到文件。
applications/luci-firewall/luasrc/model/cbi/luci_fw/rrule.lua
浏览文件 @
bb2d7517
...
...
@@ -121,7 +121,7 @@ src_mac.placeholder = translate("any")
src_ip
=
s
:
taboption
(
"advanced"
,
Value
,
"src_ip"
,
translate
(
"Source IP address"
))
src_ip
.
optional
=
true
src_ip
.
datatype
=
"ip4addr"
src_ip
.
datatype
=
"
neg_
ip4addr"
src_ip
.
placeholder
=
translate
(
"any"
)
sport
=
s
:
taboption
(
"advanced"
,
Value
,
"src_port"
,
translate
(
"Source port"
),
...
...
applications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua
浏览文件 @
bb2d7517
...
...
@@ -106,7 +106,7 @@ icmpt:value("address-mask-reply")
src_ip
=
s
:
taboption
(
"general"
,
Value
,
"src_ip"
,
translate
(
"Source address"
))
src_ip
.
optional
=
true
src_ip
.
datatype
=
has_v2
and
"
ipaddr"
or
"
ip4addr"
src_ip
.
datatype
=
has_v2
and
"
neg_ipaddr"
or
"neg_
ip4addr"
src_ip
.
placeholder
=
translate
(
"any"
)
sport
=
s
:
taboption
(
"general"
,
Value
,
"src_port"
,
translate
(
"Source port"
))
...
...
@@ -119,7 +119,7 @@ sport:depends("proto", "tcpudp")
dest_ip
=
s
:
taboption
(
"general"
,
Value
,
"dest_ip"
,
translate
(
"Destination address"
))
dest_ip
.
optional
=
true
dest_ip
.
datatype
=
has_v2
and
"
ipaddr"
or
"
ip4addr"
dest_ip
.
datatype
=
has_v2
and
"
neg_ipaddr"
or
"neg_
ip4addr"
dest_ip
.
placeholder
=
translate
(
"any"
)
dport
=
s
:
taboption
(
"general"
,
Value
,
"dest_port"
,
translate
(
"Destination port"
))
...
...
applications/luci-firewall/luasrc/model/cbi/luci_fw/zone.lua
浏览文件 @
bb2d7517
...
...
@@ -129,7 +129,7 @@ msrc = s:taboption("advanced", DynamicList, "masq_src",
translate
(
"Restrict Masquerading to given source subnets"
))
msrc
.
optional
=
true
msrc
.
datatype
=
"ip4addr"
msrc
.
datatype
=
"
neg_
ip4addr"
msrc
.
placeholder
=
"0.0.0.0/0"
msrc
:
depends
(
"family"
,
""
)
msrc
:
depends
(
"family"
,
"ipv4"
)
...
...
@@ -138,7 +138,7 @@ mdest = s:taboption("advanced", DynamicList, "masq_dest",
translate
(
"Restrict Masquerading to given destination subnets"
))
mdest
.
optional
=
true
mdest
.
datatype
=
"ip4addr"
mdest
.
datatype
=
"
neg_
ip4addr"
mdest
.
placeholder
=
"0.0.0.0/0"
mdest
:
depends
(
"family"
,
""
)
mdest
:
depends
(
"family"
,
"ipv4"
)
...
...
libs/web/htdocs/luci-static/resources/cbi.js
浏览文件 @
bb2d7517
...
...
@@ -42,6 +42,11 @@ var cbi_validators = {
return
cbi_validators
.
ip4addr
(
v
)
||
cbi_validators
.
ip6addr
(
v
);
},
'
neg_ipaddr
'
:
function
(
v
)
{
return
cbi_validators
.
ip4addr
(
v
.
replace
(
/^
\s
*!/
,
""
))
||
cbi_validators
.
ip6addr
(
v
.
replace
(
/^
\s
*!/
,
""
));
},
'
ip4addr
'
:
function
(
v
)
{
if
(
v
.
match
(
/^
(\d
+
)\.(\d
+
)\.(\d
+
)\.(\d
+
)(\/(\d
+
))?
$/
)
)
...
...
@@ -57,6 +62,11 @@ var cbi_validators = {
return
false
;
},
'
neg_ip4addr
'
:
function
(
v
)
{
return
cbi_validators
.
ip4addr
(
v
.
replace
(
/^
\s
*!/
,
""
));
},
'
ip6addr
'
:
function
(
v
)
{
if
(
v
.
match
(
/^
([
a-fA-F0-9:.
]
+
)(\/(\d
+
))?
$/
)
)
...
...
libs/web/luasrc/cbi/datatypes.lua
浏览文件 @
bb2d7517
...
...
@@ -17,8 +17,8 @@ local fs = require "nixio.fs"
local
ip
=
require
"luci.ip"
local
math
=
require
"math"
local
util
=
require
"luci.util"
local
tonumber
,
type
=
tonumber
,
type
local
tonumber
=
tonumber
module
"luci.cbi.datatypes"
...
...
@@ -66,6 +66,13 @@ function ipaddr(val)
return
ip4addr
(
val
)
or
ip6addr
(
val
)
end
function
neg_ipaddr
(
v
)
if
type
(
v
)
==
"string"
then
v
=
v
:
gsub
(
"^%s*!"
,
""
)
end
return
v
and
ipaddr
(
v
)
end
function
ip4addr
(
val
)
if
val
then
return
ip
.
IPv4
(
val
)
and
true
or
false
...
...
@@ -74,6 +81,13 @@ function ip4addr(val)
return
false
end
function
neg_ip4addr
(
v
)
if
type
(
v
)
==
"string"
then
v
=
v
:
gsub
(
"^%s*!"
,
""
)
end
return
v
and
ip4addr
(
v
)
end
function
ip4prefix
(
val
)
val
=
tonumber
(
val
)
return
(
val
and
val
>=
0
and
val
<=
32
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录