Merge branch 'master' into bmx6_testing

This commit is contained in:
Axel Neumann 2013-08-01 14:19:40 +02:00
commit ce35abee1f
26 changed files with 1135 additions and 823 deletions

View file

@ -10,11 +10,11 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=batman-adv
PKG_VERSION:=2013.2.0
BATCTL_VERSION:=2013.2.0
PKG_RELEASE:=3
PKG_MD5SUM:=9ec18300b96df22f0ed21c9f51e4ccef
BATCTL_MD5SUM:=712f86cdd0f9076503fc48acf37e109e
PKG_VERSION:=2013.3.0
BATCTL_VERSION:=2013.3.0
PKG_RELEASE:=4
PKG_MD5SUM:=d070c0879cd8fe8125315a4566fabd2d
BATCTL_MD5SUM:=747535b0296f0013a6f99373a51d41fc
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
@ -60,16 +60,29 @@ MAKE_BATMAN_ADV_ARGS += \
CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_KMOD_BATMAN_ADV_NC),y,n) \
REVISION="" all
MAKE_BATCTL_ARGS += \
# The linker can identify unused sections of a binary when each symbol is stored
# in a separate section. This mostly removes unused linker sections and reduces
# the size by ~3% on mipsel.
TARGET_CFLAGS += -ffunction-sections -fdata-sections
TARGET_LDFLAGS += -Wl,--gc-sections
# Link-time optimization allows to move parts of the optimization from the single
# source file to the global source view. This is done by emitting the GIMPLE
# representation in each object file and analyzing it again during the link step.
TARGET_CFLAGS += -flto
TARGET_LDFLAGS += -fuse-linker-plugin
MAKE_BATCTL_ENV += \
CPPFLAGS="$(TARGET_CPPFLAGS)" \
CFLAGS="$(TARGET_CFLAGS)" \
CCFLAGS="$(TARGET_CFLAGS)" \
OFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)"
MAKE_BATCTL_ARGS += \
REVISION="" \
CC="$(TARGET_CC)" \
NODEBUG=1 \
UNAME="Linux" \
DESTDIR="$(PKG_INSTALL_DIR)" \
STRIP="/bin/true" \
batctl install
ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
@ -82,7 +95,7 @@ $(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_BUILD = $(MAKE_BATCTL_ENV) $(MAKE) -C $(PKG_BATCTL_BUILD_DIR) $(MAKE_BATCTL_ARGS)
BATCTL_INSTALL = $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/
endif

View file

@ -0,0 +1,33 @@
From 2c7bfe1299efa97438814bf6826a8f7ab3bc0b16 Mon Sep 17 00:00:00 2001
From: Sven Eckelmann <sven@narfation.org>
Date: Tue, 7 May 2013 14:51:02 +0200
Subject: [PATCH] batctl: Add CFLAGS to the linker step
The GCC manual states for different parameters that the options for compilation
must also be used when linking. The options for compilation are stored in
CFLAGS and added to LINK.o to fix the behavior.
Option which need this are for example -fPIC/-fPIE or -flto.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 311e70e..233f453 100755
--- a/Makefile
+++ b/Makefile
@@ -53,7 +53,7 @@ RM ?= rm -f
INSTALL ?= install
MKDIR ?= mkdir -p
COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
-LINK.o = $(Q_LD)$(CC) $(LDFLAGS) $(TARGET_ARCH)
+LINK.o = $(Q_LD)$(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH)
# standard install paths
PREFIX = /usr/local
--
1.7.10.4

View file

@ -1,74 +0,0 @@
From 9b96ecbae7295269aaa0320667f646870de65661 Mon Sep 17 00:00:00 2001
From: Antonio Quartulli <antonio@open-mesh.com>
Date: Wed, 3 Apr 2013 10:14:20 +0200
Subject: [PATCH 01/10] batman-adv: use the proper header len when checking
the TTVN
Unicast packet might be of type either UNICAST or
UNICAST4ADDR.
In the two cases the header size is different, but the
mechanism checking the TTVN field was assuming it to be
always of the same type (UNICAST), so failing to access the
inner Ethernet header in case of UNICAST4ADDR.
Fix this by passing the real header length as argument.
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
routing.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/routing.c b/routing.c
index 2f1f889..b27a4d7 100644
--- a/routing.c
+++ b/routing.c
@@ -939,7 +939,7 @@ out:
}
static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
- struct sk_buff *skb) {
+ struct sk_buff *skb, int hdr_len) {
uint8_t curr_ttvn, old_ttvn;
struct batadv_orig_node *orig_node;
struct ethhdr *ethhdr;
@@ -948,7 +948,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
int is_old_ttvn;
/* check if there is enough data before accessing it */
- if (pskb_may_pull(skb, sizeof(*unicast_packet) + ETH_HLEN) < 0)
+ if (pskb_may_pull(skb, hdr_len + ETH_HLEN) < 0)
return 0;
/* create a copy of the skb (in case of for re-routing) to modify it. */
@@ -956,7 +956,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
return 0;
unicast_packet = (struct batadv_unicast_packet *)skb->data;
- ethhdr = (struct ethhdr *)(skb->data + sizeof(*unicast_packet));
+ ethhdr = (struct ethhdr *)(skb->data + hdr_len);
/* check if the destination client was served by this node and it is now
* roaming. In this case, it means that the node has got a ROAM_ADV
@@ -1072,8 +1072,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
if (check < 0)
return NET_RX_DROP;
-
- if (!batadv_check_unicast_ttvn(bat_priv, skb))
+ if (!batadv_check_unicast_ttvn(bat_priv, skb, hdr_size))
return NET_RX_DROP;
/* packet for me */
@@ -1117,7 +1116,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0)
return NET_RX_DROP;
- if (!batadv_check_unicast_ttvn(bat_priv, skb))
+ if (!batadv_check_unicast_ttvn(bat_priv, skb, hdr_size))
return NET_RX_DROP;
unicast_packet = (struct batadv_unicast_frag_packet *)skb->data;
--
1.7.10.4

View file

@ -1,69 +0,0 @@
From 82d1a8ebf19a1b9841ee44ce7b2448114be3e772 Mon Sep 17 00:00:00 2001
From: Patrick McHardy <kaber@trash.net>
Date: Wed, 24 Apr 2013 17:42:56 +0200
Subject: [PATCH 02/10] net: vlan: add protocol argument to packet tagging
functions
Add a protocol argument to the VLAN packet tagging functions. In case of HW
tagging, we need that protocol available in the ndo_start_xmit functions,
so it is stored in a new field in the skb. The new field fits into a hole
(on 64 bit) and doesn't increase the sks's size.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
[siwu@hrz.tu-chemnitz.de: added compat code]
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
bridge_loop_avoidance.c | 2 +-
compat.h | 16 +++++++++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index 6a4f728..379061c 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
@@ -341,7 +341,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac,
}
if (vid != -1)
- skb = vlan_insert_tag(skb, vid);
+ skb = vlan_insert_tag(skb, htons(ETH_P_8021Q), vid);
skb_reset_mac_header(skb);
skb->protocol = eth_type_trans(skb, soft_iface);
diff --git a/compat.h b/compat.h
index 0663df5..c1dadac 100644
--- a/compat.h
+++ b/compat.h
@@ -170,7 +170,7 @@ static const struct { \
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
#define kfree_rcu(ptr, rcu_head) call_rcu(&ptr->rcu_head, batadv_free_rcu_##ptr)
-#define vlan_insert_tag(skb, vid) __vlan_put_tag(skb, vid)
+#define vlan_insert_tag(skb, proto, vid) __vlan_put_tag(skb, vid)
void batadv_free_rcu_gw_node(struct rcu_head *rcu);
void batadv_free_rcu_neigh_node(struct rcu_head *rcu);
@@ -278,4 +278,18 @@ static int __batadv_interface_set_mac_addr(x, y)
#endif /* < KERNEL_VERSION(3, 9, 0) */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
+
+#ifndef vlan_insert_tag
+
+/* include this header early to let the following define
+ * not mess up the original function prototype.
+ */
+#include <linux/if_vlan.h>
+#define vlan_insert_tag(skb, proto, vid) vlan_insert_tag(skb, vid)
+
+#endif /* vlan_insert_tag */
+
+#endif /* < KERNEL_VERSION(3, 10, 0) */
+
#endif /* _NET_BATMAN_ADV_COMPAT_H_ */
--
1.7.10.4

View file

@ -1,33 +0,0 @@
From aa7d19a5b97fe48657e075e8e4d130bd6916551e Mon Sep 17 00:00:00 2001
From: Marek Lindner <lindner_marek@yahoo.de>
Date: Sat, 27 Apr 2013 16:22:28 +0800
Subject: [PATCH 03/10] batman-adv: check proto length before accessing proto
string buffer
batadv_param_set_ra() strips the trailing '\n' from the supplied
string buffer without checking the length of the buffer first. This
patches avoids random memory access and associated potential
crashes.
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.c b/main.c
index 3e30a0f..9c620cd 100644
--- a/main.c
+++ b/main.c
@@ -475,7 +475,7 @@ static int batadv_param_set_ra(const char *val, const struct kernel_param *kp)
char *algo_name = (char *)val;
size_t name_len = strlen(algo_name);
- if (algo_name[name_len - 1] == '\n')
+ if (name_len > 0 && algo_name[name_len - 1] == '\n')
algo_name[name_len - 1] = '\0';
bat_algo_ops = batadv_algo_get(algo_name);
--
1.7.10.4

View file

@ -1,44 +0,0 @@
From d22ebef1431aab13099370b89afa4ba55eb95c35 Mon Sep 17 00:00:00 2001
From: Marek Lindner <lindner_marek@yahoo.de>
Date: Tue, 7 May 2013 19:25:02 +0800
Subject: [PATCH 04/10] batman-adv: check return value of pskb_trim_rcsum()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reported-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Martin Hundebøll <martin@hundeboll.net>
---
network-coding.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/network-coding.c b/network-coding.c
index f7c5430..e84629e 100644
--- a/network-coding.c
+++ b/network-coding.c
@@ -1514,6 +1514,7 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb,
struct ethhdr *ethhdr, ethhdr_tmp;
uint8_t *orig_dest, ttl, ttvn;
unsigned int coding_len;
+ int err;
/* Save headers temporarily */
memcpy(&coded_packet_tmp, skb->data, sizeof(coded_packet_tmp));
@@ -1568,8 +1569,11 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb,
coding_len);
/* Resize decoded skb if decoded with larger packet */
- if (nc_packet->skb->len > coding_len + h_size)
- pskb_trim_rcsum(skb, coding_len + h_size);
+ if (nc_packet->skb->len > coding_len + h_size) {
+ err = pskb_trim_rcsum(skb, coding_len + h_size);
+ if (err)
+ return NULL;
+ }
/* Create decoded unicast packet */
unicast_packet = (struct batadv_unicast_packet *)skb->data;
--
1.7.10.4

View file

@ -1,48 +0,0 @@
From d6bd8b36fa1f3d72a6fd5942a6e9bde6ddafcd0d Mon Sep 17 00:00:00 2001
From: Antonio Quartulli <ordex@autistici.org>
Date: Thu, 9 May 2013 09:35:45 +0200
Subject: [PATCH 05/10] batman-adv: make DAT drop ARP requests targeting local
clients
In the outgoing ARP request snooping routine in DAT, ARP
Request sent by local clients which are supposed to be
replied by other local clients can be silently dropped.
The destination host will reply by itself through the LAN
and therefore there is no need to involve DAT.
Reported-by: Carlos Quijano <carlos@crqgestion.es>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Tested-by: Carlos Quijano <carlos@crqgestion.es>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
distributed-arp-table.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/distributed-arp-table.c b/distributed-arp-table.c
index 8e15d96..2399920 100644
--- a/distributed-arp-table.c
+++ b/distributed-arp-table.c
@@ -837,6 +837,19 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
dat_entry = batadv_dat_entry_hash_find(bat_priv, ip_dst);
if (dat_entry) {
+ /* If the ARP request is destined for a local client the local
+ * client will answer itself. DAT would only generate a
+ * duplicate packet.
+ *
+ * Moreover, if the soft-interface is enslaved into a bridge, an
+ * additional DAT answer may trigger kernel warnings about
+ * a packet coming from the wrong port.
+ */
+ if (batadv_is_my_client(bat_priv, dat_entry->mac_addr)) {
+ ret = true;
+ goto out;
+ }
+
skb_new = arp_create(ARPOP_REPLY, ETH_P_ARP, ip_src,
bat_priv->soft_iface, ip_dst, hw_src,
dat_entry->mac_addr, hw_src);
--
1.7.10.4

View file

@ -1,57 +0,0 @@
From 763f413b9c74ccb25cb066408f49f07e5dd78f9b Mon Sep 17 00:00:00 2001
From: Antonio Quartulli <ordex@autistici.org>
Date: Tue, 7 May 2013 01:06:18 +0200
Subject: [PATCH 06/10] batman-adv: reorder clean up routine in order to avoid
race conditions
nc_worker accesses the originator table during its periodic
work, but since the originator table is freed before
stopping the worker this leads to a global protection fault.
Fix this by killing the worker (in nc_free) before freeing
the originator table.
Moreover tidy up the entire clean up routine by running all
the subcomponents freeing procedures first and then killing
the TT and the originator tables at the end.
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
main.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/main.c b/main.c
index 9c620cd..1240f07 100644
--- a/main.c
+++ b/main.c
@@ -163,14 +163,22 @@ void batadv_mesh_free(struct net_device *soft_iface)
batadv_vis_quit(bat_priv);
batadv_gw_node_purge(bat_priv);
- batadv_originator_free(bat_priv);
batadv_nc_free(bat_priv);
+ batadv_dat_free(bat_priv);
+ batadv_bla_free(bat_priv);
+ /* Free the TT and the originator tables only after having terminated
+ * all the other depending components which may use these structures for
+ * their purposes.
+ */
batadv_tt_free(bat_priv);
- batadv_bla_free(bat_priv);
-
- batadv_dat_free(bat_priv);
+ /* Since the originator table clean up routine is accessing the TT
+ * tables as well, it has to be invoked after the TT tables have been
+ * freed and marked as empty. This ensures that no cleanup RCU callbacks
+ * accessing the TT data are scheduled for later execution.
+ */
+ batadv_originator_free(bat_priv);
free_percpu(bat_priv->bat_counters);
--
1.7.10.4

View file

@ -1,47 +0,0 @@
From a5d79639a76d7a71116abbc369a246bd1fcbf947 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= <martin@hundeboll.net>
Date: Wed, 17 Apr 2013 21:13:16 +0200
Subject: [PATCH 07/10] batman-adv: Avoid double freeing of bat_counters
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On errors in batadv_mesh_init(), bat_counters will be freed in both
batadv_mesh_free() and batadv_softif_init_late(). This patch fixes this
by returning earlier from batadv_softif_init_late() in case of errors in
batadv_mesh_init() and by setting bat_counters to NULL after freeing.
Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
main.c | 1 +
soft-interface.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/main.c b/main.c
index 1240f07..51aafd6 100644
--- a/main.c
+++ b/main.c
@@ -181,6 +181,7 @@ void batadv_mesh_free(struct net_device *soft_iface)
batadv_originator_free(bat_priv);
free_percpu(bat_priv->bat_counters);
+ bat_priv->bat_counters = NULL;
atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE);
}
diff --git a/soft-interface.c b/soft-interface.c
index 6f20d33..819dfb0 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -505,6 +505,7 @@ unreg_debugfs:
batadv_debugfs_del_meshif(dev);
free_bat_counters:
free_percpu(bat_priv->bat_counters);
+ bat_priv->bat_counters = NULL;
return ret;
}
--
1.7.10.4

View file

@ -1,42 +0,0 @@
From 96cd7725540f4dccdd6fbb4fde59243e1cc1ad80 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 28 May 2013 17:32:32 +0200
Subject: [PATCH 08/10] batman-adv: wait for rtnl in batadv_store_mesh_iface
instead of failing if it is taken
The rtnl_lock in batadv_store_mesh_iface has been converted to a rtnl_trylock
some time ago to avoid a possible deadlock between rtnl and s_active on removal
of the sysfs nodes.
The behaviour introduced by that was quite confusing as it could lead to the
sysfs store to fail, making batman-adv setup scripts unreliable. As recently the
sysfs removal was postponed to a worker not running with the rtnl taken, the
deadlock can't occur any more and it is safe to change the trylock back to a
lock to make the sysfs store reliable again.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Reviewed-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
sysfs.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/sysfs.c b/sysfs.c
index 15a22ef..929e304 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -582,10 +582,7 @@ static ssize_t batadv_store_mesh_iface(struct kobject *kobj,
(strncmp(hard_iface->soft_iface->name, buff, IFNAMSIZ) == 0))
goto out;
- if (!rtnl_trylock()) {
- ret = -ERESTARTSYS;
- goto out;
- }
+ rtnl_lock();
if (status_tmp == BATADV_IF_NOT_IN_USE) {
batadv_hardif_disable_interface(hard_iface,
--
1.7.10.4

View file

@ -1,35 +0,0 @@
From 518fba156ed911c6183cf5cb34955a6fdf1b4637 Mon Sep 17 00:00:00 2001
From: Simon Wunderlich <simon@open-mesh.com>
Date: Fri, 7 Jun 2013 16:52:05 +0200
Subject: [PATCH 09/10] batman-adv: Don't handle address updates when bla is
disabled
The bridge loop avoidance has a hook to handle address updates of the
originator. These should not be handled when bridge loop avoidance is
disabled - it might send some bridge loop avoidance packets which should
not appear if bla is disabled.
Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
bridge_loop_avoidance.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index 379061c..de27b31 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
@@ -1067,6 +1067,10 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
group = htons(crc16(0, primary_if->net_dev->dev_addr, ETH_ALEN));
bat_priv->bla.claim_dest.group = group;
+ /* purge everything when bridge loop avoidance is turned off */
+ if (!atomic_read(&bat_priv->bridge_loop_avoidance))
+ oldif = NULL;
+
if (!oldif) {
batadv_bla_purge_claims(bat_priv, NULL, 1);
batadv_bla_purge_backbone_gw(bat_priv, 1);
--
1.7.10.4

View file

@ -1,226 +0,0 @@
From 3d999e5116f44b47c742aa16d6382721c360a6d0 Mon Sep 17 00:00:00 2001
From: Simon Wunderlich <simon@open-mesh.com>
Date: Thu, 23 May 2013 13:07:42 +0200
Subject: [PATCH 10/10] batman-adv: forward late OGMs from best next hop
When a packet is received from another node first and later from the
best next hop, this packet is dropped. However the first OGM was sent
with the BATADV_NOT_BEST_NEXT_HOP flag and thus dropped by neighbors.
The late OGM from the best neighbor is then dropped because it is a
duplicate.
If this situation happens constantly, a node might end up not forwarding
the "valid" OGMs anymore, and nodes behind will starve from not getting
valid OGMs.
Fix this by refining the duplicate checking behaviour: The actions
should depend on whether it was a duplicate for a neighbor only or for
the originator. OGMs which are not duplicates for a specific neighbor
will now be considered in batadv_iv_ogm_forward(), but only actually
forwarded for the best next hop. Therefore, late OGMs from the best
next hop are forwarded now and not dropped as duplicates anymore.
Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
bat_iv_ogm.c | 86 +++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 55 insertions(+), 31 deletions(-)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 071f288..f680ee1 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -29,6 +29,21 @@
#include "bat_algo.h"
#include "network-coding.h"
+/**
+ * batadv_dup_status - duplicate status
+ * @BATADV_NO_DUP: the packet is a duplicate
+ * @BATADV_ORIG_DUP: OGM is a duplicate in the originator (but not for the
+ * neighbor)
+ * @BATADV_NEIGH_DUP: OGM is a duplicate for the neighbor
+ * @BATADV_PROTECTED: originator is currently protected (after reboot)
+ */
+enum batadv_dup_status {
+ BATADV_NO_DUP = 0,
+ BATADV_ORIG_DUP,
+ BATADV_NEIGH_DUP,
+ BATADV_PROTECTED,
+};
+
static struct batadv_neigh_node *
batadv_iv_ogm_neigh_new(struct batadv_hard_iface *hard_iface,
const uint8_t *neigh_addr,
@@ -650,7 +665,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
const struct batadv_ogm_packet *batadv_ogm_packet,
struct batadv_hard_iface *if_incoming,
const unsigned char *tt_buff,
- int is_duplicate)
+ enum batadv_dup_status dup_status)
{
struct batadv_neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL;
struct batadv_neigh_node *router = NULL;
@@ -676,7 +691,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
continue;
}
- if (is_duplicate)
+ if (dup_status != BATADV_NO_DUP)
continue;
spin_lock_bh(&tmp_neigh_node->lq_update_lock);
@@ -718,7 +733,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
neigh_node->tq_avg = batadv_ring_buffer_avg(neigh_node->tq_recv);
spin_unlock_bh(&neigh_node->lq_update_lock);
- if (!is_duplicate) {
+ if (dup_status == BATADV_NO_DUP) {
orig_node->last_ttl = batadv_ogm_packet->header.ttl;
neigh_node->last_ttl = batadv_ogm_packet->header.ttl;
}
@@ -902,15 +917,16 @@ out:
return ret;
}
-/* processes a batman packet for all interfaces, adjusts the sequence number and
- * finds out whether it is a duplicate.
- * returns:
- * 1 the packet is a duplicate
- * 0 the packet has not yet been received
- * -1 the packet is old and has been received while the seqno window
- * was protected. Caller should drop it.
+/**
+ * batadv_iv_ogm_update_seqnos - process a batman packet for all interfaces,
+ * adjust the sequence number and find out whether it is a duplicate
+ * @ethhdr: ethernet header of the packet
+ * @batadv_ogm_packet: OGM packet to be considered
+ * @if_incoming: interface on which the OGM packet was received
+ *
+ * Returns duplicate status as enum batadv_dup_status
*/
-static int
+static enum batadv_dup_status
batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
const struct batadv_ogm_packet *batadv_ogm_packet,
const struct batadv_hard_iface *if_incoming)
@@ -918,17 +934,18 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
struct batadv_orig_node *orig_node;
struct batadv_neigh_node *tmp_neigh_node;
- int is_duplicate = 0;
+ int is_dup;
int32_t seq_diff;
int need_update = 0;
- int set_mark, ret = -1;
+ int set_mark;
+ enum batadv_dup_status ret = BATADV_NO_DUP;
uint32_t seqno = ntohl(batadv_ogm_packet->seqno);
uint8_t *neigh_addr;
uint8_t packet_count;
orig_node = batadv_get_orig_node(bat_priv, batadv_ogm_packet->orig);
if (!orig_node)
- return 0;
+ return BATADV_NO_DUP;
spin_lock_bh(&orig_node->ogm_cnt_lock);
seq_diff = seqno - orig_node->last_real_seqno;
@@ -936,22 +953,29 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
/* signalize caller that the packet is to be dropped. */
if (!hlist_empty(&orig_node->neigh_list) &&
batadv_window_protected(bat_priv, seq_diff,
- &orig_node->batman_seqno_reset))
+ &orig_node->batman_seqno_reset)) {
+ ret = BATADV_PROTECTED;
goto out;
+ }
rcu_read_lock();
hlist_for_each_entry_rcu(tmp_neigh_node,
&orig_node->neigh_list, list) {
- is_duplicate |= batadv_test_bit(tmp_neigh_node->real_bits,
- orig_node->last_real_seqno,
- seqno);
-
neigh_addr = tmp_neigh_node->addr;
+ is_dup = batadv_test_bit(tmp_neigh_node->real_bits,
+ orig_node->last_real_seqno,
+ seqno);
+
if (batadv_compare_eth(neigh_addr, ethhdr->h_source) &&
- tmp_neigh_node->if_incoming == if_incoming)
+ tmp_neigh_node->if_incoming == if_incoming) {
set_mark = 1;
- else
+ if (is_dup)
+ ret = BATADV_NEIGH_DUP;
+ } else {
set_mark = 0;
+ if (is_dup && (ret != BATADV_NEIGH_DUP))
+ ret = BATADV_ORIG_DUP;
+ }
/* if the window moved, set the update flag. */
need_update |= batadv_bit_get_packet(bat_priv,
@@ -971,8 +995,6 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
orig_node->last_real_seqno = seqno;
}
- ret = is_duplicate;
-
out:
spin_unlock_bh(&orig_node->ogm_cnt_lock);
batadv_orig_node_free_ref(orig_node);
@@ -994,7 +1016,8 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
int is_broadcast = 0, is_bidirect;
bool is_single_hop_neigh = false;
bool is_from_best_next_hop = false;
- int is_duplicate, sameseq, simlar_ttl;
+ int sameseq, similar_ttl;
+ enum batadv_dup_status dup_status;
uint32_t if_incoming_seqno;
uint8_t *prev_sender;
@@ -1138,10 +1161,10 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
if (!orig_node)
return;
- is_duplicate = batadv_iv_ogm_update_seqnos(ethhdr, batadv_ogm_packet,
- if_incoming);
+ dup_status = batadv_iv_ogm_update_seqnos(ethhdr, batadv_ogm_packet,
+ if_incoming);
- if (is_duplicate == -1) {
+ if (dup_status == BATADV_PROTECTED) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: packet within seqno protection time (sender: %pM)\n",
ethhdr->h_source);
@@ -1211,11 +1234,12 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
* seqno and similar ttl as the non-duplicate
*/
sameseq = orig_node->last_real_seqno == ntohl(batadv_ogm_packet->seqno);
- simlar_ttl = orig_node->last_ttl - 3 <= batadv_ogm_packet->header.ttl;
- if (is_bidirect && (!is_duplicate || (sameseq && simlar_ttl)))
+ similar_ttl = orig_node->last_ttl - 3 <= batadv_ogm_packet->header.ttl;
+ if (is_bidirect && ((dup_status == BATADV_NO_DUP) ||
+ (sameseq && similar_ttl)))
batadv_iv_ogm_orig_update(bat_priv, orig_node, ethhdr,
batadv_ogm_packet, if_incoming,
- tt_buff, is_duplicate);
+ tt_buff, dup_status);
/* is single hop (direct) neighbor */
if (is_single_hop_neigh) {
@@ -1236,7 +1260,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
goto out_neigh;
}
- if (is_duplicate) {
+ if (dup_status == BATADV_NEIGH_DUP) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: duplicate packet received\n");
goto out_neigh;
--
1.7.10.4

View file

@ -32,7 +32,7 @@ PKG_SOURCE_URL:=git://bmx6.net/bmx6.git
#PKG_SOURCE_URL:=git://github.com/axn/bmx6.git
PKG_REV:=60adcbd4655ccf36a407bae58d66914e33f05a41
PKG_VERSION:=r2013060803
PKG_VERSION:=r2013073001
PKG_RELEASE:=4
PKG_SOURCE_VERSION:=$(PKG_REV)

View file

@ -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))

View file

@ -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'

View file

@ -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
}

69
ndppd/Makefile Normal file
View file

@ -0,0 +1,69 @@
#
# Copyright (C) 2007-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ndppd
PKG_VERSION:=0.2.2
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
# Latest release
PKG_SOURCE_URL:=http://www.priv.nu/projects/ndppd/files/
PKG_MD5SUM:=d90c4b65777a62274c1837dba341e5a8
# Development snapshot
#PKG_SOURCE_URL=git://github.com/Tuhox/ndppd.git
#PKG_SOURCE_VERSION=master
#PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/uclibc++.mk
include $(INCLUDE_DIR)/package.mk
define Package/ndppd
SECTION:=net
CATEGORY:=Network
TITLE:=NDP Proxy Daemon
URL:=http://www.priv.nu/projects/ndppd/
MAINTAINER:=Gabriel Kerneis <kerneis@pps.jussieu.fr>
DEPENDS:=+kmod-ipv6 $(CXX_DEPENDS)
endef
define Package/ndppd/description
ndppd, or NDP Proxy Daemon, is a daemon that proxies NDP (Neighbor Discovery
Protocol) messages between interfaces. ndppd currently only supports Neighbor
Solicitation Messages and Neighbor Advertisement Messages.
The ndp_proxy provided by Linux doesn't support listing proxies, and only hosts
are supported. No subnets. ndppd solves this by listening for Neighbor
Solicitation messages on an interface, then query the internal interfaces for
that target IP before finally sending a Neighbor Advertisement message.
endef
define Package/ndppd/conffiles
/etc/ndppd.conf
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CXX="$(TARGET_CXX)" \
CXXFLAGS="$(TARGET_CXXFLAGS) -std=c++0x -fno-rtti" \
LDFLAGS="$(TARGET_LDFLAGS)" \
LIBS="-lc" \
ndppd
endef
define Package/ndppd/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ndppd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/ndppd.init $(1)/etc/init.d/ndppd
$(INSTALL_CONF) $(PKG_BUILD_DIR)/ndppd.conf-dist $(1)/etc/ndppd.conf
endef
$(eval $(call BuildPackage,ndppd))

16
ndppd/files/ndppd.init Normal file
View file

@ -0,0 +1,16 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2007-2011 OpenWrt.org
START=90
SERVICE_USE_PID=1
SERVICE_PID_FILE=/var/run/ndppd.pid
start() {
mkdir -p /var/run
service_start /usr/sbin/ndppd -p $SERVICE_PID_FILE -d
}
stop() {
service_stop /usr/sbin/ndppd
}

304
quagga/Makefile Normal file
View file

@ -0,0 +1,304 @@
#
# Copyright (C) 2006-2013 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:=quagga
PKG_VERSION:=0.99.22
PKG_RELEASE:=6
PKG_MD5SUM:=3057bf3a91116a1017dd0df7e5e8ef93
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://download.savannah.gnu.org/releases/quagga/
PKG_CONFIG_DEPENDS:= \
CONFIG_IPV6 \
CONFIG_PACKAGE_quagga-watchquagga \
CONFIG_PACKAGE_quagga-zebra \
CONFIG_PACKAGE_quagga-libzebra \
CONFIG_PACKAGE_quagga-libospf \
CONFIG_PACKAGE_quagga-bgpd \
CONFIG_PACKAGE_quagga-isisd \
CONFIG_PACKAGE_quagga-ospf6d \
CONFIG_PACKAGE_quagga-ripd \
CONFIG_PACKAGE_quagga-ripngd \
CONFIG_PACKAGE_quagga-babeld \
CONFIG_PACKAGE_quagga-vtysh
PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/quagga/Default
SECTION:=net
CATEGORY:=Network
SUBMENU:=Routing and Redirection
DEPENDS:=quagga
TITLE:=The Quagga Software Routing Suite
URL:=http://www.quagga.net
MAINTAINER:=Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr>
endef
define Package/quagga
$(call Package/quagga/Default)
DEPENDS:=+librt
MENU:=1
endef
define Package/quagga/description
A routing software package that provides TCP/IP based routing services
with routing protocols support such as RIPv1, RIPv2, RIPng, OSPFv2,
OSPFv3, BGP-4, and BGP-4+
endef
define Package/quagga-watchquagga
$(call Package/quagga/Default)
TITLE:=Quagga watchdog
DEPENDS+=+quagga-libzebra
DEFAULT:=y if PACKAGE_quagga
endef
define Package/quagga-zebra
$(call Package/quagga/Default)
TITLE:=Zebra daemon
DEPENDS+=+quagga-libzebra
DEFAULT:=y if PACKAGE_quagga
endef
define Package/quagga-libzebra
$(call Package/quagga/Default)
TITLE:=zebra library
endef
define Package/quagga-libospf
$(call Package/quagga/Default)
TITLE:=OSPF library
endef
define Package/quagga-bgpd
$(call Package/quagga/Default)
DEPENDS+=+quagga-libzebra
TITLE:=BGPv4, BGPv4+, BGPv4- routing engine
endef
define Package/quagga-isisd
$(call Package/quagga/Default)
DEPENDS+=+quagga-libzebra
TITLE:=IS-IS routing engine
endef
define Package/quagga-ospfd
$(call Package/quagga/Default)
DEPENDS+=+quagga-libospf +quagga-libzebra
TITLE:=OSPFv2 routing engine
endef
define Package/quagga-ospf6d
$(call Package/quagga/Default)
DEPENDS+=+quagga-libospf +quagga-libzebra @IPV6
TITLE:=OSPFv3 routing engine
endef
define Package/quagga-ripd
$(call Package/quagga/Default)
DEPENDS+=+quagga-libzebra
TITLE:=RIP routing engine
endef
define Package/quagga-ripngd
$(call Package/quagga/Default)
DEPENDS+=+quagga-libzebra @IPV6
TITLE:=RIPNG routing engine
endef
define Package/quagga-babeld
$(call Package/quagga/Default)
DEPENDS+=+quagga-libzebra @IPV6
TITLE:=Babel routing engine
endef
define Package/quagga-vtysh
$(call Package/quagga/Default)
DEPENDS+=+quagga-libzebra +libreadline +libncurses
TITLE:=integrated shell for Quagga routing software
endef
define Package/quagga-zebra/conffiles
/etc/quagga/zebra.conf
endef
define Package/quagga-bgpd/conffiles
/etc/quagga/bgpd.conf
endef
define Package/quagga-isisd/conffiles
/etc/quagga/isisd.conf
endef
define Package/quagga-ospfd/conffiles
/etc/quagga/ospfd.conf
endef
define Package/quagga-ospf6d/conffiles
/etc/quagga/ospf6d.conf
endef
define Package/quagga-ripd/conffiles
/etc/quagga/ripd.conf
endef
define Package/quagga-ripngd/conffiles
/etc/quagga/ripngd.conf
endef
define Package/quagga-babeld/conffiles
/etc/quagga/babeld.conf
endef
ifneq ($(SDK),)
CONFIG_PACKAGE_quagga-libzebra:=m
CONFIG_PACKAGE_quagga-libospf:=m
CONFIG_PACKAGE_quagga-watchquagga:=m
CONFIG_PACKAGE_quagga-zebra:=m
CONFIG_PACKAGE_quagga-bgpd:=m
CONFIG_PACKAGE_quagga-isisd:=m
CONFIG_PACKAGE_quagga-ospf6d:=m
CONFIG_PACKAGE_quagga-ripd:=m
CONFIG_PACKAGE_quagga-ripngd:=m
CONFIG_PACKAGE_quagga-babeld:=m
CONFIG_PACKAGE_quagga-vtysh:=m
endif
CONFIGURE_ARGS+= \
--localstatedir=/var/run/quagga \
--sysconfdir=/etc/quagga/ \
--enable-shared \
--disable-static \
--enable-user=network \
--enable-group=network \
--enable-pie=no \
--enable-multipath=8 \
--disable-ospfclient \
--disable-capabilities \
--disable-doc \
$(call autoconf_bool,CONFIG_PACKAGE_quagga-libzebra,zebra) \
$(call autoconf_bool,CONFIG_PACKAGE_quagga-libospf,ospfd) \
$(call autoconf_bool,CONFIG_PACKAGE_quagga-bgpd,bgpd) \
$(call autoconf_bool,CONFIG_PACKAGE_quagga-isisd,isisd) \
$(call autoconf_bool,CONFIG_PACKAGE_quagga-ospf6d,ospf6d) \
$(call autoconf_bool,CONFIG_PACKAGE_quagga-ripd,ripd) \
$(call autoconf_bool,CONFIG_PACKAGE_quagga-ripngd,ripngd) \
$(call autoconf_bool,CONFIG_PACKAGE_quagga-babeld,babeld) \
$(call autoconf_bool,CONFIG_PACKAGE_quagga-vtysh,vtysh) \
MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS) -std=gnu99"
define Package/quagga/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) ./files/quagga $(1)/usr/sbin/quagga.init
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/quagga.init $(1)/etc/init.d/quagga
endef
define Package/quagga-watchquagga/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(1)/usr/sbin/
endef
define Package/quagga-zebra/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/quagga
chmod 0750 $(1)/etc/quagga
$(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/zebra.conf
endef
define Package/quagga-bgpd/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/quagga
chmod 0750 $(1)/etc/quagga
$(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/bgpd.conf
endef
define Package/quagga-isisd/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/quagga
chmod 0750 $(1)/etc/quagga
$(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/isisd.conf
endef
define Package/quagga-ospfd/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/quagga
chmod 0750 $(1)/etc/quagga
$(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ospfd.conf
endef
define Package/quagga-ospf6d/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/quagga
chmod 0750 $(1)/etc/quagga
$(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ospf6d.conf
endef
define Package/quagga-ripd/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/quagga
chmod 0750 $(1)/etc/quagga
$(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ripd.conf
endef
define Package/quagga-ripngd/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/quagga
chmod 0750 $(1)/etc/quagga
$(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ripngd.conf
endef
define Package/quagga-babeld/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/babeld $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/quagga
chmod 0750 $(1)/etc/quagga
$(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/babeld.conf
endef
define Package/quagga-vtysh/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/
endef
define Package/quagga-libospf/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(1)/usr/lib/
endef
define Package/quagga-libzebra/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,quagga))
$(eval $(call BuildPackage,quagga-libzebra))
$(eval $(call BuildPackage,quagga-libospf))
$(eval $(call BuildPackage,quagga-watchquagga))
$(eval $(call BuildPackage,quagga-zebra))
$(eval $(call BuildPackage,quagga-bgpd))
$(eval $(call BuildPackage,quagga-isisd))
$(eval $(call BuildPackage,quagga-ospfd))
$(eval $(call BuildPackage,quagga-ospf6d))
$(eval $(call BuildPackage,quagga-ripd))
$(eval $(call BuildPackage,quagga-ripngd))
$(eval $(call BuildPackage,quagga-babeld))
$(eval $(call BuildPackage,quagga-vtysh))

335
quagga/files/quagga Normal file
View file

@ -0,0 +1,335 @@
#!/bin/sh
#
# quagga Starts/stops quagga daemons and watchquagga.
# Create a daemon.conf file to have that routing daemon
# started/stopped automagically when using this script
# without any daemon names as args.
# If watchquagga is available, it will also be
# started/stopped if the script is called without
# any daemon names.
#
ME=$(basename $0)
usage() {
echo "Usage: ${ME} {start|stop|restart} [daemon ...]"
exit 2
}
if [ -z "$1" ]
then
usage
else
COMMAND=$1
fi
shift
ARG_DAEMONS=$*
BINDIR=/usr/sbin
CONFDIR=/etc/quagga
STATEDIR=/var/run/quagga
RUNUSER=network
RUNGROUP=$RUNUSER
DAEMONS="zebra ripd ripngd ospfd ospf6d bgpd"
DAEMON_FLAGS=-d
WATCHQUAGGA_FLAGS="-d -z -T 60 -R"
WATCHQUAGGA_CMD="$0 watchrestart"
if [ ${COMMAND} != "watchrestart" -a -x "${BINDIR}/watchquagga" ]
then
DAEMONS="${DAEMONS} watchquagga"
fi
DAEMONS_STARTSEQ=${DAEMONS}
reverse()
{
local revlist r
revlist=
for r
do
revlist="$r $revlist"
done
echo $revlist
}
DAEMONS_STOPSEQ=$(reverse ${DAEMONS_STARTSEQ})
#pidof() {
# ps ax | awk 'match($5, "(^|/)'"$1"'$") > 0 { printf " %s", $1 }'
#}
quit() {
echo "${ME}: $1"
exit 0
}
die() {
echo "${ME}: $1"
exit 1
}
is_in() {
local i
for i in $2
do
[ "$1" = "$i" ] && return 0
done
return 1
}
select_subset() {
local unknown i j
unknown=
RESULT=
for i in $1
do
is_in $i "$2" || unknown="$unknown $i"
done
if [ -n "$unknown" ]
then
RESULT=$unknown
return 1
else
for j in $2
do
is_in $j "$1" && RESULT="$RESULT $j"
done
return 0
fi
}
# check command
case ${COMMAND}
in
start|stop|restart)
;;
watchrestart)
if [ -n "$ARG_DAEMONS" ]
then
echo "${ME}: watchrestart mode is only for use by watchquagga"
exit 2
fi
;;
*)
usage
;;
esac
# select daemons to start
case ${COMMAND}
in
start|restart|watchrestart)
START_DAEMONS=
for d in ${DAEMONS_STARTSEQ}
do
[ -x "${BINDIR}/${d}" -a -f "${CONFDIR}/${d}.conf" ] \
&& START_DAEMONS="${START_DAEMONS}${d} "
done
WATCHQUAGGA_DAEMONS=${START_DAEMONS}
if is_in watchquagga "${DAEMONS_STARTSEQ}"
then
START_DAEMONS="${START_DAEMONS} watchquagga"
fi
if [ -n "${ARG_DAEMONS}" ]
then
if select_subset "${ARG_DAEMONS}" "${DAEMONS}"
then
if select_subset "${ARG_DAEMONS}" "${START_DAEMONS}"
then
START_DAEMONS=${RESULT}
else
die "these daemons are not startable:${RESULT}."
fi
else
die "unknown daemons:${RESULT}; choose from: ${DAEMONS}."
fi
fi
;;
esac
# select daemons to stop
case ${COMMAND}
in
stop|restart|watchrestart)
STOP_DAEMONS=${DAEMONS_STOPSEQ}
if [ -n "${ARG_DAEMONS}" ]
then
if select_subset "${ARG_DAEMONS}" "${STOP_DAEMONS}"
then
STOP_DAEMONS=${RESULT}
else
die "unknown daemons:${RESULT}; choose from: ${DAEMONS}."
fi
fi
stop_daemons=
for d in ${STOP_DAEMONS}
do
pidfile=${STATEDIR}/${d}.pid
if [ -f "${pidfile}" -o -n "$(pidof ${d})" ]
then
stop_daemons="${stop_daemons}${d} "
elif [ -n "${ARG_DAEMONS}" ]
then
echo "${ME}: found no ${d} process running."
fi
done
STOP_DAEMONS=${stop_daemons}
;;
esac
# stop daemons
for d in $STOP_DAEMONS
do
echo -n "${ME}: Stopping ${d} ... "
pidfile=${STATEDIR}/${d}.pid
if [ -f "${pidfile}" ]
then
file_pid=$(cat ${pidfile})
if [ -z "${file_pid}" ]
then
echo -n "no pid file entry found ... "
fi
else
file_pid=
echo -n "no pid file found ... "
fi
proc_pid=$(pidof ${d})
if [ -z "${proc_pid}" ]
then
echo -n "found no ${d} process running ... "
else
count=0
notinpidfile=
for p in ${proc_pid}
do
count=$((${count}+1))
if kill ${p}
then
echo -n "killed ${p} ... "
else
echo -n "failed to kill ${p} ... "
fi
[ "${p}" = "${file_pid}" ] \
|| notinpidfile="${notinpidfile} ${p}"
done
[ ${count} -le 1 ] \
|| echo -n "WARNING: ${count} ${d} processes were found running ... "
for n in ${notinpidfile}
do
echo -n "WARNING: process ${n} was not in pid file ... "
done
fi
count=0
survivors=$(pidof ${d})
while [ -n "${survivors}" ]
do
sleep 1
count=$((${count}+1))
survivors=$(pidof ${d})
[ -z "${survivors}" -o ${count} -gt 5 ] && break
for p in ${survivors}
do
sleep 1
echo -n "${p} "
kill ${p}
done
done
survivors=$(pidof ${d})
[ -n "${survivors}" ] && \
if kill -KILL ${survivors}
then
echo -n "KILLed ${survivors} ... "
else
echo -n "failed to KILL ${survivors} ... "
fi
sleep 1
survivors=$(pidof ${d})
if [ -z "${survivors}" ]
then
echo -n "done."
if [ -f "${pidfile}" ]
then
rm -f ${pidfile} \
|| echo -n " Failed to remove pidfile."
fi
else
echo -n "failed to stop ${survivors} - giving up."
if [ "${survivors}" != "${file_pid}" ]
then
if echo "${survivors}" > ${pidfile}
then
chown ${RUNUSER}:${RUNGROUP} ${pidfile}
echo -n " Wrote ${survivors} to pidfile."
else
echo -n " Failed to write ${survivors} to pidfile."
fi
fi
fi
echo
done
# start daemons
if [ -n "$START_DAEMONS" ]
then
[ -d ${CONFDIR} ] \
|| quit "${ME}: no config directory ${CONFDIR} - exiting."
chown -R ${RUNUSER}:${RUNGROUP} ${CONFDIR}
[ -d ${STATEDIR} ] || mkdir -p ${STATEDIR} \
|| die "${ME}: could not create state directory ${STATEDIR} - exiting."
chown -R ${RUNUSER}:${RUNGROUP} ${STATEDIR}
for d in $START_DAEMONS
do
echo -n "${ME}: Starting ${d} ... "
proc_pid=$(pidof ${d})
pidfile=${STATEDIR}/${d}.pid
file_pid=
if [ -f "${pidfile}" ]
then
file_pid=$(cat ${pidfile})
if [ -n "${file_pid}" ]
then
echo -n "found old pid file entry ${file_pid} ... "
fi
fi
if [ -n "${proc_pid}" ]
then
echo -n "found ${d} running (${proc_pid}) - skipping ${d}."
if [ "${proc_pid}" != "${file_pid}" ]
then
if echo "${proc_pid}" > ${pidfile}
then
chown ${RUNUSER}:${RUNGROUP} ${pidfile}
echo -n " Wrote ${proc_pid} to pidfile."
else
echo -n " Failed to write ${proc_pid} to pidfile."
fi
fi
elif rm -f "${pidfile}"
then
if [ "${d}" = "watchquagga" ]
then
"${BINDIR}/${d}" \
${WATCHQUAGGA_FLAGS} \
"${WATCHQUAGGA_CMD}" \
${WATCHQUAGGA_DAEMONS}
status=$?
else
"${BINDIR}/${d}" ${DAEMON_FLAGS}
status=$?
fi
if [ $status -eq 0 ]
then
echo -n "done."
else
echo -n "failed."
fi
else
echo -n " failed to remove pidfile."
fi
echo
done
fi

7
quagga/files/quagga.conf Normal file
View file

@ -0,0 +1,7 @@
password zebra
!
access-list vty permit 127.0.0.0/8
access-list vty deny any
!
line vty
access-class vty

11
quagga/files/quagga.init Normal file
View file

@ -0,0 +1,11 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=60
start() {
/usr/sbin/quagga.init start
}
stop() {
/usr/sbin/quagga.init stop
}

View file

@ -0,0 +1,243 @@
--- a/lib/log.c
+++ b/lib/log.c
@@ -925,13 +925,19 @@ proto_redistnum(int afi, const char *s)
return ZEBRA_ROUTE_STATIC;
else if (strncmp (s, "r", 1) == 0)
return ZEBRA_ROUTE_RIP;
- else if (strncmp (s, "o", 1) == 0)
+ else if (strncmp (s, "os", 2) == 0)
return ZEBRA_ROUTE_OSPF;
else if (strncmp (s, "i", 1) == 0)
return ZEBRA_ROUTE_ISIS;
else if (strncmp (s, "bg", 2) == 0)
return ZEBRA_ROUTE_BGP;
- else if (strncmp (s, "ba", 2) == 0)
+ else if (strncmp (s, "h", 1) == 0)
+ return ZEBRA_ROUTE_HSLS;
+ else if (strncmp (s, "ol", 2) == 0)
+ return ZEBRA_ROUTE_OLSR;
+ else if (strncmp (s, "bat", 3) == 0)
+ return ZEBRA_ROUTE_BATMAN;
+ else if (strncmp (s, "bab", 3) == 0)
return ZEBRA_ROUTE_BABEL;
}
if (afi == AFI_IP6)
@@ -944,13 +950,19 @@ proto_redistnum(int afi, const char *s)
return ZEBRA_ROUTE_STATIC;
else if (strncmp (s, "r", 1) == 0)
return ZEBRA_ROUTE_RIPNG;
- else if (strncmp (s, "o", 1) == 0)
+ else if (strncmp (s, "os", 2) == 0)
return ZEBRA_ROUTE_OSPF6;
else if (strncmp (s, "i", 1) == 0)
return ZEBRA_ROUTE_ISIS;
else if (strncmp (s, "bg", 2) == 0)
return ZEBRA_ROUTE_BGP;
- else if (strncmp (s, "ba", 2) == 0)
+ else if (strncmp (s, "h", 1) == 0)
+ return ZEBRA_ROUTE_HSLS;
+ else if (strncmp (s, "ol", 2) == 0)
+ return ZEBRA_ROUTE_OLSR;
+ else if (strncmp (s, "bat", 3) == 0)
+ return ZEBRA_ROUTE_BATMAN;
+ else if (strncmp (s, "bab", 3) == 0)
return ZEBRA_ROUTE_BABEL;
}
return -1;
--- a/lib/route_types.txt
+++ b/lib/route_types.txt
@@ -51,13 +51,9 @@ ZEBRA_ROUTE_OSPF, ospf, ospfd
ZEBRA_ROUTE_OSPF6, ospf6, ospf6d, 'O', 0, 1, "OSPFv6"
ZEBRA_ROUTE_ISIS, isis, isisd, 'I', 1, 1, "IS-IS"
ZEBRA_ROUTE_BGP, bgp, bgpd, 'B', 1, 1, "BGP"
-# HSLS and OLSR both are AFI independent (so: 1, 1), however
-# we want to disable for them for general Quagga distribution.
-# This at least makes it trivial for users of these protocols
-# to 'switch on' redist support (direct numeric entry remaining
-# possible).
-ZEBRA_ROUTE_HSLS, hsls, hslsd, 'H', 0, 0, "HSLS"
-ZEBRA_ROUTE_OLSR, olsr, olsrd, 'o', 0, 0, "OLSR"
+ZEBRA_ROUTE_HSLS, hsls, hslsd, 'H', 1, 1, "HSLS"
+ZEBRA_ROUTE_OLSR, olsr, olsrd, 'o', 1, 1, "OLSR"
+ZEBRA_ROUTE_BATMAN, batman, batmand,'b', 1, 1, "BATMAN"
ZEBRA_ROUTE_BABEL, babel, babeld, 'A', 1, 1, "Babel"
## help strings
@@ -72,5 +68,6 @@ ZEBRA_ROUTE_OSPF6, "Open Shortest Path
ZEBRA_ROUTE_ISIS, "Intermediate System to Intermediate System (IS-IS)"
ZEBRA_ROUTE_BGP, "Border Gateway Protocol (BGP)"
ZEBRA_ROUTE_HSLS, "Hazy-Sighted Link State Protocol (HSLS)"
-ZEBRA_ROUTE_OLSR, "Optimised Link State Routing (OLSR)"
+ZEBRA_ROUTE_OLSR, "Optimized Link State Routing (OLSR)"
+ZEBRA_ROUTE_BATMAN, "Better Approach to Mobile Ad-Hoc Networking (BATMAN)"
ZEBRA_ROUTE_BABEL, "Babel routing protocol (Babel)"
--- a/ripd/rip_zebra.c
+++ b/ripd/rip_zebra.c
@@ -206,9 +206,12 @@ static struct {
{ZEBRA_ROUTE_KERNEL, 1, "kernel"},
{ZEBRA_ROUTE_CONNECT, 1, "connected"},
{ZEBRA_ROUTE_STATIC, 1, "static"},
- {ZEBRA_ROUTE_OSPF, 1, "ospf"},
+ {ZEBRA_ROUTE_OSPF, 2, "ospf"},
{ZEBRA_ROUTE_BGP, 2, "bgp"},
- {ZEBRA_ROUTE_BABEL, 2, "babel"},
+ {ZEBRA_ROUTE_HSLS, 1, "hsls"},
+ {ZEBRA_ROUTE_OLSR, 2, "olsr"},
+ {ZEBRA_ROUTE_BATMAN, 3, "batman"},
+ {ZEBRA_ROUTE_BABEL, 3, "babel"},
{0, 0, NULL}
};
--- a/ripngd/ripng_zebra.c
+++ b/ripngd/ripng_zebra.c
@@ -216,9 +216,12 @@ static struct {
{ZEBRA_ROUTE_KERNEL, 1, "kernel"},
{ZEBRA_ROUTE_CONNECT, 1, "connected"},
{ZEBRA_ROUTE_STATIC, 1, "static"},
- {ZEBRA_ROUTE_OSPF6, 1, "ospf6"},
+ {ZEBRA_ROUTE_OSPF6, 2, "ospf6"},
{ZEBRA_ROUTE_BGP, 2, "bgp"},
- {ZEBRA_ROUTE_BABEL, 2, "babel"},
+ {ZEBRA_ROUTE_HSLS, 1, "hsls"},
+ {ZEBRA_ROUTE_OLSR, 2, "olsr"},
+ {ZEBRA_ROUTE_BATMAN, 3, "batman"},
+ {ZEBRA_ROUTE_BABEL, 3, "babel"},
{0, 0, NULL}
};
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -1609,6 +1609,9 @@ netlink_route_multipath (int cmd, struct
addattr_l (&req.n, sizeof req, RTA_PREFSRC,
&nexthop->src.ipv4, bytelen);
+ if (rib->type == ZEBRA_ROUTE_OLSR)
+ req.r.rtm_scope = RT_SCOPE_LINK;
+
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug("netlink_route_multipath() (single hop): "
"nexthop via if %u", nexthop->ifindex);
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -68,6 +68,9 @@ static const struct
[ZEBRA_ROUTE_OSPF6] = {ZEBRA_ROUTE_OSPF6, 110},
[ZEBRA_ROUTE_ISIS] = {ZEBRA_ROUTE_ISIS, 115},
[ZEBRA_ROUTE_BGP] = {ZEBRA_ROUTE_BGP, 20 /* IBGP is 200. */},
+ [ZEBRA_ROUTE_HSLS] = {ZEBRA_ROUTE_HSLS, 0},
+ [ZEBRA_ROUTE_OLSR] = {ZEBRA_ROUTE_OLSR, 0},
+ [ZEBRA_ROUTE_BATMAN] = {ZEBRA_ROUTE_BATMAN, 0},
[ZEBRA_ROUTE_BABEL] = {ZEBRA_ROUTE_BABEL, 95},
/* no entry/default: 150 */
};
@@ -456,6 +459,18 @@ nexthop_active_ipv4 (struct rib *rib, st
}
return 0;
}
+ else if (match->type == ZEBRA_ROUTE_OLSR)
+ {
+ for (newhop = match->nexthop; newhop; newhop = newhop->next)
+ if (CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_FIB)
+ && newhop->type == NEXTHOP_TYPE_IFINDEX)
+ {
+ if (nexthop->type == NEXTHOP_TYPE_IPV4)
+ nexthop->ifindex = newhop->ifindex;
+ return 1;
+ }
+ return 0;
+ }
else
{
return 0;
@@ -560,6 +575,18 @@ nexthop_active_ipv6 (struct rib *rib, st
}
return 0;
}
+ else if (match->type == ZEBRA_ROUTE_OLSR)
+ {
+ for (newhop = match->nexthop; newhop; newhop = newhop->next)
+ if (CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_FIB)
+ && newhop->type == NEXTHOP_TYPE_IFINDEX)
+ {
+ if (nexthop->type == NEXTHOP_TYPE_IPV6)
+ nexthop->ifindex = newhop->ifindex;
+ return 1;
+ }
+ return 0;
+ }
else
{
return 0;
@@ -1376,6 +1403,8 @@ static const u_char meta_queue_map[ZEBRA
[ZEBRA_ROUTE_ISIS] = 2,
[ZEBRA_ROUTE_BGP] = 3,
[ZEBRA_ROUTE_HSLS] = 4,
+ [ZEBRA_ROUTE_OLSR] = 4,
+ [ZEBRA_ROUTE_BATMAN] = 4,
[ZEBRA_ROUTE_BABEL] = 2,
};
--- a/zebra/zebra_snmp.c
+++ b/zebra/zebra_snmp.c
@@ -245,6 +245,12 @@ proto_trans(int type)
return 1; /* shouldn't happen */
case ZEBRA_ROUTE_BGP:
return 14; /* bgp */
+ case ZEBRA_ROUTE_HSLS:
+ return 1; /* other */
+ case ZEBRA_ROUTE_OLSR:
+ return 1; /* other */
+ case ZEBRA_ROUTE_BATMAN:
+ return 1; /* other */
default:
return 1; /* other */
}
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -558,7 +558,10 @@ vty_show_ip_route_detail (struct vty *vt
|| rib->type == ZEBRA_ROUTE_OSPF
|| rib->type == ZEBRA_ROUTE_BABEL
|| rib->type == ZEBRA_ROUTE_ISIS
- || rib->type == ZEBRA_ROUTE_BGP)
+ || rib->type == ZEBRA_ROUTE_BGP
+ || rib->type == ZEBRA_ROUTE_HSLS
+ || rib->type == ZEBRA_ROUTE_OLSR
+ || rib->type == ZEBRA_ROUTE_BATMAN)
{
time_t uptime;
struct tm *tm;
@@ -777,7 +780,10 @@ vty_show_ip_route (struct vty *vty, stru
|| rib->type == ZEBRA_ROUTE_OSPF
|| rib->type == ZEBRA_ROUTE_BABEL
|| rib->type == ZEBRA_ROUTE_ISIS
- || rib->type == ZEBRA_ROUTE_BGP)
+ || rib->type == ZEBRA_ROUTE_BGP
+ || rib->type == ZEBRA_ROUTE_HSLS
+ || rib->type == ZEBRA_ROUTE_OLSR
+ || rib->type == ZEBRA_ROUTE_BATMAN)
{
time_t uptime;
struct tm *tm;
@@ -1570,7 +1576,10 @@ vty_show_ipv6_route_detail (struct vty *
|| rib->type == ZEBRA_ROUTE_OSPF6
|| rib->type == ZEBRA_ROUTE_BABEL
|| rib->type == ZEBRA_ROUTE_ISIS
- || rib->type == ZEBRA_ROUTE_BGP)
+ || rib->type == ZEBRA_ROUTE_BGP
+ || rib->type == ZEBRA_ROUTE_HSLS
+ || rib->type == ZEBRA_ROUTE_OLSR
+ || rib->type == ZEBRA_ROUTE_BATMAN)
{
time_t uptime;
struct tm *tm;
@@ -1750,7 +1759,10 @@ vty_show_ipv6_route (struct vty *vty, st
|| rib->type == ZEBRA_ROUTE_OSPF6
|| rib->type == ZEBRA_ROUTE_BABEL
|| rib->type == ZEBRA_ROUTE_ISIS
- || rib->type == ZEBRA_ROUTE_BGP)
+ || rib->type == ZEBRA_ROUTE_BGP
+ || rib->type == ZEBRA_ROUTE_HSLS
+ || rib->type == ZEBRA_ROUTE_OLSR
+ || rib->type == ZEBRA_ROUTE_BATMAN)
{
time_t uptime;
struct tm *tm;

View file

@ -0,0 +1,22 @@
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -193,8 +193,7 @@ bgp_accept (struct thread *thread)
peer->fd = bgp_sock;
peer->status = Active;
peer->local_id = peer1->local_id;
- peer->v_holdtime = peer1->v_holdtime;
- peer->v_keepalive = peer1->v_keepalive;
+ peer->v_holdtime = BGP_LARGE_HOLDTIME;
/* Make peer's address string. */
sockunion2str (&su, buf, SU_ADDRSTRLEN);
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -732,6 +732,7 @@ struct bgp_nlri
/* BGP timers default value. */
#define BGP_INIT_START_TIMER 5
#define BGP_ERROR_START_TIMER 30
+#define BGP_LARGE_HOLDTIME 240
#define BGP_DEFAULT_HOLDTIME 180
#define BGP_DEFAULT_KEEPALIVE 60
#define BGP_DEFAULT_ASORIGINATE 15

View file

@ -0,0 +1,40 @@
--- a/lib/command.c
+++ b/lib/command.c
@@ -2527,6 +2527,13 @@ DEFUN (config_write_file,
VTY_NEWLINE);
goto finished;
}
+
+#if 0
+ /* This code fails on UNION MOUNTs and similar filesystems if the
+ * config file is still on the RO layer. Hardlinks across layers
+ * will not work and cause quagga to fail saving the configuration...
+ * should use rename() to move files around...
+ */
if (link (config_file, config_file_sav) != 0)
{
vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav,
@@ -2540,7 +2547,23 @@ DEFUN (config_write_file,
VTY_NEWLINE);
goto finished;
}
+#else
+ /* And this is the code that hopefully does work */
+ if (rename (config_file, config_file_sav) != 0)
+ {
+ vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav,
+ VTY_NEWLINE);
+ goto finished;
+ }
+ sync ();
+#endif
+
+#if 0
+ /* same here. Please no cross-filesystem hardlinks... */
if (link (config_file_tmp, config_file) != 0)
+#else
+ if (rename (config_file_tmp, config_file) != 0)
+#endif
{
vty_out (vty, "Can't save configuration file %s.%s", config_file,
VTY_NEWLINE);

View file

@ -0,0 +1,29 @@
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -268,7 +268,7 @@ vtysh_pager_init (void)
if (pager_defined)
vtysh_pager_name = strdup (pager_defined);
else
- vtysh_pager_name = strdup ("more");
+ vtysh_pager_name = strdup ("cat");
}
/* Command execution over the vty interface. */
@@ -1884,7 +1884,7 @@ DEFUN (vtysh_terminal_length,
{
int lines;
char *endptr = NULL;
- char default_pager[10];
+ char default_pager[12];
lines = strtol (argv[0], &endptr, 10);
if (lines < 0 || lines > 512 || *endptr != '\0')
@@ -1901,7 +1901,7 @@ DEFUN (vtysh_terminal_length,
if (lines != 0)
{
- snprintf(default_pager, 10, "more -%i", lines);
+ snprintf(default_pager, 12, "head -n %i", lines);
vtysh_pager_name = strdup (default_pager);
}