Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second fastd instance for backbone traffic #200

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ ffnord::mesh {
, '10.35.15.1'
, '10.35.20.1'
],

fastd_igw_enable => true,
fastd_igw_secret => "/root/fastd_igw_secret.key",
fastd_igw_port => 11281,
fastd_igw_peers_git => 'git://somehost/peersigw.git',
igw_mtu => '1280',
}

ffnord::named::zone {
Expand Down
2 changes: 1 addition & 1 deletion manifests/batman-adv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$mesh_code,
$mesh_hop_penalty,
$batman_it = 5000,
$batman_version = $::class::params::batman_version
$batman_version = $ffnord::params::batman_version
) {
include ffnord::resources::batman-adv
include ffnord::firewall
Expand Down
1 change: 1 addition & 0 deletions manifests/fastd.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
define ffnord::fastd( $mesh_code,
$batman_code,
$mesh_interface, # may not be more than 10 characters
$mesh_mac,
$mesh_hop_penalty = 60, # hop penalty for batman advanced
Expand Down
26 changes: 26 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
$dhcp_ranges = [], # dhcp pool
$dns_servers = [], # other dns servers in your network
$mesh_hop_penalty = 60, # hop_penalty for gateway hops

$fastd_igw_enable = false, # enable fastd inter gateway instance
$fastd_igw_peers_git = '', # fastd inter gateway peers
$fastd_igw_secret = '', # fastd inter gateway secret
$fastd_igw_port = 11281, # fastd inter gateway port
$fastd_igw_verify = '', # fastd backbone verification override

$igw_mtu = 1448, # fastd inter gateway mtu
$igw_hop_penalty = 60, # hop_penalty for inter gateway traffic
) {

# TODO We should handle parameters in a param class pattern.
Expand Down Expand Up @@ -66,6 +75,7 @@
} ->
ffnord::fastd { "fastd_${mesh_code}":
mesh_code => $mesh_code,
batman_code => $mesh_code,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need an extra parameter batman_code, when it is the same as mesh_code, in all applied situations?

mesh_interface => $mesh_code,
mesh_mac => $mesh_mac,
mesh_hop_penalty=> $mesh_hop_penalty,
Expand Down Expand Up @@ -94,6 +104,22 @@
ip_prefixlen => $mesh_ipv6_prefixlen;
}

if $fastd_igw_enable {
Class['ffnord::ntp'] -> ffnord::fastd { "fastd_igw_${mesh_code}":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not entirely obvious why this should be applied after the ntp service is setup.

mesh_code => "igw-${mesh_code}",
batman_code => $mesh_code,
mesh_interface => "igw-${mesh_code}",
mesh_mac => $mesh_mac,
mesh_hop_penalty=> $igw_hop_penalty,
vpn_mac => $vpn_mac,
mesh_mtu => $igw_mtu,
fastd_secret => $fastd_igw_secret,
fastd_port => $fastd_igw_port,
fastd_peers_git => $fastd_igw_peers_git,
fastd_verify => $fastd_igw_verify;
}
}

if $ffnord::params::include_bird6 {
ffnord::bird6::mesh { "bird6-${mesh_code}":
mesh_code => $mesh_code,
Expand Down
2 changes: 1 addition & 1 deletion templates/etc/fastd/fastd.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on verify "<%= @fastd_verify %>";
on up "
modprobe batman-adv
ip link set address <%= @vpn_mac %> dev $INTERFACE
/usr/sbin/batctl -m bat-<%= @mesh_code %> if add $INTERFACE
/usr/sbin/batctl -m bat-<%= @batman_code %> if add $INTERFACE
ip link set address <%= @mesh_mac %> dev bat-<%= @mesh_code %>
ifup bat-<%= @mesh_code %>
ip link set up dev $INTERFACE
Expand Down
2 changes: 1 addition & 1 deletion templates/etc/network/mesh-bridge.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
auto br-<%= @mesh_code %>
iface br-<%= @mesh_code %> inet6 static
bridge-ports none
bridge_hw <%= mesh_mac %>
bridge_hw <%= @mesh_mac %>
pre-up /sbin/ip -6 rule add pref 31000 iif $IFACE table 42
pre-up /sbin/ip -6 rule add pref 31001 iif $IFACE unreachable
post-down /sbin/ip -6 rule del pref 31000 iif $IFACE table 42
Expand Down