Merge branch 'master' into bmx6_testing

This commit is contained in:
Axel Neumann 2013-11-27 11:55:52 +01:00
commit dea7535ffa
30 changed files with 1359 additions and 260 deletions

23
MAINTAINERS Normal file
View file

@ -0,0 +1,23 @@
# _______ ________ __
# | |.-----.-----.-----.| | | |.----.| |_
# | - || _ | -__| || | | || _|| _|
# |_______|| __|_____|__|__||________||__| |____|
# |__| W I R E L E S S F R E E D O M
#
# People listed here are managing the OpenWrt routing feed,
# use alphabetical order when updating the list.
Axel "axn" Neumann <neumann@cgws.de>
Bastian Bittorf <bittorf@bluebottle.com>
Corinna "Elektra" Aichele <onelektra@gmx.net>
Gabriel Kerneis <gabriel@kerneis.info>
Gui Iribarren <gui@altermundi.net>
Jo-Philipp Wich <jow@openwrt.org>
Luka Perkov <luka@openwrt.org>
Marek Lindner <mareklindner@neomailbox.ch>
Moritz Warning <moritzwarning@web.de>
Nicolás Echániz <nicoechaniz@altermundi.net>
Pau Escrich <pau@dabax.net>
Saverio Proto <zioproto@gmail.com>
Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
Vasilis "acinonyx" Tsiligiannis <acinonyx@openwrt.gr>

53
ahcpd/Makefile Normal file
View file

@ -0,0 +1,53 @@
#
# Copyright (C) 2007-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ahcpd
PKG_VERSION:=0.53
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/files/
PKG_MD5SUM:=a1a610bf20965aa522cd766bf3d5829a
include $(INCLUDE_DIR)/package.mk
define Package/ahcpd
SECTION:=net
CATEGORY:=Network
TITLE:=Ad-Hoc Configuration Protocol daemon
URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/ahcp/
MAINTAINER:=Gabriel Kerneis <gabriel@kerneis.info>
DEPENDS:=+kmod-ipv6 +ip +librt
endef
define Package/ahcpd/description
Ahcpd is a daemon for configuring an IPv6 network using the Ad-Hoc
Configuration Protocol (AHCP). AHCP is designed for wireless mesh
networks, where IPv6 autoconfiguration and DHCPv6 do not work, but may
also be used on wired networks.
endef
define Package/ahcpd/conffiles
/etc/config/ahcpd
endef
define Package/ahcpd/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/ahcp
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ahcp-config.sh $(1)/etc/ahcp/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ahcpd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/ahcpd.config $(1)/etc/config/ahcpd
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/ahcpd.init $(1)/etc/init.d/ahcpd
endef
$(eval $(call BuildPackage,ahcpd))

32
ahcpd/files/ahcpd.config Normal file
View file

@ -0,0 +1,32 @@
package ahcpd
config ahcpd
# Choose ahcp mode: client (default), server or forwarder
## option 'mode' 'client'
# Uncomment the following lines to enable ahcpd on the desired
# interfaces.
## list 'interface' 'lan'
## list 'interface' 'wlan'
# The following only makes sense in 'server' mode.
# Tweak to suit your needs.
## list 'prefix' 'fde6:20f5:c9ac:358::/64'
## list 'prefix' '192.168.4.128/25'
## list 'name_server' 'fde6:20f5:c9ac:358::1'
## list 'name_server' '192.168.4.1'
## list 'ntp_server' '192.168.4.2'
## option 'lease_dir' '/var/lib/leases'
# option 'id_file' '/var/lib/ahcp-unique-id'
# option 'log_file' '/var/log/ahcpd.log'
# The configuration file is not necessary since you can configure
# everything from this file. But still, you might prefer using it.
## option 'conf_file' '/etc/ahcp/ahcp.conf'
# option 'multicast_address' 'ff02::cca6:c0f9:e182:5359'
# option 'port' '5359'
# option 'ipv4_only' 'false'
# option 'ipv6_only' 'false'
# option 'lease_time' '3666'
# option 'debug' '1'

109
ahcpd/files/ahcpd.init Normal file
View file

@ -0,0 +1,109 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2007-2011 OpenWrt.org
START=71
SERVICE_USE_PID=1
EXTRA_COMMANDS="status"
EXTRA_HELP=" status Print ahcpd's status to the log file."
append_bool() {
local section="$1"
local option="$2"
local value="$3"
local _loctmp
config_get_bool _loctmp "$section" "$option" 0
[ "$_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"
}
append_stmt() {
local name="$1"
local switch="$2"
append args "-C '$switch $name'"
}
append_opt_stmt() {
local section="$1"
local option="$2"
local switch="$3"
local _loctmp
config_get _loctmp "$section" "$option"
[ -z "$_loctmp" ] && return 0
append args "-C '$switch $_loctmp'"
}
ahcp_addif() {
local ifname=$(uci_get_state network "$1" ifname "$1")
append interfaces "$ifname"
}
ahcp_server() {
local cfg="$1"
append_opt_stmt "$cfg" 'mode' 'mode'
append_opt_stmt "$cfg" 'lease_dir' 'lease-dir'
config_list_foreach "$cfg" 'prefix' append_stmt 'prefix'
config_list_foreach "$cfg" 'name_server' append_stmt 'name-server'
config_list_foreach "$cfg" 'ntp_server' append_stmt 'ntp-server'
append_parm "$cfg" 'id_file' '-i'
append_parm "$cfg" 'log_file' '-L'
}
ahcp_config() {
local cfg="$1"
local interface
local _loctmp
config_list_foreach "$cfg" 'interface' ahcp_addif
# Add interfaces with "option proto ahcp" in /etc/config/network
# (only for client mode)
config_get _loctmp "$cfg" "mode"
if [ -z "$_loctmp" -o "$_loctmp" = "client" ]; then
for interface in $(uci -P /var/state show network|grep proto=ahcp|cut -d. -f2); do
ahcp_addif $interface
done
fi
append_bool "$cfg" 'ipv4_only' '-4'
append_bool "$cfg" 'ipv6_only' '-6'
append_bool "$cfg" 'no_dns' '-N'
append_parm "$cfg" 'multicast_address' '-m'
append_parm "$cfg" 'port' '-p'
append_parm "$cfg" 'lease_time' '-t'
append_parm "$cfg" 'debug' '-d'
append_parm "$cfg" 'conf_file' '-c'
append_parm "$cfg" 'script' '-s'
}
start() {
mkdir -p /var/lib
config_load ahcpd
unset args
unset interfaces
config_foreach ahcp_config ahcpd
config_foreach ahcp_server ahcpd
[ -z "$interfaces" ] && return 0
eval "service_start /usr/sbin/ahcpd -D $args $interfaces"
}
stop() {
service_stop /usr/sbin/ahcpd
}
status() {
SERVICE_SIG="USR1" service_signal /usr/sbin/ahcpd
}

View file

@ -1,7 +1,22 @@
config ALFRED_NEEDS_lua
bool
config ALFRED_NEEDS_libgps
bool
config PACKAGE_ALFRED_VIS
bool "enable vis server for alfred"
depends on PACKAGE_alfred
default y
config PACKAGE_ALFRED_BATHOSTS
bool "enable autogeneration of /etc/bat-hosts"
depends on PACKAGE_alfred
select ALFRED_NEEDS_lua
default n
config PACKAGE_ALFRED_GPSD
bool "enable gpsd service for alfred"
depends on PACKAGE_alfred
select ALFRED_NEEDS_libgps
default n

View file

@ -11,9 +11,9 @@ include $(TOPDIR)/rules.mk
# The latest alfred git hash in PKG_REV can be obtained from http://git.open-mesh.org/alfred.git
#
PKG_NAME:=alfred
PKG_VERSION:=2013.3.0
PKG_RELEASE:=0
PKG_MD5SUM:=018ef6262cdd11e900af31d71a864b13
PKG_VERSION:=2013.4.0
PKG_RELEASE:=1
PKG_MD5SUM:=3891697e127b1037cfc9349fd96e9993
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
@ -27,7 +27,9 @@ define Package/alfred
SECTION:=net
CATEGORY:=Network
TITLE:=A.L.F.R.E.D. - Almighty Lightweight Fact Remote Exchange Daemon
DEPENDS:= +libc +IPV6:kmod-ipv6 +librt
DEPENDS:= +libc +IPV6:kmod-ipv6 +librt \
+ALFRED_NEEDS_lua:lua \
+ALFRED_NEEDS_libgps:libgps
endef
define Package/alfred/description
@ -55,7 +57,8 @@ define Package/alfred/config
endef
MAKE_ALFRED_FLAGS=\
CONFIG_ALFRED_VIS=$(if $(CONFIG_PACKAGE_ALFRED_VIS),y,n)
CONFIG_ALFRED_VIS=$(if $(CONFIG_PACKAGE_ALFRED_VIS),y,n) \
CONFIG_ALFRED_GPSD=$(if $(CONFIG_PACKAGE_ALFRED_GPSD),y,n)
TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
TARGET_LDFLAGS += -Wl,--gc-sections -fuse-linker-plugin
@ -69,11 +72,14 @@ endef
define Package/alfred/install
$(INSTALL_DIR) $(1)/usr/sbin
cp -fpR $(PKG_BUILD_DIR)/alfred $(1)/usr/sbin/
[ "x$(CONFIG_PACKAGE_ALFRED_VIS)" == "xy" ] && cp -fpR $(PKG_BUILD_DIR)/vis/vis $(1)/usr/sbin/ ; true
[ "x$(CONFIG_PACKAGE_ALFRED_VIS)" == "xy" ] && cp -fpR $(PKG_BUILD_DIR)/vis/batadv-vis $(1)/usr/sbin/ ; true
[ "x$(CONFIG_PACKAGE_ALFRED_GPSD)" == "xy" ] && cp -fpR $(PKG_BUILD_DIR)/vis/alfred-gpsd $(1)/usr/sbin/ ; true
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/alfred.init $(1)/etc/init.d/alfred
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/alfred.config $(1)/etc/config/alfred
$(INSTALL_DIR) $(1)/etc/alfred
[ "x$(CONFIG_PACKAGE_ALFRED_BATHOSTS)" == "xy" ] && $(INSTALL_BIN) ./files/bat-hosts.lua $(1)/etc/alfred/bat-hosts.lua ; true
endef
$(eval $(call BuildPackage,alfred))

View file

@ -3,5 +3,6 @@ config 'alfred' 'alfred'
option mode 'master'
option batmanif 'bat0'
option start_vis '1'
option run_facters '1'
# REMOVE THIS LINE TO ENABLE ALFRED
option disabled '1'

View file

@ -11,6 +11,7 @@ START=99
STOP=99
alfred_args=""
vis_args=""
facters_dir="/etc/alfred"
pid_file_alfred="/var/run/alfred.pid"
pid_file_vis="/var/run/vis.pid"
enable=0
@ -48,6 +49,8 @@ alfred_start()
append vis_args "-i $batmanif -s"
fi
config_get_bool run_facters "$section" run_facters 0
return 0
}
@ -63,12 +66,20 @@ start()
SERVICE_PID_FILE="$pid_file_alfred"
service_start /usr/sbin/alfred ${alfred_args}
if [ "$vis_enable" = "0" ]; then
exit 0
fi
if [ "$vis_enable" = "1" ]; then
echo "${initscript}: starting vis"
SERVICE_PID_FILE="$pid_file_vis"
service_start /usr/sbin/vis ${vis_args}
fi
if [ "$run_facters" = "1" ]; then
( for file in $facters_dir/* ; do [ -x $file ] && $file ; done )
if ! ( grep -q "for file in $facters_dir/\* ; do " /etc/crontabs/root 2>/dev/null ) ; then
echo "*/5 * * * * ( for file in $facters_dir/* ; do [ -x \$file ] && \$file ; done )" >> /etc/crontabs/root
/etc/init.d/cron enable
/etc/init.d/cron restart
fi
fi
}
stop()
@ -77,5 +88,6 @@ stop()
service_stop /usr/sbin/alfred
SERVICE_PID_FILE="$pid_file_vis"
[ -x /usr/sbin/vis ] && service_stop /usr/sbin/vis
sed "\|for file in $facters_dir/\* ; do |d" -i /etc/crontabs/root
/etc/init.d/cron restart
}

107
alfred/files/bat-hosts.lua Normal file
View file

@ -0,0 +1,107 @@
#!/usr/bin/lua
local type_id = 64 -- bat-hosts
function get_hostname()
local hostfile = io.open("/proc/sys/kernel/hostname", "r")
local ret_string = hostfile:read()
hostfile:close()
return ret_string
end
function get_interfaces_names()
local ret = {}
for name in io.popen("ls -1 /sys/class/net/"):lines() do
table.insert(ret, name)
end
return ret
end
function get_interface_address(name)
local addressfile = io.open("/sys/class/net/"..name.."/address", "r")
local ret_string = addressfile:read()
addressfile:close()
return ret_string
end
local function generate_bat_hosts()
-- get hostname and interface macs/names
-- then return a table containing valid bat-hosts lines
local n, i
local ifaces, ret = {}, {}
local hostname = get_hostname()
for n, i in ipairs(get_interfaces_names()) do
local address = get_interface_address(i)
if not ifaces[address] then ifaces[address] = i end
end
for mac, iname in pairs(ifaces) do
if mac:match("^%x%x:%x%x:%x%x:%x%x:%x%x:%x%x$") and not mac:match("00:00:00:00:00:00") then
table.insert(ret, mac.." "..hostname.."_"..iname.."\n")
end
end
return ret
end
local function publish_bat_hosts()
-- pass a raw chunk of data to alfred
local fd = io.popen("alfred -s " .. type_id, "w")
if fd then
local ret = generate_bat_hosts()
if ret then
fd:write(table.concat(ret))
end
fd:close()
end
end
local function write_bat_hosts(rows)
local content = { "### /tmp/bat-hosts generated by alfred-bat-hosts\n",
"### /!\\ This file is overwritten every 5 minutes /!\\\n",
"### (To keep manual changes, replace /etc/bat-hosts symlink with a static file)\n" }
-- merge the chunks from all nodes, de-escaping newlines
for _, row in ipairs(rows) do
local node, value = unpack(row)
table.insert(content, "# Node ".. node .. "\n")
table.insert(content, value:gsub("\x0a", "\n") .. "\n")
end
-- write parsed content down to disk
local fd = io.open("/tmp/bat-hosts", "w")
if fd then
fd:write(table.concat(content))
fd:close()
end
-- try to make a symlink in /etc pointing to /tmp,
-- if it exists, ln will do nothing.
os.execute("ln -ns /tmp/bat-hosts /etc/bat-hosts 2>/dev/null")
end
local function receive_bat_hosts()
-- read raw chunks from alfred, convert them to a nested table and call write_bat_hosts
local fd = io.popen("alfred -r " .. type_id)
--[[ this command returns something like
{ "54:e6:fc:b9:cb:37", "00:11:22:33:44:55 ham_wlan0\x0a00:22:33:22:33:22 ham_eth0\x0a" },
{ "90:f6:52:bb:ec:57", "00:22:33:22:33:23 spam\x0a" },
]]--
if fd then
local output = fd:read("*a")
if output then
assert(loadstring("rows = {" .. output .. "}"))()
write_bat_hosts(rows)
end
fd:close()
end
end
publish_bat_hosts()
receive_bat_hosts()

View file

@ -0,0 +1,33 @@
From dbaaf2b294af120e42a0e95644640b128044a568 Mon Sep 17 00:00:00 2001
From: Simon Wunderlich <sw@simonwunderlich.de>
Date: Wed, 23 Oct 2013 01:17:36 +0200
Subject: [PATCH] alfred-gpsd: add -lm to linker flags for libgps
Appearently applications using libgps must link -lm themselves. A patch
was submitted [1] to change this unusual behaviour upstream, but was
never applied. Therefore link to -lm to alfred-gpsd too as this should
not hurt anyway.
[1] https://lists.berlios.de/pipermail/gpsd-dev/2011-August/009451.html
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
gpsd/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gpsd/Makefile b/gpsd/Makefile
index 9b21652..92e690f 100644
--- a/gpsd/Makefile
+++ b/gpsd/Makefile
@@ -49,7 +49,7 @@ ifeq ($(origin LIBGPS_CFLAGS) $(origin LIBGPS_LDLIBS), undefined undefined)
$(error No $(LIBGPS_NAME) development libraries found!)
endif
LIBGPS_CFLAGS += $(shell $(PKG_CONFIG) --cflags $(LIBGPS_NAME))
- LIBGPS_LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBGPS_NAME))
+ LIBGPS_LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBGPS_NAME)) -lm
endif
CFLAGS += $(LIBGPS_CFLAGS)
LDLIBS += $(LIBGPS_LDLIBS)
--
1.7.10.4

59
babeld/Makefile Normal file
View file

@ -0,0 +1,59 @@
#
# Copyright (C) 2007-2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=babeld
PKG_VERSION:=1.4.2
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/files/
PKG_MD5SUM:=a48e8129f221f66640ae1ccf73190991
include $(INCLUDE_DIR)/package.mk
define Package/babeld
SECTION:=net
CATEGORY:=Network
SUBMENU:=Routing and Redirection
TITLE:=A loop-free distance-vector routing protocol
URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/babel/
MAINTAINER:=Gabriel Kerneis <gabriel@kerneis.info>
DEPENDS:=+kmod-ipv6 +librt
endef
define Package/babeld/description
Babel is a loop-avoiding distance-vector routing protocol roughly based
on DSDV and AODV, but with provisions for link cost estimation and
redistribution of routes from other routing protocols.
While it is optimised for wireless mesh networks, Babel will also work
efficiently on wired networks. It will generate between 1.2 and 2.4 times
the amount of routing traffic that RIPng would generate, while
never counting to infinity.
endef
define Package/babeld/conffiles
/etc/babeld.conf
/etc/config/babeld
endef
MAKE_FLAGS+= \
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_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
$(eval $(call BuildPackage,babeld))

38
babeld/files/babeld.conf Normal file
View file

@ -0,0 +1,38 @@
# babel config file
#
# This config file simply documents sample entries.
# "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
## redistribute deny
#
# 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

View file

@ -0,0 +1,72 @@
package babeld
config general
# option 'multicast_address' 'ff02:0:0:0:0:0:1:6'
# option 'port' '6696'
# option 'state_file' '/var/lib/babel-state'
# option 'hello_interval' '4'
# option 'wired_hello_interval' '20'
# option 'diversity' '0,128'
# option 'smoothing_half_time' '4'
# 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 'debug' '0'
# Listen for connections from a front-end, e.g. on port 33123.
## option 'local_server' '33123'
# option 'random_router_id' 'false'
# Keep unfeasible routes
## option 'keep_unfeasible' 'false'
# Use the given kernel routing table for routes inserted by babeld.
## option 'export_table' '0'
# Export routes from the given kernel routing tables.
## list 'import_table' '0'
## list 'import_table' '42'
# 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
# Remove 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'

150
babeld/files/babeld.init Executable file
View file

@ -0,0 +1,150 @@
#!/bin/sh /etc/rc.common
START=70
pidfile='/var/run/babeld.pid'
EXTRA_COMMANDS="status"
EXTRA_HELP=" status Dump Babel's table to the log file."
listen_ifname() {
local ifname=$(uci_get_state network "$1" ifname "$1")
local switch="$2"
append args "$switch $ifname"
append interfaces "$ifname"
}
append_ifname() {
local section="$1"
local option="$2"
local switch="$3"
local _name
config_get _name "$section" "$option"
[ -z "$_name" ] && return 0
local ifname=$(uci_get_state network "$_name" ifname "$_name")
append args "$switch $ifname"
}
append_bool() {
local section="$1"
local option="$2"
local value="$3"
local _loctmp
config_get_bool _loctmp "$section" "$option" 0
[ "$_loctmp" -gt 0 ] && append args "$value"
}
append_switch() {
local value="$1"
local switch="$2"
append args "$switch $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_bool "$cfg" 'local' 'local'
append_parm "$cfg" 'ip' 'ip'
append_parm "$cfg" 'eq' 'eq'
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_parm "$cfg" 'action' ''
append args ' ' "'"
}
babel_addif() {
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"
append_bool "$cfg" 'carrier_sense' '-l'
append_bool "$cfg" 'assume_wireless' '-w'
append_bool "$cfg" 'no_split_horizon' '-s'
append_bool "$cfg" 'keep_unfeasible' '-u'
append_bool "$cfg" 'random_router_id' '-r'
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" 'diversity' '-z'
append_parm "$cfg" 'smoothing_half_time' '-M'
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'
config_list_foreach "$cfg" 'import_table' append_switch '-T'
append_parm "$cfg" 'conf_file' '-c'
append_parm "$cfg" 'log_file' '-L'
}
start() {
mkdir -p /var/lib
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 $pidfile $args $interfaces"
}
stop() {
[ -f "$pidfile" ] && kill $(cat $pidfile)
# avoid race-condition on restart: wait for
# babeld to die for real.
[ -f "$pidfile" ] && sleep 1
[ -f "$pidfile" ] && sleep 1
[ -f "$pidfile" ] && sleep 1
[ -f "$pidfile" ] && exit 42
}
status() {
[ -f "$pidfile" ] && kill -USR1 $(cat $pidfile)
}

View file

@ -10,11 +10,11 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=batman-adv
PKG_VERSION:=2013.3.0
BATCTL_VERSION:=2013.3.0
PKG_RELEASE:=5
PKG_MD5SUM:=d070c0879cd8fe8125315a4566fabd2d
BATCTL_MD5SUM:=747535b0296f0013a6f99373a51d41fc
PKG_VERSION:=2013.4.0
BATCTL_VERSION:=2013.4.0
PKG_RELEASE:=1
PKG_MD5SUM:=6590caa324709289e3cb142273a5ff57
BATCTL_MD5SUM:=42e269cc710bbc9a8fd17628201d4258
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
@ -114,6 +114,13 @@ define Build/Patch
$(BATCTL_PATCH)
endef
define Build/Prepare
$(call Build/Prepare/Default)
$(SED) '/#define _NET_BATMAN_ADV_MAIN_H_/a\#undef CONFIG_MODULE_STRIPPED' \
$(PKG_BUILD_DIR)/main.h
endef
define Build/Compile
$(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATMAN_ADV_ARGS)
$(BATCTL_BUILD)

View file

@ -1,33 +0,0 @@
Date: Fri, 6 Sep 2013 15:14:41 +0200
From: Antonio Quartulli <ordex@autistici.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Antonio Quartulli <ordex@autistici.org>
Subject: [B.A.T.M.A.N.] [PATCH openwrt-feed only] batman-adv: fix metadata stripping
a new optimisation in openwrt is stripping some metadata information, invluding
the module version which is used by batctl to tell the user which version
batman-adv the node is currently running.
Un-define this constant to prevent the metadata from being stripped
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
main.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/main.h b/main.h
index 834b1a0..b329e79 100644
--- a/main.h
+++ b/main.h
@@ -20,6 +20,8 @@
#ifndef _NET_BATMAN_ADV_MAIN_H_
#define _NET_BATMAN_ADV_MAIN_H_
+#undef CONFIG_MODULE_STRIPPED
+
#define BATADV_DRIVER_AUTHOR "Marek Lindner <lindner_marek@yahoo.de>, " \
"Simon Wunderlich <siwu@hrz.tu-chemnitz.de>"
#define BATADV_DRIVER_DESC "B.A.T.M.A.N. advanced"
--
1.8.1.5

View file

@ -1,203 +0,0 @@
From c98c3e521913b8dd5fee4d3b90dc9ed7a47e5bee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@web.de>
Date: Tue, 6 Aug 2013 20:21:15 +0200
Subject: [PATCH] batman-adv: fix potential kernel paging errors for unicast
transmissions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There are several functions which might reallocate skb data. Currently
some places keep reusing their old ethhdr pointer regardless of whether
they became invalid after such a reallocation or not. This potentially
leads to kernel paging errors.
This patch fixes these by refetching the ethdr pointer after the
potential reallocations.
Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
bridge_loop_avoidance.c | 2 ++
gateway_client.c | 13 ++++++++++++-
gateway_client.h | 3 +--
soft-interface.c | 9 ++++++++-
unicast.c | 13 ++++++++++---
5 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index e14531f..264de88 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
@@ -1529,6 +1529,8 @@ out:
* in these cases, the skb is further handled by this function and
* returns 1, otherwise it returns 0 and the caller shall further
* process the skb.
+ *
+ * This call might reallocate skb data.
*/
int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
unsigned short vid)
diff --git a/gateway_client.c b/gateway_client.c
index f105219..7614af3 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -508,6 +508,7 @@ out:
return 0;
}
+/* this call might reallocate skb data */
static bool batadv_is_type_dhcprequest(struct sk_buff *skb, int header_len)
{
int ret = false;
@@ -568,6 +569,7 @@ out:
return ret;
}
+/* this call might reallocate skb data */
bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len)
{
struct ethhdr *ethhdr;
@@ -619,6 +621,12 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len)
if (!pskb_may_pull(skb, *header_len + sizeof(*udphdr)))
return false;
+
+ /* skb->data might have been reallocated by pskb_may_pull() */
+ ethhdr = (struct ethhdr *)skb->data;
+ if (ntohs(ethhdr->h_proto) == ETH_P_8021Q)
+ ethhdr = (struct ethhdr *)(skb->data + VLAN_HLEN);
+
udphdr = (struct udphdr *)(skb->data + *header_len);
*header_len += sizeof(*udphdr);
@@ -634,12 +642,14 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len)
return true;
}
+/* this call might reallocate skb data */
bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
- struct sk_buff *skb, struct ethhdr *ethhdr)
+ struct sk_buff *skb)
{
struct batadv_neigh_node *neigh_curr = NULL, *neigh_old = NULL;
struct batadv_orig_node *orig_dst_node = NULL;
struct batadv_gw_node *curr_gw = NULL;
+ struct ethhdr *ethhdr;
bool ret, out_of_range = false;
unsigned int header_len = 0;
uint8_t curr_tq_avg;
@@ -648,6 +658,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
if (!ret)
goto out;
+ ethhdr = (struct ethhdr *)skb->data;
orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source,
ethhdr->h_dest);
if (!orig_dst_node)
diff --git a/gateway_client.h b/gateway_client.h
index 039902d..1037d75 100644
--- a/gateway_client.h
+++ b/gateway_client.h
@@ -34,7 +34,6 @@ void batadv_gw_node_delete(struct batadv_priv *bat_priv,
void batadv_gw_node_purge(struct batadv_priv *bat_priv);
int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset);
bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len);
-bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
- struct sk_buff *skb, struct ethhdr *ethhdr);
+bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, struct sk_buff *skb);
#endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */
diff --git a/soft-interface.c b/soft-interface.c
index 700d0b4..0f04e1c 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -180,6 +180,9 @@ static int batadv_interface_tx(struct sk_buff *skb,
if (batadv_bla_tx(bat_priv, skb, vid))
goto dropped;
+ /* skb->data might have been reallocated by batadv_bla_tx() */
+ ethhdr = (struct ethhdr *)skb->data;
+
/* Register the client MAC in the transtable */
if (!is_multicast_ether_addr(ethhdr->h_source))
batadv_tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif);
@@ -220,6 +223,10 @@ static int batadv_interface_tx(struct sk_buff *skb,
default:
break;
}
+
+ /* reminder: ethhdr might have become unusable from here on
+ * (batadv_gw_is_dhcp_target() might have reallocated skb data)
+ */
}
/* ethernet packet should be broadcasted */
@@ -266,7 +273,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
/* unicast packet */
} else {
if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_OFF) {
- ret = batadv_gw_out_of_range(bat_priv, skb, ethhdr);
+ ret = batadv_gw_out_of_range(bat_priv, skb);
if (ret)
goto dropped;
}
diff --git a/unicast.c b/unicast.c
index dc8b5d4..688a041 100644
--- a/unicast.c
+++ b/unicast.c
@@ -326,7 +326,9 @@ static bool batadv_unicast_push_and_fill_skb(struct sk_buff *skb, int hdr_size,
* @skb: the skb containing the payload to encapsulate
* @orig_node: the destination node
*
- * Returns false if the payload could not be encapsulated or true otherwise
+ * Returns false if the payload could not be encapsulated or true otherwise.
+ *
+ * This call might reallocate skb data.
*/
static bool batadv_unicast_prepare_skb(struct sk_buff *skb,
struct batadv_orig_node *orig_node)
@@ -343,7 +345,9 @@ static bool batadv_unicast_prepare_skb(struct sk_buff *skb,
* @orig_node: the destination node
* @packet_subtype: the batman 4addr packet subtype to use
*
- * Returns false if the payload could not be encapsulated or true otherwise
+ * Returns false if the payload could not be encapsulated or true otherwise.
+ *
+ * This call might reallocate skb data.
*/
bool batadv_unicast_4addr_prepare_skb(struct batadv_priv *bat_priv,
struct sk_buff *skb,
@@ -401,7 +405,7 @@ int batadv_unicast_generic_send_skb(struct batadv_priv *bat_priv,
struct batadv_neigh_node *neigh_node;
int data_len = skb->len;
int ret = NET_RX_DROP;
- unsigned int dev_mtu;
+ unsigned int dev_mtu, header_len;
/* get routing information */
if (is_multicast_ether_addr(ethhdr->h_dest)) {
@@ -429,10 +433,12 @@ find_router:
switch (packet_type) {
case BATADV_UNICAST:
batadv_unicast_prepare_skb(skb, orig_node);
+ header_len = sizeof(struct batadv_unicast_packet);
break;
case BATADV_UNICAST_4ADDR:
batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node,
packet_subtype);
+ header_len = sizeof(struct batadv_unicast_4addr_packet);
break;
default:
/* this function supports UNICAST and UNICAST_4ADDR only. It
@@ -441,6 +447,7 @@ find_router:
goto out;
}
+ ethhdr = (struct ethhdr *)(skb->data + header_len);
unicast_packet = (struct batadv_unicast_packet *)skb->data;
/* inform the destination node that we are still missing a correct route
--
1.7.10.4

160
bird/Makefile Normal file
View file

@ -0,0 +1,160 @@
#
# Copyright (C) 2009-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=bird
PKG_VERSION:=1.3.11
PKG_RELEASE:=1
PKG_SOURCE:=bird-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=ftp://bird.network.cz/pub/bird
PKG_MD5SUM:=8ad2eb997fb8251bc5b24cf32619571b
PKG_BUILD_DEPENDS:=libncurses libreadline
include $(INCLUDE_DIR)/package.mk
define Package/bird/Default
TITLE:=The BIRD Internet Routing Daemon
URL:=http://bird.network.cz/
DEPENDS:=
endef
define Package/birdc/Default
TITLE:=The BIRD command-line client
URL:=http://bird.network.cz/
DEPENDS:= +libreadline +libncurses
endef
define Package/bird/Default/description1
BIRD is an internet routing daemon which manages TCP/IP routing tables
with support of modern routing protocols, easy to use configuration
interface and powerful route filtering language. It is lightweight and
efficient and therefore appropriate for small embedded routers.
endef
define Package/bird/Default/description2
In BGP, BIRD supports communities, multiprotocol extensions, MD5
authentication, 32bit AS numbers and could act as a route server or a
route reflector. BIRD also supports multiple RIBs, multiple kernel
routing tables and redistribution between the protocols with a powerful
configuration syntax.
endef
define Package/bird/Default/description3
This is a BIRD command-line client. It is used to send commands to BIRD,
commands can perform simple actions such as enabling/disabling of
protocols, telling BIRD to show various information, telling it to show
a routing table filtered by a filter, or asking BIRD to reconfigure.
Unless you can't afford dependency on ncurses and readline, you
should install BIRD command-line client together with BIRD.
endef
define Package/bird4
$(call Package/bird/Default)
SECTION:=net
CATEGORY:=Network
SUBMENU:=Routing and Redirection
TITLE+= (IPv4)
endef
define Package/birdc4
$(call Package/birdc/Default)
SECTION:=net
CATEGORY:=Network
SUBMENU:=Routing and Redirection
TITLE+= (IPv4)
DEPENDS+= +bird4
endef
define Package/bird6
$(call Package/bird/Default)
SECTION:=net
CATEGORY:=Network
TITLE+= (IPv6)
endef
define Package/birdc6
$(call Package/birdc/Default)
SECTION:=net
CATEGORY:=Network
TITLE+= (IPv6)
DEPENDS+= +bird6
endef
define Package/bird4/description
$(call Package/bird/Default/description1)
This is IPv4 version of BIRD, it supports OSPFv2, RIPv2 and BGP
protocols.
$(call Package/bird/Default/description2)
endef
define Package/birdc4/description
$(call Package/bird/Default/description1)
$(call Package/bird/Default/description3)
endef
define Package/bird6/description
$(call Package/bird/Default/description1)
This is IPv6 version of BIRD, it supports OSPFv3, RIPng and BGP
protocols.
$(call Package/bird/Default/description2)
endef
define Package/birdc6/description
$(call Package/bird/Default/description1)
$(call Package/bird/Default/description3)
endef
CONFIGURE_ARGS += --with-linux-headers="$(LINUX_DIR)"
define Build/Template
$(STAMP_BUILT)-$(2): $(STAMP_PREPARED)
$(call Build/Configure/Default,$(3))
$(call Build/Compile/Default,)
( cd $(PKG_BUILD_DIR); mv -f bird bird$(2); mv -f birdc birdc$(2) )
-$(MAKE) -C $(PKG_BUILD_DIR) clean
touch $$@
$(STAMP_BUILT): $(STAMP_BUILT)-$(2)
define Package/bird$(2)/install
$(INSTALL_DIR) $$(1)/usr/sbin
$(INSTALL_BIN) $$(PKG_BUILD_DIR)/bird$(2) $$(1)/usr/sbin/
$(INSTALL_BIN) ./files/bird$(2)loop $$(1)/usr/sbin/
$(INSTALL_DIR) $$(1)/etc
$(INSTALL_DATA) ./files/bird$(2).conf $$(1)/etc/
$(INSTALL_DIR) $$(1)/etc/init.d
$(INSTALL_BIN) ./files/bird$(2).init $$(1)/etc/init.d/bird$(2)
endef
define Package/bird$(2)/conffiles
/etc/bird$(2).conf
endef
define Package/birdc$(2)/install
$(INSTALL_DIR) $$(1)/usr/sbin
$(INSTALL_BIN) $$(PKG_BUILD_DIR)/birdc$(2) $$(1)/usr/sbin/
endef
endef
$(eval $(call Build/Template,bird4,4, --disable-ipv6))
$(eval $(call Build/Template,bird6,6, --enable-ipv6))
$(eval $(call BuildPackage,bird4))
$(eval $(call BuildPackage,birdc4))
$(eval $(call BuildPackage,bird6))
$(eval $(call BuildPackage,birdc6))

121
bird/files/bird4.conf Normal file
View file

@ -0,0 +1,121 @@
# THIS CONFIG FILE IS NOT A COMPLETE DOCUMENTATION
# PLEASE LOOK IN THE BIRD DOCUMENTATION FOR MORE INFO
# However, most of options used here are just for example
# and will be removed in real-life configs.
log syslog all;
# Override router ID
#router id 192.168.0.1;
# Turn on global debugging of all protocols
#debug protocols all;
# Define a route filter...
# filter test_filter {
# if net ~ 10.0.0.0/16 then accept;
# else reject;
# }
# The direct protocol automatically generates device routes to all network
# interfaces. Can exist in as many instances as you wish if you want to
# populate multiple routing tables with device routes. Because device routes
# are handled by Linux kernel, this protocol is usually not needed.
# protocol direct {
# interface "*"; # Restrict network interfaces it works with
# }
# This pseudo-protocol performs synchronization between BIRD's routing
# tables and the kernel. You can run multiple instances of the kernel
# protocol and synchronize different kernel tables with different BIRD tables.
protocol kernel {
# learn; # Learn all alien routes from the kernel
# persist; # Don't remove routes on bird shutdown
scan time 20; # Scan kernel routing table every 20 seconds
# import none; # Default is import all
# export all; # Default is export none
}
# This pseudo-protocol watches all interface up/down events.
protocol device {
scan time 10; # Scan interfaces every 10 seconds
}
# Static routes (again, there can be multiple instances, so that you
# can disable/enable various groups of static routes on the fly).
protocol static {
# export all; # Default is export none
# route 0.0.0.0/0 via 62.168.0.13;
# route 10.0.0.0/8 reject;
# route 192.168.0.0/16 reject;
}
#protocol rip {
# disabled;
# import all;
# export all;
# export filter test_filter;
# port 1520;
# period 7;
# infinity 16;
# garbage time 60;
# interface "*" { mode broadcast; };
# honor neighbor;
# honor always;
# honor never;
# authentication none;
#}
#protocol ospf {
# disabled;
# import all;
# export all;
# export where source = RTS_STATIC;
# area 0 {
# interface "eth*" {
# cost 10;
# hello 3;
# retransmit 2;
# wait 5;
# dead 20;
# type broadcast;
# authentication simple;
# password "pass";
# };
# };
#}
#protocol bgp {
# disabled;
# import all;
# export all;
# export where source = RTS_STATIC;
# local as 65000;
# neighbor 192.168.1.1 as 65001;
# multihop 20 via 192.168.2.1;
# hold time 240;
# startup hold time 240;
# connect retry time 120;
# keepalive time 80; # defaults to hold time / 3
# start delay time 5; # How long do we wait before initial connect
# error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive
# # errors occur, we increase the delay exponentially ...
# error forget time 300; # ... until this timeout expires)
# disable after error; # Disable the protocol automatically when an error occurs
# next hop self; # Disable next hop processing and always advertise our local address as nexthop
# source address 62.168.0.14; # What local address we use for the TCP connection
# password "secret" # Password used for MD5 authentication
# rr client; # I am a route reflector and the neighor is my client
# rr cluster id 1.0.0.1 # Use this value for cluster id instead of my router id
# };
#}

24
bird/files/bird4.init Normal file
View file

@ -0,0 +1,24 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2010-2011 OpenWrt.org
START=99
STOP=10
SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1
BIRD="/usr/sbin/bird4 -c /etc/bird4.conf"
start() {
service_start $BIRD -d
# ( SERVICE_MATCH_NAME=1 service_start /usr/sbin/bird4loop )
}
stop() {
# ( SERVICE_MATCH_NAME=1 service_stop /usr/sbin/bird4loop )
service_stop $BIRD
}
reload() {
service_reload $BIRD
}

24
bird/files/bird4loop Normal file
View file

@ -0,0 +1,24 @@
#!/bin/sh
BIRD="/usr/sbin/bird4 -c /etc/bird4.conf"
$BIRD -p || return 1
. /lib/functions.sh
. /lib/functions/service.sh
SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1
sig_handler() {
running=0
service_stop $BIRD
}
running=1
trap sig_handler INT
trap sig_handler TERM
while [ $running -gt 0 ]; do
service_check $BIRD || service_start $BIRD -d "$@"
sleep 3
done

121
bird/files/bird6.conf Normal file
View file

@ -0,0 +1,121 @@
# THIS CONFIG FILE IS NOT A COMPLETE DOCUMENTATION
# PLEASE LOOK IN THE BIRD DOCUMENTATION FOR MORE INFO
# However, most of options used here are just for example
# and will be removed in real-life configs.
log syslog all;
# Override router ID
#router id 192.168.0.1;
# Turn on global debugging of all protocols
#debug protocols all;
# Define a route filter...
# filter test_filter {
# if net ~ 10.0.0.0/16 then accept;
# else reject;
# }
# The direct protocol automatically generates device routes to all network
# interfaces. Can exist in as many instances as you wish if you want to
# populate multiple routing tables with device routes. Because device routes
# are handled by Linux kernel, this protocol is usually not needed.
# protocol direct {
# interface "*"; # Restrict network interfaces it works with
# }
# This pseudo-protocol performs synchronization between BIRD's routing
# tables and the kernel. You can run multiple instances of the kernel
# protocol and synchronize different kernel tables with different BIRD tables.
protocol kernel {
# learn; # Learn all alien routes from the kernel
# persist; # Don't remove routes on bird shutdown
scan time 20; # Scan kernel routing table every 20 seconds
# import none; # Default is import all
# export all; # Default is export none
}
# This pseudo-protocol watches all interface up/down events.
protocol device {
scan time 10; # Scan interfaces every 10 seconds
}
# Static routes (again, there can be multiple instances, so that you
# can disable/enable various groups of static routes on the fly).
protocol static {
# export all; # Default is export none
# route 0.0.0.0/0 via 62.168.0.13;
# route 10.0.0.0/8 reject;
# route 192.168.0.0/16 reject;
}
#protocol rip {
# disabled;
# import all;
# export all;
# export filter test_filter;
# port 1520;
# period 7;
# infinity 16;
# garbage time 60;
# interface "*" { mode broadcast; };
# honor neighbor;
# honor always;
# honor never;
# authentication none;
#}
#protocol ospf {
# disabled;
# import all;
# export all;
# export where source = RTS_STATIC;
# area 0 {
# interface "eth*" {
# cost 10;
# hello 3;
# retransmit 2;
# wait 5;
# dead 20;
# type broadcast;
# authentication simple;
# password "pass";
# };
# };
#}
#protocol bgp {
# disabled;
# import all;
# export all;
# export where source = RTS_STATIC;
# local as 65000;
# neighbor 192.168.1.1 as 65001;
# multihop 20 via 192.168.2.1;
# hold time 240;
# startup hold time 240;
# connect retry time 120;
# keepalive time 80; # defaults to hold time / 3
# start delay time 5; # How long do we wait before initial connect
# error wait time 60, 300;# Minimum and maximum time we wait after an error (when consecutive
# # errors occur, we increase the delay exponentially ...
# error forget time 300; # ... until this timeout expires)
# disable after error; # Disable the protocol automatically when an error occurs
# next hop self; # Disable next hop processing and always advertise our local address as nexthop
# source address 62.168.0.14; # What local address we use for the TCP connection
# password "secret" # Password used for MD5 authentication
# rr client; # I am a route reflector and the neighor is my client
# rr cluster id 1.0.0.1 # Use this value for cluster id instead of my router id
# };
#}

24
bird/files/bird6.init Normal file
View file

@ -0,0 +1,24 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2010-2011 OpenWrt.org
START=99
STOP=10
SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1
BIRD="/usr/sbin/bird6 -c /etc/bird6.conf"
start() {
service_start $BIRD -d
# ( SERVICE_MATCH_NAME=1 service_start /usr/sbin/bird6loop )
}
stop() {
# ( SERVICE_MATCH_NAME=1 service_stop /usr/sbin/bird6loop )
service_stop $BIRD
}
reload() {
service_reload $BIRD
}

24
bird/files/bird6loop Normal file
View file

@ -0,0 +1,24 @@
#!/bin/sh
BIRD="/usr/sbin/bird6 -c /etc/bird6.conf"
$BIRD -p || return 1
. /lib/functions.sh
. /lib/functions/service.sh
SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1
sig_handler() {
running=0
service_stop $BIRD
}
running=1
trap sig_handler INT
trap sig_handler TERM
while [ $running -gt 0 ]; do
service_check $BIRD || service_start $BIRD -d "$@"
sleep 3
done

View file

@ -120,6 +120,7 @@
hna6 = extensions[e].HNA6_EXTENSION;
if ( extensions[e].TUN4IN6_NET_EXTENSION )
tun4in6 = extensions[e].TUN4IN6_NET_EXTENSION;
tun6in6 = extensions[e].TUN6IN6_NET_EXTENSION;
}
// Gateways
@ -131,6 +132,15 @@
else
gateways += "<li>"+tun4in6[t].network+'/'+tun4in6[t].networklen + ' | ' + tun4in6[t].bandwidth+'</li>';
}
for ( var t = 0; t < tun6in6.length; t++)
{
if ( tun6in6[t].networklen == "128" )
gateways += '<li><a href="http://' + tun6in6[t].network + '">' + tun6in6[t].network + '</a></li>';
else
gateways += "<li>"+tun6in6[t].network+'/'+tun6in6[t].networklen + ' | ' + tun6in6[t].bandwidth+'</li>';
}
gateways += '</ul>';
//Adding HNAs with prefix=128 as main address

View file

@ -8,14 +8,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ndppd
PKG_VERSION:=0.2.2
PKG_RELEASE:=2
PKG_VERSION:=0.2.3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
# Latest release
PKG_SOURCE_URL:=http://www.priv.nu/projects/ndppd/files/
PKG_MD5SUM:=d90c4b65777a62274c1837dba341e5a8
PKG_MD5SUM:=d6f3243bb7fc04c8085371c9acddc50e
# Development snapshot
#PKG_SOURCE_URL=git://github.com/Tuhox/ndppd.git
@ -30,7 +30,7 @@ define Package/ndppd
CATEGORY:=Network
TITLE:=NDP Proxy Daemon
URL:=http://www.priv.nu/projects/ndppd/
MAINTAINER:=Gabriel Kerneis <kerneis@pps.jussieu.fr>
MAINTAINER:=Gabriel Kerneis <gabriel@kerneis.info>
DEPENDS:=+kmod-ipv6 $(CXX_DEPENDS)
endef

View file

@ -0,0 +1,53 @@
From 00da8bf7bab88a3827af4110fb27df9cde542e32 Mon Sep 17 00:00:00 2001
From: Daniel Adolfsson <daniel@priv.nu>
Date: Tue, 12 Feb 2013 13:25:22 +0100
Subject: [PATCH] =?UTF-8?q?Fix=20issue=20#2=20-=20ndppd=20d=C3=A6monizes=20t?=
=?UTF-8?q?oo=20early?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/ndppd.cc | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/ndppd.cc b/src/ndppd.cc
index 6ac19e8..20ced6f 100644
--- a/src/ndppd.cc
+++ b/src/ndppd.cc
@@ -201,15 +201,6 @@ int main(int argc, char* argv[], char* env[])
}
}
- if (daemon) {
- logger::syslog(true);
-
- if (daemonize() < 0) {
- logger::error() << "Failed to daemonize process";
- return 1;
- }
- }
-
if (!pidfile.empty()) {
std::ofstream pf;
pf.open(pidfile.c_str(), std::ios::out | std::ios::trunc);
@@ -225,8 +216,15 @@ int main(int argc, char* argv[], char* env[])
if (!configure(config_path))
return -1;
+
+ if (daemon) {
+ logger::syslog(true);
- //route::load("/proc/net/ipv6_route");
+ if (daemonize() < 0) {
+ logger::error() << "Failed to daemonize process";
+ return 1;
+ }
+ }
// Time stuff.
--
1.7.10.4

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=olsrd
PKG_VERSION:=0.6.6
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.olsr.org/releases/0.6
@ -175,6 +175,8 @@ define Package/olsrd/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/olsrd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/olsrd.init $(1)/etc/init.d/olsrd
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(INSTALL_BIN) ./files/olsrd.hotplug.sh $(1)/etc/hotplug.d/iface/50-olsrd
endef
define Package/olsrd-mod-arprefresh/install

55
olsrd/files/olsrd.hotplug.sh Executable file
View file

@ -0,0 +1,55 @@
#!/bin/sh
olsrd_list_configured_interfaces()
{
local i=0
local interface
while interface="$( uci -q get olsrd.@Interface[$i].interface )"; do {
case "$( uci -q get olsrd.@Interface[$i].ignore )" in
1|on|true|enabled|yes)
# is disabled
;;
*)
echo "$interface"
;;
esac
i=$(( $i + 1 ))
} done
}
olsrd_interface_needs_adding()
{
local interface="$1" # e.g. wlanadhocRADIO1
local device="$2" # e.g. wlan1-1
local myif
local config="/var/etc/olsrd.conf"
for myif in $(olsrd_list_configured_interfaces); do {
[ "$myif" = "$interface" ] && {
if grep -s ^'Interface ' "$config" | grep -q "\"$device\""; then
logger -t olsrd_hotplug -p daemon.debug "[OK] already_active: $INTERFACE => $DEVICE"
return 1
else
logger -t olsrd_hotplug -p daemon.info "[OK] ifup: $INTERFACE => $DEVICE"
return 0
fi
}
} done
logger -t olsrd_hotplug -p daemon.debug "[OK] interface $INTERFACE not used for olsrd"
return 1
}
case "$ACTION" in
ifup)
# only work after the first normal startup
# also: no need to test, if enabled
[ -e '/var/etc/olsrd.conf' ] && {
olsrd_interface_needs_adding "$INTERFACE" "$DEVICE" && {
. /etc/rc.common /etc/init.d/olsrd restart
}
}
;;
esac

View file

@ -13,7 +13,7 @@ PID6=/var/run/olsrd.ipv6.pid
OLSRD_OLSRD_SCHEMA='ignore:internal config_file:internal DebugLevel=0 AllowNoInt=yes'
OLSRD_IPCCONNECT_SCHEMA='ignore:internal Host:list Net:list2'
OLSRD_LOADPLUGIN_SCHEMA='ignore:internal library:internal Host4:list Net4:list2 Host:list Net:list2 Host6:list Net6:list2 Ping:list redistribute:list NonOlsrIf:list name:list lat lon latlon_infile HNA:list2 hosts:list2'
OLSRD_INTERFACE_SCHEMA='ignore:internal interface:internal AutoDetectChanges:bool'
OLSRD_INTERFACE_SCHEMA='ignore:internal interface:internal AutoDetectChanges:bool LinkQualityMult:list2'
OLSRD_INTERFACE_DEFAULTS_SCHEMA='AutoDetectChanges:bool'
T=' '