[package] babeld: update to 0.98, fix scripts
- Full-featured UCI configuration file (no need for babeld.conf). - Do not check the pid file (useless) and ahcpd script (harmful). - Make /etc/config/babeld a config file. - Launch at most one instance of babeld. - Add status and reload options to init script. - 8 February 2010: babeld 0.98: * Implement the ability to prefer Babel routes to external routes according to the kernel priority (-A). * Implement the ability to redistribute "boot" routes when the protocol is explicitly specified on the "redistribute" line. * Allow trailing whitespace in config file. Signed-off-by: Gabriel Kerneis <kerneis@pps.jussieu.fr> git-svn-id: svn://svn.openwrt.org/openwrt/packages@19754 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
893dbd1ad8
commit
2aadefb3f0
@ -8,12 +8,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=babeld
|
||||
PKG_VERSION:=0.97
|
||||
PKG_VERSION:=0.98
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://www.pps.jussieu.fr/~jch/software/files/
|
||||
PKG_MD5SUM:=be0748c382dfe60bd35aa6b661e6077d
|
||||
PKG_MD5SUM:=85af76e90914b82d9ece497e15df252f
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@ -22,6 +22,7 @@ define Package/babeld
|
||||
CATEGORY:=Network
|
||||
TITLE:=A loop-free distance-vector routing protocol
|
||||
URL:=http://www.pps.jussieu.fr/~jch/software/babel/
|
||||
MAINTAINER:=Gabriel Kerneis <kerneis@pps.jussieu.fr>
|
||||
DEPENDS:=+kmod-ipv6 +librt
|
||||
endef
|
||||
|
||||
@ -37,19 +38,16 @@ endef
|
||||
|
||||
define Package/babeld/conffiles
|
||||
/etc/babeld.conf
|
||||
/etc/config/babeld
|
||||
endef
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CC="$(TARGET_CC)" \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
|
||||
define Package/babeld/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/babeld $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_CONF) ./files/babeld.conf $(1)/etc/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DATA) ./files/babeld.config $(1)/etc/config/babeld
|
||||
$(INSTALL_CONF) ./files/babeld.config $(1)/etc/config/babeld
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/babeld.init $(1)/etc/init.d/babeld
|
||||
endef
|
||||
|
@ -1,11 +1,15 @@
|
||||
# babel config file
|
||||
# Copyright (C) 2008 Juliusz Chroboczek, L. Aaron Kaplan
|
||||
# Copyright (C) 2008-2010 Juliusz Chroboczek, L. Aaron Kaplan
|
||||
# <jch@pps.jussieu.fr> , <aaron@lo-res.org>
|
||||
#
|
||||
# This config file simply documents sample entries.
|
||||
# "redistribute" means: redistribute routes from other
|
||||
# routing protocols into babel. "local" means addresses assigned to local interfaces.
|
||||
# "redistribute" means: redistribute routes from other routing protocols
|
||||
# into babel. "local" means addresses assigned to local interfaces.
|
||||
#
|
||||
# You do not need to edit this file: you can use /etc/config/babeld
|
||||
# instead (sections "interface" and "filter"). Both files can be used
|
||||
# simultaneously (the rules of this file are executed first).
|
||||
|
||||
# the default rules are:
|
||||
#
|
||||
## redistribute local
|
||||
@ -14,15 +18,23 @@
|
||||
# this says, redistribute local addresses but no other routes
|
||||
|
||||
|
||||
|
||||
# redistribute IPv4 default route into babel
|
||||
## redistribute local ip 0.0.0.0/0 le 0 metric 128
|
||||
|
||||
# same but for IPv6
|
||||
## redistribute local ip ::/0 le 0 metric 128
|
||||
|
||||
|
||||
# don't redistribute all local addresses, only selected ones
|
||||
# after the first line, the "deny" rules kicks in. After the "deny"
|
||||
# no redistribute local rules are going to match
|
||||
## redistribute local ip 192.160.4.0/24
|
||||
## redistribute local deny
|
||||
|
||||
|
||||
# Babel refuses to redistribute routes with a protocol number of "boot";
|
||||
# this is standard practice, and means that you cannot easily
|
||||
# redistribute the default route installed by dhcp. It is however
|
||||
# possible to redistribute such route by explicitly specifying "proto 3"
|
||||
# on the redistribute line.
|
||||
## redistribute ip 0.0.0.0/0 le 0 proto 3 metric 128
|
||||
|
@ -1,2 +1,70 @@
|
||||
config babeld
|
||||
#list 'interface' 'wlan'
|
||||
package babeld
|
||||
|
||||
config general
|
||||
option 'multicast_address' 'ff02::cca6:c0f9:e182:5373'
|
||||
option 'port' '8475'
|
||||
option 'state_file' '/var/lib/babel-state'
|
||||
option 'hello_interval' '4'
|
||||
option 'wired_hello_interval' '20'
|
||||
# Enable detection of idle networks. This functonality is
|
||||
# experimental, don't use it unless you know what you are doing.
|
||||
## option 'idle_hello_interval' '0'
|
||||
option 'kernel_priority' '0'
|
||||
# Do not use this option unless you know what you are doing, as it can
|
||||
# cause persistent route flapping.
|
||||
## option 'duplication_priority' '0'
|
||||
option 'carrier_sense' 'false'
|
||||
option 'assume_wireless' 'false'
|
||||
option 'no_split_horizon' 'false'
|
||||
option 'parasitic' 'false'
|
||||
option 'debug' '0'
|
||||
# Listen for connections from a front-end, e.g. on port 33123.
|
||||
## option 'local_server' '33123'
|
||||
# Use the given kernel routing table for routes inserted by babeld.
|
||||
## option 'export_table' '0'
|
||||
# Export routes from the given kernel routing table.
|
||||
## option 'import_table' '0'
|
||||
# The configuration file is not necessary since you can do everything
|
||||
# from this file.
|
||||
option 'conf_file' '/etc/babeld.conf'
|
||||
option 'log_file' '/var/log/babeld.log'
|
||||
|
||||
# You can use aliases (like lan, wlan) or real names (like eth0.0).
|
||||
# If you use an alias, it must be already defined when babeld starts.
|
||||
# Otherwise, the name is taken literally and the interface can be
|
||||
# brought up later (useful for tunnels for instance).
|
||||
config interface wlan
|
||||
# Change this line to enable babeld on this interface
|
||||
option 'ignore' 'true'
|
||||
option 'wired' 'auto'
|
||||
option 'link_quality' 'auto'
|
||||
option 'split_horizon' 'auto'
|
||||
# The default is 96 for wired interfaces, and 256 for wireless ones
|
||||
## option 'rxcost' '256'
|
||||
# The default is specified with the -h and -H command-line flags.
|
||||
## option 'hello_interval' '4'
|
||||
# This can be set to a fairly large value, unless significant
|
||||
# packet loss is expected. The default is four times the hello
|
||||
# interval.
|
||||
## option 'update_interval' '16'
|
||||
|
||||
config interface lan
|
||||
option 'ignore' 'true'
|
||||
|
||||
# A filter consists in a type ('in', 'out' or 'redistribute'), an action
|
||||
# ('allow', 'deny' or 'metric xxx') and a set of selectors ('ip', 'eq',
|
||||
# etc.). See /etc/babeld.conf for more details.
|
||||
# Here is a sample filter wich redistributes the default route if its
|
||||
# protocol number is "boot", e.g. when it installed by dhcp. It is
|
||||
# disabled by default.
|
||||
config filter
|
||||
option 'ignore' 'true'
|
||||
# Type
|
||||
option 'type' 'redistribute'
|
||||
# Selectors: ip, eq, le, ge, neigh, id, proto, local, if
|
||||
option 'ip' '0.0.0.0/0'
|
||||
option 'le' '0'
|
||||
option 'proto' '3'
|
||||
# Action
|
||||
option 'action' 'metric 128'
|
||||
|
||||
|
@ -2,37 +2,137 @@
|
||||
|
||||
START=70
|
||||
|
||||
PID_F='/var/run/babeld.pid'
|
||||
EXTRA_COMMANDS="status"
|
||||
EXTRA_HELP=" status Dump Babel's table to the log file."
|
||||
|
||||
listen_ifname() {
|
||||
local name="$1"
|
||||
local switch="$2"
|
||||
local _uciname=`uci get -q -P /var/state network.$name.ifname`
|
||||
append args "$switch ${_uciname:-$name}"
|
||||
append interfaces "${_uciname:-$name}"
|
||||
}
|
||||
|
||||
append_ifname() {
|
||||
local section="$1"
|
||||
local option="$2"
|
||||
local switch="$3"
|
||||
local _name
|
||||
config_get _name "$section" "$option"
|
||||
[ -z "$name" ] && return 0
|
||||
local _uciname=`uci get -q -P /var/state network.$_name.ifname`
|
||||
append args "$switch ${_uciname:-$_name}"
|
||||
}
|
||||
|
||||
append_bool() {
|
||||
local section="$1"
|
||||
local option="$2"
|
||||
local value="$3"
|
||||
local _loctmp
|
||||
config_get_bool _loctmp "$section" "$option"
|
||||
[ "$_loctmp" -gt 0 ] && append args "$value"
|
||||
}
|
||||
|
||||
append_parm() {
|
||||
local section="$1"
|
||||
local option="$2"
|
||||
local switch="$3"
|
||||
local _loctmp
|
||||
config_get _loctmp "$section" "$option"
|
||||
[ -z "$_loctmp" ] && return 0
|
||||
append args "$switch $_loctmp"
|
||||
}
|
||||
|
||||
babel_filter() {
|
||||
local cfg="$1"
|
||||
local _loctmp
|
||||
|
||||
local _ignored
|
||||
config_get_bool _ignored "$cfg" 'ignore' 0
|
||||
[ "$_ignored" -eq 1 ] && return 0
|
||||
|
||||
append args "-C '"
|
||||
|
||||
append_parm "$cfg" 'type' ''
|
||||
|
||||
append_parm "$cfg" 'ip' 'ip'
|
||||
append_parm "$cfg" 'le' 'le'
|
||||
append_parm "$cfg" 'ge' 'ge'
|
||||
append_parm "$cfg" 'neigh' 'neigh'
|
||||
append_parm "$cfg" 'id' 'id'
|
||||
append_parm "$cfg" 'proto' 'proto'
|
||||
|
||||
append_ifname "$cfg" 'if' 'if'
|
||||
|
||||
append_bool "$cfg" 'local' 'local'
|
||||
|
||||
append args ' ' "'"
|
||||
}
|
||||
|
||||
babel_addif() {
|
||||
config_get ifname $1 ifname
|
||||
append interfaces "$ifname"
|
||||
local cfg="$1"
|
||||
|
||||
local _ignored
|
||||
config_get_bool _ignored "$cfg" 'ignore' 0
|
||||
[ "$_ignored" -eq 1 ] && return 0
|
||||
|
||||
listen_ifname "$cfg" "-C 'interface"
|
||||
|
||||
append_parm "$cfg" 'wired' 'wired'
|
||||
append_parm "$cfg" 'link_quality' 'link-quality'
|
||||
append_parm "$cfg" 'split_horizon' 'split-horizon'
|
||||
append_parm "$cfg" 'rxcost' 'rxcost'
|
||||
append_parm "$cfg" 'hello_interval' 'hello-interval'
|
||||
append_parm "$cfg" 'update_interval' 'update-interval'
|
||||
|
||||
append args ' ' "'"
|
||||
}
|
||||
|
||||
babel_config() {
|
||||
local cfg="$1"
|
||||
interfaces=
|
||||
config_list_foreach "$cfg" interface babel_addif
|
||||
pidfile=/var/run/babeld-"$cfg".pid
|
||||
[ -z "$interfaces" ] && return 0
|
||||
if [ -e $pidfile ] ; then
|
||||
echo "$pidfile exists -- not starting babel." >&2
|
||||
else
|
||||
/usr/sbin/babeld -D -I $pidfile $interfaces
|
||||
fi
|
||||
|
||||
append_bool "$cfg" 'carrier_sense' '-l'
|
||||
append_bool "$cfg" 'assume_wireless' '-w'
|
||||
append_bool "$cfg" 'no_split_horizon' '-s'
|
||||
append_bool "$cfg" 'parasitic' '-P'
|
||||
|
||||
append_parm "$cfg" 'multicast_address' '-m'
|
||||
append_parm "$cfg" 'port' '-p'
|
||||
append_parm "$cfg" 'state_file' '-S'
|
||||
append_parm "$cfg" 'hello_interval' '-h'
|
||||
append_parm "$cfg" 'wired_hello_interval' '-H'
|
||||
append_parm "$cfg" 'idle_hello_interval' '-i'
|
||||
append_parm "$cfg" 'kernel_priority' '-k'
|
||||
append_parm "$cfg" 'duplication_priority' '-A'
|
||||
append_parm "$cfg" 'debug' '-d'
|
||||
append_parm "$cfg" 'local_server' '-g'
|
||||
append_parm "$cfg" 'export_table' '-t'
|
||||
append_parm "$cfg" 'import_table' '-T'
|
||||
append_parm "$cfg" 'conf_file' '-c'
|
||||
append_parm "$cfg" 'log_file' '-L'
|
||||
}
|
||||
|
||||
start() {
|
||||
if [ -x /etc/init.d/ahcpd ] && /etc/init.d/ahcpd enabled; then
|
||||
echo 'Not starting babel -- will be started by ahcpd.'
|
||||
exit 0
|
||||
fi
|
||||
include /lib/network
|
||||
scan_interfaces
|
||||
config_load babeld
|
||||
mkdir -p /var/lib
|
||||
config_foreach babel_config babeld
|
||||
config_load babeld
|
||||
unset args
|
||||
unset interfaces
|
||||
config_foreach babel_config general
|
||||
config_foreach babel_addif interface
|
||||
config_foreach babel_filter filter
|
||||
[ -z "$interfaces" ] && return 0
|
||||
eval "/usr/sbin/babeld -D -I $PID_F $args $interfaces"
|
||||
}
|
||||
|
||||
stop() {
|
||||
kill $(cat /var/run/babeld-*.pid)
|
||||
rm -f /var/run/babeld-*.pid
|
||||
[ -f $PID_F ] && kill $(cat $PID_F)
|
||||
}
|
||||
|
||||
status() {
|
||||
[ -f $PID_F ] && kill -USR1 $(cat $PID_F)
|
||||
}
|
||||
|
||||
reload() {
|
||||
[ -f $PID_F ] && kill -USR2 $(cat $PID_F)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user