Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
nexdpi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
sysadmin
nexdpi
Commits
80a51904
Commit
80a51904
authored
Apr 28, 2021
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ifconfig and use ip to detect active PPP devices (Thanks Matteo
Croce for the suggestion )
parent
853d659f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
dpi
dpi
+11
-1
mhome
mhome
+2
-1
shaping
shaping
+1
-0
No files found.
dpi
View file @
80a51904
...
@@ -86,6 +86,12 @@ except:
...
@@ -86,6 +86,12 @@ except:
Cats
=
R
[
'Cats'
]
Cats
=
R
[
'Cats'
]
Apps
=
R
[
'Apps'
]
Apps
=
R
[
'Apps'
]
Ignore
=
list
(
R
[
'Ignore'
])
Ignore
=
list
(
R
[
'Ignore'
])
Config
=
{
'throttle'
:
0
}
if
'Config'
in
R
.
keys
():
Config
=
R
[
'Config'
]
if
'Log'
in
R
.
keys
():
if
'Log'
in
R
.
keys
():
if
R
[
'Log'
]
==
'DEBUG'
:
if
R
[
'Log'
]
==
'DEBUG'
:
...
@@ -102,6 +108,7 @@ def reloadconf(signum, frame):
...
@@ -102,6 +108,7 @@ def reloadconf(signum, frame):
global
Cats
global
Cats
global
Apps
global
Apps
global
Ignore
global
Ignore
global
Config
try
:
try
:
fconf
=
open
(
"/etc/nexdpi/dpirules.json"
,
"r"
)
fconf
=
open
(
"/etc/nexdpi/dpirules.json"
,
"r"
)
...
@@ -119,6 +126,8 @@ def reloadconf(signum, frame):
...
@@ -119,6 +126,8 @@ def reloadconf(signum, frame):
log
.
setLevel
(
logging
.
WARNING
)
log
.
setLevel
(
logging
.
WARNING
)
elif
R
[
'Log'
]
==
"ERROR"
:
elif
R
[
'Log'
]
==
"ERROR"
:
log
.
setLevel
(
logging
.
ERROR
)
log
.
setLevel
(
logging
.
ERROR
)
if
'Config'
in
R
.
keys
():
Config
=
R
[
'Config'
]
log
.
warning
(
"Rules file reloaded"
)
log
.
warning
(
"Rules file reloaded"
)
except
:
except
:
...
@@ -243,7 +252,8 @@ class NexDPI():
...
@@ -243,7 +252,8 @@ class NexDPI():
UnknownMatch
.
append
(
self
.
fullname
)
UnknownMatch
.
append
(
self
.
fullname
)
#time.sleep(0.1)
if
Config
[
'throttle'
]
>
0
:
time
.
sleep
(
Config
[
'throttle'
])
...
...
mhome
View file @
80a51904
...
@@ -46,7 +46,8 @@ OVPN_CONFIG_DIR="/etc/openvpn"
...
@@ -46,7 +46,8 @@ OVPN_CONFIG_DIR="/etc/openvpn"
CDIR
=
$(
dirname
$0
)
CDIR
=
$(
dirname
$0
)
FIXEDACTIVEDEVS
=
"eth0"
FIXEDACTIVEDEVS
=
"eth0"
PPPACTIVEDEVS
=
$(
/sbin/ifconfig |
grep
ppp |
awk
'{print $1}'
|
grep
-v
-w
ppp |
cut
-b
-4
)
PPPACTIVEDEVS
=
$(
ip
link
show |
grep
-B
1 ppp |
grep
-e
"^[0-9]
\{
1,2
\}
:"
|
awk
'{print $2}'
| rev |
cut
-b
2- | rev
)
#PPPACTIVEDEVS=$(/sbin/ifconfig | grep ppp | awk '{print $0}' | grep -v -w ppp | cut -b -4)
[[
-n
$FIXEDACTIVEDEVS
&&
-n
$PPPACTIVEDEVS
]]
&&
ACTIVEDEVS
=
"
$PPPACTIVEDEVS
$FIXEDACTIVEDEVS
"
[[
-n
$FIXEDACTIVEDEVS
&&
-n
$PPPACTIVEDEVS
]]
&&
ACTIVEDEVS
=
"
$PPPACTIVEDEVS
$FIXEDACTIVEDEVS
"
[
-z
$ACTIVEDEVS
]
&&
[
-n
$FIXEDACTIVEDEVS
]
&&
ACTIVEDEVS
=
"
$FIXEDACTIVEDEVS
"
[
-z
$ACTIVEDEVS
]
&&
[
-n
$FIXEDACTIVEDEVS
]
&&
ACTIVEDEVS
=
"
$FIXEDACTIVEDEVS
"
[
-z
$ACTIVEDEVS
]
&&
[
-n
$PPPACTIVEDEVS
]
&&
ACTIVEDEVS
=
"
$PPPACTIVEDEVS
"
[
-z
$ACTIVEDEVS
]
&&
[
-n
$PPPACTIVEDEVS
]
&&
ACTIVEDEVS
=
"
$PPPACTIVEDEVS
"
...
...
shaping
View file @
80a51904
...
@@ -241,6 +241,7 @@ ApplyShaping() {
...
@@ -241,6 +241,7 @@ ApplyShaping() {
$TCLASS
1:1 classid 1:50 htb rate
${
MAXREDUCEDRATE
}
mbit ceil
${
REALRATE
}
mbit prio 1
$TCLASS
1:1 classid 1:50 htb rate
${
MAXREDUCEDRATE
}
mbit ceil
${
REALRATE
}
mbit prio 1
$TDISC
1:50 fq_codel
$TDISC
1:50 fq_codel
# Prioritis are important! The first that match is the winning one.
# Prioritis are important! The first that match is the winning one.
$TFILTER
1: protocol ip prio 1 handle
${
IPSETS
[
"social"
]
}
fw flowid 1:40
$TFILTER
1: protocol ip prio 1 handle
${
IPSETS
[
"social"
]
}
fw flowid 1:40
...
...
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