packages: drop olsrd, batman, bmxd and batman-adv packages since they moved to a different feed
git-svn-id: svn://svn.openwrt.org/openwrt/packages@36369 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
df3488f51a
commit
95fc83a1d1
@ -1,24 +0,0 @@
|
||||
|
||||
config KMOD_BATMAN_ADV_DEBUG_LOG
|
||||
bool "enable verbose debug logging"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default n
|
||||
|
||||
config KMOD_BATMAN_ADV_BLA
|
||||
bool "enable bridge loop avoidance"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
|
||||
config KMOD_BATMAN_ADV_DAT
|
||||
bool "enable distributed arp table"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
|
||||
config KMOD_BATMAN_ADV_BATCTL
|
||||
bool "enable batctl"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
help
|
||||
batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced.
|
||||
It is an easier method for configuring batman-adv and
|
||||
provides some additional tools for debugging as well.
|
@ -1,121 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id: Makefile 5624 2006-11-23 00:29:07Z nbd $
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=batman-adv
|
||||
|
||||
PKG_VERSION:=2013.1.0
|
||||
BATCTL_VERSION:=2013.1.0
|
||||
PKG_RELEASE:=3
|
||||
PKG_MD5SUM:=fe1fd32eddde1f91575d7a7ec21d5782
|
||||
BATCTL_MD5SUM:=767bf36c77c517e1d321169bf9a7fae5
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BATCTL_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/batctl-$(BATCTL_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
define KernelPackage/batman-adv
|
||||
URL:=http://www.open-mesh.org/
|
||||
MAINTAINER:=Marek Lindner <lindner_marek@yahoo.de>
|
||||
SUBMENU:=Network Support
|
||||
DEPENDS:=+kmod-lib-crc16 +kmod-crypto-core +kmod-crypto-crc32c +kmod-lib-crc32c +libc
|
||||
TITLE:=B.A.T.M.A.N. Adv
|
||||
FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX)
|
||||
AUTOLOAD:=$(call AutoLoad,50,batman-adv)
|
||||
endef
|
||||
|
||||
define KernelPackage/batman-adv/description
|
||||
B.A.T.M.A.N. advanced is a kernel module which allows to
|
||||
build layer 2 mesh networks. This package contains the
|
||||
version $(PKG_VERSION) of the kernel module plus its user space
|
||||
configuration & managerment tool batctl.
|
||||
endef
|
||||
|
||||
define KernelPackage/batman-adv/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
MAKE_BATMAN_ADV_ARGS += \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
KERNELPATH="$(LINUX_DIR)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
PATH="$(TARGET_PATH)" \
|
||||
SUBDIRS="$(PKG_BUILD_DIR)" \
|
||||
PWD="$(PKG_BUILD_DIR)" \
|
||||
LINUX_VERSION="$(LINUX_VERSION)" \
|
||||
CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),y,n) \
|
||||
CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_KMOD_BATMAN_ADV_BLA),y,n) \
|
||||
CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_KMOD_BATMAN_ADV_DAT),y,n) \
|
||||
REVISION="" all
|
||||
|
||||
MAKE_BATCTL_ARGS += \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
CCFLAGS="$(TARGET_CFLAGS)" \
|
||||
OFLAGS="$(TARGET_CFLAGS)" \
|
||||
REVISION="" \
|
||||
CC="$(TARGET_CC)" \
|
||||
NODEBUG=1 \
|
||||
UNAME="Linux" \
|
||||
DESTDIR="$(PKG_INSTALL_DIR)" \
|
||||
STRIP="/bin/true" \
|
||||
batctl install
|
||||
|
||||
ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
|
||||
define Download/batctl
|
||||
FILE:=batctl-$(BATCTL_VERSION).tar.gz
|
||||
URL:=$(PKG_SOURCE_URL)
|
||||
MD5SUM:=$(BATCTL_MD5SUM)
|
||||
endef
|
||||
$(eval $(call Download,batctl))
|
||||
|
||||
BATCTL_EXTRACT = tar xzf "$(DL_DIR)/batctl-$(BATCTL_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)"
|
||||
BATCTL_PATCH = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)","*batctl*")
|
||||
BATCTL_BUILD = $(MAKE) -C $(PKG_BATCTL_BUILD_DIR) $(MAKE_BATCTL_ARGS)
|
||||
BATCTL_INSTALL = $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/
|
||||
endif
|
||||
|
||||
KPATCH ?= $(PATCH)
|
||||
define Build/DoPatch
|
||||
@if [ -d "$(2)" ]; then \
|
||||
if [ "$$$$(ls $(2) | grep -Ec $(3))" -gt 0 ]; then \
|
||||
$(KPATCH) "$(1)" "$(2)" "$(3)"; \
|
||||
fi; \
|
||||
fi
|
||||
endef
|
||||
|
||||
define Build/Patch
|
||||
$(call Build/DoPatch,"$(PKG_BUILD_DIR)","$(PATCH_DIR)","*batman*")
|
||||
$(BATCTL_EXTRACT)
|
||||
$(BATCTL_PATCH)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATMAN_ADV_ARGS)
|
||||
$(BATCTL_BUILD)
|
||||
endef
|
||||
|
||||
define Build/Clean
|
||||
rm -rf $(BUILD_DIR)/$(PKG_NAME)/
|
||||
endef
|
||||
|
||||
define KernelPackage/batman-adv/install
|
||||
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv $(1)/usr/sbin $(1)/lib/netifd/proto
|
||||
$(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
|
||||
$(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv
|
||||
$(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net
|
||||
$(INSTALL_BIN) ./files/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto
|
||||
$(BATCTL_INSTALL)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,batman-adv))
|
@ -1,19 +0,0 @@
|
||||
|
||||
config 'mesh' 'bat0'
|
||||
option 'aggregated_ogms'
|
||||
option 'ap_isolation'
|
||||
option 'bonding'
|
||||
option 'fragmentation'
|
||||
option 'gw_bandwidth'
|
||||
option 'gw_mode'
|
||||
option 'gw_sel_class'
|
||||
option 'log_level'
|
||||
option 'orig_interval'
|
||||
option 'vis_mode'
|
||||
option 'bridge_loop_avoidance'
|
||||
option 'distributed_arp_table'
|
||||
option 'hop_penalty'
|
||||
|
||||
# yet another batX instance
|
||||
# config 'mesh' 'bat5'
|
||||
# option 'interfaces' 'second_mesh'
|
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/batman-adv/config.sh
|
||||
|
||||
bat_load_module
|
||||
config_load batman-adv
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
[ -d /sys/class/net/$INTERFACE/mesh/ ] && bat_config "$INTERFACE"
|
||||
;;
|
||||
esac
|
@ -1,46 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
bat_load_module()
|
||||
{
|
||||
[ -d "/sys/module/batman_adv/" ] && return
|
||||
|
||||
. /lib/functions.sh
|
||||
load_modules /etc/modules.d/*-crc16 /etc/modules.d/*-batman-adv*
|
||||
}
|
||||
|
||||
bat_config()
|
||||
{
|
||||
local mesh="$1"
|
||||
local aggregated_ogms ap_isolation bonding bridge_loop_avoidance distributed_arp_table fragmentation
|
||||
local gw_bandwidth gw_mode gw_sel_class hop_penalty log_level orig_interval vis_mode
|
||||
|
||||
config_get aggregated_ogms "$mesh" aggregated_ogms
|
||||
config_get ap_isolation "$mesh" ap_isolation
|
||||
config_get bonding "$mesh" bonding
|
||||
config_get bridge_loop_avoidance "$mesh" bridge_loop_avoidance
|
||||
config_get distributed_arp_table "$mesh" distributed_arp_table
|
||||
config_get fragmentation "$mesh" fragmentation
|
||||
config_get gw_bandwidth "$mesh" gw_bandwidth
|
||||
config_get gw_mode "$mesh" gw_mode
|
||||
config_get gw_sel_class "$mesh" gw_sel_class
|
||||
config_get hop_penalty "$mesh" hop_penalty
|
||||
config_get log_level "$mesh" log_level
|
||||
config_get orig_interval "$mesh" orig_interval
|
||||
config_get vis_mode "$mesh" vis_mode
|
||||
|
||||
[ ! -f "/sys/class/net/$mesh/mesh/orig_interval" ] && echo "batman-adv mesh $mesh does not exist - check your interface configuration" && return 1
|
||||
|
||||
[ -n "$aggregate_ogms" ] && echo $aggregate_ogms > /sys/class/net/$mesh/mesh/aggregate_ogms
|
||||
[ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation
|
||||
[ -n "$bonding" ] && echo $bonding > /sys/class/net/$mesh/mesh/bonding
|
||||
[ -n "$bridge_loop_avoidance" ] && echo $bridge_loop_avoidance > /sys/class/net/$mesh/mesh/bridge_loop_avoidance
|
||||
[ -n "$distributed_arp_table" ] && echo $distributed_arp_table > /sys/class/net/$mesh/mesh/distributed_arp_table
|
||||
[ -n "$fragmentation" ] && echo $fragmentation > /sys/class/net/$mesh/mesh/fragmentation
|
||||
[ -n "$gw_bandwidth" ] && echo $gw_bandwidth > /sys/class/net/$mesh/mesh/gw_bandwidth
|
||||
[ -n "$gw_mode" ] && echo $gw_mode > /sys/class/net/$mesh/mesh/gw_mode
|
||||
[ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class
|
||||
[ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty
|
||||
[ -n "$log_level" ] && echo $log_level > /sys/class/net/$mesh/mesh/log_level 2>&-
|
||||
[ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval
|
||||
[ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$mesh/mesh/vis_mode
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
|
||||
proto_batadv_init_config() {
|
||||
proto_config_add_string "mesh"
|
||||
}
|
||||
|
||||
proto_batadv_setup() {
|
||||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
local mesh
|
||||
json_get_vars mesh
|
||||
|
||||
echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface"
|
||||
proto_init_update "$iface" 1
|
||||
proto_send_update "$config"
|
||||
}
|
||||
|
||||
proto_batadv_teardown() {
|
||||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
echo "none" > "/sys/class/net/$iface/batman_adv/mesh_iface" || true
|
||||
}
|
||||
|
||||
add_protocol batadv
|
@ -1,42 +0,0 @@
|
||||
From e56c79f4e863436d0fc6c48fed0db09b7a49e565 Mon Sep 17 00:00:00 2001
|
||||
From: Marek Lindner <lindner_marek@yahoo.de>
|
||||
Date: Mon, 4 Mar 2013 10:39:49 +0800
|
||||
Subject: [PATCH 1/3] batman-adv: verify tt len does not exceed packet len
|
||||
|
||||
batadv_iv_ogm_process() accesses the packet using the tt_num_changes
|
||||
attribute regardless of the real packet len (assuming the length check
|
||||
was done before). Therefore a length check is needed to avoid reading
|
||||
random memory.
|
||||
|
||||
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
|
||||
---
|
||||
bat_iv_ogm.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
|
||||
index 72fe1bb..d5be889 100644
|
||||
--- a/bat_iv_ogm.c
|
||||
+++ b/bat_iv_ogm.c
|
||||
@@ -1292,7 +1292,8 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,
|
||||
batadv_ogm_packet = (struct batadv_ogm_packet *)packet_buff;
|
||||
|
||||
/* unpack the aggregated packets and process them one by one */
|
||||
- do {
|
||||
+ while (batadv_iv_ogm_aggr_packet(buff_pos, packet_len,
|
||||
+ batadv_ogm_packet->tt_num_changes)) {
|
||||
tt_buff = packet_buff + buff_pos + BATADV_OGM_HLEN;
|
||||
|
||||
batadv_iv_ogm_process(ethhdr, batadv_ogm_packet, tt_buff,
|
||||
@@ -1303,8 +1304,7 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,
|
||||
|
||||
packet_pos = packet_buff + buff_pos;
|
||||
batadv_ogm_packet = (struct batadv_ogm_packet *)packet_pos;
|
||||
- } while (batadv_iv_ogm_aggr_packet(buff_pos, packet_len,
|
||||
- batadv_ogm_packet->tt_num_changes));
|
||||
+ }
|
||||
|
||||
kfree_skb(skb);
|
||||
return NET_RX_SUCCESS;
|
||||
--
|
||||
1.7.10.4
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,250 +0,0 @@
|
||||
From 647d23f3e358d9fa4b1a8f0bb67a3e6bff30d4a1 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Quartulli <ordex@autistici.org>
|
||||
Date: Wed, 3 Apr 2013 19:10:26 +0200
|
||||
Subject: [PATCH 3/3] batman-adv: make is_my_mac() check for the current mesh
|
||||
only
|
||||
|
||||
On a multi-mesh node (a node running more than one batman-adv
|
||||
virtual interface) batadv_is_my_mac() has to check MAC
|
||||
addresses of hard interfaces belonging to the current mesh
|
||||
only.
|
||||
|
||||
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
|
||||
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
|
||||
---
|
||||
main.c | 5 ++++-
|
||||
main.h | 2 +-
|
||||
routing.c | 38 ++++++++++++++++++++------------------
|
||||
translation-table.c | 2 +-
|
||||
vis.c | 4 ++--
|
||||
5 files changed, 28 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/main.c b/main.c
|
||||
index 0488d70..fa563e4 100644
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -169,7 +169,7 @@ void batadv_mesh_free(struct net_device *soft_iface)
|
||||
atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE);
|
||||
}
|
||||
|
||||
-int batadv_is_my_mac(const uint8_t *addr)
|
||||
+int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr)
|
||||
{
|
||||
const struct batadv_hard_iface *hard_iface;
|
||||
|
||||
@@ -178,6 +178,9 @@ int batadv_is_my_mac(const uint8_t *addr)
|
||||
if (hard_iface->if_status != BATADV_IF_ACTIVE)
|
||||
continue;
|
||||
|
||||
+ if (hard_iface->soft_iface != bat_priv->soft_iface)
|
||||
+ continue;
|
||||
+
|
||||
if (batadv_compare_eth(hard_iface->net_dev->dev_addr, addr)) {
|
||||
rcu_read_unlock();
|
||||
return 1;
|
||||
diff --git a/main.h b/main.h
|
||||
index 08c5dd1..fcb5d65 100644
|
||||
--- a/main.h
|
||||
+++ b/main.h
|
||||
@@ -164,7 +164,7 @@ extern struct workqueue_struct *batadv_event_workqueue;
|
||||
|
||||
int batadv_mesh_init(struct net_device *soft_iface);
|
||||
void batadv_mesh_free(struct net_device *soft_iface);
|
||||
-int batadv_is_my_mac(const uint8_t *addr);
|
||||
+int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr);
|
||||
struct batadv_hard_iface *
|
||||
batadv_seq_print_text_primary_if_get(struct seq_file *seq);
|
||||
int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
|
||||
diff --git a/routing.c b/routing.c
|
||||
index 5ee21ce..319f290 100644
|
||||
--- a/routing.c
|
||||
+++ b/routing.c
|
||||
@@ -402,7 +402,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
|
||||
goto out;
|
||||
|
||||
/* not for me */
|
||||
- if (!batadv_is_my_mac(ethhdr->h_dest))
|
||||
+ if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest))
|
||||
goto out;
|
||||
|
||||
icmp_packet = (struct batadv_icmp_packet_rr *)skb->data;
|
||||
@@ -416,7 +416,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
|
||||
}
|
||||
|
||||
/* packet for me */
|
||||
- if (batadv_is_my_mac(icmp_packet->dst))
|
||||
+ if (batadv_is_my_mac(bat_priv, icmp_packet->dst))
|
||||
return batadv_recv_my_icmp_packet(bat_priv, skb, hdr_size);
|
||||
|
||||
/* TTL exceeded */
|
||||
@@ -548,7 +548,8 @@ batadv_find_ifalter_router(struct batadv_orig_node *primary_orig,
|
||||
return router;
|
||||
}
|
||||
|
||||
-static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size)
|
||||
+static int batadv_check_unicast_packet(struct batadv_priv *bat_priv,
|
||||
+ struct sk_buff *skb, int hdr_size)
|
||||
{
|
||||
struct ethhdr *ethhdr;
|
||||
|
||||
@@ -567,7 +568,7 @@ static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size)
|
||||
return -1;
|
||||
|
||||
/* not for me */
|
||||
- if (!batadv_is_my_mac(ethhdr->h_dest))
|
||||
+ if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@@ -582,7 +583,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if)
|
||||
char tt_flag;
|
||||
size_t packet_size;
|
||||
|
||||
- if (batadv_check_unicast_packet(skb, hdr_size) < 0)
|
||||
+ if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0)
|
||||
return NET_RX_DROP;
|
||||
|
||||
/* I could need to modify it */
|
||||
@@ -614,7 +615,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if)
|
||||
case BATADV_TT_RESPONSE:
|
||||
batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX);
|
||||
|
||||
- if (batadv_is_my_mac(tt_query->dst)) {
|
||||
+ if (batadv_is_my_mac(bat_priv, tt_query->dst)) {
|
||||
/* packet needs to be linearized to access the TT
|
||||
* changes
|
||||
*/
|
||||
@@ -657,14 +658,15 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct batadv_hard_iface *recv_if)
|
||||
struct batadv_roam_adv_packet *roam_adv_packet;
|
||||
struct batadv_orig_node *orig_node;
|
||||
|
||||
- if (batadv_check_unicast_packet(skb, sizeof(*roam_adv_packet)) < 0)
|
||||
+ if (batadv_check_unicast_packet(bat_priv, skb,
|
||||
+ sizeof(*roam_adv_packet)) < 0)
|
||||
goto out;
|
||||
|
||||
batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX);
|
||||
|
||||
roam_adv_packet = (struct batadv_roam_adv_packet *)skb->data;
|
||||
|
||||
- if (!batadv_is_my_mac(roam_adv_packet->dst))
|
||||
+ if (!batadv_is_my_mac(bat_priv, roam_adv_packet->dst))
|
||||
return batadv_route_unicast_packet(skb, recv_if);
|
||||
|
||||
/* check if it is a backbone gateway. we don't accept
|
||||
@@ -967,7 +969,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
|
||||
* last time) the packet had an updated information or not
|
||||
*/
|
||||
curr_ttvn = (uint8_t)atomic_read(&bat_priv->tt.vn);
|
||||
- if (!batadv_is_my_mac(unicast_packet->dest)) {
|
||||
+ if (!batadv_is_my_mac(bat_priv, unicast_packet->dest)) {
|
||||
orig_node = batadv_orig_hash_find(bat_priv,
|
||||
unicast_packet->dest);
|
||||
/* if it is not possible to find the orig_node representing the
|
||||
@@ -1044,14 +1046,14 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
|
||||
if (is4addr)
|
||||
hdr_size = sizeof(*unicast_4addr_packet);
|
||||
|
||||
- if (batadv_check_unicast_packet(skb, hdr_size) < 0)
|
||||
+ if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0)
|
||||
return NET_RX_DROP;
|
||||
|
||||
if (!batadv_check_unicast_ttvn(bat_priv, skb))
|
||||
return NET_RX_DROP;
|
||||
|
||||
/* packet for me */
|
||||
- if (batadv_is_my_mac(unicast_packet->dest)) {
|
||||
+ if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) {
|
||||
if (is4addr) {
|
||||
batadv_dat_inc_counter(bat_priv,
|
||||
unicast_4addr_packet->subtype);
|
||||
@@ -1088,7 +1090,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
|
||||
struct sk_buff *new_skb = NULL;
|
||||
int ret;
|
||||
|
||||
- if (batadv_check_unicast_packet(skb, hdr_size) < 0)
|
||||
+ if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0)
|
||||
return NET_RX_DROP;
|
||||
|
||||
if (!batadv_check_unicast_ttvn(bat_priv, skb))
|
||||
@@ -1097,7 +1099,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
|
||||
unicast_packet = (struct batadv_unicast_frag_packet *)skb->data;
|
||||
|
||||
/* packet for me */
|
||||
- if (batadv_is_my_mac(unicast_packet->dest)) {
|
||||
+ if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) {
|
||||
ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb);
|
||||
|
||||
if (ret == NET_RX_DROP)
|
||||
@@ -1151,13 +1153,13 @@ int batadv_recv_bcast_packet(struct sk_buff *skb,
|
||||
goto out;
|
||||
|
||||
/* ignore broadcasts sent by myself */
|
||||
- if (batadv_is_my_mac(ethhdr->h_source))
|
||||
+ if (batadv_is_my_mac(bat_priv, ethhdr->h_source))
|
||||
goto out;
|
||||
|
||||
bcast_packet = (struct batadv_bcast_packet *)skb->data;
|
||||
|
||||
/* ignore broadcasts originated by myself */
|
||||
- if (batadv_is_my_mac(bcast_packet->orig))
|
||||
+ if (batadv_is_my_mac(bat_priv, bcast_packet->orig))
|
||||
goto out;
|
||||
|
||||
if (bcast_packet->header.ttl < 2)
|
||||
@@ -1243,14 +1245,14 @@ int batadv_recv_vis_packet(struct sk_buff *skb,
|
||||
ethhdr = (struct ethhdr *)skb_mac_header(skb);
|
||||
|
||||
/* not for me */
|
||||
- if (!batadv_is_my_mac(ethhdr->h_dest))
|
||||
+ if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest))
|
||||
return NET_RX_DROP;
|
||||
|
||||
/* ignore own packets */
|
||||
- if (batadv_is_my_mac(vis_packet->vis_orig))
|
||||
+ if (batadv_is_my_mac(bat_priv, vis_packet->vis_orig))
|
||||
return NET_RX_DROP;
|
||||
|
||||
- if (batadv_is_my_mac(vis_packet->sender_orig))
|
||||
+ if (batadv_is_my_mac(bat_priv, vis_packet->sender_orig))
|
||||
return NET_RX_DROP;
|
||||
|
||||
switch (vis_packet->vis_type) {
|
||||
diff --git a/translation-table.c b/translation-table.c
|
||||
index 98a66a0..7abee19 100644
|
||||
--- a/translation-table.c
|
||||
+++ b/translation-table.c
|
||||
@@ -1953,7 +1953,7 @@ out:
|
||||
bool batadv_send_tt_response(struct batadv_priv *bat_priv,
|
||||
struct batadv_tt_query_packet *tt_request)
|
||||
{
|
||||
- if (batadv_is_my_mac(tt_request->dst)) {
|
||||
+ if (batadv_is_my_mac(bat_priv, tt_request->dst)) {
|
||||
/* don't answer backbone gws! */
|
||||
if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_request->src))
|
||||
return true;
|
||||
diff --git a/vis.c b/vis.c
|
||||
index c053244..6a1e646 100644
|
||||
--- a/vis.c
|
||||
+++ b/vis.c
|
||||
@@ -477,7 +477,7 @@ void batadv_receive_client_update_packet(struct batadv_priv *bat_priv,
|
||||
|
||||
/* Are we the target for this VIS packet? */
|
||||
if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC &&
|
||||
- batadv_is_my_mac(vis_packet->target_orig))
|
||||
+ batadv_is_my_mac(bat_priv, vis_packet->target_orig))
|
||||
are_target = 1;
|
||||
|
||||
spin_lock_bh(&bat_priv->vis.hash_lock);
|
||||
@@ -496,7 +496,7 @@ void batadv_receive_client_update_packet(struct batadv_priv *bat_priv,
|
||||
batadv_send_list_add(bat_priv, info);
|
||||
|
||||
/* ... we're not the recipient (and thus need to forward). */
|
||||
- } else if (!batadv_is_my_mac(packet->target_orig)) {
|
||||
+ } else if (!batadv_is_my_mac(bat_priv, packet->target_orig)) {
|
||||
batadv_send_list_add(bat_priv, info);
|
||||
}
|
||||
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,152 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2008-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=batmand
|
||||
PKG_REV:=1439
|
||||
PKG_VERSION:=r$(PKG_REV)
|
||||
PKG_RELEASE:=2
|
||||
PKG_EXTRA_CFLAGS=-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_REV)\"
|
||||
|
||||
PKG_SOURCE_PROTO:=svn
|
||||
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||
PKG_SOURCE_SUBDIR:=$(if $(PKG_BRANCH),$(PKG_BRANCH),$(PKG_NAME))-$(PKG_VERSION)
|
||||
PKG_SOURCE_URL:=http://downloads.open-mesh.org/svn/batman/trunk/
|
||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||
|
||||
PKG_KMOD_BUILD_DIR:=$(PKG_BUILD_DIR)/batman/linux/modules
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/batmand/Default
|
||||
URL:=http://www.open-mesh.org/
|
||||
MAINTAINER:=Marek Lindner <lindner_marek@yahoo.de>
|
||||
endef
|
||||
|
||||
define Package/batmand
|
||||
$(call Package/batmand/Default)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
DEPENDS:=+libpthread +kmod-tun
|
||||
TITLE:=B.A.T.M.A.N. layer 3 routing daemon
|
||||
endef
|
||||
|
||||
define Package/batmand/description
|
||||
B.A.T.M.A.N. layer 3 routing daemon
|
||||
endef
|
||||
|
||||
define Package/vis
|
||||
$(call Package/batmand/Default)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
DEPENDS:=+libpthread
|
||||
TITLE:=visualization server for B.A.T.M.A.N. layer 3
|
||||
endef
|
||||
|
||||
define Package/vis/description
|
||||
visualization server for B.A.T.M.A.N. layer 3
|
||||
endef
|
||||
|
||||
define KernelPackage/batgat
|
||||
$(call Package/batmand/Default)
|
||||
SUBMENU:=Network Support
|
||||
DEPENDS:=+batmand @BROKEN
|
||||
TITLE:=B.A.T.M.A.N. gateway module
|
||||
FILES:=$(PKG_KMOD_BUILD_DIR)/batgat.$(LINUX_KMOD_SUFFIX)
|
||||
AUTOLOAD:=$(call AutoLoad,50,batgat)
|
||||
endef
|
||||
|
||||
|
||||
define KernelPackage/batgat/description
|
||||
Kernel gateway module for B.A.T.M.A.N. for better tunnel performance
|
||||
endef
|
||||
|
||||
MAKE_BATMAND_ARGS += \
|
||||
EXTRA_CFLAGS='$(TARGET_CFLAGS) $(PKG_EXTRA_CFLAGS)' \
|
||||
CCFLAGS="$(TARGET_CFLAGS)" \
|
||||
OFLAGS="$(TARGET_CFLAGS)" \
|
||||
REVISION="$(PKG_REV)" \
|
||||
CC="$(TARGET_CC)" \
|
||||
NODEBUG=1 \
|
||||
UNAME="Linux" \
|
||||
INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
|
||||
STRIP="/bin/true" \
|
||||
batmand install
|
||||
|
||||
MAKE_VIS_ARGS += \
|
||||
EXTRA_CFLAGS='$(TARGET_CFLAGS) $(PKG_EXTRA_CFLAGS)' \
|
||||
CCFLAGS="$(TARGET_CFLAGS)" \
|
||||
OFLAGS="$(TARGET_CFLAGS)" \
|
||||
REVISION="$(PKG_REV)" \
|
||||
CC="$(TARGET_CC)" \
|
||||
NODEBUG=1 \
|
||||
UNAME="Linux" \
|
||||
INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
|
||||
STRIP="/bin/true" \
|
||||
vis install
|
||||
|
||||
MAKE_BATGAT_ARGS += \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
PATH="$(TARGET_PATH)" \
|
||||
SUBDIRS="$(PKG_KMOD_BUILD_DIR)" \
|
||||
LINUX_VERSION="$(LINUX_VERSION)" \
|
||||
REVISION="$(PKG_REV)" modules
|
||||
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
ifneq ($(DEVELOPER)$(CONFIG_PACKAGE_batmand),)
|
||||
BUILD_BATMAND := $(MAKE) -C $(PKG_BUILD_DIR)/batman $(MAKE_BATMAND_ARGS)
|
||||
endif
|
||||
|
||||
ifneq ($(DEVELOPER)$(CONFIG_PACKAGE_vis),)
|
||||
BUILD_VIS := $(MAKE) -C $(PKG_BUILD_DIR)/vis $(MAKE_VIS_ARGS)
|
||||
endif
|
||||
|
||||
ifneq ($(DEVELOPER)$(CONFIG_PACKAGE_kmod-batgat),)
|
||||
BUILD_BATGAT := $(MAKE) -C "$(LINUX_DIR)" $(MAKE_BATGAT_ARGS)
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
$(BUILD_BATMAND)
|
||||
$(BUILD_VIS)
|
||||
cp $(PKG_KMOD_BUILD_DIR)/Makefile.kbuild $(PKG_KMOD_BUILD_DIR)/Makefile
|
||||
$(BUILD_BATGAT)
|
||||
endef
|
||||
|
||||
define Package/batmand/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/batmand $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/batmand $(1)/etc/init.d
|
||||
$(INSTALL_DATA) ./files/etc/config/batmand $(1)/etc/config
|
||||
endef
|
||||
|
||||
define Package/batmand/conffiles
|
||||
/etc/config/batmand
|
||||
endef
|
||||
|
||||
define Package/vis/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/vis $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/vis $(1)/etc/init.d
|
||||
$(INSTALL_DATA) ./files/etc/config/vis $(1)/etc/config
|
||||
endef
|
||||
|
||||
define Package/vis/conffiles
|
||||
/etc/config/vis
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,batmand))
|
||||
$(eval $(call BuildPackage,vis))
|
||||
$(eval $(call KernelPackage,batgat))
|
@ -1,12 +0,0 @@
|
||||
config batmand general
|
||||
option interface ath0
|
||||
option hna
|
||||
option gateway_class
|
||||
option originator_interval
|
||||
option preferred_gateway
|
||||
option routing_class
|
||||
option visualisation_srv
|
||||
option policy_routing_script
|
||||
option disable_client_nat
|
||||
option disable_aggregation
|
||||
|
@ -1,3 +0,0 @@
|
||||
config vis general
|
||||
option interface ath0
|
||||
|
@ -1,66 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=90
|
||||
|
||||
start () {
|
||||
interface=$(uci get batmand.general.interface)
|
||||
if [ "$interface" = "" ]; then
|
||||
echo $1 Error, you must specify at least a network interface
|
||||
exit
|
||||
fi
|
||||
hnas=$(uci get batmand.general.hna)
|
||||
gateway_class=$(uci get batmand.general.gateway_class)
|
||||
originator_interval=$(uci get batmand.general.originator_interval)
|
||||
preferred_gateway=$(uci get batmand.general.preferred_gateway)
|
||||
routing_class=$(uci get batmand.general.routing_class)
|
||||
visualisation_srv=$(uci get batmand.general.visualisation_srv)
|
||||
policy_routing_script=$(uci get batmand.general.policy_routing_script)
|
||||
disable_client_nat=$(uci get batmand.general.disable_client_nat)
|
||||
disable_aggregation=$(uci get batmand.general.disable_aggregation)
|
||||
batman_args=""
|
||||
|
||||
for hna in $hnas
|
||||
do
|
||||
batman_args=${batman_args}'-a '$hna' '
|
||||
done
|
||||
|
||||
if [ $gateway_class ]; then
|
||||
batman_args=${batman_args}'-g '$gateway_class' '
|
||||
fi
|
||||
|
||||
if [ $originator_interval ]; then
|
||||
batman_args=${batman_args}'-o '$originator_interval' '
|
||||
fi
|
||||
|
||||
if [ $preferred_gateway ]; then
|
||||
batman_args=${batman_args}'-p '$preferred_gateway' '
|
||||
fi
|
||||
|
||||
if [ $routing_class ]; then
|
||||
batman_args=${batman_args}'-r '$routing_class' '
|
||||
fi
|
||||
|
||||
if [ $visualisation_srv ]; then
|
||||
batman_args=${batman_args}'-s '$visualisation_srv' '
|
||||
fi
|
||||
|
||||
if [ $policy_routing_script ]; then
|
||||
batman_args=${batman_args}'--policy-routing-script '$policy_routing_script' '
|
||||
fi
|
||||
|
||||
if [ $disable_client_nat ]; then
|
||||
batman_args=${batman_args}'--disable-client-nat '
|
||||
fi
|
||||
|
||||
if [ $disable_aggregation ]; then
|
||||
batman_args=${batman_args}'--disable-aggregation '
|
||||
fi
|
||||
|
||||
batman_args=${batman_args}$interface
|
||||
batmand $batman_args >/dev/null 2>&1
|
||||
}
|
||||
|
||||
stop () {
|
||||
killall batmand
|
||||
}
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=90
|
||||
|
||||
start () {
|
||||
interface=$(uci get vis.general.interface)
|
||||
if [ "$interface" = "" ]; then
|
||||
echo $1 Error, you must specify at least a network interface
|
||||
exit
|
||||
fi
|
||||
vis_args=$interface
|
||||
|
||||
vis $vis_args >/dev/null 2>&1
|
||||
}
|
||||
|
||||
stop () {
|
||||
killall vis
|
||||
}
|
||||
|
||||
|
@ -1,47 +0,0 @@
|
||||
---
|
||||
batman/linux/modules/gateway.c | 19 +++++++++++++++++++
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
--- batmand-r1439.orig/batman/linux/modules/gateway.c
|
||||
+++ batmand-r1439/batman/linux/modules/gateway.c
|
||||
@@ -29,6 +29,7 @@ static struct class *batman_class;
|
||||
static int batgat_open(struct inode *inode, struct file *filp);
|
||||
static int batgat_release(struct inode *inode, struct file *file);
|
||||
static int batgat_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg );
|
||||
+static long batgat_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg );
|
||||
|
||||
|
||||
static void udp_data_ready(struct sock *sk, int len);
|
||||
@@ -53,7 +54,11 @@ static int proc_clients_read(char *buf,
|
||||
static struct file_operations fops = {
|
||||
.open = batgat_open,
|
||||
.release = batgat_release,
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
|
||||
+ .unlocked_ioctl = batgat_ioctl_unlocked,
|
||||
+#else
|
||||
.ioctl = batgat_ioctl,
|
||||
+#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -166,6 +171,20 @@ static int batgat_release(struct inode *
|
||||
}
|
||||
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
|
||||
+#include <linux/smp_lock.h>
|
||||
+static long batgat_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg )
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ lock_kernel();
|
||||
+ ret = batgat_ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
|
||||
+ unlock_kernel();
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static int batgat_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg )
|
||||
{
|
||||
uint8_t tmp_ip[4];
|
@ -1,75 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2008 Freifunk Leipzig
|
||||
# Copyright (C) 2008-2010 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:=bmxd
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=git://github.com/axn/bmxd.git
|
||||
PKG_REV:=9c1d12b554dccd2efde249f5e44a7d4de59ce1a8
|
||||
PKG_VERSION:=r2012011001
|
||||
#PKG_RELEASE:=1
|
||||
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||
|
||||
PKG_EXTRA_CFLAGS:=-DNODEBUGALL
|
||||
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bmxd/Default
|
||||
URL:=http://www.bmx6.net/
|
||||
MAINTAINER:=Axel Neumann <neumann@cgws.de>
|
||||
endef
|
||||
|
||||
define Package/bmxd
|
||||
$(call Package/bmxd/Default)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
DEPENDS:=+kmod-tun
|
||||
TITLE:=B.a.t.M.a.n. eXperimental (BMX) layer 3 routing daemon
|
||||
endef
|
||||
|
||||
define Package/bmxd/conffiles
|
||||
/etc/config/bmxd
|
||||
endef
|
||||
|
||||
|
||||
define Package/bmxd/description
|
||||
B.a.t.M.a.n. eXperimental (BMX) layer 3 routing daemon
|
||||
endef
|
||||
|
||||
MAKE_ARGS += \
|
||||
EXTRA_CFLAGS="$(TARGET_CFLAGS) $(PKG_EXTRA_CFLAGS)" \
|
||||
CCFLAGS="$(TARGET_CFLAGS)" \
|
||||
OFLAGS="$(TARGET_CFLAGS)" \
|
||||
REVISION="$(PKG_REV)" \
|
||||
CC="$(TARGET_CC)" \
|
||||
NODEBUG=1 \
|
||||
UNAME="Linux" \
|
||||
INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
|
||||
STRIP="/bin/true" \
|
||||
bmxd install
|
||||
|
||||
define Build/Compile
|
||||
mkdir -p $(PKG_INSTALL_DIR)/usr/sbin
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS)
|
||||
endef
|
||||
|
||||
define Package/bmxd/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bmxd $(1)/usr/sbin/bmxd
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bmxd $(1)/etc/init.d
|
||||
$(INSTALL_DATA) ./files/etc/config/bmxd $(1)/etc/config
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bmxd))
|
@ -1,9 +0,0 @@
|
||||
config bmxd general
|
||||
option interface 'ath0'
|
||||
# option announce
|
||||
# option gateway_class
|
||||
# option originator_interval
|
||||
# option preferred_gateway
|
||||
# option routing_class
|
||||
# option visualisation_srv
|
||||
# option misc 'base-port=14305'
|
@ -1,51 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=91
|
||||
. /lib/config/uci.sh
|
||||
uci_load bmxd
|
||||
start () {
|
||||
interface="$(uci get bmxd.general.interface)"
|
||||
if [ "$interface" = "" ]; then
|
||||
echo $1 Error, you must specify at least a network interface
|
||||
exit
|
||||
fi
|
||||
announce=$(uci get bmxd.general.announce)
|
||||
gateway_class=$(uci get bmxd.general.gateway_class)
|
||||
originator_interval=$(uci get bmxd.general.originator_interval)
|
||||
preferred_gateway=$(uci get bmxd.general.preferred_gateway)
|
||||
routing_class=$(uci get bmxd.general.routing_class)
|
||||
visualisation_srv=$(uci get bmxd.general.visualisation_srv)
|
||||
misc="$(uci get bmxd.general.misc)"
|
||||
bmx_args=""
|
||||
|
||||
if [ $announce ]; then
|
||||
bmx_args=${bmx_args}'-a '$announce' '
|
||||
fi
|
||||
|
||||
if [ $gateway_class ]; then
|
||||
bmx_args=${bmx_args}'-g '$gateway_class' '
|
||||
fi
|
||||
|
||||
if [ $originator_interval ]; then
|
||||
bmx_args=${bmx_args}'-o '$originator_interval' '
|
||||
fi
|
||||
|
||||
if [ $preferred_gateway ]; then
|
||||
bmx_args=${bmx_args}'-p '$preferred_gateway' '
|
||||
fi
|
||||
|
||||
if [ $routing_class ]; then
|
||||
bmx_args=${bmx_args}'-r '$routing_class' '
|
||||
fi
|
||||
|
||||
if [ $visualisation_srv ]; then
|
||||
bmx_args=${bmx_args}'-s '$visualisation_srv' '
|
||||
fi
|
||||
|
||||
|
||||
bmx_args="$misc ${bmx_args} $interface"
|
||||
bmxd $bmx_args >/dev/null 2>&1
|
||||
}
|
||||
|
||||
stop () {
|
||||
killall bmxd
|
||||
}
|
@ -1,290 +0,0 @@
|
||||
#
|
||||
# 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:=olsrd
|
||||
PKG_VERSION:=0.6.5.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=http://www.olsr.org/releases/0.6
|
||||
|
||||
PKG_MD5SUM:=190e3c763656f71d3ca6868db7658f43
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS += $(FPIC)
|
||||
|
||||
define Package/olsrd/template
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
MAINTAINER:=Saverio Proto <zioproto@gmail.com>
|
||||
TITLE:=OLSR (Optimized Link State Routing) daemon
|
||||
URL:=http://www.olsr.org/
|
||||
endef
|
||||
|
||||
define Package/olsrd
|
||||
$(call Package/olsrd/template)
|
||||
MENU:=1
|
||||
DEPENDS:=+libpthread
|
||||
endef
|
||||
|
||||
define Package/olsrd/conffiles
|
||||
/etc/config/olsrd
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-arprefresh
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Kernel ARP cache refresh plugin
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-dot-draw
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Dot topology information plugin
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-bmf
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd +kmod-tun
|
||||
TITLE:=Basic multicast forwarding plugin
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-dyn-gw
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Dynamic internet gateway plugin
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-dyn-gw-plain
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Dynamic internet gateway plain plugin
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-httpinfo
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Small informative web server plugin
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-jsoninfo
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Small informative plugin with JSON output
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-mdns
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=MDNS/Zeroconf/Bonjour packet distribution
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-nameservice
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Lightweight hostname resolver plugin
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-p2pd
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Peer to Peer Discovery plugin
|
||||
endef
|
||||
|
||||
|
||||
define Package/olsrd-mod-pgraph
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=output network topology for pgraph
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-pud
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Position Update Distribution plugin
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-quagga
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Quagga plugin
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-secure
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Message signing plugin to secure routing domain
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-sgwdynspeed
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Smart Gateway dynamic speed plugin
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-txtinfo
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Small informative web server plugin
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-watchdog
|
||||
$(call Package/olsrd/template)
|
||||
DEPENDS:=olsrd
|
||||
TITLE:=Watchdog plugin
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-pud/conffiles
|
||||
/etc/olsrd.d/olsrd.pud.position.conf
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-secure/conffiles
|
||||
/etc/olsrd.d/olsrd_secure_key
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-sgwdynspeed/conffiles
|
||||
/etc/olsrd.d/olsrd.sgw.speed.conf
|
||||
endef
|
||||
|
||||
MAKE_FLAGS+= \
|
||||
NO_DEBUG_MESSAGES=1 \
|
||||
OS="linux" \
|
||||
DESTDIR="$(PKG_INSTALL_DIR)" \
|
||||
STRIP="true" \
|
||||
INSTALL_LIB="true" \
|
||||
SUBDIRS="arprefresh bmf dot_draw dyn_gw dyn_gw_plain httpinfo jsoninfo mdns nameservice p2pd pgraph pud quagga secure sgwdynspeed txtinfo watchdog"
|
||||
|
||||
define Build/Compile
|
||||
$(call Build/Compile/Default,all)
|
||||
$(call Build/Compile/Default,libs)
|
||||
endef
|
||||
|
||||
define Package/olsrd/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DATA) ./files/olsrd.config $(1)/etc/config/olsrd
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(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
|
||||
endef
|
||||
|
||||
define Package/olsrd-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-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-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-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-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-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-mod-jsoninfo/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/jsoninfo/olsrd_jsoninfo.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-mdns/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/mdns/olsrd_mdns.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/olsrd-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-mod-p2pd/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/p2pd/olsrd_p2pd.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-pgraph/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/pgraph/olsrd_pgraph.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-pud/install
|
||||
$(INSTALL_DIR) $(1)/etc/olsrd.d
|
||||
$(CP) ./files/olsrd.pud.position.conf $(1)/etc/olsrd.d/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/pud/nmealib/lib/libnmea.so $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/pud/wireformat/lib/libOlsrdPudWireFormat.so $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/pud/olsrd_pud.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/olsrd-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-mod-secure/install
|
||||
$(INSTALL_DIR) $(1)/etc/olsrd.d
|
||||
$(CP) ./files/olsrd_secure_key $(1)/etc/olsrd.d/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/secure/olsrd_secure.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-sgwdynspeed/install
|
||||
$(INSTALL_DIR) $(1)/etc/olsrd.d
|
||||
$(CP) ./files/olsrd.sgw.speed.conf $(1)/etc/olsrd.d/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/sgwdynspeed/olsrd_sgwdynspeed.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/olsrd-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-mod-watchdog/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/watchdog/olsrd_watchdog.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,olsrd))
|
||||
$(eval $(call BuildPackage,olsrd-mod-arprefresh))
|
||||
$(eval $(call BuildPackage,olsrd-mod-dot-draw))
|
||||
$(eval $(call BuildPackage,olsrd-mod-bmf))
|
||||
$(eval $(call BuildPackage,olsrd-mod-dyn-gw))
|
||||
$(eval $(call BuildPackage,olsrd-mod-dyn-gw-plain))
|
||||
$(eval $(call BuildPackage,olsrd-mod-httpinfo))
|
||||
$(eval $(call BuildPackage,olsrd-mod-jsoninfo))
|
||||
$(eval $(call BuildPackage,olsrd-mod-mdns))
|
||||
$(eval $(call BuildPackage,olsrd-mod-nameservice))
|
||||
$(eval $(call BuildPackage,olsrd-mod-p2pd))
|
||||
$(eval $(call BuildPackage,olsrd-mod-pgraph))
|
||||
$(eval $(call BuildPackage,olsrd-mod-pud))
|
||||
$(eval $(call BuildPackage,olsrd-mod-quagga))
|
||||
$(eval $(call BuildPackage,olsrd-mod-secure))
|
||||
$(eval $(call BuildPackage,olsrd-mod-sgwdynspeed))
|
||||
$(eval $(call BuildPackage,olsrd-mod-txtinfo))
|
||||
$(eval $(call BuildPackage,olsrd-mod-watchdog))
|
@ -1,26 +0,0 @@
|
||||
config olsrd
|
||||
# uncomment the following line to use a custom config file instead:
|
||||
#option config_file '/etc/olsrd.conf'
|
||||
|
||||
option IpVersion '4'
|
||||
|
||||
config LoadPlugin
|
||||
option library 'olsrd_arprefresh.so.0.1'
|
||||
|
||||
config LoadPlugin
|
||||
option library 'olsrd_dyn_gw.so.0.5'
|
||||
|
||||
config LoadPlugin
|
||||
option library 'olsrd_httpinfo.so.0.1'
|
||||
option port '1978'
|
||||
list Net '0.0.0.0 0.0.0.0'
|
||||
|
||||
config LoadPlugin
|
||||
option library 'olsrd_nameservice.so.0.3'
|
||||
|
||||
config LoadPlugin
|
||||
option library 'olsrd_txtinfo.so.0.1'
|
||||
option accept '0.0.0.0'
|
||||
|
||||
config Interface
|
||||
list interface 'wlan'
|
@ -1,850 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2008-2012 OpenWrt.org
|
||||
|
||||
START=65
|
||||
|
||||
SERVICE_DAEMONIZE=1
|
||||
SERVICE_WRITE_PID=1
|
||||
|
||||
CONF=/var/etc/olsrd.conf
|
||||
PID=/var/run/olsrd.pid
|
||||
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_DEFAULTS_SCHEMA='AutoDetectChanges:bool'
|
||||
|
||||
T=' '
|
||||
N='
|
||||
'
|
||||
|
||||
log()
|
||||
{
|
||||
logger -t olsrd -p daemon.info -s "$1"
|
||||
}
|
||||
|
||||
validate_varname() {
|
||||
local varname="$1"
|
||||
[ -z "$varname" -o "$varname" != "${varname%%[!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
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
if [ -z "$SYSTEM_LAT" -o -z "$SYSTEM_LON" ]; then
|
||||
config_get latlon "$cfg" latitude
|
||||
SYSTEM_LAT="$latlon"
|
||||
config_get latlon "$cfg" longitude
|
||||
SYSTEM_LON="$latlon"
|
||||
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 funcname="warning_invalid_value"
|
||||
local package="$1"
|
||||
validate_varname "$package" || package=
|
||||
local config="$2"
|
||||
validate_varname "$config" || config=
|
||||
local option="$3"
|
||||
validate_varname "$option" || option=
|
||||
|
||||
if [ -n "$package" -a -n "$config" ]; then
|
||||
log "$funcname() in option '$package.$config${option:+.}$option', skipped"
|
||||
else
|
||||
log "$funcname() skipped"
|
||||
fi
|
||||
|
||||
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 "$option" != "LinkQualityMult" -a "$value" != "yes" -a "$value" != "no" ]; then
|
||||
value="\"$value\""
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -n "${N}$param$option $value"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
olsrd_write_plparam() {
|
||||
local funcname="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
|
||||
if [ "$option" = 'NonOlsrIf' ]; then
|
||||
if validate_varname "$value"; then
|
||||
if network_get_device ifname "$value"; then
|
||||
log "$funcname() Info: mdns Interface '$value' ifname '$ifname' found"
|
||||
else
|
||||
log "$funcname() Warning: mdns Interface '$value' not found, skipped"
|
||||
fi
|
||||
else
|
||||
warning_invalid_value olsrd "$cfg" "NonOlsrIf"
|
||||
fi
|
||||
[ -z "$ifname" ] || value=$ifname
|
||||
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() {
|
||||
local funcname="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
|
||||
local speed
|
||||
local list_speed_vars="HelloInterval HelloValidityTime TcInterval TcValidityTime MidInterval MidValidityTime HnaInterval HnaValidityTime"
|
||||
|
||||
get_value_for_entry()
|
||||
{
|
||||
local schema_entry="$1"
|
||||
|
||||
default="${schema_entry#*[=]}"
|
||||
[ "$default" = "$schema_entry" ] && default=
|
||||
option="${schema_entry%%[=]*}"
|
||||
|
||||
IFS=':'; set -- $option; unset IFS
|
||||
option="$1"
|
||||
option_type="$2"
|
||||
|
||||
validate_varname "$option" || return 1
|
||||
[ -z "$option_type" ] || validate_varname "$option_type" || return 1
|
||||
[ "$option_type" = internal ] && return 1
|
||||
|
||||
config_get value "$cfg" "$option"
|
||||
[ "$option" = "speed" ] && return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
already_in_schema()
|
||||
{
|
||||
case " $schema " in
|
||||
*" $1 "*)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
already_in_schema "speed" && {
|
||||
get_value_for_entry "speed"
|
||||
|
||||
if [ 2>/dev/null $value -gt 0 -a $value -le 20 ]; then
|
||||
speed="$value"
|
||||
else
|
||||
log "$funcname() Warning: invalid speed-value: '$value' - allowed integers: 1...20, fallback to 6"
|
||||
speed=6
|
||||
fi
|
||||
|
||||
for schema_entry in $list_speed_vars; do {
|
||||
already_in_schema "$schema_entry" || schema="$schema $schema_entry"
|
||||
} done
|
||||
}
|
||||
|
||||
for schema_entry in $schema; do
|
||||
if [ -n "$speed" ]; then # like sven-ola freifunk firmware fff-1.7.4
|
||||
case "$schema_entry" in
|
||||
HelloInterval)
|
||||
value="$(( $speed / 2 + 1 )).0"
|
||||
;;
|
||||
HelloValidityTime)
|
||||
value="$(( $speed * 25 )).0"
|
||||
;;
|
||||
TcInterval) # todo: not fisheye? -> $(( $speed * 2 ))
|
||||
value=$(( $speed / 2 ))
|
||||
[ $value -eq 0 ] && value=1
|
||||
value="$value.0"
|
||||
;;
|
||||
TcValidityTime)
|
||||
value="$(( $speed * 100 )).0"
|
||||
;;
|
||||
MidInterval)
|
||||
value="$(( $speed * 5 )).0"
|
||||
;;
|
||||
MidValidityTime)
|
||||
value="$(( $speed * 100 )).0"
|
||||
;;
|
||||
HnaInterval)
|
||||
value="$(( $speed * 2 )).0"
|
||||
;;
|
||||
HnaValidityTime)
|
||||
value="$(( $speed * 25 )).0"
|
||||
;;
|
||||
*)
|
||||
get_value_for_entry "$schema_entry" || continue
|
||||
;;
|
||||
esac
|
||||
|
||||
is_speed_var()
|
||||
{
|
||||
case " $list_speed_vars " in
|
||||
*" $1 "*)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
is_speed_var "$schema_entry" && option="$schema_entry"
|
||||
else
|
||||
get_value_for_entry "$schema_entry" || continue
|
||||
fi
|
||||
|
||||
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_get ipversion "$cfg" IpVersion
|
||||
if [ "$ipversion" = "6and4" ]; then
|
||||
OLSRD_IPVERSION_6AND4=1
|
||||
config_set "$cfg" IpVersion '6'
|
||||
fi
|
||||
config_get smartgateway "$cfg" SmartGateway
|
||||
config_get smartgatewayuplink "$cfg" SmartGatewayUplink
|
||||
|
||||
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}${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}${T}$netaddr $prefix"
|
||||
HNA6_COUNT=$((HNA6_COUNT + 1))
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
olsrd_write_loadplugin() {
|
||||
local funcname="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
|
||||
log "$funcname() Warning: Plugin library '$library' not found, skipped"
|
||||
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
|
||||
|
||||
for f in latlon_file hosts_file services_file resolv_file macs_file; do
|
||||
config_get $f "$cfg" $f
|
||||
done
|
||||
|
||||
[ -z "$latlon_file" ] && config_set "$cfg" latlon_file '/var/run/latlon.js'
|
||||
;;
|
||||
olsrd_watchdog.*)
|
||||
config_get wd_file "$cfg" 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 funcname="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 network_get_device IFNAME "$interface"; then
|
||||
ifnames="$ifnames \"$IFNAME\""
|
||||
ifsglobal="$ifsglobal $IFNAME"
|
||||
else
|
||||
log "$funcname() Warning: Interface '$interface' not found, skipped"
|
||||
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_write_interface_defaults() {
|
||||
local cfg="$1"
|
||||
validate_varname "$cfg" || return 0
|
||||
|
||||
echo -n "${N}InterfaceDefaults$ifnames${N}{"
|
||||
config_write_options "$OLSRD_INTERFACE_DEFAULTS_SCHEMA" "$cfg" olsrd_write_option "${T}"
|
||||
echo "${N}}"
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
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";;
|
||||
InterfaceDefaults) config_update_schema OLSRD_INTERFACE_DEFAULTS_SCHEMA "$command" "$varname" "$value";;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
olsrd_write_config() {
|
||||
OLSRD_IPVERSION_6AND4=0
|
||||
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_defaults InterfaceDefaults
|
||||
config_foreach olsrd_write_interface Interface
|
||||
echo
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
get_wan_ifnames()
|
||||
{
|
||||
local wanifnames word catch_next
|
||||
|
||||
which ip >/dev/null || return 1
|
||||
|
||||
set -- $( ip route list exact 0.0.0.0/0 table all )
|
||||
for word in $*; do
|
||||
case "$word" in
|
||||
dev)
|
||||
catch_next="true"
|
||||
;;
|
||||
*)
|
||||
[ -n "$catch_next" ] && {
|
||||
case "$wanifnames" in
|
||||
*" $word "*)
|
||||
;;
|
||||
*)
|
||||
wanifnames="$wanifnames $word "
|
||||
;;
|
||||
esac
|
||||
|
||||
catch_next=
|
||||
}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "$wanifnames"
|
||||
}
|
||||
|
||||
olsrd_setup_smartgw_rules() {
|
||||
local funcname="olsrd_setup_smartgw_rules"
|
||||
# Check if ipip is installed
|
||||
[ -e /etc/modules.d/[0-9]*-ipip ] || {
|
||||
log "$funcname() Warning: kmod-ipip is missing. SmartGateway will not work until you install it."
|
||||
return 1
|
||||
}
|
||||
|
||||
local wanifnames="$( get_wan_ifnames )"
|
||||
|
||||
if [ -z "$wanifnames" ]; then
|
||||
nowan=1
|
||||
else
|
||||
nowan=0
|
||||
fi
|
||||
|
||||
IP4T=$(which iptables)
|
||||
IP6T=$(which ip6tables)
|
||||
|
||||
# Delete smartgw firewall rules first
|
||||
for IPT in $IP4T $IP6T; do
|
||||
while $IPT -D forwarding_rule -o tnl_+ -j ACCEPT 2> /dev/null; do :;done
|
||||
for IFACE in $wanifnames; do
|
||||
while $IPT -D forwarding_rule -i tunl0 -o $IFACE -j ACCEPT 2> /dev/null; do :; done
|
||||
done
|
||||
for IFACE in $ifsglobal; do
|
||||
while $IPT -D input_rule -i $IFACE -p 4 -j ACCEPT 2> /dev/null; do :; done
|
||||
done
|
||||
done
|
||||
while $IP4T -t nat -D postrouting_rule -o tnl_+ -j MASQUERADE 2> /dev/null; do :;done
|
||||
|
||||
if [ "$smartgateway" == "yes" ]; then
|
||||
log "$funcname() Notice: Inserting firewall rules for SmartGateway"
|
||||
if [ ! "$smartgatewayuplink" == "none" ]; then
|
||||
if [ "$smartgatewayuplink" == "ipv4" ]; then
|
||||
# Allow everything to be forwarded to tnl_+ and use NAT for it
|
||||
$IP4T -I forwarding_rule -o tnl_+ -j ACCEPT
|
||||
$IP4T -t nat -I postrouting_rule -o tnl_+ -j MASQUERADE
|
||||
# Allow forwarding from tunl0 to (all) wan-interfaces
|
||||
if [ "$nowan"="0" ]; then
|
||||
for IFACE in $wanifnames; do
|
||||
$IP4T -A forwarding_rule -i tunl0 -o $IFACE -j ACCEPT
|
||||
done
|
||||
fi
|
||||
# Allow incoming ipip on all olsr-interfaces
|
||||
for IFACE in $ifsglobal; do
|
||||
$IP4T -I input_rule -i $IFACE -p 4 -j ACCEPT
|
||||
done
|
||||
elif [ "$smartgatewayuplink" == "ipv6" ]; then
|
||||
$IP6T -I forwarding_rule -o tnl_+ -j ACCEPT
|
||||
if [ "$nowan"="0" ]; then
|
||||
for IFACE in $wanifnames; do
|
||||
$IP6T -A forwarding_rule -i tunl0 -o $IFACE -j ACCEPT
|
||||
done
|
||||
fi
|
||||
for IFACE in $ifsglobal; do
|
||||
$IP6T -I input_rule -i $IFACE -p 4 -j ACCEPT
|
||||
done
|
||||
else
|
||||
for IPT in $IP4T $IP6T; do
|
||||
$IPT -I forwarding_rule -o tnl_+ -j ACCEPT
|
||||
$IPT -t nat -I postrouting_rule -o tnl_+ -j MASQUERADE
|
||||
if [ "$nowan"="0" ]; then
|
||||
for IFACE in $wanifnames; do
|
||||
$IPT -A forwarding_rule -i tunl0 -o $IFACE -j ACCEPT
|
||||
done
|
||||
fi
|
||||
for IFACE in $ifsglobal; do
|
||||
$IPT -I input_rule -i $IFACE -p 4 -j ACCEPT
|
||||
done
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
error() {
|
||||
log "error() ${initscript}: $@"
|
||||
}
|
||||
|
||||
start() {
|
||||
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" "$@"
|
||||
}
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
config_load olsrd
|
||||
reset_cb
|
||||
|
||||
OLSRD_CONFIG_FILE=
|
||||
config_foreach olsrd_find_config_file olsrd
|
||||
|
||||
if [ -z "$OLSRD_CONFIG_FILE" ]; then
|
||||
mkdir -p -- /var/etc/
|
||||
olsrd_write_config > /var/etc/olsrd.conf
|
||||
if [ "$INTERFACES_COUNT" -gt 0 -a "$OLSRD_COUNT" -gt 0 ]; then
|
||||
OLSRD_CONFIG_FILE=/var/etc/olsrd.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -z "$OLSRD_CONFIG_FILE" ] && return 1
|
||||
|
||||
local bindv6only='0'
|
||||
if [ "$OLSRD_IPVERSION_6AND4" -ne 0 ]; then
|
||||
bindv6only="$(sysctl -n net.ipv6.bindv6only)"
|
||||
sysctl -w net.ipv6.bindv6only=1 > /dev/null
|
||||
sed -e '/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/d' < "$OLSRD_CONFIG_FILE" > /var/etc/olsrd.conf.ipv6
|
||||
sed -e 's/^IpVersion[ ][ ]*6$/IpVersion 4/' -e 's/^\t\t[A-Fa-f0-9.:]*[:][A-Fa-f0-9.:]*[ ][0-9]*$//' < "$OLSRD_CONFIG_FILE" > /var/etc/olsrd.conf.ipv4
|
||||
rm $OLSRD_CONFIG_FILE
|
||||
|
||||
# some filenames should get the suffix .ipv6
|
||||
for file in $latlon_file $hosts_file $services_file $resolv_file $macs_file $wd_file;do
|
||||
f=$(echo $file|sed 's/\//\\\//g')
|
||||
sed -i "s/$f/$f.ipv6/g" /var/etc/olsrd.conf.ipv6
|
||||
done
|
||||
|
||||
SERVICE_PID_FILE="$PID6"
|
||||
if service_check /usr/sbin/olsrd; then
|
||||
error "there is already an IPv6 instance of olsrd running (pid: '$(cat $PID6)'), not starting."
|
||||
else
|
||||
service_start /usr/sbin/olsrd -f /var/etc/olsrd.conf.ipv6 -nofork
|
||||
fi
|
||||
|
||||
SERVICE_PID_FILE="$PID"
|
||||
if service_check /usr/sbin/olsrd; then
|
||||
error "there is already an IPv4 instance of olsrd running (pid: '$(cat $PID)'), not starting."
|
||||
else
|
||||
service_start /usr/sbin/olsrd -f /var/etc/olsrd.conf.ipv4 -nofork
|
||||
fi
|
||||
|
||||
sleep 3
|
||||
sysctl -w net.ipv6.bindv6only="$bindv6only" > /dev/null
|
||||
|
||||
else
|
||||
|
||||
if [ "$ipversion" = "6" ]; then
|
||||
sed -i '/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/d' "$OLSRD_CONFIG_FILE"
|
||||
fi
|
||||
|
||||
SERVICE_PID_FILE="$PID"
|
||||
if service_check /usr/sbin/olsrd; then
|
||||
error "there is already an IPv4 instance of olsrd running (pid: '$(cat $PID)'), not starting."
|
||||
return 1
|
||||
else
|
||||
service_start /usr/sbin/olsrd -f "$OLSRD_CONFIG_FILE" -nofork
|
||||
fi
|
||||
fi
|
||||
olsrd_setup_smartgw_rules
|
||||
}
|
||||
|
||||
stop() {
|
||||
SERVICE_PID_FILE="$PID"
|
||||
service_stop /usr/sbin/olsrd
|
||||
|
||||
SERVICE_PID_FILE="$PID6"
|
||||
service_stop /usr/sbin/olsrd
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
#
|
||||
# OLSrd PUD plugin position configuration file
|
||||
#
|
||||
|
||||
# GPS operating mode.
|
||||
# Values : bad, 2d, 3d
|
||||
# Default: bad
|
||||
# Note : a value of 'bad' will make the resulting position information invalid
|
||||
# (the mask will indicate that all other information is not present)
|
||||
#fix = bad
|
||||
|
||||
# GPS quality indicator.
|
||||
# Values : bad, low, mid, high
|
||||
# Default: high
|
||||
#sig = high
|
||||
|
||||
# HDOP (Horizontal Dilution Of Precision)
|
||||
# Values : floating point value
|
||||
# Default: 0.0
|
||||
# Note : From HDOP, VDOP and PDOP are determined: VDOP = HDOP, and PDOP = sqrt(2) * HDOP.
|
||||
#hdop = 0.0
|
||||
|
||||
# Latitude
|
||||
# Values : floating point value
|
||||
# Unit is NMEA like latitude: ddmm.sssss (d=degrees, m=minutes, s=seconds)
|
||||
# Default: 0000.00000
|
||||
#lat = 0000.00000
|
||||
|
||||
# Longitude
|
||||
# Values: floating point value
|
||||
# Unit is NMEA like longitude: dddmm.sssss (d=degrees, m=minutes, s=seconds)
|
||||
# Default: 00000.00000
|
||||
#lon = 00000.00000
|
||||
|
||||
# Elevation
|
||||
# Values: floating point value
|
||||
# Unit is meters above the mean sea level (geoid)
|
||||
# Default: 0.0
|
||||
#elv = 0.0
|
||||
|
||||
# Speed
|
||||
# Values: floating point value
|
||||
# Unit is over the ground in kph
|
||||
# Default: 0.0
|
||||
#speed = 0.0
|
||||
|
||||
# Direction/Track
|
||||
# Values: floating point value
|
||||
# Unit is (compass) degrees
|
||||
# Default: 0.0
|
||||
#direction = 0.0
|
@ -1,14 +0,0 @@
|
||||
#
|
||||
# OLSrd Smart Gateway uplink speed configuration file
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# Upstream speed in kilobit/s
|
||||
# Default: 128
|
||||
#upstream=128
|
||||
|
||||
#
|
||||
# Downstream speed in kilobit/s
|
||||
# Default: 1024
|
||||
#downstream=1024
|
@ -1 +0,0 @@
|
||||
1234567890123456
|
Loading…
x
Reference in New Issue
Block a user