+++ /dev/null
-#
-# 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))
+++ /dev/null
-#!/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
+++ /dev/null
-password zebra
-!
-access-list vty permit 127.0.0.0/8
-access-list vty deny any
-!
-line vty
- access-class vty
+++ /dev/null
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2006 OpenWrt.org
-
-START=60
-start() {
- /usr/sbin/quagga.init start
-}
-
-stop() {
- /usr/sbin/quagga.init stop
-}
+++ /dev/null
---- 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;
+++ /dev/null
---- 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
+++ /dev/null
---- 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);
+++ /dev/null
---- 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);
- }
-
--- /dev/null
+#
+# 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))
--- /dev/null
+#!/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
--- /dev/null
+password zebra
+!
+access-list vty permit 127.0.0.0/8
+access-list vty deny any
+!
+line vty
+ access-class vty
--- /dev/null
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=60
+start() {
+ /usr/sbin/quagga.init start
+}
+
+stop() {
+ /usr/sbin/quagga.init stop
+}
--- /dev/null
+--- 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;
--- /dev/null
+--- 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
--- /dev/null
+--- 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);
--- /dev/null
+--- 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);
+ }
+