From: Michael Tremer Date: Wed, 27 Aug 2014 10:12:13 +0000 (+0200) Subject: Remove batman-adv zones X-Git-Tag: 007~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1beade745e5cff8e8e597c5ed645aab7e09d905b;p=network.git Remove batman-adv zones BATMAN networks are usually switched and not routed so this hook is not necessary any more. If you want to route them any way you can simply create a zone with only one batman-adv port. --- diff --git a/Makefile.am b/Makefile.am index 3b88c608..8914ca38 100644 --- a/Makefile.am +++ b/Makefile.am @@ -194,7 +194,6 @@ dist_hooks_zones_SCRIPTS = \ src/hooks/zones/6rd \ src/hooks/zones/6to4-tunnel \ src/hooks/zones/aiccu \ - src/hooks/zones/batman-adv \ src/hooks/zones/bridge \ src/hooks/zones/isdn \ src/hooks/zones/isdn-server \ diff --git a/src/hooks/zones/batman-adv b/src/hooks/zones/batman-adv deleted file mode 100644 index 23aa66d7..00000000 --- a/src/hooks/zones/batman-adv +++ /dev/null @@ -1,187 +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-zone - -HOOK_SETTINGS="HOOK ADDRESS MESH_ID SSID CHANNEL PHY" - -# Default values -ADDRESS=$(mac_generate) -CHANNEL=1 -MESH_ID= -SSID= - -# batman-adv inserts an additional header of 28 bytes, so we set the MTU -# to 1528, that normal ethernet packets with 1500 bytes can pass the network. -MTU=1528 - -function hook_check() { - assert isset ADDRESS - assert ismac ADDRESS - assert isset CHANNEL - assert isset MESH_ID - assert ismac MESH_ID - assert isset PHY - assert ismac PHY - assert isset SSID -} - -function hook_parse_cmdline() { - while [ $# -gt 0 ]; do - case "${1}" in - --address=*) - ADDRESS="$(cli_get_val ${1})" - ;; - --channel=*) - CHANNEL="$(cli_get_val ${1})" - ;; - --mesh-id=*) - MESH_ID="$(cli_get_val ${1})" - ;; - --phy=*) - PHY="$(cli_get_val ${1})" - ;; - --ssid=*) - SSID=$(cli_get_val ${1}) - ;; - *) - warning "Unrecognized option: ${1}" - ;; - esac - shift - done - - # Save address of phy do identify it again - PHY=$(phy_get ${PHY}) - PHY=$(phy_get_address ${PHY}) - - return ${EXIT_OK} -} - -function hook_up() { - local zone=${1} - assert isset zone - - # Read zone configuration. - zone_config_read ${zone} - - # Check if the PHY is present. - local phy="$(phy_get ${PHY})" - if ! isset phy; then - log DEBUG "phy '${PHY}' is not present" - exit ${EXIT_ERROR} - fi - - # Create the wireless device, if it does not exist, yet. - if ! device_exists "${zone}"; then - wireless_create "${zone}" \ - --address="${ADDRESS}" \ - --phy="${phy}" \ - --type="ibss" - fi - - # Set the MTU. - device_set_mtu "${zone}" "${MTU}" - - # Join the ad-hoc network. - wireless_ibss_join "${zone}" --channel="${CHANNEL}" \ - --bssid="${MESH_ID}" --essid="${SSID}" - - # Add the device as a batman-adv device. - batman_adv_interface_add "${zone}" - - zone_configs_up ${zone} - - exit ${EXIT_OK} -} - -function hook_down() { - local zone=${1} - shift - - if ! device_is_up ${zone}; then - warning "Zone '${zone}' is not up" - exit ${EXIT_OK} - fi - - zone_configs_down ${zone} - - # Remove the batman-adv device. - batman_adv_interface_del "${zone}" - - # Leave the ad-hoc network. - wireless_ibss_leave "${zone}" - - # Remove the device if it is still present. - if device_exists "${zone}"; then - wireless_remove "${zone}" - fi - - exit ${EXIT_OK} -} - -function hook_status() { - local zone=${1} - assert isset zone - - # Print the default header. - cli_device_headline ${zone} - - # Exit if zone is down - if ! zone_is_up ${zone}; then - echo # Empty line - exit ${EXIT_ERROR} - fi - - cli_headline 2 "Wireless network information" - cli_print_fmt1 2 "SSID" "$(wpa_cli_status_get ${zone} ssid)" - cli_space - - cli_headline 3 "Access Point" - local bssid=$(wpa_cli_status_get ${zone} bssid) - assert isset bssid - - cli_print_fmt1 3 "BSSID" "${bssid}" - cli_print_fmt1 3 "Frequency" \ - "$(wpa_cli_bss_get_frequency ${zone} ${bssid}) MHz" - cli_print_fmt1 3 "Noise" \ - "$(wpa_cli_bss_get_noise ${zone} ${bssid})" - cli_print_fmt1 3 "Quality" \ - "$(wpa_cli_bss_get_quality ${zone} ${bssid})" - cli_print_fmt1 3 "Flags" \ - "$(wpa_cli_bss_get_flags ${zone} ${bssid})" - cli_space - - cli_headline 3 "Encryption" - cli_print_fmt1 3 "Mode" \ - "$(wpa_cli_status_get ${zone} key_mgmt)" - cli_print_fmt1 3 "Pairwise cipher" \ - "$(wpa_cli_status_get ${zone} pairwise_cipher)" - cli_print_fmt1 3 "Group cipher" \ - "$(wpa_cli_status_get ${zone} group_cipher)" - cli_space - - cli_headline 2 "Configurations" - zone_configs_cmd status ${zone} - cli_space - - exit ${EXIT_OK} -}