From 5bc016ba313173f66edeeb269fe550d7d6b873a1 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 22 Dec 2014 23:14:35 +0000 Subject: [PATCH] Remove support for macvtap devices We don't have any use for them. --- Makefile.am | 2 - src/functions/functions.macvlan | 81 ----------------------- src/hooks/ports/macvlan | 113 -------------------------------- 3 files changed, 196 deletions(-) delete mode 100644 src/functions/functions.macvlan delete mode 100644 src/hooks/ports/macvlan diff --git a/Makefile.am b/Makefile.am index 5b26284c..96d59e42 100644 --- a/Makefile.am +++ b/Makefile.am @@ -130,7 +130,6 @@ dist_network_SCRIPTS = \ src/functions/functions.lock \ src/functions/functions.logging \ src/functions/functions.macros \ - src/functions/functions.macvlan \ src/functions/functions.modem \ src/functions/functions.phy \ src/functions/functions.ports \ @@ -189,7 +188,6 @@ dist_hooks_ports_SCRIPTS = \ src/hooks/ports/bonding \ src/hooks/ports/dummy \ src/hooks/ports/ethernet \ - src/hooks/ports/macvlan \ src/hooks/ports/vlan \ src/hooks/ports/wireless-adhoc \ src/hooks/ports/wireless-ap diff --git a/src/functions/functions.macvlan b/src/functions/functions.macvlan deleted file mode 100644 index de611c21..00000000 --- a/src/functions/functions.macvlan +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -############################################################################### -# # -# IPFire.org - A linux based firewall # -# Copyright (C) 2012 IPFire Network Development Team # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program 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 General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -############################################################################### - -MACVLAN_PORT_INTERFIX="mv" - -function macvlan_create() { - local device=${1} - assert isset device - - local parent=${2} - assert isset parent - - local address=${3} - assert ismac address - - # Check if the parent device exists. - if ! device_exists ${parent}; then - log ERROR "macvlan: parent device '${parent}' does not exist" - return ${EXIT_ERROR} - fi - - # Check if the device we want to create does not already exist. - if device_exists ${device}; then - log ERROR "macvlan: device '${device}' already exists" - return ${EXIT_ERROR} - fi - - # The macvlan device cannot be created, when the parent device - # is attached to a bridge. So we detach the parent device and - # reattach it again. - local bridge - if device_is_bridge_attached ${parent}; then - bridge=$(device_get_bridge ${parent}) - - # Detach the parent device. - bridge_detach_device ${bridge} ${parent} - fi - - # Actually create the device. - cmd_quiet ip link add link ${parent} name ${device} address ${address} \ - type macvlan - local ret=$? - - if [ ${ret} -eq ${EXIT_OK} ]; then - log DEBUG "macvlan device '${device}' has been created" - else - log ERROR "Could not create macvlan device '${device}': ${ret}" - fi - - # Re-attach device. - if isset bridge; then - bridge_attach_device ${bridge} ${parent} - fi - - return ${ret} -} - -function macvlan_remove() { - local device=${1} - assert isset device - - device_delete ${device} -} diff --git a/src/hooks/ports/macvlan b/src/hooks/ports/macvlan deleted file mode 100644 index a4ce6850..00000000 --- a/src/hooks/ports/macvlan +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash -############################################################################### -# # -# IPFire.org - A linux based firewall # -# Copyright (C) 2010 Michael Tremer & Christian Schmidt # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program 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 General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -############################################################################### -# -# XXX This hook is rather unusable because the parent device cannot be used -# anymore in a bridge. -# - -. /usr/lib/network/header-port - -HOOK_SETTINGS="HOOK ADDRESS PARENT" - -function hook_check() { - assert isset PARENT - assert ismac ADDRESS -} - -function hook_create() { - while [ $# -gt 0 ]; do - case "${1}" in - --parent-device=*) - PARENT=$(cli_get_val ${1}) - ;; - --address=*) - ADDRESS=$(cli_get_val ${1}) - ;; - *) - warning "Unknown argument '${1}'" - ;; - esac - shift - done - - local port=$(port_find_free "${PARENT}${MACVLAN_PORT_INTERFIX}N") - assert isset port - - if port_settings_write "${port}" ${HOOK_SETTINGS}; then - log INFO "New macvlan port '${port}' has been created." - fi - - exit ${EXIT_OK} -} - -function hook_edit() { - local port=${1} - assert isset port - shift - - port_settings_read "${port}" ${HOOK_SETTINGS} - - while [ $# -gt 0 ]; do - case "${1}" in - --address=*) - ADDRESS=$(cli_get_val ${1}) - ;; - *) - warning "Unknown argument '${1}'" - ;; - esac - shift - done - - port_settings_write "${port}" ${HOOK_SETTINGS} - - exit ${EXIT_OK} -} - -function hook_up() { - local port=${1} - assert isset port - - port_settings_read "${port}" ${HOOK_SETTINGS} - - # Create device if not already exists. - if ! device_exists ${port}; then - macvlan_create "${port}" "${PARENT}" "${ADDRESS}" - fi - - exit ${EXIT_OK} -} - -function hook_down() { - local port=${1} - - assert isset port - - port_settings_read "${port}" ${HOOK_SETTINGS} - - if ! device_exists ${port}; then - exit ${EXIT_OK} - fi - - macvlan_remove ${port} - - exit ${EXIT_OK} -} -- 2.39.2