Remove ifconfig and use ip to detect active PPP devices (Thanks Matteo

Croce for the suggestion )
parent 853d659f
......@@ -86,6 +86,12 @@ except:
Cats = R['Cats']
Apps = R['Apps']
Ignore = list(R['Ignore'])
Config = {
'throttle': 0
}
if 'Config' in R.keys():
Config = R['Config']
if 'Log' in R.keys():
if R['Log'] == 'DEBUG':
......@@ -102,6 +108,7 @@ def reloadconf(signum, frame):
global Cats
global Apps
global Ignore
global Config
try:
fconf = open("/etc/nexdpi/dpirules.json", "r")
......@@ -119,6 +126,8 @@ def reloadconf(signum, frame):
log.setLevel(logging.WARNING)
elif R['Log'] == "ERROR":
log.setLevel(logging.ERROR)
if 'Config' in R.keys():
Config = R['Config']
log.warning("Rules file reloaded")
except:
......@@ -243,7 +252,8 @@ class NexDPI():
UnknownMatch.append(self.fullname)
#time.sleep(0.1)
if Config['throttle'] > 0:
time.sleep(Config['throttle'])
......
......@@ -46,7 +46,8 @@ OVPN_CONFIG_DIR="/etc/openvpn"
CDIR=$(dirname $0)
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"
[ -z $ACTIVEDEVS ] && [ -n $FIXEDACTIVEDEVS ] && ACTIVEDEVS="$FIXEDACTIVEDEVS"
[ -z $ACTIVEDEVS ] && [ -n $PPPACTIVEDEVS ] && ACTIVEDEVS="$PPPACTIVEDEVS"
......
......@@ -241,6 +241,7 @@ ApplyShaping() {
$TCLASS 1:1 classid 1:50 htb rate ${MAXREDUCEDRATE}mbit ceil ${REALRATE}mbit prio 1
$TDISC 1:50 fq_codel
# Prioritis are important! The first that match is the winning one.
$TFILTER 1: protocol ip prio 1 handle ${IPSETS["social"]} fw flowid 1:40
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment