From: Michael Tremer Date: Fri, 18 Aug 2017 12:15:38 +0000 (+0000) Subject: Remove B.A.T.M.A.N. X-Git-Url: http://git.ipfire.org/?p=people%2Fstevee%2Fnetwork.git;a=commitdiff_plain;h=3216ee3eaf3aa522768a3fc8268c5981ca9ee930 Remove B.A.T.M.A.N. We do not seem to have an obvious application for this and since 802.11s is wider supported we will support that for wireless mesh networks instead. Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 60f59607..5d5e315b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -105,7 +105,6 @@ EXTRA_DIST += \ dist_network_SCRIPTS = \ src/functions/functions.at \ src/functions/functions.auth \ - src/functions/functions.batman-adv \ src/functions/functions.bonding \ src/functions/functions.bridge \ src/functions/functions.cli \ @@ -197,7 +196,6 @@ dist_hooks_configs_SCRIPTS = \ src/hooks/configs/pppoe-server dist_hooks_ports_SCRIPTS = \ - src/hooks/ports/batman-adv \ src/hooks/ports/bonding \ src/hooks/ports/dummy \ src/hooks/ports/ethernet \ @@ -344,8 +342,6 @@ MANPAGES = \ man/network-dns-server.8 \ man/network-performance-tuning.8 \ man/network-port.8 \ - man/network-port-batman-adv.8 \ - man/network-port-batman-adv-port.8 \ man/network-quick-start.8 \ man/network-route.8 \ man/network-route-static.8 \ diff --git a/man/network-port-batman-adv-port.xml b/man/network-port-batman-adv-port.xml deleted file mode 100644 index 15f2f4e1..00000000 --- a/man/network-port-batman-adv-port.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - network-port-batman-adv-port - network - - - - Developer - Michael - Tremer - michael.tremer@ipfire.org - - - - - - network-port-batman-adv-port - 8 - - - - network-port-batman-adv-port - Network Configuration Control Program - - - - - network port create batman-adv-port ... - - - - network PORT edit ... - - - - - Description - - - This hook configures a wireless device that is then used as a port - in the batman-adv hook. - - - - - Options - - - The following options are understood: - - - - - - - - - - - Define the MAC address of the interface. If no address - is defined, a random one will be generated. - - - - - - - - - - - - Set the channel number of the channel that should be used - for the wireless network. - - - - - - - - - - - - Use this wireless phy to create the interface. - - - - - - - - - - - - Define the ESSID of the wireless network. - - - - - - - - - - - - Define the mesh id or BSSID of the wireless network. - - - - - - - - See Also - - - - network - 8 - , - - network-port - 8 - , - - network-port-batman-adv - 8 - - - - diff --git a/man/network-port-batman-adv.xml b/man/network-port-batman-adv.xml deleted file mode 100644 index 580b13a4..00000000 --- a/man/network-port-batman-adv.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - network-port-batman-adv - network - - - - Developer - Michael - Tremer - michael.tremer@ipfire.org - - - - - - network-port-batman-adv - 8 - - - - network-port-batman-adv - Network Configuration Control Program - - - - - network port create batman-adv ... - - - - network PORT edit ... - - - - - Description - - - The batman-adv hook creates a batman-adv soft interface, which is - used to bridge several hard interfaces (wireless adapters, etc.). - - - - - Options - - - The following options are understood: - - - - - - - - - - - Define the MAC address of the interface. If no address - is defined, a random one will be generated. - - - - - - - - (only on create) - - - - - Define a lits of port, which should be used as slaves. - All slaves must be batman-adv-port - ports. - - - - - - - - (only on edit) - - - - - Adds an additional slave port. - - - - - - - - (only on edit) - - - - - Removes a slave port. - - - - - - - - See Also - - - - network - 8 - , - - network-port - 8 - , - - network-port-batman-adv-port - 8 - - - - diff --git a/src/functions/functions.batman-adv b/src/functions/functions.batman-adv deleted file mode 100644 index 80ebde77..00000000 --- a/src/functions/functions.batman-adv +++ /dev/null @@ -1,218 +0,0 @@ -#!/bin/bash -############################################################################### -# # -# IPFire.org - A linux based firewall # -# Copyright (C) 2013 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 . # -# # -############################################################################### - -batman_adv_add() { - local device="${1}" - assert isset device - - # Make sure the kernel module is loaded - module_load "batman-adv" - - local cmd="ip link add name ${device} type batadv" - cmd_quiet "${cmd}" - local ret=$? - - if [ ${ret} -eq ${EXIT_OK} ]; then - log DEBUG "batman-adv device '${device}' has been created" - else - log ERROR "batman-adv device '${device}' could not be created: ${ret}" - fi - - return ${ret} -} - -batman_adv_delete() { - local device="${1}" - assert isset device - - device_delete "${device}" -} - -batman_adv_attach() { - local device=${1} - assert isset device - - local port=${2} - assert isset port - - device_set_master "${port}" "${device}" -} - -batman_adv_detach() { - local port=${1} - assert isset port - - device_remove_master "${port}" -} - -batman_adv_get_aggregated_ogms() { - local device=${1} - assert isset device - - local value="$(__device_get_file "${device}" "mesh/aggregated_ogms")" - case "${value}" in - enabled) - return ${EXIT_TRUE} - ;; - disabled) - return ${EXIT_FALSE} - ;; - esac - - return ${EXIT_ERROR} -} - -batman_adv_get_ap_isolation() { - local device=${1} - assert isset device - - local value="$(__device_get_file "${device}" "mesh/ap_isolation")" - case "${value}" in - enabled) - return ${EXIT_TRUE} - ;; - disabled) - return ${EXIT_FALSE} - ;; - esac - - return ${EXIT_ERROR} -} - -batman_adv_get_bonding_mode() { - local device=${1} - assert isset device - - local value="$(__device_get_file "${device}" "mesh/bonding")" - case "${value}" in - enabled) - return ${EXIT_TRUE} - ;; - disabled) - return ${EXIT_FALSE} - ;; - esac - - return ${EXIT_ERROR} -} - -batman_adv_get_distributed_arp_table() { - local device=${1} - assert isset device - - local value="$(__device_get_file "${device}" "mesh/distributed_arp_table")" - case "${value}" in - enabled) - return ${EXIT_TRUE} - ;; - disabled) - return ${EXIT_FALSE} - ;; - esac - - return ${EXIT_ERROR} -} - -batman_adv_get_bridge_loop_avoidance() { - local device=${1} - assert isset device - - local value="$(__device_get_file "${device}" "mesh/bridge_loop_avoidance")" - case "${value}" in - enabled) - return ${EXIT_TRUE} - ;; - disabled) - return ${EXIT_FALSE} - ;; - esac - - return ${EXIT_ERROR} -} - -batman_adv_get_fragmentation() { - local device=${1} - assert isset device - - local value="$(__device_get_file "${device}" "mesh/fragmentation")" - case "${value}" in - enabled) - return ${EXIT_TRUE} - ;; - disabled) - return ${EXIT_FALSE} - ;; - esac - - return ${EXIT_ERROR} -} - -batman_adv_get_gateway_mode() { - local device=${1} - assert isset device - - local value="$(__device_get_file "${device}" "mesh/gw_mode")" - case "${value}" in - on) - return ${EXIT_TRUE} - ;; - off) - return ${EXIT_FALSE} - ;; - esac - - return ${EXIT_ERROR} -} - -batman_adv_get_gateway_bandwidth() { - local device=${1} - assert isset device - - __device_get_file "${device}" "mesh/gw_bandwidth" -} - -batman_adv_get_gateway_selection_class() { - local device=${1} - assert isset device - - __device_get_file "${device}" "mesh/gw_sel_class" -} - -batman_adv_get_hop_penalty() { - local device=${1} - assert isset device - - __device_get_file "${device}" "mesh/hop_penalty" -} - -batman_adv_get_originator_interval() { - local device=${1} - assert isset device - - __device_get_file "${device}" "mesh/orig_interval" -} - -batman_adv_get_routing_algorithm() { - local device=${1} - assert isset device - - __device_get_file "${device}" "mesh/routing_algo" -} diff --git a/src/functions/functions.device b/src/functions/functions.device index a2cfb9f5..4fc91294 100644 --- a/src/functions/functions.device +++ b/src/functions/functions.device @@ -140,31 +140,6 @@ device_get_ifindex() { print "$(<${path})" } -# Check if the device is a batman-adv bridge -device_is_batman_adv() { - [ -d "${SYS_CLASS_NET}/${1}/mesh" ] -} - -# Check if the device is a batman-adv slave port -device_is_batman_adv_slave() { - local device="${1}" - - if [ -d "${SYS_CLASS_NET}/${device}/batman_adv" ]; then - local status="$(<${SYS_CLASS_NET}/${device}/batman_adv/iface_status)" - - case "${status}" in - "active") - return ${EXIT_TRUE} - ;; - *) - return ${EXIT_FALSE} - ;; - esac - fi - - return ${EXIT_FALSE} -} - # Check if the device is a bonding device device_is_bonding() { [ -d "/sys/class/net/${1}/bonding" ] @@ -386,9 +361,6 @@ device_get_type() { elif device_is_ppp ${device}; then echo "ppp" - elif device_is_batman_adv ${device}; then - echo "batman-adv" - elif device_is_loopback ${device}; then echo "loopback" diff --git a/src/hooks/ports/batman-adv b/src/hooks/ports/batman-adv deleted file mode 100644 index b304f4fe..00000000 --- a/src/hooks/ports/batman-adv +++ /dev/null @@ -1,238 +0,0 @@ -#!/bin/bash -############################################################################### -# # -# IPFire.org - A linux based firewall # -# Copyright (C) 2013 Michael Tremer # -# # -# 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 . # -# # -############################################################################### - -. /usr/lib/network/header-port - -HOOK_SETTINGS="HOOK ADDRESS SLAVES" - -PORT_CHILDREN_VAR="SLAVES" - -ADDRESS=$(mac_generate) -SLAVES= - -hook_check_settings() { - assert isset ADDRESS - assert ismac ADDRESS -} - -hook_new() { - while [ $# -gt 0 ]; do - case "${1}" in - --address=*) - ADDRESS="$(cli_get_val "${1}")" - ;; - --slaves=*) - SLAVES="$(cli_get_val "${1}")" - ;; - *) - warning "Ignoring unknown argument '${1}'" - ;; - esac - shift - done - - local port=$(port_find_free ${PORT_PATTERN_BATMAN_ADV}) - assert isset port - - port_settings_write "${port}" ${HOOK_SETTINGS} - - exit ${EXIT_OK} -} - -hook_edit() { - local port=${1} - assert isset port - shift - - port_settings_read "${port}" - - while [ $# -gt 0 ]; do - case "${1}" in - --address=*) - ADDRESS="$(cli_get_val "${1}")" - ;; - --add-slave=*) - SLAVES="${SLAVES} $(cli_get_val "${1}")" - ;; - --del-slave=*) - local slave="$(cli_get_val "${1}")" - - local s slaves - for s in ${SLAVES}; do - [ "${slave}" = "${s}" ] && continue - slaves="${slaves} ${s}" - done - SLAVES="${slaves}" - ;; - *) - warning "Unknown argument '${1}'" - ;; - esac - shift - done - - port_settings_write "${port}" ${HOOK_SETTINGS} - - exit ${EXIT_OK} -} - -hook_create() { - local port="${1}" - assert isset port - - port_settings_read "${port}" ${HOOK_SETTINGS} - - # Create a new batman-adv device - batman_adv_add "${port}" || exit ${?} - - # Set the address. - device_set_address "${port}" "${ADDRESS}" - - exit ${EXIT_OK} -} - -hook_remove() { - local port="${1}" - assert isset port - - port_settings_read "${port}" ${HOOK_SETTINGS} - - # Remove the batman-adv device - batman_adv_delete "${port}" - - exit ${EXIT_OK} -} - -hook_hotplug() { - local port="${1}" - assert isset port - - case "$(hotplug_action)" in - add) - # Handle events of the same interface - if hotplug_event_port_is_interface "${port}"; then - # Bring up all slaves - # They will be attached by their own hotplug event - local slave - for slave in $(port_get_slaves "${port}"); do - port_create "${slave}" - done - - exit ${EXIT_OK} - - # Handle slave devices that have just been created and - # attach them. - elif hotplug_event_interface_is_slave_of_port "${port}"; then - batman_adv_attach "${port}" "${INTERFACE}" - - # If the batman-adv is already up, we will bring - # up the slave we just added as well. - if port_is_up "${port}"; then - port_up "${INTERFACE}" - fi - fi - - exit ${EXIT_OK} - ;; - - remove) - if hotplug_event_port_is_interface "${port}"; then - # Bring down all slaves when the batman device went down - local slave - for slave in $(port_get_slaves "${port}"); do - port_remove "${slave}" - done - - exit ${EXIT_OK} - fi - ;; - esac - exit ${EXIT_NOT_HANDLED} -} - -hook_status() { - local port=${1} - assert isset port - - cli_device_headline "${port}" --long - - cli_headline 2 "B.A.T.M.A.N." - - # Routing algorithm - cli_print_fmt1 2 "Routing Algorithm" \ - "$(batman_adv_get_routing_algorithm "${port}")" - - # Space - cli_space - - # Originator interval - cli_print_fmt1 2 "Originator Interval" \ - "$(batman_adv_get_originator_interval "${port}") ms" - - # Aggregated originator messages - batman_adv_get_aggregated_ogms "${port}" - cli_print_fmt1 2 "Aggregated Originator Messages" "$(cli_print_bool $?)" - - # AP isolation - batman_adv_get_ap_isolation "${port}" - cli_print_fmt1 2 "Access Point Isolation" "$(cli_print_bool $?)" - - # Bonding mode - batman_adv_get_bonding_mode "${port}" - cli_print_fmt1 2 "Bonding Mode" "$(cli_print_bool $?)" - - # Bridge loop avoidance - batman_adv_get_bridge_loop_avoidance "${port}" - cli_print_fmt1 2 "Bridge Loop Avoidance" "$(cli_print_bool $?)" - - # Distributed ARP table - batman_adv_get_distributed_arp_table "${port}" - cli_print_fmt1 2 "Distributed ARP Table" "$(cli_print_bool $?)" - - # Fragmentation - batman_adv_get_fragmentation "${port}" - cli_print_fmt1 2 "Fragmentation" "$(cli_print_bool $?)" - - # Hop penalty - cli_print_fmt1 2 "Hop Penalty" \ - "$(batman_adv_get_hop_penalty "${port}")" - cli_space - - # Gateway - cli_headline 3 "Gateway" - - # Gateway mode - batman_adv_get_gateway_mode "${port}" - local gw_enabled=$? - - cli_print_fmt1 3 "Enabled" "$(cli_print_bool ${gw_enabled})" - - if [ ${gw_enabled} -eq ${EXIT_TRUE} ]; then - cli_print_fmt1 3 "Bandwidth" \ - "$(batman_adv_get_gateway_bandwidth "${port}")" - cli_print_fmt1 3 "Selection Class" \ - "$(batman_adv_get_gateway_selection_class "${port}")" - fi - - cli_space - - exit ${EXIT_OK} -} diff --git a/src/hooks/ports/wireless-adhoc b/src/hooks/ports/wireless-adhoc index d97bf551..10dc80aa 100644 --- a/src/hooks/ports/wireless-adhoc +++ b/src/hooks/ports/wireless-adhoc @@ -218,24 +218,3 @@ hook_hotplug() { exit ${EXIT_OK} } - -hook_find_parent() { - local port=${1} - assert isset port - - local p child hook - for p in $(ports_get); do - hook=$(port_get_hook "${p}") - - if [ "${hook}" = "batman-adv" ]; then - for child in $(port_get_children "${p}"); do - [ "${child}" = "${port}" ] || continue - - print "${p}" - return ${EXIT_OK} - done - fi - done - - return ${EXIT_ERROR} -}