Drop code for radvd
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 31 Mar 2019 12:20:40 +0000 (14:20 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 31 Mar 2019 12:20:40 +0000 (14:20 +0200)
This is now being replaced by bird.

Bird is running anyways and can do this job just as well.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/functions/functions.bird
src/functions/functions.dns
src/functions/functions.radvd [deleted file]
src/functions/functions.routing
src/network-radvd-config [deleted file]

index 1b5e7e9..ce587b7 100644 (file)
@@ -173,7 +173,6 @@ dist_network_DATA = \
        src/functions/functions.ports \
        src/functions/functions.ppp \
        src/functions/functions.pppoe-server \
-       src/functions/functions.radvd \
        src/functions/functions.route \
        src/functions/functions.routing \
        src/functions/functions.serial \
@@ -193,7 +192,6 @@ dist_network_DATA = \
        src/functions/functions.wireless-networks \
        src/functions/functions.wpa_supplicant \
        src/functions/functions.zone \
-       src/network-radvd-config \
        src/header-config \
        src/header-port \
        src/header-zone
index 950bb78..55d43b5 100644 (file)
@@ -33,6 +33,17 @@ bird_reload() {
        service_reload "bird.service"
 }
 
+# Update configuration any apply it in one go
+bird_update() {
+       if ! bird_generate_config; then
+               log ERROR "Could not write Bird configuration"
+               return ${EXIT_ERROR}
+       fi
+
+       # Reload bird
+       bird_reload
+}
+
 bird_generate_config() {
        log DEBUG "Write BIRD configuration file"
 
index 890f1ac..0e058be 100644 (file)
@@ -31,8 +31,8 @@ NETWORK_SETTINGS_FILE_PARAMS="${NETWORK_SETTINGS_FILE_PARAMS} DNS_RANDOMIZE"
 DNS_SEARCH_DOMAINS=""
 NETWORK_SETTINGS_FILE_PARAMS="${NETWORK_SETTINGS_FILE_PARAMS} DNS_SEARCH_DOMAINS"
 
-# Set this option to true if the DNS servers should be advertised by
-# radvd.
+# Set this option to true if the DNS servers should be advertised in
+# IPv6 router advertisements
 DNS_ADVERTISE_SERVERS="true"
 
 DNS_SERVER_CONFIG_FILE="${NETWORK_CONFIG_DIR}/dns-servers"
@@ -234,8 +234,8 @@ dns_server_update() {
        # Regenerate /etc/resolv.conf
        dns_generate_resolvconf
 
-       # Restart radvd which propagates IPv6 DNS servers
-       radvd_update
+       # Update bird about IPv6 DNS server changes
+       bird_update
 }
 
 dns_generate_resolvconf() {
diff --git a/src/functions/functions.radvd b/src/functions/functions.radvd
deleted file mode 100644 (file)
index 1c8b8d0..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/bin/bash
-###############################################################################
-#                                                                             #
-# IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2010  Michael Tremer & Christian Schmidt                      #
-#                                                                             #
-# 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/>.       #
-#                                                                             #
-###############################################################################
-
-RADVD_CONFIGFILE="/etc/radvd.conf"
-
-radvd_update() {
-       # (Re-)write the configuration file
-       if radvd_write_config; then
-               # Reload the radvd service if it is already running
-               if service_is_active radvd; then
-                       service_reload radvd
-                       return ${EXIT_OK}
-               fi
-
-               # Start the radvd service
-               service_start radvd
-       fi
-}
-
-radvd_clear_config() {
-       log DEBUG "Clearing radv daemon configuration file"
-
-       config_header "radv daemon configuration file" > ${RADVD_CONFIGFILE}
-
-       return ${EXIT_OK}
-}
-
-radvd_write_config() {
-       radvd_clear_config
-
-       # Write the configuration for all zones.
-       local zone
-
-       # The return value determine if radvd is started or not
-       local return_value=${EXIT_FALSE}
-
-       for zone in $(zones_get_local); do
-               if __radvd_config_interface ${zone}; then
-                       # We return TRUE when __radvd_config_interface returns True
-                       return_value=${EXIT_TRUE}
-               fi
-       done >> ${RADVD_CONFIGFILE}
-
-       return ${return_value}
-}
-
-# This function return ${EXIT_FALSE} if no radvd config was written and ${EXIT_TRUE} in all other cases
-__radvd_config_interface() {
-       local zone=${1}
-       assert isset zone
-
-       log DEBUG "Writing radvd configuration for ${zone}."
-
-       # If the interface does not provide any routing information,
-       # we can skip this whole stuff.
-       if ! db_exists "${zone}/ipv6"; then
-               return ${EXIT_FALSE}
-       fi
-
-       # Skip if zone is not active.
-       local active="$(db_get "${zone}/ipv6/active")"
-       [ "${active}" = "0" ] && return ${EXIT_FALSE}
-
-       # Skip if there is no prefix or prefix is link-local.
-       local addr="$(db_get "${zone}/ipv6/local-ip-address")"
-       if [ -z "${addr}" ] || [ "${addr:0:5}" = "fe80:" ]; then
-               return ${EXIT_FALSE}
-       fi
-
-       # Check if the subnet is configured by the DHCP server.
-       local dhcpd="false"
-       local prefix="$(ipv6_get_network "${addr}")"
-       if isset prefix && dhcpd_subnet_match ipv6 "${prefix}"; then
-               dhcpd="true"
-       fi
-
-       print "interface ${zone} {"
-       print " AdvSendAdvert on;"
-       print " MinRtrAdvInterval 3;"
-       print " MaxRtrAdvInterval 10;"
-       print " IgnoreIfMissing on;"
-
-       if enabled dhcpd; then
-               print " AdvManagedFlag on;"
-               print " AdvOtherConfigFlag on;"
-       fi
-
-       print
-       print " prefix ::/64 {"
-       print "         AdvOnLink on;"
-
-       if enabled dhcpd; then
-               print "         AdvRouterAddr off;"
-               print "         AdvAutonomous off;"
-       else
-               print "         AdvRouterAddr on;"
-               print "         AdvAutonomous on;"
-       fi
-
-       print " };"
-       print
-
-       # Add the DNS configuration.
-       __radvd_config_dns ${zone}
-
-       print "};"
-       print
-
-       return ${EXIT_TRUE}
-}
-
-__radvd_config_dns() {
-       local zone=${1}
-
-       # Do nothing, when this option is not enabled.
-       enabled DNS_ADVERTISE_SERVERS || return ${EXIT_OK}
-
-       # XXX it is kind of difficult to announce our local
-       # resolver.
-
-       local server servers
-       for server in $(dns_server_list_sorted); do
-               # Filter out non IPv6 addresses.
-               ipv6_is_valid ${server} || continue
-
-               servers="${servers} ${server}"
-       done
-
-       # Remove whitespaces.
-       servers=$(echo ${servers})
-
-       # If there are no servers to announce, we stop right here.
-       if ! isset servers; then
-               log DEBUG "No servers to announce."
-               return ${EXIT_OK}
-       fi
-
-       print " RDNSS ${servers} {"
-       print "         # Use the defaults here."
-       print " };"
-       print
-}
index c7aac09..351cc53 100644 (file)
@@ -80,8 +80,8 @@ routing_default_update() {
                # Remove too much spaces.
                routes=$(echo ${routes})
 
-               # Reload radvd configuration
-               [[ "${proto}" = "ipv6" ]] && radvd_update
+               # Reload bird configuration
+               [[ "${proto}" = "ipv6" ]] && bird_update
 
                # Remove all default routes.
                if [ -z "${routes}" ]; then
diff --git a/src/network-radvd-config b/src/network-radvd-config
deleted file mode 100644 (file)
index e9809e1..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-###############################################################################
-#                                                                             #
-# IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2011  Michael Tremer & Christian Schmidt                      #
-#                                                                             #
-# 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/>.       #
-#                                                                             #
-###############################################################################
-
-. /lib/network/functions
-
-case "${1}" in
-       start)
-               # Write the radvd configuration file.
-               radvd_write_config
-               ;;
-       stop)
-               # Clear all contents in the configuration file.
-               radvd_clear_config
-               ;;
-esac
-
-exit ${EXIT_OK}