From: Michael Tremer Date: Sun, 16 Dec 2018 17:10:47 +0000 (+0000) Subject: bird: Add some generic configuration file X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Fnetwork.git;a=commitdiff_plain;h=6a1b0fb170c7d66559935a6a4f8ee0e2bfdbf485 bird: Add some generic configuration file Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 399652e1..0139f95e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -127,6 +127,7 @@ EXTRA_DIST += \ dist_network_DATA = \ src/functions/functions.at \ src/functions/functions.auth \ + src/functions/functions.bird \ src/functions/functions.bonding \ src/functions/functions.bridge \ src/functions/functions.cli \ diff --git a/src/functions/functions.bird b/src/functions/functions.bird new file mode 100644 index 00000000..9c8b0068 --- /dev/null +++ b/src/functions/functions.bird @@ -0,0 +1,74 @@ +#!/bin/bash +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2018 IPFire Network Development Team # +# # +# 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 . # +# # +############################################################################### + +BIRD_CONF="/etc/bird.conf" + +bird_start() { + service_start "bird.service" +} + +bird_stop() { + service_stop "bird.service" +} + +bird_reload() { + service_reload "bird.service" +} + +bird_generate_config() { + log DEBUG "Write BIRD configuration file" + + # Write header + config_header "bird" > ${BIRD_CONF} + + # Write some basic settings + local proto + ( + print "# Log everything to syslog" + print "log syslog all;" + print + + print "# Turn on internal watchdog" + print "watchdog warning 5s;" + print "watchdog timeout 30s;" + print + + print "# Define default route tables" + print "ipv6 table master6;" + print "ipv4 table master4;" + + print "# Enable device configuration" + print "protocol device {}" + print + + print "# Export all routes to kernel" + for proto in ipv6 ipv4; do + print "protocol kernel {" + print " ${proto} {" + print " table ${proto/ipv/master};" + print " export all;" + print " };" + print " learn;" + print "}" + print + done + ) >> ${BIRD_CONF} +}