# Log errors to stderr
log level error;

# Log warnings to a log file
log to syslog as "fastd-hofheim" level warn;

# Set the interface name
interface "fastd-hofheim";

# Disable encryption
method "null";

# Bind to any IPv4 and IPv6 address with a fixed port
bind any:11007;

# fastd needs a key despite the disabled encryption. generate with "fastd --generate-key"
#
# Der öffentliche Schlüssel für die KeyXchange Admins kann
# mit "fastd -c /etc/fastd/<hoodname>/fastd.conf --show-key" angezeigt werden.
secret "XXX-GENERIEREN-UND-HIER-EINFUEGEN-XXX";

# WICHTIG: diese Peers kommen aus der KeyXchange API
# URL: https://keyserver.freifunk-franken.de/v2/index.php?hoodid=4
peer "test" {
  remote ipv4 "hofheim.fff.nixxda.net" port 10000;
  key "e97de5acd15691a3f18c433b7e89543dedf06fa8e36d43ef01388e1c4ebbe13e";
}

# See https://fastd.readthedocs.io/en/v18/manual/mtu.html
# Must not be changed! It has to be the same for both server and all clients.
mtu 1426;

# Skript starten, sobald fastd Interface angelegt ist. Damit wird es zu batman hinzugefügt.
secure handshakes no;

on up "
  ip link set fastd-hofheim up
  ip link add bat-hofheim type batadv
  batctl -m bat-hofheim if add fastd-hofheim
  sysctl -w net.ipv6.conf.bat-hofheim.autoconf=0
  ip link set bat-hofheim up
  brctl addbr br-hofheim
  sysctl -w net.ipv6.conf.br-hofheim.autoconf=0
  ip link set br-hofheim up
  brctl addif br-hofheim bat-hofheim
";

on down "
  ip link del bat-hofheim
  ip link del br-hofheim
";