Skip to content

Commit 155512c

Browse files
committed
T7965: invoke Python hooks from bash script for better performance
1 parent c44dc99 commit 155512c

File tree

6 files changed

+45
-23
lines changed

6 files changed

+45
-23
lines changed

src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
interface=$6
4+
if [ -z "$interface" ]; then
5+
exit
6+
fi
7+
8+
# 1. Handle sstpc interface callback
9+
if [[ "$interface" == sstpc* ]]; then
10+
/etc/ppp/ip-up.d/ppp-hook-scripts/96-vyos-sstpc-callback "$@"
11+
fi
12+
13+
# 2. Configure DNS via vyos-hostsd if active
14+
hostsd_client="/usr/bin/vyos-hostsd-client"
15+
hostsd_active=false
16+
17+
if /usr/bin/systemctl -q is-active vyos-hostsd; then
18+
hostsd_active=true
19+
fi
20+
21+
if $hostsd_active; then
22+
$hostsd_client --delete-name-servers --tag "dhcp-$interface"
23+
24+
if [ "$USEPEERDNS" ] && [ -n "$DNS1" ]; then
25+
$hostsd_client --add-name-servers "$DNS1" --tag "dhcp-$interface"
26+
fi
27+
28+
if [ "$USEPEERDNS" ] && [ -n "$DNS2" ]; then
29+
$hostsd_client --add-name-servers "$DNS2" --tag "dhcp-$interface"
30+
fi
31+
32+
$hostsd_client --apply
33+
fi
34+
35+
# 3. Handle pppoe interface callbacks
36+
if [[ "$interface" == pppoe* ]]; then
37+
/etc/ppp/ip-up.d/ppp-hook-scripts/99-vyos-pppoe-callback "$@"
38+
/etc/ppp/ip-up.d/ppp-hook-scripts/99-vyos-pppoe-qos "$@"
39+
fi
40+
41+
# 4. Handle WLB callback if wlb daemon is running
42+
WLB_PID_FILE="/run/wlb_daemon.pid"
43+
if [ -f "$WLB_PID_FILE" ]; then
44+
/etc/ppp/ip-up.d/ppp-hook-scripts/99-vyos-pppoe-wlb "$@"
45+
fi

0 commit comments

Comments
 (0)