|
1 | | -#!/usr/bin/env python3 |
2 | | -# |
3 | | -# Copyright VyOS maintainers and contributors <[email protected]> |
4 | | -# |
5 | | -# This program is free software; you can redistribute it and/or modify |
6 | | -# it under the terms of the GNU General Public License version 2 or later as |
7 | | -# published by the Free Software Foundation. |
8 | | -# |
9 | | -# This program is distributed in the hope that it will be useful, |
10 | | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | | -# GNU General Public License for more details. |
13 | | -# |
14 | | -# You should have received a copy of the GNU General Public License |
15 | | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 1 | +#!/bin/bash |
16 | 2 |
|
17 | | -# This is a Python hook script which is invoked whenever a PPPoE session goes |
18 | | -# "ip-up". It will call into our vyos.ifconfig library and will then execute |
19 | | -# common tasks for the PPPoE interface. The reason we have to "hook" this is |
20 | | -# that we can not create a pppoeX interface in advance in linux and then connect |
21 | | -# pppd to this already existing interface. |
| 3 | +interface=$6 |
| 4 | +WLB_PID_FILE="/run/wlb_daemon.pid" |
22 | 5 |
|
23 | | -from sys import argv |
24 | | -from sys import exit |
| 6 | +if [ -z "$interface" ]; then |
| 7 | + exit |
| 8 | +fi |
25 | 9 |
|
26 | | -from vyos.configquery import ConfigTreeQuery |
27 | | -from vyos.configdict import get_interface_dict |
28 | | -from vyos.ifconfig import PPPoEIf |
| 10 | +if [[ "$interface" == pppoe* ]]; then |
| 11 | + /etc/ppp/ip-up.d/ppp-hook-scripts/99-vyos-pppoe-callback "$@" |
| 12 | + /etc/ppp/ip-up.d/ppp-hook-scripts/99-vyos-pppoe-qos "$@" |
| 13 | +fi |
29 | 14 |
|
30 | | -# When the ppp link comes up, this script is called with the following |
31 | | -# parameters |
32 | | -# $1 the interface name used by pppd (e.g. ppp3) |
33 | | -# $2 the tty device name |
34 | | -# $3 the tty device speed |
35 | | -# $4 the local IP address for the interface |
36 | | -# $5 the remote IP address |
37 | | -# $6 the parameter specified by the 'ipparam' option to pppd |
38 | | - |
39 | | -if (len(argv) < 7): |
40 | | - exit(1) |
41 | | - |
42 | | -interface = argv[6] |
43 | | - |
44 | | -conf = ConfigTreeQuery() |
45 | | -_, pppoe = get_interface_dict(conf.config, ['interfaces', 'pppoe'], interface) |
46 | | - |
47 | | -# Update the config |
48 | | -p = PPPoEIf(interface) |
49 | | -p.update(pppoe) |
| 15 | +if [ -f "$WLB_PID_FILE" ]; then |
| 16 | + /etc/ppp/ip-up.d/ppp-hook-scripts/99-vyos-pppoe-wlb "$@" |
| 17 | +fi |
0 commit comments