diff options
Diffstat (limited to 'src/etc/netplug')
| -rwxr-xr-x | src/etc/netplug/linkup.d/vyos-python-helper | 4 | ||||
| -rwxr-xr-x | src/etc/netplug/netplug | 41 | ||||
| -rw-r--r-- | src/etc/netplug/netplugd.conf | 4 | ||||
| -rwxr-xr-x | src/etc/netplug/vyos-netplug-dhcp-client | 62 |
4 files changed, 0 insertions, 111 deletions
diff --git a/src/etc/netplug/linkup.d/vyos-python-helper b/src/etc/netplug/linkup.d/vyos-python-helper deleted file mode 100755 index 9c59c58ad..000000000 --- a/src/etc/netplug/linkup.d/vyos-python-helper +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -PYTHON3=$(which python3) -# Call the real python script and forward commandline arguments -$PYTHON3 /etc/netplug/vyos-netplug-dhcp-client "${@:1}" diff --git a/src/etc/netplug/netplug b/src/etc/netplug/netplug deleted file mode 100755 index 60b65e8c9..000000000 --- a/src/etc/netplug/netplug +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# -# Copyright 2023 VyOS maintainers and contributors <maintainers@vyos.io> -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library. If not, see <http://www.gnu.org/licenses/>. - -dev="$1" -action="$2" - -case "$action" in -in) - run-parts --arg $dev --arg in /etc/netplug/linkup.d - ;; -out) - run-parts --arg $dev --arg out /etc/netplug/linkdown.d - ;; - -# probe loads and initialises the driver for the interface and brings the -# interface into the "up" state, so that it can generate netlink(7) events. -# This interferes with "admin down" for an interface. Thus, commented out. An -# "admin up" is treated as a "link up" and thus, "link up" action is executed. -# To execute "link down" action on "admin down", run appropriate script in -# /etc/netplug/linkdown.d -#probe) -# ;; - -*) - exit 1 - ;; -esac diff --git a/src/etc/netplug/netplugd.conf b/src/etc/netplug/netplugd.conf deleted file mode 100644 index 7da3c67e8..000000000 --- a/src/etc/netplug/netplugd.conf +++ /dev/null @@ -1,4 +0,0 @@ -eth* -br* -bond* -wlan* diff --git a/src/etc/netplug/vyos-netplug-dhcp-client b/src/etc/netplug/vyos-netplug-dhcp-client deleted file mode 100755 index 55d15a163..000000000 --- a/src/etc/netplug/vyos-netplug-dhcp-client +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright 2023 VyOS maintainers and contributors <maintainers@vyos.io> -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library. If not, see <http://www.gnu.org/licenses/>. - -import sys - -from time import sleep - -from vyos.configquery import ConfigTreeQuery -from vyos.ifconfig import Section -from vyos.utils.boot import boot_configuration_complete -from vyos.utils.commit import commit_in_progress -from vyos.utils.process import call -from vyos import airbag -airbag.enable() - -if len(sys.argv) < 3: - airbag.noteworthy("Must specify both interface and link status!") - sys.exit(1) - -if not boot_configuration_complete(): - airbag.noteworthy("System bootup not yet finished...") - sys.exit(1) - -while commit_in_progress(): - sleep(1) - -interface = sys.argv[1] -in_out = sys.argv[2] -config = ConfigTreeQuery() - -interface_path = ['interfaces'] + Section.get_config_path(interface).split() - -for _, interface_config in config.get_config_dict(interface_path).items(): - # Bail out early if we do not have an IP address configured - if 'address' not in interface_config: - continue - # Bail out early if interface ist administrative down - if 'disable' in interface_config: - continue - systemd_action = 'start' - if in_out == 'out': - systemd_action = 'stop' - # Start/Stop DHCP service - if 'dhcp' in interface_config['address']: - call(f'systemctl {systemd_action} dhclient@{interface}.service') - # Start/Stop DHCPv6 service - if 'dhcpv6' in interface_config['address']: - call(f'systemctl {systemd_action} dhcp6c@{interface}.service') |
