]> git.ipfire.org Git - network.git/commitdiff
bird: Add some generic configuration file
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 16 Dec 2018 17:10:47 +0000 (17:10 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 16 Dec 2018 17:10:47 +0000 (17:10 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/functions/functions.bird [new file with mode: 0644]

index 399652e1fb85c86a43a02dbb2bd0c197b6a06353..0139f95e82e0eb268e96742cc637f8cc8b46a670 100644 (file)
@@ -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 (file)
index 0000000..9c8b006
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+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}
+}