Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
1b899db5
Commit
1b899db5
authored
Aug 27, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whitespace firewall_rules_edit.php
parent
86b7b77c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
33 deletions
+32
-33
firewall_rules_edit.php
src/www/firewall_rules_edit.php
+32
-33
No files found.
src/www/firewall_rules_edit.php
View file @
1b899db5
...
...
@@ -71,41 +71,40 @@ function formInterfaces() {
* fetch list of selectable networks to use in form
*/
function
formNetworks
()
{
$networks
=
array
();
$networks
[
"any"
]
=
gettext
(
"any"
);
$networks
[
"pptp"
]
=
gettext
(
"PPTP clients"
);
$networks
[
"pppoe"
]
=
gettext
(
"PPPoE clients"
);
$networks
[
"l2tp"
]
=
gettext
(
"L2TP clients"
);
foreach
(
get_configured_interface_with_descr
()
as
$ifent
=>
$ifdesc
)
{
$networks
[
$ifent
]
=
htmlspecialchars
(
$ifdesc
)
.
" "
.
gettext
(
"net"
);
$networks
[
$ifent
.
"ip"
]
=
htmlspecialchars
(
$ifdesc
)
.
" "
.
gettext
(
"address"
);
}
return
$networks
;
$networks
=
array
();
$networks
[
"any"
]
=
gettext
(
"any"
);
$networks
[
"pptp"
]
=
gettext
(
"PPTP clients"
);
$networks
[
"pppoe"
]
=
gettext
(
"PPPoE clients"
);
$networks
[
"l2tp"
]
=
gettext
(
"L2TP clients"
);
foreach
(
get_configured_interface_with_descr
()
as
$ifent
=>
$ifdesc
)
{
$networks
[
$ifent
]
=
htmlspecialchars
(
$ifdesc
)
.
" "
.
gettext
(
"net"
);
$networks
[
$ifent
.
"ip"
]
=
htmlspecialchars
(
$ifdesc
)
.
" "
.
gettext
(
"address"
);
}
return
$networks
;
}
/**
* check if advanced options are set on selected element
*/
function
FormSetAdvancedOptions
(
&
$item
)
{
foreach
(
array
(
"max"
,
"max-src-nodes"
,
"max-src-conn"
,
"max-src-states"
,
"nopfsync"
,
"statetimeout"
,
"max-src-conn-rate"
,
"max-src-conn-rates"
,
"tag"
,
"tagged"
,
"allowopts"
,
"disablereplyto"
,
"tcpflags1"
,
"tcpflags2"
)
as
$fieldname
)
{
if
(
!
empty
(
$item
[
$fieldname
]))
{
return
true
;
}
}
if
(
!
empty
(
$item
[
"statetype"
])
&&
$item
[
"statetype"
]
!=
'keep state'
)
{
return
true
;
}
return
false
;
foreach
(
array
(
"max"
,
"max-src-nodes"
,
"max-src-conn"
,
"max-src-states"
,
"nopfsync"
,
"statetimeout"
,
"max-src-conn-rate"
,
"max-src-conn-rates"
,
"tag"
,
"tagged"
,
"allowopts"
,
"disablereplyto"
,
"tcpflags1"
,
"tcpflags2"
)
as
$fieldname
)
{
if
(
!
empty
(
$item
[
$fieldname
]))
{
return
true
;
}
}
if
(
!
empty
(
$item
[
"statetype"
])
&&
$item
[
"statetype"
]
!=
'keep state'
)
{
return
true
;
}
return
false
;
}
function
is_posnumericint
(
$arg
)
{
// Note that to be safe we do not allow any leading zero - "01", "007"
return
(
is_numericint
(
$arg
)
&&
$arg
[
0
]
!=
'0'
&&
$arg
>
0
);
// Note that to be safe we do not allow any leading zero - "01", "007"
return
(
is_numericint
(
$arg
)
&&
$arg
[
0
]
!=
'0'
&&
$arg
>
0
);
}
...
...
@@ -117,12 +116,12 @@ function is_posnumericint($arg) {
$specialsrcdst
=
explode
(
" "
,
"any (self) pptp pppoe l2tp openvpn"
);
$ifdisp
=
get_configured_interface_with_descr
();
foreach
(
$ifdisp
as
$kif
=>
$kdescr
)
{
$specialsrcdst
[]
=
"
{
$kif
}
"
;
$specialsrcdst
[]
=
"
{
$kif
}
ip"
;
$specialsrcdst
[]
=
"
{
$kif
}
"
;
$specialsrcdst
[]
=
"
{
$kif
}
ip"
;
}
if
(
!
isset
(
$config
[
'filter'
][
'rule'
]))
{
$config
[
'filter'
][
'rule'
]
=
array
();
$config
[
'filter'
][
'rule'
]
=
array
();
}
$a_filter
=
&
$config
[
'filter'
][
'rule'
];
...
...
@@ -205,9 +204,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$outoftcpflags
=
array
();
foreach
(
$tcpflags
as
$tcpflag
)
{
if
(
isset
(
$pconfig
[
'tcpflags1_'
.
$tcpflag
])
&&
$pconfig
[
'tcpflags1_'
.
$tcpflag
]
==
"on"
)
$settcpflags
[]
=
$tcpflag
;
$settcpflags
[]
=
$tcpflag
;
if
(
isset
(
$pconfig
[
'tcpflags2_'
.
$tcpflag
])
&&
$pconfig
[
'tcpflags2_'
.
$tcpflag
]
==
"on"
)
$outoftcpflags
[]
=
$tcpflag
;
$outoftcpflags
[]
=
$tcpflag
;
}
// flags should be set within
if
(
!
empty
(
$outoftcpflags
))
{
...
...
@@ -302,11 +301,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
if
((
is_ipaddr
(
$pconfig
[
'src'
])
&&
is_ipaddr
(
$pconfig
[
'dst'
])))
{
if
(
!
validate_address_family
(
$pconfig
[
'src'
],
$pconfig
[
'dst'
]))
$input_errors
[]
=
sprintf
(
gettext
(
"The Source IP address %s Address Family differs from the destination %s."
),
$pconfig
[
'src'
],
$pconfig
[
'dst'
]);
$input_errors
[]
=
sprintf
(
gettext
(
"The Source IP address %s Address Family differs from the destination %s."
),
$pconfig
[
'src'
],
$pconfig
[
'dst'
]);
if
((
is_ipaddrv6
(
$pconfig
[
'src'
])
||
is_ipaddrv6
(
$pconfig
[
'dst'
]))
&&
(
$pconfig
[
'ipprotocol'
]
==
"inet"
))
$input_errors
[]
=
gettext
(
"You can not use IPv6 addresses in IPv4 rules."
);
$input_errors
[]
=
gettext
(
"You can not use IPv6 addresses in IPv4 rules."
);
if
((
is_ipaddrv4
(
$pconfig
[
'src'
])
||
is_ipaddrv4
(
$pconfig
[
'dst'
]))
&&
(
$pconfig
[
'ipprotocol'
]
==
"inet6"
))
$input_errors
[]
=
gettext
(
"You can not use IPv4 addresses in IPv6 rules."
);
$input_errors
[]
=
gettext
(
"You can not use IPv4 addresses in IPv6 rules."
);
}
if
(
is_ipaddrv4
(
$pconfig
[
'src'
])
&&
$pconfig
[
'srcmask'
]
>
32
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment