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
66f8411d
Commit
66f8411d
authored
Jun 22, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(trafficshaper) automatic number new rules behind existing ones
parent
1bf389a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
SettingsController.php
...rollers/OPNsense/TrafficShaper/Api/SettingsController.php
+1
-0
TrafficShaper.php
...e/mvc/app/models/OPNsense/TrafficShaper/TrafficShaper.php
+15
-0
No files found.
src/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/Api/SettingsController.php
View file @
66f8411d
...
@@ -363,6 +363,7 @@ class SettingsController extends ApiControllerBase
...
@@ -363,6 +363,7 @@ class SettingsController extends ApiControllerBase
}
else
{
}
else
{
// generate new node, but don't save to disc
// generate new node, but don't save to disc
$node
=
$mdlShaper
->
rules
->
rule
->
add
()
;
$node
=
$mdlShaper
->
rules
->
rule
->
add
()
;
$node
->
sequence
=
$mdlShaper
->
getMaxRuleSequence
()
+
10
;
return
array
(
"rule"
=>
$node
->
getNodes
());
return
array
(
"rule"
=>
$node
->
getNodes
());
}
}
return
array
();
return
array
();
...
...
src/opnsense/mvc/app/models/OPNsense/TrafficShaper/TrafficShaper.php
View file @
66f8411d
...
@@ -120,4 +120,19 @@ class TrafficShaper extends BaseModel
...
@@ -120,4 +120,19 @@ class TrafficShaper extends BaseModel
$queue
->
number
=
$newId
;
$queue
->
number
=
$newId
;
return
$queue
;
return
$queue
;
}
}
/**
* retrieve last generated rule sequence number
*/
public
function
getMaxRuleSequence
()
{
$seq
=
0
;
foreach
(
$this
->
rules
->
rule
->
__items
as
$rule
)
{
if
((
string
)
$rule
->
sequence
>
$seq
)
{
$seq
=
(
string
)
$rule
->
sequence
;
}
}
return
$seq
;
}
}
}
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