Skip to content

Commit c44dc99

Browse files
committed
T7965: reapply the QoS policy when the interface reconnect
1 parent 7e47154 commit c44dc99

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python3
2+
3+
# Dynamic interfaces may lose QoS config on reconnect.
4+
# This script reapplies the QoS policy when the interface comes up.
5+
6+
from sys import argv
7+
from sys import exit
8+
from vyos.utils.process import call
9+
from vyos.configquery import ConfigTreeQuery
10+
11+
# When the ppp link comes up, this script is called with the following
12+
# parameters
13+
# $1 the interface name used by pppd (e.g., pppoe0, l2tpc0, sstpc0)
14+
# $2 the tty device name
15+
# $3 the tty device speed
16+
# $4 the local IP address for the interface
17+
# $5 the remote IP address
18+
# $6 the parameter specified by the 'ipparam' option to pppd
19+
20+
if len(argv) < 7:
21+
exit(1)
22+
23+
interface = argv[6]
24+
25+
conf = ConfigTreeQuery()
26+
27+
try:
28+
# Check if QoS is configured for the interface
29+
qos_path = ['qos', 'interface', interface]
30+
if conf.exists(qos_path):
31+
call('/usr/libexec/vyos/conf_mode/qos.py')
32+
except Exception:
33+
exit(1)

0 commit comments

Comments
 (0)