AGRAVIS Oldenburg/config: Unterschied zwischen den Versionen

Aus Freifunk Nordwest Wiki
Zur Navigation springen Zur Suche springen
(no index)
(IPv6 Client Multidomain)
 
(4 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 369: Zeile 369:
 
option ifname 'eth0.15'
 
option ifname 'eth0.15'
 
option proto 'gluon_wired'
 
option proto 'gluon_wired'
 +
option disabled '0'
 
option transitive '1'
 
option transitive '1'
option disabled '0'
 
 
option macaddr '02:fb:e4:51:9a:15'
 
option macaddr '02:fb:e4:51:9a:15'
  
 
config interface 'mesh_vlan16'
 
config interface 'mesh_vlan16'
 
option ifname 'eth0.16'
 
option ifname 'eth0.16'
option proto 'batif'
+
option proto 'agravis_wired'
option mesh 'ol2'
+
option domain 'oldenburg2'
 +
option domainif 'ol2'
 +
option disabled '0'
 +
option transitive '1'
 
option macaddr '02:fb:e4:51:9a:16'
 
option macaddr '02:fb:e4:51:9a:16'
  
Zeile 382: Zeile 385:
 
option ifname 'eth0.17'
 
option ifname 'eth0.17'
 
option proto 'gluon_wired'
 
option proto 'gluon_wired'
 +
option disabled '0'
 
option transitive '1'
 
option transitive '1'
option disabled '0'
 
 
option macaddr '02:fb:e4:51:9a:17'
 
option macaddr '02:fb:e4:51:9a:17'
  
 
config interface 'mesh_vlan18'
 
config interface 'mesh_vlan18'
 
option ifname 'eth0.18'
 
option ifname 'eth0.18'
option index '0'
+
option proto 'gluon_wired'
 +
option disabled '0'
 
option transitive '1'
 
option transitive '1'
option disabled '0'
 
option proto 'gluon_wired'
 
 
option macaddr '02:fb:e4:51:9a:18'
 
option macaddr '02:fb:e4:51:9a:18'
  
Zeile 473: Zeile 475:
 
config interface 'mesh_vlan30'
 
config interface 'mesh_vlan30'
 
option ifname 'eth0.30'
 
option ifname 'eth0.30'
option proto 'batif'
+
option proto 'agravis_wired'
option mesh 'rastede'
+
option domain 'rastede'
 +
option domainif 'rastede'
 +
option disabled '0'
 +
option transitive '1'
 
option macaddr '02:fb:e4:51:9a:30'
 
option macaddr '02:fb:e4:51:9a:30'
  
 
config interface 'mesh_vlan31'
 
config interface 'mesh_vlan31'
 
option ifname 'eth0.31'
 
option ifname 'eth0.31'
option proto 'batif'
+
option proto 'agravis_wired'
option mesh 'ol2'
+
option domain 'oldenburg2'
 +
option domainif 'ol2'
 +
option disabled '0'
 +
option transitive '1'
 
option macaddr '02:fb:e4:51:9a:31'
 
option macaddr '02:fb:e4:51:9a:31'
  
Zeile 611: Zeile 619:
 
config interface 'mesh_vlan50'
 
config interface 'mesh_vlan50'
 
option ifname 'eth0.50'
 
option ifname 'eth0.50'
option proto 'batif'
+
option proto 'agravis_wired'
option mesh 'ol2'
+
option domain 'oldenburg2'
 +
option domainif 'ol2'
 +
option disabled '0'
 +
option transitive '1'
 
option macaddr '02:fb:e4:51:9a:50'
 
option macaddr '02:fb:e4:51:9a:50'
  
Zeile 747: Zeile 758:
 
option transitive '1'
 
option transitive '1'
 
option macaddr '02:fb:e4:51:9a:69'
 
option macaddr '02:fb:e4:51:9a:69'
 
config interface 'bat_ol2'
 
option ifname 'bat-ol2'
 
option gw_mode 'client'
 
option proto 'bat'
 
 
config interface 'bat_rastede'
 
option ifname 'bat-rastede'
 
        option gw_mode 'client'               
 
        option proto 'bat'
 
  
 
config interface 'mgmt'
 
config interface 'mgmt'
Zeile 765: Zeile 766:
 
option ip4table '120'
 
option ip4table '120'
 
option ip6addr 'fe80::1'
 
option ip6addr 'fe80::1'
 +
 +
config rule
 +
option in 'mgmt'
 +
option goto '100000'
  
 
config interface 'client4'
 
config interface 'client4'
Zeile 770: Zeile 775:
 
option auto '1'
 
option auto '1'
 
option proto 'dhcp'
 
option proto 'dhcp'
option ip4table '120'
+
option ip4table '100'
 +
 
 +
config rule 'routing_bat0'
 +
option priority '100000'
 +
option lookup '100'
 +
 
 +
config interface 'agravis_bat_ol2'
 +
option gw_mode 'client'
 +
option proto 'agravis_bat'
 +
option domain 'oldenburg2'
 +
option domainif 'ol2'
 +
 
 +
config interface 'bat_ol2'
 +
option multicast_router '2'
 +
option ifname 'bat-ol2'
 +
option auto '1'
 +
option macaddr 'b4:fb:e4:51:9a:46'
 +
option learning '1'
 +
option proto 'none'
 +
 
 +
config interface 'client_ol2'
 +
option ifname 'bat-ol2'
 +
option auto '1'
 +
option proto 'dhcp'
 +
option ipv6 '1'
 +
option ip4table '101'
 +
option ip6table '101'
 +
 
 +
config rule 'routing_ol2'
 +
option priority '100001'
 +
option lookup '101'
 +
 
 +
config rule6 'routing6_ol2'
 +
option priority '100001'
 +
option lookup '101'
 +
 
 +
config interface 'agravis_bat_rastede'
 +
option gw_mode 'client'
 +
option proto 'agravis_bat'
 +
option domain 'rastede'
 +
option domainif 'rastede'
 +
 
 +
config interface 'bat_rastede'
 +
option multicast_router '2'
 +
option ifname 'bat-rastede'
 +
option auto '1'
 +
option macaddr 'b4:fb:e4:51:9a:46'
 +
option learning '1'
 +
option proto 'none'
 +
 
 +
config interface 'client_rastede'
 +
option ifname 'bat-rastede'
 +
option auto '1'
 +
option proto 'dhcp'
 +
option ipv6 '1'
 +
option ip4table '102'
 +
option ip6table '102'
 +
 
 +
config rule 'routing_rastede'
 +
option priority '100002'
 +
option lookup '102'
  
config rule
+
config rule6 'routing6_rastede'
option in 'mgmt'
+
option priority '100002'
option lookup '120'
+
option lookup '102'
  
 
</pre>
 
</pre>
Zeile 800: Zeile 865:
  
 
== Multihood ==
 
== Multihood ==
 
+
/lib/gluon/upgrade/742-agravis
=== /lib/netifd/proto/bat.sh ===
 
Make executable
 
 
  #!/bin/sh
 
  #!/bin/sh
   
+
  function mkifsetupteardown() {
. /lib/functions.sh
+
  mkdir "$2"
. ../netifd-proto.sh
+
  find "$1" -type d -print | sed -n "s|^$1/||p" | while IFS= read -r dir; do
init_proto "$@"
+
mkdir "$2/$dir"
+
  done
proto_bat_init_config() {
+
find "$1" -type f -print | sed -n "s|^$1/||p" | while IFS= read -r file; do
  no_device=1
+
sed 's/gluon_bat0/agravis_bat_$DOMAINIF/' "$1/$file" > "$2/$file"
available=1
+
  <nowiki> </nowiki>      chmod +x "$2/$file"
renew_handler=1
+
done
 
proto_config_add_string 'gw_mode'
 
}
 
 
lookup_site() {
 
local path="$1" default="$2"
 
  lua -e "print(require('gluon.site').$path('$default'))"
 
}
 
 
lookup_uci() {
 
local path="$1" default="$2"
 
  uci -q get "$path" || echo "$default"
 
}
 
 
proto_bat_renew() {
 
local CONFIG="$1"
 
 
local ifname
 
json_get_vars ifname
 
 
local IFNAME="${ifname:-$CONFIG}"
 
 
lock /var/lock/"$IFNAME".bat.lock
 
 
ubus call network.interface dump | jsonfilter \
 
-e "@.interface[@.proto='batif' && @.data.mesh='${IFNAME:4}' && @.up=true].device" \
 
| xargs -r -n 1 batctl -m "$IFNAME" interface add
 
   
 
lock -u /var/lock/"$IFNAME".bat.lock
 
 
  }
 
  }
 
   
 
   
  proto_bat_setup() {
+
  mkifsetupteardown "/lib/gluon/core/mesh/setup.d" "/lib/gluon/core/mesh/agravis-setup.d"
local CONFIG="$1"
+
  mkifsetupteardown "/lib/gluon/core/mesh/post-setup.d" "/lib/gluon/core/mesh/agravis-post-setup.d"
   
+
  mkifsetupteardown "/lib/gluon/core/mesh/teardown.d" "/lib/gluon/core/mesh/agravis-teardown.d"
local routing_algo=$(lookup_site 'mesh.batman_adv.routing_algo' 'BATMAN_IV')
 
   
 
local gw_mode ifname
 
json_get_vars gw_mode ifname
 
 
local IFNAME="${ifname:-$CONFIG}"
 
 
   
 
   
batctl -m "$IFNAME" routing_algo "$routing_algo"
+
<nowiki>#</nowiki> TODO lua -e "print(require('gluon.site').$path('$default'))" returning correct site?
batctl -m "$IFNAME" interface create
+
sed -e 's/gluon_bat0.lock/agravis_bat_$domainif.lock/' \
 +
<nowiki> </nowiki>  -e 's/gluon_bat0/agravis_bat/' \
 +
<nowiki> </nowiki>  -e 's/local gw_mode/local gw_mode domain domainif/' \
 +
<nowiki> </nowiki>  -e 's/json_get_vars gw_mode/json_get_vars gw_mode domain domainif/' \
 +
<nowiki> </nowiki>  -e 's/primary0_/pri_/' \
 +
<nowiki> </nowiki>  -e 's/primary0/pri-$domainif/' \
 +
<nowiki> </nowiki>  -e 's/batctl/batctl -m "bat-$domainif"/' \
 +
<nowiki> </nowiki>  -e '/^proto_agravis_bat_renew() {$/{N;s/proto_agravis_bat_renew() {\n\tlocal config="$1"/proto_agravis_bat_renew() {\n\tlocal config="$1"\n\n\tlocal domain domainif\n\tjson_get_vars domain domainif/}' \
 +
<nowiki> </nowiki>  -e '/^proto_agravis_bat_teardown() {$/{N;s/proto_agravis_bat_teardown() {\n\tlocal config="$1"/proto_agravis_bat_teardown() {\n\tlocal config="$1"\n\n\tlocal domain domainif\n\tjson_get_vars domain domainif/}' \
 +
<nowiki> </nowiki>  -e "s/@.proto='gluon_mesh'/@.proto='agravis_mesh' \&\& @.data.domainif='\$domainif'/" \
 +
<nowiki> </nowiki>  -e "s/proto_config_add_string 'gw_mode'/proto_config_add_string 'gw_mode'\n\tproto_config_add_string 'domain'\n\tproto_config_add_string 'domainif'/" \
 +
<nowiki> </nowiki>  /lib/netifd/proto/gluon_bat0.sh >/lib/netifd/proto/agravis_bat.sh
 +
chmod +x /lib/netifd/proto/agravis_bat.sh
 
   
 
   
batctl -m "$IFNAME" orig_interval 5000
+
sed -e 's/gluon_mesh/agravis_mesh/' \
batctl -m "$IFNAME" hop_penalty "$(lookup_uci 'gluon.mesh_batman_adv.hop_penalty' 15)"
+
<nowiki> </nowiki>  -e 's!/lib/gluon/core/mesh/!/lib/gluon/core/mesh/agravis-!' \
batctl -m "$IFNAME" multicast_mode 0
+
<nowiki> </nowiki>  -e 's/local fixed_mtu transitive/local fixed_mtu transitive domain domainif/' \
 +
<nowiki> </nowiki>  -e 's/json_get_vars fixed_mtu transitive/json_get_vars fixed_mtu transitive domain domainif/' \
 +
<nowiki> </nowiki>  -e 's/export TRANSITIVE="${transitive:-0}"/export TRANSITIVE="${transitive:-0}"\n\texport DOMAIN="$domain"\n\texport DOMAINIF="$domainif"/' \
 +
<nowiki> </nowiki>  -e 's/json_add_boolean transitive "$TRANSITIVE"/json_add_boolean transitive "$TRANSITIVE"\n\tjson_add_string domain "$DOMAIN"\n\tjson_add_string domainif "$DOMAINIF"/' \
 +
<nowiki> </nowiki>  -e 's/proto_config_add_boolean transitive/proto_config_add_boolean transitive\n\tproto_config_add_string domain\n\tproto_config_add_string domainif/' \
 +
<nowiki> </nowiki>  -e 's!for script in /lib/gluon/core/mesh/agravis-teardown.d/!local domain domainif\n\tjson_get_vars domain domainif\n\texport DOMAIN="$domain"\n\texport DOMAINIF="$domainif"\n\n\tfor script in /lib/gluon/core/mesh/agravis-teardown.d/!' \
 +
<nowiki> </nowiki>  /lib/netifd/proto/gluon_mesh.sh >/lib/netifd/proto/agravis_mesh.sh
 +
chmod +x /lib/netifd/proto/agravis_mesh.sh
 
   
 
   
case "$gw_mode" in
+
sed -e 's/gluon_wired/agravis_wired/' \
server)
+
<nowiki> </nowiki>  -e 's/proto_config_add_string vxpeer6addr/proto_config_add_string vxpeer6addr\n\tproto_config_add_string domain\n\tproto_config_add_string domainif/' \
batctl -m "$IFNAME" gw_mode "server"
+
<nowiki> </nowiki>  -e 's/local transitive index vxlan vxpeer6addr/local transitive index vxlan vxpeer6addr domain domainif/' \
;;
+
<nowiki> </nowiki>  -e 's/json_get_vars transitive index vxlan vxpeer6addr/json_get_vars transitive index vxlan vxpeer6addr domain domainif/' \
client)
+
<nowiki> </nowiki>  -e "s/json_add_string proto 'gluon_mesh'/json_add_string proto 'agravis_mesh'\n\tjson_add_string domain \"\$domain\"\n\tjson_add_string domainif \"\$domainif\"/" \
local gw_sel_class="$(lookup_site 'mesh.batman_adv.gw_sel_class')"
+
<nowiki> </nowiki>  -e "s#require(\"gluon.util\").domain_seed_bytes(#require(\"gluon.agravis\").domain_seed_bytes(\"'\"\$(cat /lib/gluon/domains/\"\$domain\".json | jsonfilter -e \"@.domain_seed\")\"'\", #" \
if [ -n "$gw_sel_class" ]; then
+
<nowiki> </nowiki>  /lib/netifd/proto/gluon_wired.sh >/lib/netifd/proto/agravis_wired.sh
batctl -m "$IFNAME" gw_mode "client" "$gw_sel_class"
+
chmod +x /lib/netifd/proto/agravis_wired.sh
else
 
batctl -m "$IFNAME" gw_mode "client"
 
fi
 
;;
 
*)
 
batctl -m "$IFNAME" gw_mode "off"
 
;;
 
esac
 
 
   
 
   
 +
cat <<EOF >/usr/lib/lua/gluon/agravis.lua
 +
local util = require 'gluon.util'
 
   
 
   
local primary0_mac="$(lua -e 'print(require("gluon.util").generate_mac(3))')"
+
local M = {}
 
   
 
   
ip link add "pri-${IFNAME:4}" type dummy
+
function M.domain_seed_bytes(domain_seed, key, length)
  echo 1 > /proc/sys/net/ipv6/conf/"pri-${IFNAME:4}"/disable_ipv6
+
  local ret = <nowiki>''</nowiki>
ip link set "pri-${IFNAME:4}" address "$primary0_mac" mtu 1532 up
+
  local v = <nowiki>''</nowiki>
 
+
  local i = 0
  ip link set "$IFNAME" address "$(lua -e 'print(require("gluon.sysconfig").primary_mac)')"
 
 
   
 
   
  batctl -m "$IFNAME" interface add "pri-${IFNAME:4}"
+
  -- Inspired by HKDF key expansion, but much simpler, as we don't need
 +
-- cryptographic strength
 +
while ret:len() < 2*length do
 +
i = i + 1
 +
v = hash.md5(v .. key .. domain_seed:lower() .. i)
 +
ret = ret .. v
 +
end
 
   
 
   
  proto_init_update "pri-${IFNAME:4}" 1
+
  return ret:sub(0, 2*length)
proto_init_update "$IFNAME" 1
+
end
proto_send_update "$CONFIG"
 
 
   
 
   
proto_bat_renew "$1"
+
return M
  }
+
  EOF
 
   
 
   
  proto_bat_teardown() {
+
  sed -i "s/@.proto='gluon_mesh'/(@.proto='gluon_mesh' || @.proto='agravis_mesh')/" /etc/init.d/gluon-respondd
local CONFIG="$1"
 
local IFNAME="$2"
 
 
batctl -m "$IFNAME" interface destroy
 
ip link del "pri-${IFNAME:4}"
 
}
 
 
add_protocol bat
 
 
 
=== /lib/netifd/proto/batif.sh ===
 
Make executable
 
#!/bin/sh
 
 
. /lib/functions.sh
 
. ../netifd-proto.sh
 
init_proto "$@"
 
 
proto_batif_init_config() {
 
proto_config_add_string 'mesh'
 
}
 
 
proto_batif_setup() {
 
local CONFIG="$1"
 
local IFNAME="$2"
 
 
local mesh
 
json_get_vars mesh
 
 
ubus call network.interface."$CONFIG" set_data "{\"mesh\":\"$mesh\"}"
 
 
proto_init_update "$IFNAME" 1
 
proto_send_update "$CONFIG"
 
 
ubus call network.interface."bat_${mesh}" renew
 
}
 
 
proto_batif_teardown() {
 
local CONFIG="$1"
 
local IFNAME="$2"
 
 
batctl -m "bat-${mesh}" interface -M del "$IFNAME" 2>/dev/null
 
}
 
 
add_protocol batif
 
 
 
=== Beispiel Netzwerkkonfiguration ===
 
config interface 'mesh_vlan123'
 
option ifname 'eth0.123'
 
option proto 'batif'
 
option mesh 'hood2'
 
   
 
config interface 'bat_hood2'
 
option ifname 'bat-hood2'
 
option gw_mode 'client'
 
option proto 'bat'
 

Aktuelle Version vom 29. März 2022, 16:18 Uhr

Network

package network

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '2 6t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '120'
	option ports '0t 1 3t 4t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '3'
	option ports '3 4 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '10'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '11'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '12'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '13'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '14'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '15'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '16'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '17'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '18'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '19'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '20'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '21'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '22'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '23'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '24'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '25'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '26'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '27'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '28'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '29'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '30'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '31'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '32'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '33'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '34'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '35'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '36'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '37'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '38'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '39'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '40'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '41'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '42'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '43'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '44'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '45'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '46'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '47'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '48'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '49'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '50'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '51'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '52'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '53'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '54'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '55'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '56'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '57'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '58'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '59'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '60'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '61'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '62'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '63'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '64'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '65'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '66'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '67'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '68'
	option ports '0t 6t'
	
config switch_vlan
	option device 'switch0'
	option vlan '69'
	option ports '0t 6t'

config interface 'mesh_vlan3'
	option ifname 'eth0.3'
	option index '0'
	option proto 'gluon_wired'
	option disabled '0'
	option transitive '1'

config interface 'mesh_vlan10'
	option ifname 'eth0.10'
	option proto 'gluon_wired'
	option disabled '0'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:10'

config interface 'mesh_vlan11'
	option ifname 'eth0.11'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:11'

config interface 'mesh_vlan12'
	option ifname 'eth0.12'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:12'

config interface 'mesh_vlan13'
	option ifname 'eth0.13'
	option index '0'
	option proto 'gluon_wired'
	option disabled '0'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:13'

config interface 'mesh_vlan14'
	option ifname 'eth0.14'
	option proto 'gluon_wired'
	option disabled '0'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:14'

config interface 'mesh_vlan15'
	option ifname 'eth0.15'
	option proto 'gluon_wired'
	option disabled '0'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:15'

config interface 'mesh_vlan16'
	option ifname 'eth0.16'
	option proto 'agravis_wired'
	option domain 'oldenburg2'
	option domainif 'ol2'
	option disabled '0'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:16'

config interface 'mesh_vlan17'
	option ifname 'eth0.17'
	option proto 'gluon_wired'
	option disabled '0'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:17'

config interface 'mesh_vlan18'
	option ifname 'eth0.18'
	option proto 'gluon_wired'
	option disabled '0'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:18'

config interface 'mesh_vlan19'
	option ifname 'eth0.19'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:19'

config interface 'mesh_vlan20'
	option ifname 'eth0.20'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:20'

config interface 'mesh_vlan21'
	option ifname 'eth0.21'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:21'

config interface 'mesh_vlan22'
	option ifname 'eth0.22'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:22'

config interface 'mesh_vlan23'
	option ifname 'eth0.23'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:23'

config interface 'mesh_vlan24'
	option ifname 'eth0.24'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:24'

config interface 'mesh_vlan25'
	option ifname 'eth0.25'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:25'

config interface 'mesh_vlan26'
	option ifname 'eth0.26'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:26'

config interface 'mesh_vlan27'
	option ifname 'eth0.27'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:27'

config interface 'mesh_vlan28'
	option ifname 'eth0.28'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:28'

config interface 'mesh_vlan29'
	option ifname 'eth0.29'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:29'

config interface 'mesh_vlan30'
	option ifname 'eth0.30'
	option proto 'agravis_wired'
	option domain 'rastede'
	option domainif 'rastede'
	option disabled '0'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:30'

config interface 'mesh_vlan31'
	option ifname 'eth0.31'
	option proto 'agravis_wired'
	option domain 'oldenburg2'
	option domainif 'ol2'
	option disabled '0'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:31'

config interface 'mesh_vlan32'
	option ifname 'eth0.32'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:32'

config interface 'mesh_vlan33'
	option ifname 'eth0.33'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:33'

config interface 'mesh_vlan34'
	option ifname 'eth0.34'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:34'

config interface 'mesh_vlan35'
	option ifname 'eth0.35'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:35'

config interface 'mesh_vlan36'
	option ifname 'eth0.36'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:36'

config interface 'mesh_vlan37'
	option ifname 'eth0.37'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:37'

config interface 'mesh_vlan38'
	option ifname 'eth0.38'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:38'

config interface 'mesh_vlan39'
	option ifname 'eth0.39'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:39'

config interface 'mesh_vlan40'
	option ifname 'eth0.40'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:40'

config interface 'mesh_vlan41'
	option ifname 'eth0.41'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:41'

config interface 'mesh_vlan42'
	option ifname 'eth0.42'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:42'

config interface 'mesh_vlan43'
	option ifname 'eth0.43'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:43'

config interface 'mesh_vlan44'
	option ifname 'eth0.44'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:44'

config interface 'mesh_vlan45'
	option ifname 'eth0.45'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:45'

config interface 'mesh_vlan46'
	option ifname 'eth0.46'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:46'

config interface 'mesh_vlan47'
	option ifname 'eth0.47'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:47'

config interface 'mesh_vlan48'
	option ifname 'eth0.48'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:48'

config interface 'mesh_vlan49'
	option ifname 'eth0.49'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:49'

config interface 'mesh_vlan50'
	option ifname 'eth0.50'
	option proto 'agravis_wired'
	option domain 'oldenburg2'
	option domainif 'ol2'
	option disabled '0'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:50'

config interface 'mesh_vlan51'
	option ifname 'eth0.51'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:51'

config interface 'mesh_vlan52'
	option ifname 'eth0.52'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:52'

config interface 'mesh_vlan53'
	option ifname 'eth0.53'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:53'

config interface 'mesh_vlan54'
	option ifname 'eth0.54'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:54'

config interface 'mesh_vlan55'
	option ifname 'eth0.55'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:55'

config interface 'mesh_vlan56'
	option ifname 'eth0.56'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:56'

config interface 'mesh_vlan57'
	option ifname 'eth0.57'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:57'

config interface 'mesh_vlan58'
	option ifname 'eth0.58'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:58'

config interface 'mesh_vlan59'
	option ifname 'eth0.59'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:59'

config interface 'mesh_vlan60'
	option ifname 'eth0.60'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:60'

config interface 'mesh_vlan61'
	option ifname 'eth0.61'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:61'

config interface 'mesh_vlan62'
	option ifname 'eth0.62'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:62'

config interface 'mesh_vlan63'
	option ifname 'eth0.63'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:63'

config interface 'mesh_vlan64'
	option ifname 'eth0.64'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:64'

config interface 'mesh_vlan65'
	option ifname 'eth0.65'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:65'

config interface 'mesh_vlan66'
	option ifname 'eth0.66'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:66'

config interface 'mesh_vlan67'
	option ifname 'eth0.67'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:67'

config interface 'mesh_vlan68'
	option ifname 'eth0.68'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:68'

config interface 'mesh_vlan69'
	option ifname 'eth0.69'
	option proto 'gluon_wired'
	option disabled '1'
	option transitive '1'
	option macaddr '02:fb:e4:51:9a:69'

config interface 'mgmt'
	option ifname 'eth0.120'
	option proto 'static'
	option ipaddr '172.20.0.2'
	option netmask '16'
	option ip4table '120'
	option ip6addr 'fe80::1'

config rule
	option in 'mgmt'
	option goto '100000'

config interface 'client4'
	option ifname 'br-client'
	option auto '1'
	option proto 'dhcp'
	option ip4table '100'

config rule 'routing_bat0'
	option priority '100000'
	option lookup '100'

config interface 'agravis_bat_ol2'
	option gw_mode 'client'
	option proto 'agravis_bat'
	option domain 'oldenburg2'
	option domainif 'ol2'

config interface 'bat_ol2'
	option multicast_router '2'
	option ifname 'bat-ol2'
	option auto '1'
	option macaddr 'b4:fb:e4:51:9a:46'
	option learning '1'
	option proto 'none'

config interface 'client_ol2'
	option ifname 'bat-ol2'
	option auto '1'
	option proto 'dhcp'
	option ipv6 '1'
	option ip4table '101'
	option ip6table '101'

config rule 'routing_ol2'
	option priority '100001'
	option lookup '101'

config rule6 'routing6_ol2'
	option priority '100001'
	option lookup '101'

config interface 'agravis_bat_rastede'
	option gw_mode 'client'
	option proto 'agravis_bat'
	option domain 'rastede'
	option domainif 'rastede'

config interface 'bat_rastede'
	option multicast_router '2'
	option ifname 'bat-rastede'
	option auto '1'
	option macaddr 'b4:fb:e4:51:9a:46'
	option learning '1'
	option proto 'none'

config interface 'client_rastede'
	option ifname 'bat-rastede'
	option auto '1'
	option proto 'dhcp'
	option ipv6 '1'
	option ip4table '102'
	option ip6table '102'

config rule 'routing_rastede'
	option priority '100002'
	option lookup '102'

config rule6 'routing6_rastede'
	option priority '100002'
	option lookup '102'

Firewall

config zone
	option name 'mgmt'
	list network 'mgmt'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'

config forwarding
	option src 'mgmt'
	option dest 'mesh'

uci set firewall.mesh.masq='1'
uci set firewall.mesh.mtu_fix='1'
uci set firewall.mesh.masq_src='mgmt'
uci commit firewall

Multihood

/lib/gluon/upgrade/742-agravis

#!/bin/sh
function mkifsetupteardown() {
	mkdir "$2"
	find "$1" -type d -print | sed -n "s|^$1/||p" | while IFS= read -r dir; do
		mkdir "$2/$dir"
	done
	find "$1" -type f -print | sed -n "s|^$1/||p" | while IFS= read -r file; do
		sed 's/gluon_bat0/agravis_bat_$DOMAINIF/' "$1/$file" > "$2/$file"
        chmod +x "$2/$file"
	done
}

mkifsetupteardown "/lib/gluon/core/mesh/setup.d" "/lib/gluon/core/mesh/agravis-setup.d"
mkifsetupteardown "/lib/gluon/core/mesh/post-setup.d" "/lib/gluon/core/mesh/agravis-post-setup.d"
mkifsetupteardown "/lib/gluon/core/mesh/teardown.d" "/lib/gluon/core/mesh/agravis-teardown.d"

# TODO lua -e "print(require('gluon.site').$path('$default'))" returning correct site?
sed -e 's/gluon_bat0.lock/agravis_bat_$domainif.lock/' \
    -e 's/gluon_bat0/agravis_bat/' \
    -e 's/local gw_mode/local gw_mode domain domainif/' \
    -e 's/json_get_vars gw_mode/json_get_vars gw_mode domain domainif/' \
    -e 's/primary0_/pri_/' \
    -e 's/primary0/pri-$domainif/' \
    -e 's/batctl/batctl -m "bat-$domainif"/' \
    -e '/^proto_agravis_bat_renew() {$/{N;s/proto_agravis_bat_renew() {\n\tlocal config="$1"/proto_agravis_bat_renew() {\n\tlocal config="$1"\n\n\tlocal domain domainif\n\tjson_get_vars domain domainif/}' \
    -e '/^proto_agravis_bat_teardown() {$/{N;s/proto_agravis_bat_teardown() {\n\tlocal config="$1"/proto_agravis_bat_teardown() {\n\tlocal config="$1"\n\n\tlocal domain domainif\n\tjson_get_vars domain domainif/}' \
    -e "s/@.proto='gluon_mesh'/@.proto='agravis_mesh' \&\& @.data.domainif='\$domainif'/" \
    -e "s/proto_config_add_string 'gw_mode'/proto_config_add_string 'gw_mode'\n\tproto_config_add_string 'domain'\n\tproto_config_add_string 'domainif'/" \
    /lib/netifd/proto/gluon_bat0.sh >/lib/netifd/proto/agravis_bat.sh
chmod +x /lib/netifd/proto/agravis_bat.sh

sed -e 's/gluon_mesh/agravis_mesh/' \
    -e 's!/lib/gluon/core/mesh/!/lib/gluon/core/mesh/agravis-!' \
    -e 's/local fixed_mtu transitive/local fixed_mtu transitive domain domainif/' \
    -e 's/json_get_vars fixed_mtu transitive/json_get_vars fixed_mtu transitive domain domainif/' \
    -e 's/export TRANSITIVE="${transitive:-0}"/export TRANSITIVE="${transitive:-0}"\n\texport DOMAIN="$domain"\n\texport DOMAINIF="$domainif"/' \
    -e 's/json_add_boolean transitive "$TRANSITIVE"/json_add_boolean transitive "$TRANSITIVE"\n\tjson_add_string domain "$DOMAIN"\n\tjson_add_string domainif "$DOMAINIF"/' \
    -e 's/proto_config_add_boolean transitive/proto_config_add_boolean transitive\n\tproto_config_add_string domain\n\tproto_config_add_string domainif/' \
    -e 's!for script in /lib/gluon/core/mesh/agravis-teardown.d/!local domain domainif\n\tjson_get_vars domain domainif\n\texport DOMAIN="$domain"\n\texport DOMAINIF="$domainif"\n\n\tfor script in /lib/gluon/core/mesh/agravis-teardown.d/!' \
    /lib/netifd/proto/gluon_mesh.sh >/lib/netifd/proto/agravis_mesh.sh
chmod +x /lib/netifd/proto/agravis_mesh.sh

sed -e 's/gluon_wired/agravis_wired/' \
    -e 's/proto_config_add_string vxpeer6addr/proto_config_add_string vxpeer6addr\n\tproto_config_add_string domain\n\tproto_config_add_string domainif/' \
    -e 's/local transitive index vxlan vxpeer6addr/local transitive index vxlan vxpeer6addr domain domainif/' \
    -e 's/json_get_vars transitive index vxlan vxpeer6addr/json_get_vars transitive index vxlan vxpeer6addr domain domainif/' \
    -e "s/json_add_string proto 'gluon_mesh'/json_add_string proto 'agravis_mesh'\n\tjson_add_string domain \"\$domain\"\n\tjson_add_string domainif \"\$domainif\"/" \
    -e "s#require(\"gluon.util\").domain_seed_bytes(#require(\"gluon.agravis\").domain_seed_bytes(\"'\"\$(cat /lib/gluon/domains/\"\$domain\".json | jsonfilter -e \"@.domain_seed\")\"'\", #" \
    /lib/netifd/proto/gluon_wired.sh >/lib/netifd/proto/agravis_wired.sh
chmod +x /lib/netifd/proto/agravis_wired.sh

cat <<EOF >/usr/lib/lua/gluon/agravis.lua
local util = require 'gluon.util'

local M = {}

function M.domain_seed_bytes(domain_seed, key, length)
	local ret = ''
	local v = ''
	local i = 0

	-- Inspired by HKDF key expansion, but much simpler, as we don't need
	-- cryptographic strength
	while ret:len() < 2*length do
		i = i + 1
		v = hash.md5(v .. key .. domain_seed:lower() .. i)
		ret = ret .. v
	end

	return ret:sub(0, 2*length)
end

return M
EOF

sed -i "s/@.proto='gluon_mesh'/(@.proto='gluon_mesh' || @.proto='agravis_mesh')/" /etc/init.d/gluon-respondd