1
0
mirror of https://git.openwrt.org/feed/routing.git synced 2024-06-16 12:14:10 +02:00
openwrt-routing/batman-adv/files/lib/netifd/proto/batadv.sh

124 lines
3.5 KiB
Bash
Raw Normal View History

#!/bin/sh
batman-adv: Split batadv proto in meshif and hardif part batman-adv allows to configure three different objects: * batadv hardif - network interface used by batadv meshif to transport the batman-adv packets - its master interface is set to the batadv meshif * batadv (meshif/softif) - virtual interface that emulates a normal 802.3 interface on top - encapsulates traffic and forwards it via the batadv hardifs * batadv vlan - potential VLAN ID on top of batadv meshif - allows filtering of traffic from specific VIDs While batadv vlan objects were already represented as an own proto "batadv_vlan", the batadv meshif could never be fully configured using /etc/config/network. Instead, parts of its configuration were stored in /etc/config/batman_adv and some in the interfaces with the "batadv" proto. To increase the confusion, the "batadv" proto wasn't used to define the batadv meshif but to identify batadv (slave) hardifs. The batman-adv meshifs were also never created directly but only when a hardif was configured. The actual modification of the configuration settings was then applied using a hotplug script hack. The batadv meshif network interface could therefore only be created when an hardif was available and not manipulated with ifup/ifdown. Also `/etc/init.d/network reload` didn't modify the batadv meshif interface configuration correctly. The "batadv" is now renamed to "batadv_hardif" and a new "batadv" proto is used to configure the main (meshif) network interface with all its configuration. A simple network configuration with WiFi & ethernet interfaces and static IP on top of bat0 would look like: # batadv meshif bat0 config interface 'bat0' option proto 'batadv' option routing_algo 'BATMAN_IV' option aggregated_ogms 1 option ap_isolation 0 option bonding 0 option fragmentation 1 #option gw_bandwidth '10000/2000' option gw_mode 'off' #option gw_sel_class 20 option log_level 0 option orig_interval 1000 option bridge_loop_avoidance 1 option distributed_arp_table 1 option multicast_mode 1 option network_coding 0 option hop_penalty 30 option isolation_mark '0x00000000/0x00000000' # add *single* wifi-iface with network bat0_hardif_wlan as hardif to bat0 config interface 'bat0_hardif_wlan' option mtu '1536' option proto 'batadv_hardif' option master 'bat0' # option ifname is filled out by the wifi-iface # add eth0 as hardif to bat0 config interface 'bat0_hardif_eth0' option proto 'batadv_hardif' option master 'bat0' option ifname 'eth0' option mtu '1536' # configure IP on bat0 config interface 'bat0_lan' option ifname 'bat0' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-24 17:51:13 +01:00
[ -n "$INCLUDE_ONLY" ] || {
. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"
}
proto_batadv_init_config() {
batman-adv: Split batadv proto in meshif and hardif part batman-adv allows to configure three different objects: * batadv hardif - network interface used by batadv meshif to transport the batman-adv packets - its master interface is set to the batadv meshif * batadv (meshif/softif) - virtual interface that emulates a normal 802.3 interface on top - encapsulates traffic and forwards it via the batadv hardifs * batadv vlan - potential VLAN ID on top of batadv meshif - allows filtering of traffic from specific VIDs While batadv vlan objects were already represented as an own proto "batadv_vlan", the batadv meshif could never be fully configured using /etc/config/network. Instead, parts of its configuration were stored in /etc/config/batman_adv and some in the interfaces with the "batadv" proto. To increase the confusion, the "batadv" proto wasn't used to define the batadv meshif but to identify batadv (slave) hardifs. The batman-adv meshifs were also never created directly but only when a hardif was configured. The actual modification of the configuration settings was then applied using a hotplug script hack. The batadv meshif network interface could therefore only be created when an hardif was available and not manipulated with ifup/ifdown. Also `/etc/init.d/network reload` didn't modify the batadv meshif interface configuration correctly. The "batadv" is now renamed to "batadv_hardif" and a new "batadv" proto is used to configure the main (meshif) network interface with all its configuration. A simple network configuration with WiFi & ethernet interfaces and static IP on top of bat0 would look like: # batadv meshif bat0 config interface 'bat0' option proto 'batadv' option routing_algo 'BATMAN_IV' option aggregated_ogms 1 option ap_isolation 0 option bonding 0 option fragmentation 1 #option gw_bandwidth '10000/2000' option gw_mode 'off' #option gw_sel_class 20 option log_level 0 option orig_interval 1000 option bridge_loop_avoidance 1 option distributed_arp_table 1 option multicast_mode 1 option network_coding 0 option hop_penalty 30 option isolation_mark '0x00000000/0x00000000' # add *single* wifi-iface with network bat0_hardif_wlan as hardif to bat0 config interface 'bat0_hardif_wlan' option mtu '1536' option proto 'batadv_hardif' option master 'bat0' # option ifname is filled out by the wifi-iface # add eth0 as hardif to bat0 config interface 'bat0_hardif_eth0' option proto 'batadv_hardif' option master 'bat0' option ifname 'eth0' option mtu '1536' # configure IP on bat0 config interface 'bat0_lan' option ifname 'bat0' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-24 17:51:13 +01:00
no_device=1
available=1
proto_config_add_boolean 'aggregated_ogms:bool'
proto_config_add_boolean 'ap_isolation:bool'
proto_config_add_boolean 'bonding:bool'
proto_config_add_boolean 'bridge_loop_avoidance:bool'
proto_config_add_boolean 'distributed_arp_table:bool'
proto_config_add_boolean 'fragmentation:bool'
proto_config_add_string 'gw_bandwidth'
proto_config_add_string 'gw_mode'
proto_config_add_int 'gw_sel_class'
proto_config_add_int 'hop_penalty'
proto_config_add_string 'isolation_mark'
proto_config_add_string 'log_level'
proto_config_add_int 'multicast_fanout'
batman-adv: Split batadv proto in meshif and hardif part batman-adv allows to configure three different objects: * batadv hardif - network interface used by batadv meshif to transport the batman-adv packets - its master interface is set to the batadv meshif * batadv (meshif/softif) - virtual interface that emulates a normal 802.3 interface on top - encapsulates traffic and forwards it via the batadv hardifs * batadv vlan - potential VLAN ID on top of batadv meshif - allows filtering of traffic from specific VIDs While batadv vlan objects were already represented as an own proto "batadv_vlan", the batadv meshif could never be fully configured using /etc/config/network. Instead, parts of its configuration were stored in /etc/config/batman_adv and some in the interfaces with the "batadv" proto. To increase the confusion, the "batadv" proto wasn't used to define the batadv meshif but to identify batadv (slave) hardifs. The batman-adv meshifs were also never created directly but only when a hardif was configured. The actual modification of the configuration settings was then applied using a hotplug script hack. The batadv meshif network interface could therefore only be created when an hardif was available and not manipulated with ifup/ifdown. Also `/etc/init.d/network reload` didn't modify the batadv meshif interface configuration correctly. The "batadv" is now renamed to "batadv_hardif" and a new "batadv" proto is used to configure the main (meshif) network interface with all its configuration. A simple network configuration with WiFi & ethernet interfaces and static IP on top of bat0 would look like: # batadv meshif bat0 config interface 'bat0' option proto 'batadv' option routing_algo 'BATMAN_IV' option aggregated_ogms 1 option ap_isolation 0 option bonding 0 option fragmentation 1 #option gw_bandwidth '10000/2000' option gw_mode 'off' #option gw_sel_class 20 option log_level 0 option orig_interval 1000 option bridge_loop_avoidance 1 option distributed_arp_table 1 option multicast_mode 1 option network_coding 0 option hop_penalty 30 option isolation_mark '0x00000000/0x00000000' # add *single* wifi-iface with network bat0_hardif_wlan as hardif to bat0 config interface 'bat0_hardif_wlan' option mtu '1536' option proto 'batadv_hardif' option master 'bat0' # option ifname is filled out by the wifi-iface # add eth0 as hardif to bat0 config interface 'bat0_hardif_eth0' option proto 'batadv_hardif' option master 'bat0' option ifname 'eth0' option mtu '1536' # configure IP on bat0 config interface 'bat0_lan' option ifname 'bat0' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-24 17:51:13 +01:00
proto_config_add_boolean 'multicast_mode:bool'
proto_config_add_boolean 'network_coding:bool'
proto_config_add_int 'orig_interval'
proto_config_add_string 'routing_algo'
}
proto_batadv_setup() {
local config="$1"
batman-adv: Split batadv proto in meshif and hardif part batman-adv allows to configure three different objects: * batadv hardif - network interface used by batadv meshif to transport the batman-adv packets - its master interface is set to the batadv meshif * batadv (meshif/softif) - virtual interface that emulates a normal 802.3 interface on top - encapsulates traffic and forwards it via the batadv hardifs * batadv vlan - potential VLAN ID on top of batadv meshif - allows filtering of traffic from specific VIDs While batadv vlan objects were already represented as an own proto "batadv_vlan", the batadv meshif could never be fully configured using /etc/config/network. Instead, parts of its configuration were stored in /etc/config/batman_adv and some in the interfaces with the "batadv" proto. To increase the confusion, the "batadv" proto wasn't used to define the batadv meshif but to identify batadv (slave) hardifs. The batman-adv meshifs were also never created directly but only when a hardif was configured. The actual modification of the configuration settings was then applied using a hotplug script hack. The batadv meshif network interface could therefore only be created when an hardif was available and not manipulated with ifup/ifdown. Also `/etc/init.d/network reload` didn't modify the batadv meshif interface configuration correctly. The "batadv" is now renamed to "batadv_hardif" and a new "batadv" proto is used to configure the main (meshif) network interface with all its configuration. A simple network configuration with WiFi & ethernet interfaces and static IP on top of bat0 would look like: # batadv meshif bat0 config interface 'bat0' option proto 'batadv' option routing_algo 'BATMAN_IV' option aggregated_ogms 1 option ap_isolation 0 option bonding 0 option fragmentation 1 #option gw_bandwidth '10000/2000' option gw_mode 'off' #option gw_sel_class 20 option log_level 0 option orig_interval 1000 option bridge_loop_avoidance 1 option distributed_arp_table 1 option multicast_mode 1 option network_coding 0 option hop_penalty 30 option isolation_mark '0x00000000/0x00000000' # add *single* wifi-iface with network bat0_hardif_wlan as hardif to bat0 config interface 'bat0_hardif_wlan' option mtu '1536' option proto 'batadv_hardif' option master 'bat0' # option ifname is filled out by the wifi-iface # add eth0 as hardif to bat0 config interface 'bat0_hardif_eth0' option proto 'batadv_hardif' option master 'bat0' option ifname 'eth0' option mtu '1536' # configure IP on bat0 config interface 'bat0_lan' option ifname 'bat0' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-24 17:51:13 +01:00
local iface="$config"
local aggregated_ogms
local ap_isolation
local bonding
local bridge_loop_avoidance
local distributed_arp_table
local fragmentation
local gw_bandwidth
local gw_mode
local gw_sel_class
local hop_penalty
local isolation_mark
local log_level
local multicast_fanout
batman-adv: Split batadv proto in meshif and hardif part batman-adv allows to configure three different objects: * batadv hardif - network interface used by batadv meshif to transport the batman-adv packets - its master interface is set to the batadv meshif * batadv (meshif/softif) - virtual interface that emulates a normal 802.3 interface on top - encapsulates traffic and forwards it via the batadv hardifs * batadv vlan - potential VLAN ID on top of batadv meshif - allows filtering of traffic from specific VIDs While batadv vlan objects were already represented as an own proto "batadv_vlan", the batadv meshif could never be fully configured using /etc/config/network. Instead, parts of its configuration were stored in /etc/config/batman_adv and some in the interfaces with the "batadv" proto. To increase the confusion, the "batadv" proto wasn't used to define the batadv meshif but to identify batadv (slave) hardifs. The batman-adv meshifs were also never created directly but only when a hardif was configured. The actual modification of the configuration settings was then applied using a hotplug script hack. The batadv meshif network interface could therefore only be created when an hardif was available and not manipulated with ifup/ifdown. Also `/etc/init.d/network reload` didn't modify the batadv meshif interface configuration correctly. The "batadv" is now renamed to "batadv_hardif" and a new "batadv" proto is used to configure the main (meshif) network interface with all its configuration. A simple network configuration with WiFi & ethernet interfaces and static IP on top of bat0 would look like: # batadv meshif bat0 config interface 'bat0' option proto 'batadv' option routing_algo 'BATMAN_IV' option aggregated_ogms 1 option ap_isolation 0 option bonding 0 option fragmentation 1 #option gw_bandwidth '10000/2000' option gw_mode 'off' #option gw_sel_class 20 option log_level 0 option orig_interval 1000 option bridge_loop_avoidance 1 option distributed_arp_table 1 option multicast_mode 1 option network_coding 0 option hop_penalty 30 option isolation_mark '0x00000000/0x00000000' # add *single* wifi-iface with network bat0_hardif_wlan as hardif to bat0 config interface 'bat0_hardif_wlan' option mtu '1536' option proto 'batadv_hardif' option master 'bat0' # option ifname is filled out by the wifi-iface # add eth0 as hardif to bat0 config interface 'bat0_hardif_eth0' option proto 'batadv_hardif' option master 'bat0' option ifname 'eth0' option mtu '1536' # configure IP on bat0 config interface 'bat0_lan' option ifname 'bat0' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-24 17:51:13 +01:00
local multicast_mode
local network_coding
local orig_interval
local routing_algo
json_get_vars aggregated_ogms
json_get_vars ap_isolation
json_get_vars bonding
json_get_vars bridge_loop_avoidance
json_get_vars distributed_arp_table
json_get_vars fragmentation
json_get_vars gw_bandwidth
json_get_vars gw_mode
json_get_vars gw_sel_class
json_get_vars hop_penalty
json_get_vars isolation_mark
json_get_vars log_level
json_get_vars multicast_fanout
batman-adv: Split batadv proto in meshif and hardif part batman-adv allows to configure three different objects: * batadv hardif - network interface used by batadv meshif to transport the batman-adv packets - its master interface is set to the batadv meshif * batadv (meshif/softif) - virtual interface that emulates a normal 802.3 interface on top - encapsulates traffic and forwards it via the batadv hardifs * batadv vlan - potential VLAN ID on top of batadv meshif - allows filtering of traffic from specific VIDs While batadv vlan objects were already represented as an own proto "batadv_vlan", the batadv meshif could never be fully configured using /etc/config/network. Instead, parts of its configuration were stored in /etc/config/batman_adv and some in the interfaces with the "batadv" proto. To increase the confusion, the "batadv" proto wasn't used to define the batadv meshif but to identify batadv (slave) hardifs. The batman-adv meshifs were also never created directly but only when a hardif was configured. The actual modification of the configuration settings was then applied using a hotplug script hack. The batadv meshif network interface could therefore only be created when an hardif was available and not manipulated with ifup/ifdown. Also `/etc/init.d/network reload` didn't modify the batadv meshif interface configuration correctly. The "batadv" is now renamed to "batadv_hardif" and a new "batadv" proto is used to configure the main (meshif) network interface with all its configuration. A simple network configuration with WiFi & ethernet interfaces and static IP on top of bat0 would look like: # batadv meshif bat0 config interface 'bat0' option proto 'batadv' option routing_algo 'BATMAN_IV' option aggregated_ogms 1 option ap_isolation 0 option bonding 0 option fragmentation 1 #option gw_bandwidth '10000/2000' option gw_mode 'off' #option gw_sel_class 20 option log_level 0 option orig_interval 1000 option bridge_loop_avoidance 1 option distributed_arp_table 1 option multicast_mode 1 option network_coding 0 option hop_penalty 30 option isolation_mark '0x00000000/0x00000000' # add *single* wifi-iface with network bat0_hardif_wlan as hardif to bat0 config interface 'bat0_hardif_wlan' option mtu '1536' option proto 'batadv_hardif' option master 'bat0' # option ifname is filled out by the wifi-iface # add eth0 as hardif to bat0 config interface 'bat0_hardif_eth0' option proto 'batadv_hardif' option master 'bat0' option ifname 'eth0' option mtu '1536' # configure IP on bat0 config interface 'bat0_lan' option ifname 'bat0' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-24 17:51:13 +01:00
json_get_vars multicast_mode
json_get_vars network_coding
json_get_vars orig_interval
json_get_vars routing_algo
batman-adv: Split batadv proto in meshif and hardif part batman-adv allows to configure three different objects: * batadv hardif - network interface used by batadv meshif to transport the batman-adv packets - its master interface is set to the batadv meshif * batadv (meshif/softif) - virtual interface that emulates a normal 802.3 interface on top - encapsulates traffic and forwards it via the batadv hardifs * batadv vlan - potential VLAN ID on top of batadv meshif - allows filtering of traffic from specific VIDs While batadv vlan objects were already represented as an own proto "batadv_vlan", the batadv meshif could never be fully configured using /etc/config/network. Instead, parts of its configuration were stored in /etc/config/batman_adv and some in the interfaces with the "batadv" proto. To increase the confusion, the "batadv" proto wasn't used to define the batadv meshif but to identify batadv (slave) hardifs. The batman-adv meshifs were also never created directly but only when a hardif was configured. The actual modification of the configuration settings was then applied using a hotplug script hack. The batadv meshif network interface could therefore only be created when an hardif was available and not manipulated with ifup/ifdown. Also `/etc/init.d/network reload` didn't modify the batadv meshif interface configuration correctly. The "batadv" is now renamed to "batadv_hardif" and a new "batadv" proto is used to configure the main (meshif) network interface with all its configuration. A simple network configuration with WiFi & ethernet interfaces and static IP on top of bat0 would look like: # batadv meshif bat0 config interface 'bat0' option proto 'batadv' option routing_algo 'BATMAN_IV' option aggregated_ogms 1 option ap_isolation 0 option bonding 0 option fragmentation 1 #option gw_bandwidth '10000/2000' option gw_mode 'off' #option gw_sel_class 20 option log_level 0 option orig_interval 1000 option bridge_loop_avoidance 1 option distributed_arp_table 1 option multicast_mode 1 option network_coding 0 option hop_penalty 30 option isolation_mark '0x00000000/0x00000000' # add *single* wifi-iface with network bat0_hardif_wlan as hardif to bat0 config interface 'bat0_hardif_wlan' option mtu '1536' option proto 'batadv_hardif' option master 'bat0' # option ifname is filled out by the wifi-iface # add eth0 as hardif to bat0 config interface 'bat0_hardif_eth0' option proto 'batadv_hardif' option master 'bat0' option ifname 'eth0' option mtu '1536' # configure IP on bat0 config interface 'bat0_lan' option ifname 'bat0' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-24 17:51:13 +01:00
set_default routing_algo 'BATMAN_IV'
batctl routing_algo "$routing_algo"
batman-adv: Split batadv proto in meshif and hardif part batman-adv allows to configure three different objects: * batadv hardif - network interface used by batadv meshif to transport the batman-adv packets - its master interface is set to the batadv meshif * batadv (meshif/softif) - virtual interface that emulates a normal 802.3 interface on top - encapsulates traffic and forwards it via the batadv hardifs * batadv vlan - potential VLAN ID on top of batadv meshif - allows filtering of traffic from specific VIDs While batadv vlan objects were already represented as an own proto "batadv_vlan", the batadv meshif could never be fully configured using /etc/config/network. Instead, parts of its configuration were stored in /etc/config/batman_adv and some in the interfaces with the "batadv" proto. To increase the confusion, the "batadv" proto wasn't used to define the batadv meshif but to identify batadv (slave) hardifs. The batman-adv meshifs were also never created directly but only when a hardif was configured. The actual modification of the configuration settings was then applied using a hotplug script hack. The batadv meshif network interface could therefore only be created when an hardif was available and not manipulated with ifup/ifdown. Also `/etc/init.d/network reload` didn't modify the batadv meshif interface configuration correctly. The "batadv" is now renamed to "batadv_hardif" and a new "batadv" proto is used to configure the main (meshif) network interface with all its configuration. A simple network configuration with WiFi & ethernet interfaces and static IP on top of bat0 would look like: # batadv meshif bat0 config interface 'bat0' option proto 'batadv' option routing_algo 'BATMAN_IV' option aggregated_ogms 1 option ap_isolation 0 option bonding 0 option fragmentation 1 #option gw_bandwidth '10000/2000' option gw_mode 'off' #option gw_sel_class 20 option log_level 0 option orig_interval 1000 option bridge_loop_avoidance 1 option distributed_arp_table 1 option multicast_mode 1 option network_coding 0 option hop_penalty 30 option isolation_mark '0x00000000/0x00000000' # add *single* wifi-iface with network bat0_hardif_wlan as hardif to bat0 config interface 'bat0_hardif_wlan' option mtu '1536' option proto 'batadv_hardif' option master 'bat0' # option ifname is filled out by the wifi-iface # add eth0 as hardif to bat0 config interface 'bat0_hardif_eth0' option proto 'batadv_hardif' option master 'bat0' option ifname 'eth0' option mtu '1536' # configure IP on bat0 config interface 'bat0_lan' option ifname 'bat0' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-24 17:51:13 +01:00
batctl -m "$iface" interface create
[ -n "$aggregated_ogms" ] && batctl -m "$iface" aggregation "$aggregated_ogms"
[ -n "$ap_isolation" ] && batctl -m "$iface" ap_isolation "$ap_isolation"
[ -n "$bonding" ] && batctl -m "$iface" bonding "$bonding"
[ -n "$bridge_loop_avoidance" ] && batctl -m "$iface" bridge_loop_avoidance "$bridge_loop_avoidance" 2>&-
[ -n "$distributed_arp_table" ] && batctl -m "$iface" distributed_arp_table "$distributed_arp_table" 2>&-
[ -n "$fragmentation" ] && batctl -m "$iface" fragmentation "$fragmentation"
case "$gw_mode" in
server)
if [ -n "$gw_bandwidth" ]; then
batctl -m "$iface" gw_mode "server" "$gw_bandwidth"
else
batctl -m "$iface" gw_mode "server"
fi
;;
client)
if [ -n "$gw_sel_class" ]; then
batctl -m "$iface" gw_mode "client" "$gw_sel_class"
else
batctl -m "$iface" gw_mode "client"
fi
;;
*)
batctl -m "$iface" gw_mode "off"
;;
esac
[ -n "$hop_penalty" ] && batctl -m "$iface" hop_penalty "$hop_penalty"
[ -n "$isolation_mark" ] && batctl -m "$iface" isolation_mark "$isolation_mark"
[ -n "$multicast_fanout" ] && batctl -m "$iface" multicast_fanout "$multicast_fanout"
batman-adv: Split batadv proto in meshif and hardif part batman-adv allows to configure three different objects: * batadv hardif - network interface used by batadv meshif to transport the batman-adv packets - its master interface is set to the batadv meshif * batadv (meshif/softif) - virtual interface that emulates a normal 802.3 interface on top - encapsulates traffic and forwards it via the batadv hardifs * batadv vlan - potential VLAN ID on top of batadv meshif - allows filtering of traffic from specific VIDs While batadv vlan objects were already represented as an own proto "batadv_vlan", the batadv meshif could never be fully configured using /etc/config/network. Instead, parts of its configuration were stored in /etc/config/batman_adv and some in the interfaces with the "batadv" proto. To increase the confusion, the "batadv" proto wasn't used to define the batadv meshif but to identify batadv (slave) hardifs. The batman-adv meshifs were also never created directly but only when a hardif was configured. The actual modification of the configuration settings was then applied using a hotplug script hack. The batadv meshif network interface could therefore only be created when an hardif was available and not manipulated with ifup/ifdown. Also `/etc/init.d/network reload` didn't modify the batadv meshif interface configuration correctly. The "batadv" is now renamed to "batadv_hardif" and a new "batadv" proto is used to configure the main (meshif) network interface with all its configuration. A simple network configuration with WiFi & ethernet interfaces and static IP on top of bat0 would look like: # batadv meshif bat0 config interface 'bat0' option proto 'batadv' option routing_algo 'BATMAN_IV' option aggregated_ogms 1 option ap_isolation 0 option bonding 0 option fragmentation 1 #option gw_bandwidth '10000/2000' option gw_mode 'off' #option gw_sel_class 20 option log_level 0 option orig_interval 1000 option bridge_loop_avoidance 1 option distributed_arp_table 1 option multicast_mode 1 option network_coding 0 option hop_penalty 30 option isolation_mark '0x00000000/0x00000000' # add *single* wifi-iface with network bat0_hardif_wlan as hardif to bat0 config interface 'bat0_hardif_wlan' option mtu '1536' option proto 'batadv_hardif' option master 'bat0' # option ifname is filled out by the wifi-iface # add eth0 as hardif to bat0 config interface 'bat0_hardif_eth0' option proto 'batadv_hardif' option master 'bat0' option ifname 'eth0' option mtu '1536' # configure IP on bat0 config interface 'bat0_lan' option ifname 'bat0' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-24 17:51:13 +01:00
[ -n "$multicast_mode" ] && batctl -m "$iface" multicast_mode "$multicast_mode" 2>&-
[ -n "$network_coding" ] && batctl -m "$iface" network_coding "$network_coding" 2>&-
[ -n "$log_level" ] && batctl -m "$iface" loglevel "$log_level" 2>&-
[ -n "$orig_interval" ] && batctl -m "$iface" orig_interval "$orig_interval"
proto_init_update "$iface" 1
proto_send_update "$config"
}
proto_batadv_teardown() {
local config="$1"
batman-adv: Split batadv proto in meshif and hardif part batman-adv allows to configure three different objects: * batadv hardif - network interface used by batadv meshif to transport the batman-adv packets - its master interface is set to the batadv meshif * batadv (meshif/softif) - virtual interface that emulates a normal 802.3 interface on top - encapsulates traffic and forwards it via the batadv hardifs * batadv vlan - potential VLAN ID on top of batadv meshif - allows filtering of traffic from specific VIDs While batadv vlan objects were already represented as an own proto "batadv_vlan", the batadv meshif could never be fully configured using /etc/config/network. Instead, parts of its configuration were stored in /etc/config/batman_adv and some in the interfaces with the "batadv" proto. To increase the confusion, the "batadv" proto wasn't used to define the batadv meshif but to identify batadv (slave) hardifs. The batman-adv meshifs were also never created directly but only when a hardif was configured. The actual modification of the configuration settings was then applied using a hotplug script hack. The batadv meshif network interface could therefore only be created when an hardif was available and not manipulated with ifup/ifdown. Also `/etc/init.d/network reload` didn't modify the batadv meshif interface configuration correctly. The "batadv" is now renamed to "batadv_hardif" and a new "batadv" proto is used to configure the main (meshif) network interface with all its configuration. A simple network configuration with WiFi & ethernet interfaces and static IP on top of bat0 would look like: # batadv meshif bat0 config interface 'bat0' option proto 'batadv' option routing_algo 'BATMAN_IV' option aggregated_ogms 1 option ap_isolation 0 option bonding 0 option fragmentation 1 #option gw_bandwidth '10000/2000' option gw_mode 'off' #option gw_sel_class 20 option log_level 0 option orig_interval 1000 option bridge_loop_avoidance 1 option distributed_arp_table 1 option multicast_mode 1 option network_coding 0 option hop_penalty 30 option isolation_mark '0x00000000/0x00000000' # add *single* wifi-iface with network bat0_hardif_wlan as hardif to bat0 config interface 'bat0_hardif_wlan' option mtu '1536' option proto 'batadv_hardif' option master 'bat0' # option ifname is filled out by the wifi-iface # add eth0 as hardif to bat0 config interface 'bat0_hardif_eth0' option proto 'batadv_hardif' option master 'bat0' option ifname 'eth0' option mtu '1536' # configure IP on bat0 config interface 'bat0_lan' option ifname 'bat0' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-24 17:51:13 +01:00
local iface="$config"
batman-adv: Split batadv proto in meshif and hardif part batman-adv allows to configure three different objects: * batadv hardif - network interface used by batadv meshif to transport the batman-adv packets - its master interface is set to the batadv meshif * batadv (meshif/softif) - virtual interface that emulates a normal 802.3 interface on top - encapsulates traffic and forwards it via the batadv hardifs * batadv vlan - potential VLAN ID on top of batadv meshif - allows filtering of traffic from specific VIDs While batadv vlan objects were already represented as an own proto "batadv_vlan", the batadv meshif could never be fully configured using /etc/config/network. Instead, parts of its configuration were stored in /etc/config/batman_adv and some in the interfaces with the "batadv" proto. To increase the confusion, the "batadv" proto wasn't used to define the batadv meshif but to identify batadv (slave) hardifs. The batman-adv meshifs were also never created directly but only when a hardif was configured. The actual modification of the configuration settings was then applied using a hotplug script hack. The batadv meshif network interface could therefore only be created when an hardif was available and not manipulated with ifup/ifdown. Also `/etc/init.d/network reload` didn't modify the batadv meshif interface configuration correctly. The "batadv" is now renamed to "batadv_hardif" and a new "batadv" proto is used to configure the main (meshif) network interface with all its configuration. A simple network configuration with WiFi & ethernet interfaces and static IP on top of bat0 would look like: # batadv meshif bat0 config interface 'bat0' option proto 'batadv' option routing_algo 'BATMAN_IV' option aggregated_ogms 1 option ap_isolation 0 option bonding 0 option fragmentation 1 #option gw_bandwidth '10000/2000' option gw_mode 'off' #option gw_sel_class 20 option log_level 0 option orig_interval 1000 option bridge_loop_avoidance 1 option distributed_arp_table 1 option multicast_mode 1 option network_coding 0 option hop_penalty 30 option isolation_mark '0x00000000/0x00000000' # add *single* wifi-iface with network bat0_hardif_wlan as hardif to bat0 config interface 'bat0_hardif_wlan' option mtu '1536' option proto 'batadv_hardif' option master 'bat0' # option ifname is filled out by the wifi-iface # add eth0 as hardif to bat0 config interface 'bat0_hardif_eth0' option proto 'batadv_hardif' option master 'bat0' option ifname 'eth0' option mtu '1536' # configure IP on bat0 config interface 'bat0_lan' option ifname 'bat0' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-24 17:51:13 +01:00
batctl -m "$iface" interface destroy
}
add_protocol batadv