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
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
opentrafficshaper
opentrafficshaper
Commits
786ea99f
Commit
786ea99f
authored
8 years ago
by
Nigel Kukard
Browse files
Options
Downloads
Patches
Plain Diff
Do aware with cburst and use adaptive RED and SFQ
parent
0796a91f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7
Do aware with cburst and use adaptive RED and SFQ
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
opentrafficshaper/plugins/tc/tc.pm
+10
-437
10 additions, 437 deletions
opentrafficshaper/plugins/tc/tc.pm
with
10 additions
and
437 deletions
opentrafficshaper/plugins/tc/tc.pm
+
10
−
437
View file @
786ea99f
...
...
@@ -945,7 +945,6 @@ sub _tc_iface_init
'
htb
',
'
rate
',"
$interface
->{'Limit'}kbit
",
'
burst
',"
${burst}
kb
",
'
cburst
',"
${burst}
kb
",
]);
# Class 0 is our interface, it points to 1 (the major TcClass)) : 1 (class below)
...
...
@@ -965,13 +964,7 @@ sub _tc_iface_init
my
$tcClass
=
_getTcClassFromTrafficClassID
(
$interfaceID
,
$trafficClassID
);
my
$trafficPriority
=
getTrafficClassPriority
(
$trafficClassID
);
$burst
=
int
(
$interfaceTrafficClass
->
{'
CIR
'}
/
8
);
# Allow burst up to the CIR
my
$cburst
=
int
((
$interfaceTrafficClass
->
{'
Limit
'}
-
$interfaceTrafficClass
->
{'
CIR
'})
/ 8 /
10
)
+
1600
;
# Allow burst of 10% of the diff between CIR and Limit
# NK: cburst should not exceed burst, if it does, just use the burst value
# this ensures we do not get negative burst
if
(
$cburst
>
$burst
)
{
$cburst
=
$burst
;
}
$burst
=
int
(
$interfaceTrafficClass
->
{'
Limit
'}
/
8
);
# Allow burst up to the Limit
# Add class
$changeSet
->
add
([
...
...
@@ -984,7 +977,6 @@ sub _tc_iface_init
'
ceil
',"
$interfaceTrafficClass
->{'Limit'}kbit
",
'
prio
',
$trafficPriority
,
'
burst
',
"
${burst}
kb
",
'
cburst
',
"
${cburst}
kb
",
]);
# Setup interface traffic class details
...
...
@@ -1005,13 +997,10 @@ sub _tc_iface_init
_tc_class_optimize
(
$changeSet
,
$interfaceID
,
$defaultPoolTcClass
,
$interfaceTrafficClass
->
{'
Limit
'});
# Make the queue size big enough
my
$queueSize
=
int
(
$interfaceTrafficClass
->
{'
CIR
'}
/
8
)
*
10
00
*
5
;
my
$queueSize
=
int
(
$interfaceTrafficClass
->
{'
Limit
'}
/
8
)
*
10
24
;
# RED metrics (sort of as per manpage)
my
$redAvPkt
=
1000
;
my
$redMax
=
int
(
$queueSize
*
0.50
);
# 50% mark at 100% probabilty
my
$redMin
=
int
(
$queueSize
*
0.10
);
# 10% mark start RED
my
$redBurst
=
int
(
(
$redMin
+
$redMax
)
/
(
2
*$redAvPkt
));
my
$redLimit
=
$queueSize
;
my
$prioTcClass
=
_getPrioTcClass
(
$interfaceID
,
$defaultPoolTcClass
);
...
...
@@ -1036,11 +1025,9 @@ sub _tc_iface_init
# TODO: NK - try enable the below
# 'estimator','1sec','4sec', # Quick monitoring, every 1s with 4s constraint
'
red
',
'
min
',
$redMin
,
'
max
',
$redMax
,
'
limit
',
$redLimit
,
'
burst
',
$redBurst
,
'
avpkt
',
$redAvPkt
,
'
adaptive
',
# NK: ECN may cause excessive dips in traffic if there is an exceptional amount of traffic
# 'ecn'
# XXX: Very new kernels only ... use redflowlimit in future
...
...
@@ -1058,11 +1045,9 @@ sub _tc_iface_init
'
parent
',"
$prioTcClass
:
"
.
toHex
(
$prioBand
),
'
handle
',
_reserveMajorTcClass
(
$interfaceID
,"
_default_pool_:
$defaultPoolTcClass
=>
$prioBand
")
.
"
:
",
'
red
',
'
min
',
$redMin
,
'
max
',
$redMax
,
'
limit
',
$redLimit
,
'
burst
',
$redBurst
,
'
avpkt
',
$redAvPkt
,
'
adaptive
',
# NK: ECN may cause excessive dips in traffic if there is an exceptional amount of traffic
# 'ecn'
]);
...
...
@@ -1080,15 +1065,6 @@ sub _tc_class_optimize
my
$interface
=
getInterface
(
$interfaceID
);
# Rate for things like ICMP , ACK, SYN ... etc
my
$rateBand1
=
int
(
$rate
*
(
PROTO_RATE_LIMIT
/
100
));
$rateBand1
=
PROTO_RATE_BURST_MIN
if
(
$rateBand1
<
PROTO_RATE_BURST_MIN
);
my
$rateBand1Burst
=
(
$rateBand1
/
8
)
*
PROTO_RATE_BURST_MAXM
;
# Rate for things like VoIP/SSH/Telnet
my
$rateBand2
=
int
(
$rate
*
(
PRIO_RATE_LIMIT
/
100
));
$rateBand2
=
PRIO_RATE_BURST_MIN
if
(
$rateBand2
<
PRIO_RATE_BURST_MIN
);
my
$rateBand2Burst
=
(
$rateBand2
/
8
)
*
PRIO_RATE_BURST_MAXM
;
my
$prioTcClass
=
_reserveMajorTcClassByPrioClass
(
$interfaceID
,
$poolTcClass
);
#
...
...
@@ -1101,403 +1077,14 @@ sub _tc_class_optimize
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
1:
$poolTcClass
",
'
handle
',"
$prioTcClass
:
",
'
prio
',
'
bands
','
3
',
'
priomap
','
2
','
2
','
2
','
2
','
2
','
2
','
2
','
2
','
2
','
2
','
2
','
2
','
2
','
2
','
2
','
2
',
'
sfq
',
'
limit
',
int
(
$rate
/
8
)
*
1024
,
'
headdrop
',
'
perturb
',
60
,
'
redflowlimit
',
int
(
$rate
/
8
)
*
1024
,
]);
#
# CLASSIFICATIONS
#
# Prioritize ICMP up to a certain limit
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x1
','
0xff
',
# ICMP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand1}
kbit
",'
burst
',"
${rateBand1Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
# Prioritize ACK up to a certain limit
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u8
','
0x10
','
0xff
',
# ACK
'
at
',
33
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand1}
kbit
",'
burst
',"
${rateBand1Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
# Prioritize SYN-ACK up to a certain limit
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u8
','
0x12
','
0xff
',
# SYN-ACK
'
at
',
33
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand1}
kbit
",'
burst
',"
${rateBand1Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
# Prioritize FIN up to a certain limit
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u8
','
0x1
','
0xff
',
# FIN
'
at
',
33
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand1}
kbit
",'
burst
',"
${rateBand1Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
# Prioritize RST up to a certain limit
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u8
','
0x4
','
0xff
',
# RST
'
at
',
33
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand1}
kbit
",'
burst
',"
${rateBand1Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
# DNS
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u16
','
0x0035
','
0xffff
',
# SPORT 53
'
at
',
20
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand2}
kbit
",'
burst
',"
${rateBand2Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u16
','
0x0035
','
0xffff
',
# DPORT 53
'
at
',
22
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand2}
kbit
",'
burst
',"
${rateBand2Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
# VOIP
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u16
','
0x13c4
','
0xffff
',
# SPORT 5060
'
at
',
20
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand2}
kbit
",'
burst
',"
${rateBand2Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u16
','
0x13c4
','
0xffff
',
# DPORT 5060
'
at
',
22
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand2}
kbit
",'
burst
',"
${rateBand2Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
# SNMP
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0xa1
','
0xffff
',
# SPORT 161
'
at
',
20
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand2}
kbit
",'
burst
',"
${rateBand2Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0xa1
','
0xffff
',
# DPORT 161
'
at
',
22
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand2}
kbit
",'
burst
',"
${rateBand2Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
# SSH
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x16
','
0xffff
',
# SPORT 22
'
at
',
20
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand2}
kbit
",'
burst
',"
${rateBand2Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x16
','
0xffff
',
# DPORT 22
'
at
',
22
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand2}
kbit
",'
burst
',"
${rateBand2Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
# TELNET
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x17
','
0xffff
',
# SPORT 23
'
at
',
20
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand2}
kbit
",'
burst
',"
${rateBand2Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x17
','
0xffff
',
# DPORT 23
'
at
',
22
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand2}
kbit
",'
burst
',"
${rateBand2Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
# TODO: Make this customizable not hard coded?
# Mikrotik Management Port
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u16
','
0x2063
','
0xffff
',
# SPORT 8291
'
at
',
20
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand2}
kbit
",'
burst
',"
${rateBand2Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u16
','
0x2063
','
0xffff
',
# DPORT 8291
'
at
',
22
+
$config
->
{'
iphdr_offset
'},
'
police
',
'
rate
',"
${rateBand2}
kbit
",'
burst
',"
${rateBand2Burst}
k
",'
continue
',
'
flowid
',"
$prioTcClass
:1
",
]);
# SMTP
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x19
','
0xffff
',
# SPORT 25
'
at
',
20
+
$config
->
{'
iphdr_offset
'},
'
flowid
',"
$prioTcClass
:2
",
]);
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x19
','
0xffff
',
# DPORT 25
'
at
',
22
+
$config
->
{'
iphdr_offset
'},
'
flowid
',"
$prioTcClass
:2
",
]);
# POP3
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x6e
','
0xffff
',
# SPORT 110
'
at
',
20
+
$config
->
{'
iphdr_offset
'},
'
flowid
',"
$prioTcClass
:2
",
]);
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x6e
','
0xffff
',
# DPORT 110
'
at
',
22
+
$config
->
{'
iphdr_offset
'},
'
flowid
',"
$prioTcClass
:2
",
]);
# IMAP
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x8f
','
0xffff
',
# SPORT 143
'
at
',
20
+
$config
->
{'
iphdr_offset
'},
'
flowid
',"
$prioTcClass
:2
",
]);
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x8f
','
0xffff
',
# DPORT 143
'
at
',
22
+
$config
->
{'
iphdr_offset
'},
'
flowid
',"
$prioTcClass
:2
",
]);
# HTTP
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x50
','
0xffff
',
# SPORT 80
'
at
',
20
+
$config
->
{'
iphdr_offset
'},
'
flowid
',"
$prioTcClass
:2
",
]);
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x50
','
0xffff
',
# DPORT 80
'
at
',
22
+
$config
->
{'
iphdr_offset
'},
'
flowid
',"
$prioTcClass
:2
",
]);
# HTTPS
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x1bb
','
0xffff
',
# SPORT 443
'
at
',
20
+
$config
->
{'
iphdr_offset
'},
'
flowid
',"
$prioTcClass
:2
",
]);
$changeSet
->
add
([
'
/sbin/tc
','
filter
','
add
',
'
dev
',
$interface
->
{'
Device
'},
'
parent
',"
$prioTcClass
:
",
'
prio
','
1
',
'
protocol
',
$config
->
{'
ip_protocol
'},
'
u32
',
'
match
','
u8
','
0x6
','
0xff
',
# TCP
'
at
',
9
+
$config
->
{'
iphdr_offset
'},
'
match
','
u16
','
0x1bb
','
0xffff
',
# DPORT 443
'
at
',
22
+
$config
->
{'
iphdr_offset
'},
'
flowid
',"
$prioTcClass
:2
",
]);
return
undef
;
}
...
...
@@ -1620,12 +1207,6 @@ sub _tc_class_add
# Set burst to a sane value, in this case the CIR (or $rate) size
my
$burst
=
int
(
$rate
/
8
);
my
$cburst
=
int
((
$ceil
-
$rate
)
/ 8 /
10
);
# NK: cburst should not exceed burst, if it does, just use the burst value
# this ensures we do not get negative burst
if
(
$cburst
>
$burst
)
{
$cburst
=
$burst
;
}
# Create main rate limiting classes
$changeSet
->
add
([
...
...
@@ -1638,7 +1219,6 @@ sub _tc_class_add
'
ceil
',
"
${ceil}
kbit
",
'
prio
',
$trafficPriority
,
'
burst
',
"
${burst}
kb
",
'
cburst
',
"
${cburst}
kb
",
]);
}
...
...
@@ -1661,12 +1241,6 @@ sub _tc_class_change
# Set the burst rate to the CIR (or $rate in this case)
my
$burst
=
int
(
$rate
/
8
);
my
$cburst
=
int
((
$ceil
-
$rate
)
/ 8 /
10
);
# NK: cburst should not exceed burst, if it does, just use the burst value
# this ensures we do not get negative burst
if
(
$cburst
>
$burst
)
{
$cburst
=
$burst
;
}
# Check if we have a priority
if
(
defined
(
$trafficPriority
))
{
...
...
@@ -1683,7 +1257,6 @@ sub _tc_class_change
'
rate
',
"
${rate}
kbit
",
'
ceil
',
"
${ceil}
kbit
",
'
burst
',
"
${burst}
kb
",
'
cburst
',
"
${cburst}
kb
",
@args
]);
}
...
...
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