contrib: remove olsrd-luci
This commit is contained in:
parent
7e32981740
commit
b375106e82
12 changed files with 0 additions and 7493 deletions
|
@ -1,226 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (C) 2008-2009 Freifunk Leipzig
|
|
||||||
#
|
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
|
||||||
# See /LICENSE for more information.
|
|
||||||
#
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_BASENAME:=olsrd
|
|
||||||
PKG_NAME:=$(PKG_BASENAME)-luci
|
|
||||||
PKG_BASEVER:=0.5.6-r7
|
|
||||||
PKG_RELEASE:=2
|
|
||||||
|
|
||||||
#PKG_HGREV:=438bd63a1ab8
|
|
||||||
#PKG_SOURCE:=$(PKG_HGREV).tar.gz
|
|
||||||
#PKG_SOURCE_URL:=http://gredler.at/hg/olsrd-0.5.6/archive
|
|
||||||
#PKG_MD5SUM:=18cfb6afd823daa29dee8375223201d2
|
|
||||||
#PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_HGREV)
|
|
||||||
#PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
|
|
||||||
#PKG_VERSION:=$(PKG_BASEVER)+$(PKG_HGREV)+luci1
|
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_BASENAME)-$(PKG_BASEVER).tar.bz2
|
|
||||||
PKG_SOURCE_URL:=http://www.olsr.org/releases/0.5
|
|
||||||
PKG_MD5SUM:=dde8cb45a10f0cad2010ab2e8ad55146
|
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_BASEVER)
|
|
||||||
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xjf $(DL_DIR)/$(PKG_SOURCE)
|
|
||||||
PKG_VERSION:=$(PKG_BASEVER)+luci1
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
|
|
||||||
|
|
||||||
define Package/olsrd-luci/common_info
|
|
||||||
SECTION:=luci
|
|
||||||
CATEGORY:=LuCI
|
|
||||||
SUBMENU:=Freifunk
|
|
||||||
TITLE:=OLSR - Optimized Link State Routing Daemon
|
|
||||||
URL:=http://www.olsr.org/
|
|
||||||
MAINTAINER:=Jo-Philipp Wich <xm@subsignal.org>
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci
|
|
||||||
$(call Package/olsrd-luci/common_info)
|
|
||||||
MENU:=1
|
|
||||||
DEPENDS:=+libpthread
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci/conffiles
|
|
||||||
/etc/config/olsrd
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-arprefresh
|
|
||||||
$(call Package/olsrd-luci/common_info)
|
|
||||||
TITLE:=OLSR - ARP Refresh Plugin
|
|
||||||
DEPENDS:=olsrd-luci
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-dot-draw
|
|
||||||
$(call Package/olsrd-luci/common_info)
|
|
||||||
TITLE:=OLSR - Dot Draw Plugin
|
|
||||||
DEPENDS:=olsrd-luci
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-bmf
|
|
||||||
$(call Package/olsrd-luci/common_info)
|
|
||||||
TITLE:=OLSR - Basic Multicast Forwarding Plugin
|
|
||||||
DEPENDS:=olsrd-luci +kmod-tun
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-dyn-gw
|
|
||||||
$(call Package/olsrd-luci/common_info)
|
|
||||||
TITLE:=OLSR - Dynamic Gateway Plugin
|
|
||||||
DEPENDS:=olsrd-luci
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-dyn-gw-plain
|
|
||||||
$(call Package/olsrd-luci/common_info)
|
|
||||||
TITLE:=OLSR - Dynamic Gateway Plugin (Plain Version)
|
|
||||||
DEPENDS:=olsrd-luci
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-httpinfo
|
|
||||||
$(call Package/olsrd-luci/common_info)
|
|
||||||
TITLE:=OLSR - HTTP/HTML Info Plugin
|
|
||||||
DEPENDS:=olsrd-luci
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-nameservice
|
|
||||||
$(call Package/olsrd-luci/common_info)
|
|
||||||
TITLE:=OLSR - Hostname Propagation Plugin
|
|
||||||
DEPENDS:=olsrd-luci
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-secure
|
|
||||||
$(call Package/olsrd-luci/common_info)
|
|
||||||
TITLE:=OLSR - Security Extensions Plugin
|
|
||||||
DEPENDS:=olsrd-luci
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-txtinfo
|
|
||||||
$(call Package/olsrd-luci/common_info)
|
|
||||||
TITLE:=OLSR - HTTP/Plaintext Info Plugin
|
|
||||||
DEPENDS:=olsrd-luci
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-quagga
|
|
||||||
$(call Package/olsrd-luci/common_info)
|
|
||||||
TITLE:=OLSR - Quagga Plugin
|
|
||||||
DEPENDS:=olsrd-luci
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-watchdog
|
|
||||||
$(call Package/olsrd-luci/common_info)
|
|
||||||
TITLE:=OLSR - Watchdog Plugin
|
|
||||||
DEPENDS:=olsrd-luci
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-mdns
|
|
||||||
$(call Package/olsrd-luci/common_info)
|
|
||||||
TITLE:=OLSR - mDNS Plugin
|
|
||||||
DEPENDS:=olsrd-luci
|
|
||||||
endef
|
|
||||||
|
|
||||||
TARGET_CFLAGS += $(FPIC)
|
|
||||||
|
|
||||||
define Build/Compile
|
|
||||||
$(MAKE) -C "$(PKG_BUILD_DIR)" olsrd libs \
|
|
||||||
$(TARGET_CONFIGURE_OPTS) \
|
|
||||||
NODEBUG=1 \
|
|
||||||
CFLAGS="$(TARGET_CFLAGS) -DSVEN_OLA_UNBLOAT -DNODEBUG" \
|
|
||||||
OS="linux" \
|
|
||||||
INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
|
|
||||||
LIBDIR="$(PKG_INSTALL_DIR)/usr/lib" \
|
|
||||||
SBINDIR="$(PKG_INSTALL_DIR)/usr/sbin/" \
|
|
||||||
ETCDIR="$(PKG_INSTALL_DIR)/etc" \
|
|
||||||
MANDIR="$(PKG_INSTALL_DIR)/usr/share/man" \
|
|
||||||
STRIP="true" \
|
|
||||||
INSTALL_LIB="true" \
|
|
||||||
SUBDIRS="arprefresh bmf dot_draw dyn_gw dyn_gw_plain httpinfo nameservice secure txtinfo quagga watchdog mdns"
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/olsrd $(1)/usr/sbin/
|
|
||||||
$(INSTALL_BIN) ./files/etc/init.d/olsrd $(1)/etc/init.d/
|
|
||||||
$(INSTALL_CONF) ./files/etc/config/olsrd $(1)/etc/config/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-arprefresh/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/arprefresh/olsrd_arprefresh.so.* $(1)/usr/lib/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-dot-draw/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/dot_draw/olsrd_dot_draw.so.* $(1)/usr/lib/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-bmf/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmf/olsrd_bmf.so.* $(1)/usr/lib/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-dyn-gw/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/dyn_gw/olsrd_dyn_gw.so.* $(1)/usr/lib/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-dyn-gw-plain/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/dyn_gw_plain/olsrd_dyn_gw_plain.so.* $(1)/usr/lib/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-httpinfo/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/httpinfo/olsrd_httpinfo.so.* $(1)/usr/lib/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-nameservice/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/nameservice/olsrd_nameservice.so.* $(1)/usr/lib/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-secure/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/secure/olsrd_secure.so.* $(1)/usr/lib/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-txtinfo/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/txtinfo/olsrd_txtinfo.so.* $(1)/usr/lib/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-quagga/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/quagga/olsrd_quagga.so.* $(1)/usr/lib/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-watchdog/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/watchdog/olsrd_watchdog.so.* $(1)/usr/lib/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/olsrd-luci-mod-mdns/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/mdns/olsrd_mdns.so.* $(1)/usr/lib/
|
|
||||||
endef
|
|
||||||
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,olsrd-luci))
|
|
||||||
$(eval $(call BuildPackage,olsrd-luci-mod-arprefresh))
|
|
||||||
$(eval $(call BuildPackage,olsrd-luci-mod-dot-draw))
|
|
||||||
$(eval $(call BuildPackage,olsrd-luci-mod-bmf))
|
|
||||||
$(eval $(call BuildPackage,olsrd-luci-mod-dyn-gw))
|
|
||||||
$(eval $(call BuildPackage,olsrd-luci-mod-dyn-gw-plain))
|
|
||||||
$(eval $(call BuildPackage,olsrd-luci-mod-httpinfo))
|
|
||||||
$(eval $(call BuildPackage,olsrd-luci-mod-nameservice))
|
|
||||||
$(eval $(call BuildPackage,olsrd-luci-mod-secure))
|
|
||||||
$(eval $(call BuildPackage,olsrd-luci-mod-txtinfo))
|
|
||||||
$(eval $(call BuildPackage,olsrd-luci-mod-quagga))
|
|
||||||
$(eval $(call BuildPackage,olsrd-luci-mod-watchdog))
|
|
||||||
$(eval $(call BuildPackage,olsrd-luci-mod-mdns))
|
|
|
@ -1,21 +0,0 @@
|
||||||
config 'olsrd'
|
|
||||||
option 'IpVersion' '4'
|
|
||||||
option 'FIBMetric' 'flat'
|
|
||||||
option 'LinkQualityAlgorithm' 'etx_ff'
|
|
||||||
option 'NatThreshold' '0.75'
|
|
||||||
|
|
||||||
config 'Interface'
|
|
||||||
option 'ignore' '1'
|
|
||||||
option 'interface' 'ff'
|
|
||||||
|
|
||||||
config 'LoadPlugin'
|
|
||||||
option 'library' 'olsrd_dyn_gw_plain.so.0.4'
|
|
||||||
|
|
||||||
config 'LoadPlugin'
|
|
||||||
option 'library' 'olsrd_nameservice.so.0.3'
|
|
||||||
option 'suffix' '.olsr'
|
|
||||||
option 'hosts_file' '/var/etc/hosts.olsr'
|
|
||||||
|
|
||||||
config 'LoadPlugin'
|
|
||||||
option 'library' 'olsrd_txtinfo.so.0.1'
|
|
||||||
option 'accept' '127.0.0.1'
|
|
|
@ -1,8 +0,0 @@
|
||||||
# you can override olsrd's startup variables here
|
|
||||||
#BIN=/usr/sbin/olsrd
|
|
||||||
#CONF=/var/etc/olsrd.conf
|
|
||||||
#PID=/var/run/olsrd.pid
|
|
||||||
|
|
||||||
# place your custom olsrd parameters here
|
|
||||||
OPTIONS=
|
|
||||||
|
|
|
@ -1,581 +0,0 @@
|
||||||
#!/bin/sh /etc/rc.common
|
|
||||||
# Copyright (C) 2008 Alina Friedrichsen <x-alina@gmx.net>
|
|
||||||
# Special thanks to bittorf wireless ))
|
|
||||||
START=50
|
|
||||||
|
|
||||||
BIN=/usr/sbin/olsrd
|
|
||||||
CONF=/var/etc/olsrd.conf
|
|
||||||
PID=/var/run/olsrd.pid
|
|
||||||
|
|
||||||
OLSRD_OLSRD_SCHEMA='ignore:internal config_file:internal DebugLevel=0 IpVersion=4 AllowNoInt:bool=1 Pollrate=0.025 TcRedundancy=2 MprCoverage=3 LinkQualityFishEye=1 LinkQualityDijkstraLimit=0+9.0 FIBMetric=flat ClearScreen:bool=1 Willingness=3 LinkQualityAging=0.1 LinkQualityAlgorithm=etx_fpm MinTCVTime=500.0'
|
|
||||||
OLSRD_IPCCONNECT_SCHEMA='ignore:internal Host:list Net:list2'
|
|
||||||
OLSRD_LOADPLUGIN_SCHEMA='ignore:internal library:internal Host:list Net: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 Ip4Broadcast HelloInterval=5.0 HelloValidityTime=40.0 TcInterval=2.0 TcValidityTime=256.0 MidInterval=18.0 MidValidityTime=324.0 HnaInterval=18.0 HnaValidityTime=108.0'
|
|
||||||
|
|
||||||
T=' '
|
|
||||||
N='
|
|
||||||
'
|
|
||||||
|
|
||||||
validate_varname() {
|
|
||||||
local varname=$1
|
|
||||||
[ -z "$varname" -o "$varname" != "${varname%%[!A-Za-z0-9_]*}" ] && return 1
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
validate_ifname() {
|
|
||||||
local ifname=$1
|
|
||||||
[ -z "$ifname" -o "$ifname" != "${ifname%%[!A-Za-z0-9.:_-]*}" ] && return 1
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
validate_olsrd_option() {
|
|
||||||
local str=$1
|
|
||||||
[ -z "$str" -o "$str" != "${str%%[! 0-9A-Za-z./|:_-]*}" ] && return 1
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
get_ifname() {
|
|
||||||
IFNAME=
|
|
||||||
local interface=$1
|
|
||||||
validate_varname "$interface" || return 1
|
|
||||||
local ifname
|
|
||||||
|
|
||||||
config_get ifname "$interface" ifname
|
|
||||||
validate_ifname "$ifname" || return 1
|
|
||||||
IFNAME=$ifname
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
system_config() {
|
|
||||||
local cfg=$1
|
|
||||||
local cfgt
|
|
||||||
local hostname
|
|
||||||
local latlon
|
|
||||||
|
|
||||||
config_get cfgt "$cfg" TYPE
|
|
||||||
|
|
||||||
if [ "$cfgt" = "system" ]; then
|
|
||||||
config_get hostname "$cfg" hostname
|
|
||||||
hostname=${hostname:-OpenWrt}
|
|
||||||
SYSTEM_HOSTNAME=$hostname
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$SYSTEM_LAT" -o -z "$SYSTEM_LON" ]; then
|
|
||||||
config_get latlon "$cfg" latlon
|
|
||||||
IFS=" ${T}${N},"
|
|
||||||
set -- $latlon
|
|
||||||
unset IFS
|
|
||||||
SYSTEM_LAT=$1
|
|
||||||
SYSTEM_LON=$2
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
olsrd_find_config_file() {
|
|
||||||
local cfg=$1
|
|
||||||
validate_varname "$cfg" || return 0
|
|
||||||
|
|
||||||
config_get_bool ignore "$cfg" ignore 0
|
|
||||||
[ "$ignore" -ne 0 ] && return 0
|
|
||||||
config_get OLSRD_CONFIG_FILE "$cfg" config_file
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
warning_invalid_value() {
|
|
||||||
local package=$1
|
|
||||||
validate_varname "$package" || package=
|
|
||||||
local config=$2
|
|
||||||
validate_varname "$config" || config=
|
|
||||||
local option=$3
|
|
||||||
validate_varname "$option" || option=
|
|
||||||
|
|
||||||
echo -n "Warning: Invalid value" 1>&2
|
|
||||||
|
|
||||||
if [ -n "$package" -a -n "$config" ]; then
|
|
||||||
echo -n " in option '$package.$config${option:+.}$option'" 1>&2
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ", skipped" 1>&2
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
olsrd_write_option() {
|
|
||||||
local param=$1
|
|
||||||
local cfg=$2
|
|
||||||
validate_varname "$cfg" || return 1
|
|
||||||
local option=$3
|
|
||||||
validate_varname "$option" || return 1
|
|
||||||
local value=$4
|
|
||||||
local option_type=$5
|
|
||||||
|
|
||||||
if [ "$option_type" = bool ]; then
|
|
||||||
case "$value" in
|
|
||||||
1|on|true|enabled|yes) value=yes;;
|
|
||||||
0|off|false|disabled|no) value=no;;
|
|
||||||
*) warning_invalid_value olsrd "$cfg" "$option"; return 1;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! validate_olsrd_option "$value"; then
|
|
||||||
warning_invalid_value olsrd "$cfg" "$option"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$value" != "${value%%[G-Zg-z_-]*}" ]; then
|
|
||||||
if [ "$option" != "Ip6AddrType" -a "$value" != "yes" -a "$value" != "no" ]; then
|
|
||||||
value="\"$value\""
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -n "${N}$param$option $value"
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
olsrd_write_plparam() {
|
|
||||||
local param=$1
|
|
||||||
local cfg=$2
|
|
||||||
validate_varname "$cfg" || return 1
|
|
||||||
local option=$3
|
|
||||||
validate_varname "$option" || return 1
|
|
||||||
local value=$4
|
|
||||||
local option_type=$5
|
|
||||||
local _option
|
|
||||||
|
|
||||||
if [ "$option_type" = bool ]; then
|
|
||||||
case "$value" in
|
|
||||||
1|on|true|enabled|yes) value=yes;;
|
|
||||||
0|off|false|disabled|no) value=no;;
|
|
||||||
*) warning_invalid_value olsrd "$cfg" "$option"; return 1;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! validate_olsrd_option "$value"; then
|
|
||||||
warning_invalid_value olsrd "$cfg" "$option"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
IFS='-_'
|
|
||||||
set -- $option
|
|
||||||
option="$*"
|
|
||||||
unset IFS
|
|
||||||
_option="$option"
|
|
||||||
if [ "$option" = 'hosts' ]; then
|
|
||||||
set -- $value
|
|
||||||
option=$1
|
|
||||||
shift
|
|
||||||
value="$*"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -n "${N}${param}PlParam \"$option\" \"$value\""
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
config_update_schema() {
|
|
||||||
unset IFS
|
|
||||||
local schema_varname=$1
|
|
||||||
validate_varname "$schema_varname" || return 1
|
|
||||||
local command=$2
|
|
||||||
validate_varname "$command" || return 1
|
|
||||||
local option=$3
|
|
||||||
validate_varname "$option" || return 1
|
|
||||||
local value=$4
|
|
||||||
local schema
|
|
||||||
local cur_option
|
|
||||||
|
|
||||||
case "$varname" in
|
|
||||||
*_LENGTH) return 0;;
|
|
||||||
*_ITEM*) return 0;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
eval "export -n -- \"schema=\${$schema_varname}\""
|
|
||||||
|
|
||||||
for cur_option in $schema; do
|
|
||||||
[ "${cur_option%%[:=]*}" = "$option" ] && return 0
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$command" = list ]; then
|
|
||||||
set -- $value
|
|
||||||
if [ "$#" -ge "3" ]; then
|
|
||||||
schema_entry="$option:list3"
|
|
||||||
elif [ "$#" -ge "2" ]; then
|
|
||||||
schema_entry="$option:list2"
|
|
||||||
else
|
|
||||||
schema_entry="$option:list"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
schema_entry="$option"
|
|
||||||
fi
|
|
||||||
|
|
||||||
append "$schema_varname" "$schema_entry"
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
config_write_options() {
|
|
||||||
unset IFS
|
|
||||||
local schema=$1
|
|
||||||
local cfg=$2
|
|
||||||
validate_varname "$cfg" || return 1
|
|
||||||
local write_func=$3
|
|
||||||
[ -z "$write_func" ] && output_func=echo
|
|
||||||
local write_param=$4
|
|
||||||
local schema_entry
|
|
||||||
local option
|
|
||||||
local option_length
|
|
||||||
local option_type
|
|
||||||
local default
|
|
||||||
local value
|
|
||||||
local list_size
|
|
||||||
local list_item
|
|
||||||
local list_value
|
|
||||||
local i
|
|
||||||
local position
|
|
||||||
|
|
||||||
for schema_entry in $schema; do
|
|
||||||
default=${schema_entry#*[=]}
|
|
||||||
[ "$default" = "$schema_entry" ] && default=
|
|
||||||
option=${schema_entry%%[=]*}
|
|
||||||
IFS=':'
|
|
||||||
set -- $option
|
|
||||||
unset IFS
|
|
||||||
option=$1
|
|
||||||
option_type=$2
|
|
||||||
validate_varname "$option" || continue
|
|
||||||
[ -z "$option_type" ] || validate_varname "$option_type" || continue
|
|
||||||
[ "$option_type" = internal ] && continue
|
|
||||||
config_get value "$cfg" "$option"
|
|
||||||
|
|
||||||
if [ -z "$value" ]; then
|
|
||||||
IFS='+'
|
|
||||||
set -- $default
|
|
||||||
unset IFS
|
|
||||||
value=$*
|
|
||||||
elif [ "$value" = '-' -a -n "$default" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -z "$value" ] && continue
|
|
||||||
|
|
||||||
case "$option_type" in
|
|
||||||
list) list_size=1;;
|
|
||||||
list2) list_size=2;;
|
|
||||||
list3) list_size=3;;
|
|
||||||
*) list_size=0;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ "$list_size" -gt 0 ]; then
|
|
||||||
config_get option_length "$cfg" "${option}_LENGTH"
|
|
||||||
if [ -n "$option_length" ]; then
|
|
||||||
i=1
|
|
||||||
while [ "$i" -le "$option_length" ]; do
|
|
||||||
config_get list_value "$cfg" "${option}_ITEM$i"
|
|
||||||
"$write_func" "$write_param" "$cfg" "$option" "$list_value" "$option_type" || break
|
|
||||||
i=$((i + 1))
|
|
||||||
done
|
|
||||||
else
|
|
||||||
list_value=
|
|
||||||
i=0
|
|
||||||
for list_item in $value; do
|
|
||||||
append "list_value" "$list_item"
|
|
||||||
i=$((i + 1))
|
|
||||||
position=$((i % list_size))
|
|
||||||
if [ "$position" -eq 0 ]; then
|
|
||||||
"$write_func" "$write_param" "$cfg" "$option" "$list_value" "$option_type" || break
|
|
||||||
list_value=
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
[ "$position" -ne 0 ] && "$write_func" "$write_param" "$cfg" "$option" "$list_value" "$option_type"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
"$write_func" "$write_param" "$cfg" "$option" "$value" "$option_type"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
olsrd_write_olsrd() {
|
|
||||||
local cfg=$1
|
|
||||||
validate_varname "$cfg" || return 0
|
|
||||||
local ignore
|
|
||||||
|
|
||||||
config_get_bool ignore "$cfg" ignore 0
|
|
||||||
[ "$ignore" -ne 0 ] && return 0
|
|
||||||
|
|
||||||
[ "$OLSRD_COUNT" -gt 0 ] && return 0
|
|
||||||
|
|
||||||
config_write_options "$OLSRD_OLSRD_SCHEMA" "$cfg" olsrd_write_option
|
|
||||||
echo
|
|
||||||
OLSRD_COUNT=$((OLSRD_COUNT + 1))
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
olsrd_write_ipcconnect() {
|
|
||||||
local cfg=$1
|
|
||||||
validate_varname "$cfg" || return 0
|
|
||||||
local ignore
|
|
||||||
|
|
||||||
config_get_bool ignore "$cfg" ignore 0
|
|
||||||
[ "$ignore" -ne 0 ] && return 0
|
|
||||||
|
|
||||||
[ "$IPCCONNECT_COUNT" -gt 0 ] && return 0
|
|
||||||
|
|
||||||
echo -n "${N}IpcConnect${N}{"
|
|
||||||
config_write_options "$OLSRD_IPCCONNECT_SCHEMA" "$cfg" olsrd_write_option "${T}"
|
|
||||||
echo "${N}}"
|
|
||||||
IPCCONNECT_COUNT=$((IPCCONNECT_COUNT + 1))
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
olsrd_write_hna4() {
|
|
||||||
local cfg=$1
|
|
||||||
validate_varname "$cfg" || return 0
|
|
||||||
local ignore
|
|
||||||
|
|
||||||
config_get_bool ignore "$cfg" ignore 0
|
|
||||||
[ "$ignore" -ne 0 ] && return 0
|
|
||||||
|
|
||||||
config_get netaddr "$cfg" netaddr
|
|
||||||
if ! validate_olsrd_option "$netaddr"; then
|
|
||||||
warning_invalid_value olsrd "$cfg" "netaddr"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
config_get netmask "$cfg" netmask
|
|
||||||
if ! validate_olsrd_option "$netmask"; then
|
|
||||||
warning_invalid_value olsrd "$cfg" "netmask"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ "$HNA4_COUNT" -le 0 ] && echo -n "${N}Hna4${N}{"
|
|
||||||
echo -n "${N}${T}$netaddr $netmask"
|
|
||||||
HNA4_COUNT=$((HNA4_COUNT + 1))
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
olsrd_write_hna6() {
|
|
||||||
local cfg=$1
|
|
||||||
validate_varname "$cfg" || return 0
|
|
||||||
local ignore
|
|
||||||
|
|
||||||
config_get_bool ignore "$cfg" ignore 0
|
|
||||||
[ "$ignore" -ne 0 ] && return 0
|
|
||||||
|
|
||||||
config_get netaddr "$cfg" netaddr
|
|
||||||
if ! validate_olsrd_option "$netaddr"; then
|
|
||||||
warning_invalid_value olsrd "$cfg" "netaddr"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
config_get prefix "$cfg" prefix
|
|
||||||
if ! validate_olsrd_option "$prefix"; then
|
|
||||||
warning_invalid_value olsrd "$cfg" "prefix"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ "$HNA6_COUNT" -le 0 ] && echo -n "${N}Hna6${N}{"
|
|
||||||
echo -n "${N}${T}$netaddr $prefix"
|
|
||||||
HNA6_COUNT=$((HNA6_COUNT + 1))
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
olsrd_write_loadplugin() {
|
|
||||||
local cfg=$1
|
|
||||||
validate_varname "$cfg" || return 0
|
|
||||||
local ignore
|
|
||||||
local name
|
|
||||||
local suffix
|
|
||||||
local lat
|
|
||||||
local lon
|
|
||||||
local latlon_infile
|
|
||||||
|
|
||||||
config_get_bool ignore "$cfg" ignore 0
|
|
||||||
[ "$ignore" -ne 0 ] && return 0
|
|
||||||
|
|
||||||
config_get library "$cfg" library
|
|
||||||
if ! validate_olsrd_option "$library"; then
|
|
||||||
warning_invalid_value olsrd "$cfg" "library"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
if ! [ -x "/lib/$library" -o -x "/usr/lib/$library" -o -x "/usr/local/lib/$library" ]; then
|
|
||||||
echo "Warning: Plugin library '$library' not found, skipped" 1>&2
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$library" in
|
|
||||||
olsrd_nameservice.*)
|
|
||||||
config_get name "$cfg" name
|
|
||||||
[ -z "$name" ] && config_set "$cfg" name $SYSTEM_HOSTNAME
|
|
||||||
|
|
||||||
config_get suffix "$cfg" suffix
|
|
||||||
[ -z "$suffix" ] && config_set "$cfg" suffix '.olsr'
|
|
||||||
|
|
||||||
config_get lat "$cfg" lat
|
|
||||||
config_get lon "$cfg" lon
|
|
||||||
config_get latlon_infile "$cfg" latlon_infile
|
|
||||||
if [ \( -z "$lat" -o -z "$lat" \) -a -z "$latlon_infile" ]; then
|
|
||||||
if [ -f '/var/run/latlon.txt' ]; then
|
|
||||||
config_set "$cfg" lat ''
|
|
||||||
config_set "$cfg" lon ''
|
|
||||||
config_set "$cfg" latlon_infile '/var/run/latlon.txt'
|
|
||||||
else
|
|
||||||
config_set "$cfg" lat "$SYSTEM_LAT"
|
|
||||||
config_set "$cfg" lon "$SYSTEM_LON"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
config_get latlon_file "$cfg" latlon_file
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo -n "${N}LoadPlugin \"$library\"${N}{"
|
|
||||||
config_write_options "$OLSRD_LOADPLUGIN_SCHEMA" "$cfg" olsrd_write_plparam "${T}"
|
|
||||||
echo "${N}}"
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
olsrd_write_interface() {
|
|
||||||
local cfg=$1
|
|
||||||
validate_varname "$cfg" || return 0
|
|
||||||
local ignore
|
|
||||||
local interfaces
|
|
||||||
local interface
|
|
||||||
local ifnames
|
|
||||||
|
|
||||||
config_get_bool ignore "$cfg" ignore 0
|
|
||||||
[ "$ignore" -ne 0 ] && return 0
|
|
||||||
|
|
||||||
ifnames=
|
|
||||||
config_get interfaces "$cfg" interface
|
|
||||||
for interface in $interfaces; do
|
|
||||||
if validate_varname "$interface"; then
|
|
||||||
if get_ifname "$interface"; then
|
|
||||||
ifnames="$ifnames \"$IFNAME\""
|
|
||||||
else
|
|
||||||
echo "Warning: Interface '$interface' not found, skipped" 1>&2
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
warning_invalid_value olsrd "$cfg" "interface"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
[ -z "$ifnames" ] && return 0
|
|
||||||
|
|
||||||
echo -n "${N}Interface$ifnames${N}{"
|
|
||||||
config_write_options "$OLSRD_INTERFACE_SCHEMA" "$cfg" olsrd_write_option "${T}"
|
|
||||||
echo "${N}}"
|
|
||||||
INTERFACES_COUNT=$((INTERFACES_COUNT + 1))
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
olsrd_update_schema() {
|
|
||||||
local command="$1"
|
|
||||||
validate_varname "$command" || return 0
|
|
||||||
local varname="$2"
|
|
||||||
validate_varname "$varname" || return 0
|
|
||||||
local value="$3"
|
|
||||||
local cfg="$CONFIG_SECTION"
|
|
||||||
local cfgt
|
|
||||||
local cur_varname
|
|
||||||
|
|
||||||
config_get cfgt "$cfg" TYPE
|
|
||||||
case "$cfgt" in
|
|
||||||
olsrd) config_update_schema OLSRD_OLSRD_SCHEMA "$command" "$varname" "$value";;
|
|
||||||
IpcConnect) config_update_schema OLSRD_IPCCONNECT_SCHEMA "$command" "$varname" "$value";;
|
|
||||||
LoadPlugin) config_update_schema OLSRD_LOADPLUGIN_SCHEMA "$command" "$varname" "$value";;
|
|
||||||
Interface) config_update_schema OLSRD_INTERFACE_SCHEMA "$command" "$varname" "$value";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
olsrd_write_config() {
|
|
||||||
OLSRD_COUNT=0
|
|
||||||
config_foreach olsrd_write_olsrd olsrd
|
|
||||||
IPCCONNECT_COUNT=0
|
|
||||||
config_foreach olsrd_write_ipcconnect IpcConnect
|
|
||||||
HNA4_COUNT=0
|
|
||||||
config_foreach olsrd_write_hna4 Hna4
|
|
||||||
[ "$HNA4_COUNT" -gt 0 ] && echo "${N}}"
|
|
||||||
HNA6_COUNT=0
|
|
||||||
config_foreach olsrd_write_hna6 Hna6
|
|
||||||
[ "$HNA6_COUNT" -gt 0 ] && echo "${N}}"
|
|
||||||
config_foreach olsrd_write_loadplugin LoadPlugin
|
|
||||||
INTERFACES_COUNT=0
|
|
||||||
config_foreach olsrd_write_interface Interface
|
|
||||||
echo
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
### check for running instance
|
|
||||||
if [ -s $PID ]; then
|
|
||||||
if kill -0 $(cat $PID) 2>&-; then
|
|
||||||
echo "there is already a running instance ($(cat $PID))"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
### disable icmp redirects
|
|
||||||
echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects
|
|
||||||
|
|
||||||
SYSTEM_HOSTNAME=
|
|
||||||
SYSTEM_LAT=
|
|
||||||
SYSTEM_LON=
|
|
||||||
config_load system
|
|
||||||
config_foreach system_config system
|
|
||||||
|
|
||||||
option_cb() {
|
|
||||||
olsrd_update_schema "option" "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
list_cb() {
|
|
||||||
olsrd_update_schema "list" "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
include /lib/network
|
|
||||||
scan_interfaces
|
|
||||||
config_load olsrd
|
|
||||||
reset_cb
|
|
||||||
|
|
||||||
OLSRD_CONFIG_FILE=
|
|
||||||
config_foreach olsrd_find_config_file olsrd
|
|
||||||
|
|
||||||
if [ -z "$OLSRD_CONFIG_FILE" ]; then
|
|
||||||
### generate config
|
|
||||||
mkdir -p ${CONF%/*}
|
|
||||||
olsrd_write_config > $CONF
|
|
||||||
if [ "$INTERFACES_COUNT" -gt 0 -a "$OLSRD_COUNT" -gt 0 ]; then
|
|
||||||
OLSRD_CONFIG_FILE=$CONF
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -z "$OLSRD_CONFIG_FILE" ] && return 1
|
|
||||||
|
|
||||||
### start olsrd
|
|
||||||
start-stop-daemon -q -b -m -p $PID -x $BIN -S -- -f $CONF -nofork
|
|
||||||
}
|
|
||||||
|
|
||||||
stop() {
|
|
||||||
### stop olsrd
|
|
||||||
start-stop-daemon -q -p $PID -x $BIN -K
|
|
||||||
|
|
||||||
### re-enable icmp redirects
|
|
||||||
echo 1 > /proc/sys/net/ipv4/conf/all/send_redirects
|
|
||||||
}
|
|
||||||
|
|
||||||
restart() {
|
|
||||||
### override generic restart because we need some time between stop and start
|
|
||||||
stop; sleep 3; start
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
[ -n "${IPKG_INSTROOT}" ] || {
|
|
||||||
/etc/init.d/olsrd enabled || /etc/init.d/olsrd enable
|
|
||||||
exit 0
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
diff -Nur olsrd-0.5.6-r2.orig/src/lq_plugin_default_ff.h olsrd-0.5.6-r2/src/lq_plugin_default_ff.h
|
|
||||||
--- olsrd-0.5.6-r2.orig/src/lq_plugin_default_ff.h 2008-11-26 10:53:16.000000000 +0100
|
|
||||||
+++ olsrd-0.5.6-r2/src/lq_plugin_default_ff.h 2008-11-26 10:53:16.000000000 +0100
|
|
||||||
@@ -50,7 +50,8 @@
|
|
||||||
|
|
||||||
#define LQ_ALGORITHM_ETX_FF_NAME "etx_ff"
|
|
||||||
|
|
||||||
-#define LQ_FF_WINDOW 32
|
|
||||||
+/* 16,32,64 and max. 128 */
|
|
||||||
+#define LQ_FF_WINDOW 64
|
|
||||||
#define LQ_FF_QUICKSTART_INIT 4
|
|
||||||
|
|
||||||
struct default_lq_ff {
|
|
|
@ -1,11 +0,0 @@
|
||||||
diff -Nur olsrd-0.5.6-r2.orig/src/net_olsr.c olsrd-0.5.6-r2/src/net_olsr.c
|
|
||||||
--- olsrd-0.5.6-r2.orig/src/net_olsr.c 2008-11-26 10:53:53.000000000 +0100
|
|
||||||
+++ olsrd-0.5.6-r2/src/net_olsr.c 2008-11-26 10:53:53.000000000 +0100
|
|
||||||
@@ -78,6 +78,7 @@
|
|
||||||
static const char *const deny_ipv4_defaults[] = {
|
|
||||||
"0.0.0.0",
|
|
||||||
"127.0.0.1",
|
|
||||||
+ "192.168.1.1",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
--- a/lib/arprefresh/src/olsrd_arprefresh.c
|
|
||||||
+++ b/lib/arprefresh/src/olsrd_arprefresh.c
|
|
||||||
@@ -34,6 +34,8 @@
|
|
||||||
* Plugin to refresh the local ARP cache from received OLSR broadcasts
|
|
||||||
*/
|
|
||||||
|
|
||||||
+#undef ARPREFRESH_DEBUG
|
|
||||||
+
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
@@ -46,6 +48,9 @@
|
|
||||||
#include <netinet/ip.h>
|
|
||||||
#include <netinet/udp.h>
|
|
||||||
#include <netpacket/packet.h>
|
|
||||||
+#ifdef ARPREFRESH_DEBUG
|
|
||||||
+#include <arpa/inet.h>
|
|
||||||
+#endif
|
|
||||||
#include <linux/types.h>
|
|
||||||
#include <linux/filter.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
@@ -54,7 +59,6 @@
|
|
||||||
#include "kernel_routes.h"
|
|
||||||
#include "scheduler.h"
|
|
||||||
|
|
||||||
-#undef ARPREFRESH_DEBUG
|
|
||||||
#define PLUGIN_INTERFACE_VERSION 5
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
@@ -129,7 +133,13 @@
|
|
||||||
memcpy(&req.in_pa.sin_addr, &buf.ip.saddr, sizeof(buf.ip.saddr));
|
|
||||||
req.arp.arp_ha.sa_family = AF_LOCAL;
|
|
||||||
memcpy(&req.arp.arp_ha.sa_data, &buf.eth.h_source, sizeof(buf.eth.h_source));
|
|
||||||
- req.arp.arp_flags = ATF_COM;
|
|
||||||
+ /*
|
|
||||||
+ * Currently, temp arp entries work partially under linux-2.6 (the entries
|
|
||||||
+ * are timed out after a short period, not after the default 5 minutes. Under
|
|
||||||
+ * linux 2.4 this does not work. The ATF_MAGIC triggers a hack in the Freifunk
|
|
||||||
+ * firmware's kernel. ATF_MACIG seem not to be used anywhere...
|
|
||||||
+ */
|
|
||||||
+ req.arp.arp_flags = ATF_COM | ATF_MAGIC;
|
|
||||||
if_indextoname(from.sll_ifindex, req.arp.arp_dev);
|
|
||||||
#ifdef ARPREFRESH_DEBUG
|
|
||||||
{
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,10 +0,0 @@
|
||||||
--- a/src/linux/kernel_routes.c
|
|
||||||
+++ b/src/linux/kernel_routes.c
|
|
||||||
@@ -42,6 +42,7 @@
|
|
||||||
#include "kernel_routes.h"
|
|
||||||
#include "ipc_frontend.h"
|
|
||||||
#include "log.h"
|
|
||||||
+#include <fcntl.h>
|
|
||||||
|
|
||||||
/* values for control flag to handle recursive route corrections
|
|
||||||
* currently only requires in linux specific kernel_routes.c */
|
|
|
@ -1,256 +0,0 @@
|
||||||
--- a/lib/httpinfo/src/olsrd_httpinfo.c
|
|
||||||
+++ b/lib/httpinfo/src/olsrd_httpinfo.c
|
|
||||||
@@ -687,9 +687,16 @@
|
|
||||||
void
|
|
||||||
olsr_plugin_exit(void)
|
|
||||||
{
|
|
||||||
+ struct allowed_net *a, *next;
|
|
||||||
if (http_socket >= 0) {
|
|
||||||
CLOSE(http_socket);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ for (a = allowed_nets; a != NULL; a = next) {
|
|
||||||
+ next = a->next;
|
|
||||||
+
|
|
||||||
+ free(a);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
--- a/src/interfaces.h
|
|
||||||
+++ b/src/interfaces.h
|
|
||||||
@@ -187,6 +187,7 @@
|
|
||||||
extern struct interface *ifnet;
|
|
||||||
|
|
||||||
int ifinit(void);
|
|
||||||
+void olsr_delete_interfaces(void);
|
|
||||||
|
|
||||||
void run_ifchg_cbs(struct interface *, int);
|
|
||||||
|
|
||||||
--- a/src/linux/kernel_routes.c
|
|
||||||
+++ b/src/linux/kernel_routes.c
|
|
||||||
@@ -85,6 +85,8 @@
|
|
||||||
OLSR_PRINTF(1,"could not create rtnetlink socket! %d",sock);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
+ memset(&addr, 0, sizeof(addr));
|
|
||||||
+
|
|
||||||
addr.nl_family = AF_NETLINK;
|
|
||||||
addr.nl_pid = 0; //kernel will assign appropiate number instead of pid (which is already used by primaray rtnetlink socket to add/delete routes)
|
|
||||||
addr.nl_groups = rtnl_mgrp;
|
|
||||||
--- a/src/main.c
|
|
||||||
+++ b/src/main.c
|
|
||||||
@@ -57,6 +57,7 @@
|
|
||||||
#include "net_os.h"
|
|
||||||
#include "build_msg.h"
|
|
||||||
#include "net_olsr.h"
|
|
||||||
+#include "mid_set.h"
|
|
||||||
|
|
||||||
#if LINUX_POLICY_ROUTING
|
|
||||||
#include <linux/types.h>
|
|
||||||
@@ -526,6 +527,7 @@
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
struct interface *ifn;
|
|
||||||
+ int exit_value;
|
|
||||||
|
|
||||||
OLSR_PRINTF(1, "Received signal %d - shutting down\n", (int)signo);
|
|
||||||
|
|
||||||
@@ -542,6 +544,12 @@
|
|
||||||
|
|
||||||
olsr_delete_all_kernel_routes();
|
|
||||||
|
|
||||||
+ olsr_delete_all_tc_entries();
|
|
||||||
+
|
|
||||||
+ olsr_delete_all_mid_entries();
|
|
||||||
+
|
|
||||||
+ olsr_destroy_parser();
|
|
||||||
+
|
|
||||||
OLSR_PRINTF(1, "Closing sockets...\n");
|
|
||||||
|
|
||||||
/* front-end IPC socket */
|
|
||||||
@@ -551,7 +559,6 @@
|
|
||||||
}
|
|
||||||
#endif /* SVEN_OLA_UNBLOAT */
|
|
||||||
|
|
||||||
- /* OLSR sockets */
|
|
||||||
for (ifn = ifnet; ifn; ifn = ifn->int_next)
|
|
||||||
close(ifn->olsr_socket);
|
|
||||||
|
|
||||||
@@ -581,13 +588,17 @@
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Free cookies and memory pools attached. */
|
|
||||||
+ OLSR_PRINTF(0, "Free all memory...\n");
|
|
||||||
olsr_delete_all_cookies();
|
|
||||||
|
|
||||||
olsr_syslog(OLSR_LOG_INFO, "%s stopped", olsrd_version);
|
|
||||||
|
|
||||||
OLSR_PRINTF(1, "\n <<<< %s - terminating >>>>\n http://www.olsr.org\n", olsrd_version);
|
|
||||||
|
|
||||||
- exit(olsr_cnf->exit_value);
|
|
||||||
+ exit_value = olsr_cnf->exit_value;
|
|
||||||
+ free (olsr_cnf);
|
|
||||||
+
|
|
||||||
+ exit(exit_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
--- a/src/mid_set.c
|
|
||||||
+++ b/src/mid_set.c
|
|
||||||
@@ -38,6 +38,7 @@
|
|
||||||
* the copyright holders.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
+#include <assert.h>
|
|
||||||
|
|
||||||
#include "ipcalc.h"
|
|
||||||
#include "defs.h"
|
|
||||||
@@ -79,6 +80,15 @@
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+void olsr_delete_all_mid_entries(void) {
|
|
||||||
+ int hash;
|
|
||||||
+
|
|
||||||
+ for (hash = 0; hash < HASHSIZE; hash++) {
|
|
||||||
+ while (mid_set[hash].next != &mid_set[hash]) {
|
|
||||||
+ olsr_delete_mid_entry(mid_set[hash].next);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
/**
|
|
||||||
* Wrapper for the timer callback.
|
|
||||||
*/
|
|
||||||
@@ -124,10 +134,10 @@
|
|
||||||
*
|
|
||||||
* @param m_addr the main address of the node
|
|
||||||
* @param alias the alias address to insert
|
|
||||||
- * @return nada
|
|
||||||
+ * @return false if mid_address is unnecessary, true otherwise
|
|
||||||
*/
|
|
||||||
|
|
||||||
-void
|
|
||||||
+static bool
|
|
||||||
insert_mid_tuple(union olsr_ip_addr *m_addr, struct mid_address *alias, olsr_reltime vtime)
|
|
||||||
{
|
|
||||||
struct mid_entry *tmp;
|
|
||||||
@@ -147,9 +157,8 @@
|
|
||||||
/* Check if alias is already registered with m_addr */
|
|
||||||
registered_m_addr = mid_lookup_main_addr(&alias->alias);
|
|
||||||
if (registered_m_addr != NULL && ipequal(registered_m_addr, m_addr)) {
|
|
||||||
-
|
|
||||||
/* Alias is already registered with main address. Nothing to do here. */
|
|
||||||
- return;
|
|
||||||
+ return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@@ -223,6 +232,7 @@
|
|
||||||
}
|
|
||||||
tmp_adr = tmp_adr->next_alias;
|
|
||||||
}
|
|
||||||
+ return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
@@ -284,7 +294,9 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- insert_mid_tuple(main_add, adr, vtime);
|
|
||||||
+ if (!insert_mid_tuple(main_add, adr, vtime)) {
|
|
||||||
+ free(adr);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
/*
|
|
||||||
*Recalculate topology
|
|
||||||
--- a/src/mid_set.h
|
|
||||||
+++ b/src/mid_set.h
|
|
||||||
@@ -75,7 +75,7 @@
|
|
||||||
struct mid_alias;
|
|
||||||
|
|
||||||
int olsr_init_mid_set(void);
|
|
||||||
-void insert_mid_tuple(union olsr_ip_addr *, struct mid_address *, olsr_reltime);
|
|
||||||
+void olsr_delete_all_mid_entries(void);
|
|
||||||
void insert_mid_alias(union olsr_ip_addr *, const union olsr_ip_addr *, olsr_reltime);
|
|
||||||
union olsr_ip_addr *mid_lookup_main_addr(const union olsr_ip_addr *);
|
|
||||||
struct mid_address *mid_lookup_aliases(const union olsr_ip_addr *);
|
|
||||||
--- a/src/parser.c
|
|
||||||
+++ b/src/parser.c
|
|
||||||
@@ -104,6 +104,26 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
+olsr_destroy_parser(void) {
|
|
||||||
+ struct parse_function_entry *pe, *pe_next;
|
|
||||||
+ struct preprocessor_function_entry *ppe, *ppe_next;
|
|
||||||
+ struct packetparser_function_entry *pae, *pae_next;
|
|
||||||
+
|
|
||||||
+ for (pe = parse_functions; pe; pe = pe_next) {
|
|
||||||
+ pe_next = pe->next;
|
|
||||||
+ free (pe);
|
|
||||||
+ }
|
|
||||||
+ for (ppe = preprocessor_functions; ppe; ppe = ppe_next) {
|
|
||||||
+ ppe_next = ppe->next;
|
|
||||||
+ free (ppe);
|
|
||||||
+ }
|
|
||||||
+ for (pae = packetparser_functions; pae; pae = pae_next) {
|
|
||||||
+ pae_next = pae->next;
|
|
||||||
+ free(pae);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
olsr_parser_add_function(parse_function * function, uint32_t type)
|
|
||||||
{
|
|
||||||
struct parse_function_entry *new_entry;
|
|
||||||
--- a/src/parser.h
|
|
||||||
+++ b/src/parser.h
|
|
||||||
@@ -74,6 +74,8 @@
|
|
||||||
|
|
||||||
void olsr_init_parser(void);
|
|
||||||
|
|
||||||
+void olsr_destroy_parser(void);
|
|
||||||
+
|
|
||||||
void olsr_input(int);
|
|
||||||
|
|
||||||
void olsr_input_hostemu(int);
|
|
||||||
--- a/src/scheduler.c
|
|
||||||
+++ b/src/scheduler.c
|
|
||||||
@@ -40,6 +40,8 @@
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
+#include <assert.h>
|
|
||||||
+
|
|
||||||
#include "defs.h"
|
|
||||||
#include "scheduler.h"
|
|
||||||
#include "log.h"
|
|
||||||
--- a/src/tc_set.c
|
|
||||||
+++ b/src/tc_set.c
|
|
||||||
@@ -205,6 +205,14 @@
|
|
||||||
tc_myself = olsr_add_tc_entry(&olsr_cnf->main_addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
+void olsr_delete_all_tc_entries(void) {
|
|
||||||
+ struct tc_entry *tc;
|
|
||||||
+
|
|
||||||
+ OLSR_FOR_ALL_TC_ENTRIES(tc) {
|
|
||||||
+ olsr_delete_tc_entry(tc);
|
|
||||||
+ } OLSR_FOR_ALL_TC_ENTRIES_END(tc)
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/**
|
|
||||||
* The main ip address has changed.
|
|
||||||
* Do the needful.
|
|
||||||
--- a/src/tc_set.h
|
|
||||||
+++ b/src/tc_set.h
|
|
||||||
@@ -142,6 +142,7 @@
|
|
||||||
extern struct tc_entry *tc_myself;
|
|
||||||
|
|
||||||
void olsr_init_tc(void);
|
|
||||||
+void olsr_delete_all_tc_entries(void);
|
|
||||||
void olsr_change_myself_tc(void);
|
|
||||||
void olsr_print_tc_table(void);
|
|
||||||
void olsr_time_out_tc_set(void);
|
|
Loading…
Reference in a new issue