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
Show 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 {
...
@@ -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
* @param $zoneid
...
@@ -255,7 +276,9 @@ class CPClient {
...
@@ -255,7 +276,9 @@ class CPClient {
/**
/**
* Reconfigure zones ( generate and load ruleset )
* Reconfigure zones ( generate and load ruleset )
*/
*/
public
function
reconfigure
(){
public
function
reconfigure
()
{
if
(
$this
->
isEnabled
()
)
{
$ruleset_filename
=
\Phalcon\DI\FactoryDefault
::
getDefault
()
->
get
(
'config'
)
->
globals
->
temp_path
.
"/ipfw.rules"
;
$ruleset_filename
=
\Phalcon\DI\FactoryDefault
::
getDefault
()
->
get
(
'config'
)
->
globals
->
temp_path
.
"/ipfw.rules"
;
$this
->
rules
->
generate
(
$ruleset_filename
);
$this
->
rules
->
generate
(
$ruleset_filename
);
...
@@ -267,6 +290,10 @@ class CPClient {
...
@@ -267,6 +290,10 @@ class CPClient {
// after reinit all accounting rules are vanished, reapply them for active sessions
// after reinit all accounting rules are vanished, reapply them for active sessions
$this
->
loadAccounting
();
$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
...
@@ -294,7 +294,6 @@ class Rules {
...
@@ -294,7 +294,6 @@ class Rules {
}
}
/**
/**
* load ruleset
* 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