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
1ac3f123
Commit
1ac3f123
authored
Jan 02, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flush ipfw when captiveportal is disabled
parent
f3d9e10b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
11 deletions
+37
-11
CPClient.php
...nsense/mvc/app/models/OPNsense/CaptivePortal/CPClient.php
+36
-9
Rules.php
src/opnsense/mvc/app/models/OPNsense/CaptivePortal/Rules.php
+1
-2
No files found.
src/opnsense/mvc/app/models/OPNsense/CaptivePortal/CPClient.php
View file @
1ac3f123
...
...
@@ -152,6 +152,27 @@ class CPClient {
}
}
/**
* check if captiveportal is enabled (traverse zones, if none active return false )
* @return bool
*/
public
function
isEnabled
()
{
$enabled_zones
=
0
;
foreach
(
$this
->
config
->
object
()
->
captiveportal
->
children
()
as
$cpzonename
=>
$zone
)
{
if
(
isset
(
$zone
->
enable
))
{
$enabled_zones
++
;
}
}
if
(
$enabled_zones
>
0
)
{
return
true
;
}
else
{
return
false
;
}
}
/**
*
* @param $zoneid
...
...
@@ -255,18 +276,24 @@ class CPClient {
/**
* Reconfigure zones ( generate and load ruleset )
*/
public
function
reconfigure
(){
$ruleset_filename
=
\Phalcon\DI\FactoryDefault
::
getDefault
()
->
get
(
'config'
)
->
globals
->
temp_path
.
"/ipfw.rules"
;
$this
->
rules
->
generate
(
$ruleset_filename
);
public
function
reconfigure
()
{
if
(
$this
->
isEnabled
()
)
{
$ruleset_filename
=
\Phalcon\DI\FactoryDefault
::
getDefault
()
->
get
(
'config'
)
->
globals
->
temp_path
.
"/ipfw.rules"
;
$this
->
rules
->
generate
(
$ruleset_filename
);
// load ruleset
$this
->
shell
->
exec
(
"/sbin/ipfw -f "
.
$ruleset_filename
);
// load ruleset
$this
->
shell
->
exec
(
"/sbin/ipfw -f "
.
$ruleset_filename
);
// update tables
$this
->
update
();
// update tables
$this
->
update
();
// after reinit all accounting rules are vanished, reapply them for active sessions
$this
->
loadAccounting
();
// after reinit all accounting rules are vanished, reapply them for active sessions
$this
->
loadAccounting
();
}
else
{
// captiveportal is disabled, flush all rules to be sure
$this
->
shell
->
exec
(
"/sbin/ipfw -f flush"
);
}
}
/**
...
...
src/opnsense/mvc/app/models/OPNsense/CaptivePortal/Rules.php
View file @
1ac3f123
...
...
@@ -293,8 +293,7 @@ class Rules {
$this
->
rules
[]
=
"add 65534 deny all from any to any"
;
}
/**
* load ruleset
*/
...
...
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