Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
opentrafficshaper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eezysol
opentrafficshaper
Commits
0f12afef
Commit
0f12afef
authored
11 years ago
by
Nigel Kukard
Browse files
Options
Downloads
Patches
Plain Diff
Cleaned up configuration of opentraffishaperd
parent
4c72dd48
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
opentrafficshaperd
+21
-44
21 additions, 44 deletions
opentrafficshaperd
with
21 additions
and
44 deletions
opentrafficshaperd
+
21
−
44
View file @
0f12afef
...
@@ -64,15 +64,11 @@ sub parseCfgCmdLine
...
@@ -64,15 +64,11 @@ sub parseCfgCmdLine
my
$cfg
;
my
$cfg
;
$cfg
->
{'
config_file
'}
=
"
/etc/opentrafficshaper.conf
";
$cfg
->
{'
config_file
'}
=
"
/etc/opentrafficshaper.conf
";
$cfg
->
{'
timeout
'}
=
120
;
# $cfg->{'timeout'} = 120;
$cfg
->
{'
background
'}
=
"
yes
";
# $cfg->{'background'} = "yes";
$cfg
->
{'
pid_file
'}
=
"
/var/run/opentrafficshaper/opentrafficshaperd.pid
";
# $cfg->{'pid_file'} = "/var/run/opentrafficshaper/opentrafficshaperd.pid";
$cfg
->
{'
log_level
'}
=
2
;
# $cfg->{'log_level'} = 2;
$cfg
->
{'
log_file
'}
=
"
/var/log/opentrafficshaper/opentrafficshaperd.log
";
# $cfg->{'log_file'} = "/var/log/opentrafficshaper/opentrafficshaperd.log";
# $server->{'host'} = "*";
# $server->{'port'} = [ 1812, 1813 ];
# $server->{'proto'} = 'udp';
# Parse command line params
# Parse command line params
my
$cmdline
;
my
$cmdline
;
...
@@ -109,12 +105,12 @@ sub parseCfgCmdLine
...
@@ -109,12 +105,12 @@ sub parseCfgCmdLine
# Pull in params for the server
# Pull in params for the server
my
@server_params
=
(
my
@server_params
=
(
'
log_level
','
log_file
',
'
log_level
',
#
'log_file',
'
host
',
#
'host',
'
pid_file
',
#
'pid_file',
'
user
',
'
group
',
#
'user', 'group',
'
timeout
',
#
'timeout',
'
background
',
#
'background',
);
);
foreach
my
$param
(
@server_params
)
{
foreach
my
$param
(
@server_params
)
{
$cfg
->
{
$param
}
=
$config
{'
server
'}{
$param
}
if
(
defined
(
$config
{'
server
'}{
$param
}));
$cfg
->
{
$param
}
=
$config
{'
server
'}{
$param
}
if
(
defined
(
$config
{'
server
'}{
$param
}));
...
@@ -135,12 +131,12 @@ sub parseCfgCmdLine
...
@@ -135,12 +131,12 @@ sub parseCfgCmdLine
}
}
# Loop with logging detail
# Loop with logging detail
if
(
defined
(
$config
{'
server
'}{'
log_detail
'}))
{
#
if (defined($config{'server'}{'log_detail'})) {
# Lets see what we have to enable
#
# Lets see what we have to enable
foreach
my
$detail
(
split
(
/[,\s;]/
,
$config
{'
server
'}{'
log_detail
'}))
{
#
foreach my $detail (split(/[,\s;]/,$config{'server'}{'log_detail'})) {
$cfg
->
{'
logging
'}{
$detail
}
=
1
;
#
$cfg->{'logging'}{$detail} = 1;
}
#
}
}
#
}
#
#
# System plugins
# System plugins
...
@@ -161,31 +157,12 @@ sub parseCfgCmdLine
...
@@ -161,31 +157,12 @@ sub parseCfgCmdLine
}
}
}
}
#
# Dictionary configuration
#
# Split off dictionaries to load
if
(
ref
(
$config
{'
dictionary
'}
->
{'
load
'})
eq
"
ARRAY
")
{
foreach
my
$dict
(
@
{
$config
{'
dictionary
'}
->
{'
load
'}})
{
$dict
=~
s/\s+//g
;
# Skip comments
next
if
(
$dict
=~
/^#/
);
push
(
@
{
$cfg
->
{'
dictionary_list
'}},
$dict
);
}
}
elsif
(
defined
(
$config
{'
dictionary
'}
->
{'
load
'}))
{
my
@dictList
=
split
(
/\s+/
,
$config
{'
dictionary
'}
->
{'
load
'});
foreach
my
$dict
(
@dictList
)
{
# Skip comments
next
if
(
$dict
=~
/^#/
);
push
(
@
{
$cfg
->
{'
dictionary_list
'}},
$dict
);
}
}
# Check if the user specified a cache_file in the config
# Check if the user specified a cache_file in the config
if
(
defined
(
$config
{'
server
'}{'
cache_file
'}))
{
#
if (defined($config{'server'}{'cache_file'})) {
$cfg
->
{'
cache_file
'}
=
$config
{'
server
'}{'
cache_file
'};
#
$cfg->{'cache_file'} = $config{'server'}{'cache_file'};
}
#
}
$globals
->
{'
file.config
'}
=
\
%config
;
$globals
->
{'
config
'}
=
$cfg
;
$globals
->
{'
config
'}
=
$cfg
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment