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
de5376b8
Commit
de5376b8
authored
Mar 30, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove some unused captive_portal code
parent
5fa5cbb8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
109 deletions
+0
-109
captiveportal.inc
src/etc/inc/captiveportal.inc
+0
-109
No files found.
src/etc/inc/captiveportal.inc
View file @
de5376b8
...
...
@@ -1184,116 +1184,7 @@ function captiveportal_free_dn_ruleno($ruleno) {
unlock
(
$cpruleslck
);
}
function
captiveportal_get_dn_passthru_ruleno
(
$value
)
{
global
$config
,
$g
,
$cpzone
,
$cpzoneid
;
$cpcfg
=
$config
[
'captiveportal'
][
$cpzone
];
if
(
!
isset
(
$cpcfg
[
'enable'
]))
return
NULL
;
$cpruleslck
=
lock
(
"captiveportalrulesdn"
,
LOCK_EX
);
$ruleno
=
NULL
;
if
(
file_exists
(
"
{
$g
[
'vardb_path'
]
}
/captiveportaldn.rules"
))
{
$rules
=
unserialize
(
file_get_contents
(
"
{
$g
[
'vardb_path'
]
}
/captiveportaldn.rules"
));
unset
(
$output
);
$_gb
=
exec
(
"/sbin/ipfw show | /usr/bin/grep "
.
escapeshellarg
(
$value
)
.
" | /usr/bin/grep -v grep | /usr/bin/awk '{print $5}' | /usr/bin/head -n 1"
,
$output
);
$ruleno
=
intval
(
$output
[
0
]);
if
(
!
$rules
[
$ruleno
])
$ruleno
=
NULL
;
unset
(
$rules
);
}
unlock
(
$cpruleslck
);
return
$ruleno
;
}
/*
* This function will calculate the lowest free firewall ruleno
* within the range specified based on the actual logged on users
*
*/
function
captiveportal_get_next_ipfw_ruleno
(
$rulenos_start
=
2
,
$rulenos_range_max
=
64500
)
{
global
$config
,
$g
,
$cpzone
;
$cpcfg
=
$config
[
'captiveportal'
][
$cpzone
];
if
(
!
isset
(
$cpcfg
[
'enable'
]))
return
NULL
;
$cpruleslck
=
lock
(
"captiveportalrules
{
$cpzone
}
"
,
LOCK_EX
);
$ruleno
=
0
;
if
(
file_exists
(
"
{
$g
[
'vardb_path'
]
}
/captiveportal_
{
$cpzone
}
.rules"
))
{
$rules
=
unserialize
(
file_get_contents
(
"
{
$g
[
'vardb_path'
]
}
/captiveportal_
{
$cpzone
}
.rules"
));
$ridx
=
$rulenos_start
;
while
(
$ridx
<
$rulenos_range_max
)
{
if
(
empty
(
$rules
[
$ridx
]))
{
$ruleno
=
$ridx
;
$rules
[
$ridx
]
=
$cpzone
;
$ridx
++
;
$rules
[
$ridx
]
=
$cpzone
;
break
;
}
else
{
/*
* This allows our traffic shaping pipes to be the in pipe the same as ruleno
* and the out pipe ruleno + 1.
*/
$ridx
+=
2
;
}
}
}
else
{
$rules
=
array_pad
(
array
(),
$rulenos_range_max
,
false
);
$ruleno
=
$rulenos_start
;
$rules
[
$rulenos_start
]
=
$cpzone
;
$rulenos_start
++
;
$rules
[
$rulenos_start
]
=
$cpzone
;
}
file_put_contents
(
"
{
$g
[
'vardb_path'
]
}
/captiveportal_
{
$cpzone
}
.rules"
,
serialize
(
$rules
));
unlock
(
$cpruleslck
);
unset
(
$rules
);
return
$ruleno
;
}
function
captiveportal_free_ipfw_ruleno
(
$ruleno
)
{
global
$config
,
$g
,
$cpzone
;
$cpcfg
=
$config
[
'captiveportal'
][
$cpzone
];
if
(
!
isset
(
$cpcfg
[
'enable'
]))
return
NULL
;
$cpruleslck
=
lock
(
"captiveportalrules
{
$cpzone
}
"
,
LOCK_EX
);
if
(
file_exists
(
"
{
$g
[
'vardb_path'
]
}
/captiveportal_
{
$cpzone
}
.rules"
))
{
$rules
=
unserialize
(
file_get_contents
(
"
{
$g
[
'vardb_path'
]
}
/captiveportal_
{
$cpzone
}
.rules"
));
$rules
[
$ruleno
]
=
false
;
$ruleno
++
;
$rules
[
$ruleno
]
=
false
;
file_put_contents
(
"
{
$g
[
'vardb_path'
]
}
/captiveportal_
{
$cpzone
}
.rules"
,
serialize
(
$rules
));
unset
(
$rules
);
}
unlock
(
$cpruleslck
);
}
function
captiveportal_get_ipfw_passthru_ruleno
(
$value
)
{
global
$config
,
$g
,
$cpzone
,
$cpzoneid
;
$cpcfg
=
$config
[
'captiveportal'
][
$cpzone
];
if
(
!
isset
(
$cpcfg
[
'enable'
]))
return
NULL
;
$cpruleslck
=
lock
(
"captiveportalrules
{
$cpzone
}
"
,
LOCK_EX
);
$ruleno
=
NULL
;
if
(
file_exists
(
"
{
$g
[
'vardb_path'
]
}
/captiveportal_
{
$cpzone
}
.rules"
))
{
$rules
=
unserialize
(
file_get_contents
(
"
{
$g
[
'vardb_path'
]
}
/captiveportal_
{
$cpzone
}
.rules"
));
unset
(
$output
);
$_gb
=
exec
(
"/sbin/ipfw show | /usr/bin/grep "
.
escapeshellarg
(
$value
)
.
" | /usr/bin/grep -v grep | /usr/bin/awk '{print $1}' | /usr/bin/head -n 1"
,
$output
);
$ruleno
=
intval
(
$output
[
0
]);
if
(
!
$rules
[
$ruleno
])
$ruleno
=
NULL
;
unset
(
$rules
);
}
unlock
(
$cpruleslck
);
return
$ruleno
;
}
/**
* This function will calculate the traffic produced by a client
...
...
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