Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Estelle
smradius
Commits
55bc7fe4
Commit
55bc7fe4
authored
Sep 14, 2016
by
Estelle
Browse files
Merge branch 'master' into 'AllCapping'
# Conflicts: # smradius/modules/features/mod_feature_capping.pm
parents
78f8d82d
6835d022
Pipeline
#185
failed with stage
in 59 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
smradius/modules/features/mod_feature_capping.pm
View file @
55bc7fe4
...
...
@@ -598,6 +598,65 @@ if (defined ($user->('SMRadius-AutoTopup-TrafficEnable'))){
#We top the user up
sub
allowCapping
{
my
(
$server
,
$user
)
=
@_
;
if
(
defined
(
$user
->
{'
ConfigAttributes
'}
->
{'
SMRadius-Config-Capping-Traffic-Multiplier
'}))
{
my
$multiplier
=
@user
;
my
$newLimit
=
$trafficLimitWithTopups
*
$multiplier
;
$server
->
log
(
LOG_INFO
,"
[MOD_FEATURE_CAPPING] Client cap traffic multiplier '
$multiplier
' changes limit
"
.
"
from '
$trafficLimitWithTopups
' to '
$newLimit
'
");
$trafficLimitWithTopups
=
$newLimit
;
}
if
(
defined
(
$user
->
{'
ConfigAttributes
'}
->
{'
SMRadius-Config-Capping-Uptime-Multiplier
'}))
{
my
$multiplier
=
@user
;
my
$newLimit
=
$trafficLimitWithTopups
*
$multiplier
;
$server
->
log
(
LOG_INFO
,"
[MOD_FEATURE_CAPPING] Client cap uptime multiplier '
$multiplier
' changes limit
"
.
"
from '
$uptimeLimitWithTopups
' to '
$newLimit
'
");
$uptimeLimitWithTopups
=
$newLimit
;
}
}
sub
AllowOverideCappingByClient
{
my
(
$server
,
$user
)
=
@_
;
if
(
defined
(
$user
->
{'
ConfigAttributes
'}
->
{'
SMRadius-Config-Capping-Uptime-Multiplier
'}))
{
my
$multiplier
=
$user
->
{'
ConfigAttributes
'}
->
{'
SMRadius-Config-Capping-Uptime-Multiplier
'};
my
$newLimit
=
$uptimeLimitWithTopups
*
$multiplier
;
my
$newSessionTime
=
$accountingUsage
->
{'
TotalSessionTime
'}
*
$multiplier
;
$uptimeLimitWithTopups
=
$newLimit
;
$accountingUsage
->
{'
TotalSessionTime
'}
=
$newSessionTime
;
$server
->
log
(
LOG_INFO
,"
[MOD_FEATURE_CAPPING] Client uptime multiplier '
$multiplier
' changes
"
.
"
uptime limit ('
$uptimeLimitWithTopups
' => '
$newLimit
'),
"
.
"
uptime usage ('
"
.
$accountingUsage
->
{'
TotalSessionTime
'}
.
"
' => '
$newSessionTime
')
");
if
(
defined
(
$user
->
{'
ConfigAttributes
'}
->
{'
SMRadius-Config-Capping-Traffic-Multiplier
'}))
{
my
$multiplier
=
$user
->
{'
ConfigAttributes
'}
->
{'
SMRadius-Config-Capping-Traffic-Multiplier
'};
my
$newLimit
=
$trafficLimitWithTopups
*
$multiplier
;
my
$newDataUsage
=
$accountingUsage
->
{'
TotalDataUsage
'}
*
$multiplier
;
$trafficLimitWithTopups
=
$newLimit
;
$accountingUsage
->
{'
TotalDataUsage
'}
=
$newDataUsage
;
$server
->
log
(
LOG_INFO
,"
[MOD_FEATURE_CAPPING] Client traffic multiplier '
$multiplier
' changes
"
.
"
traffic limit ('
$trafficLimitWithTopups
' => '
$newLimit
'),
"
.
"
traffic usage ('
"
.
$accountingUsage
->
{'
iTotalDataUsage
'}
.
"
' => '
$newDataUsage
')
"
);
}
}
}
...
...
@@ -607,4 +666,4 @@ if (defined ($user->('SMRadius-AutoTopup-TrafficEnable'))){
}
1
;
# vim: ts=4
# vim: ts=4
\ No newline at end of file
Write
Preview
Supports
Markdown
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