From 4cab09d37d3361a8df9b21a697756d8461aa8eb6 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 7 Aug 2006 09:53:12 +0000 Subject: [PATCH 001/117] Port quagga to -ng git-svn-id: https://svn.openwrt.org/openwrt@4502 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 188 +++++++++++++++++++ files/quagga.init | 333 ++++++++++++++++++++++++++++++++++ patches/quagga-cross.patch | 84 +++++++++ patches/quagga-readline.patch | 58 ++++++ 4 files changed, 663 insertions(+) create mode 100644 Makefile create mode 100644 files/quagga.init create mode 100644 patches/quagga-cross.patch create mode 100644 patches/quagga-readline.patch diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4236842 --- /dev/null +++ b/Makefile @@ -0,0 +1,188 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=quagga +PKG_VERSION:=0.98.5 +PKG_RELEASE:=1 +PKG_MD5SUM:=ec09c1ec624aea98e18aa19282666784 + +PKG_SOURCE_URL:=http://www.quagga.net/download/ \ + http://www.de.quagga.net/download/ \ + http://www.uk.quagga.net/download/ +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/quagga + SECTION:=net + CATEGORY:=Network + TITLE:=The Quagga Software Routing Suite + 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+\\\ + URL:=http://www.quagga.net + MENU:=1 +endef + +define Package/quagga-libzebra + SECTION:=net + CATEGORY:=Network + DEPENDS:=quagga + TITLE:=zebra library +endef + +define Package/quagga-libospf + SECTION:=net + CATEGORY:=Network + DEPENDS:=quagga + TITLE:=OSPF library +endef + +define Package/quagga-bgpd + SECTION:=net + CATEGORY:=Network + DEPENDS:=quagga + TITLE:=BGPv4, BGPv4+, BGPv4- routing engine +endef + +define Package/quagga-isisd + SECTION:=net + CATEGORY:=Network + DEPENDS:=quagga + TITLE:=IS-IS routing engine +endef + +define Package/quagga-ospfd + SECTION:=net + CATEGORY:=Network + DEPENDS:=quagga quagga-libospf + TITLE:=OSPFv2 routing engine +endef + +define Package/quagga-ospf6d + SECTION:=net + CATEGORY:=Network + DEPENDS:=quagga quagga-libospf + TITLE:=OSPFv3 routing engine +endef + +define Package/quagga-ripd + SECTION:=net + CATEGORY:=Network + DEPENDS:=quagga + TITLE:=RIP routing engine +endef + +define Package/quagga-ripngd + SECTION:=net + CATEGORY:=Network + DEPENDS:=quagga + TITLE:=RIPNG routing engine +endef + +define Package/quagga-vtysh + SECTION:=net + CATEGORY:=Network + DEPENDS:=quagga +libreadline +libncurses + TITLE:=integrated shell for Quagga routing software +endef + +define Build/Configure +$(call Build/Configure/Default, --enable-shared \ + --disable-static \ + --enable-ipv6 \ + --enable-vtysh \ + --enable-user=quagga \ + --enable-group=quagga \ + --enable-multipath=8 \ + --enable-isisd) +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR=$(PKG_INSTALL_DIR) \ + all install +endef + +define Package/quagga/install + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(1)/usr/sbin/ + # avoid /etc being set to 0750 + install -d -m0755 $(1)/etc/quagga/ + chmod 0750 $(1)/etc/quagga/ + install -d -m0755 $(1)/etc/init.d/ + install -m0755 ./files/quagga.init $(1)/etc/init.d/quagga + ln -sf quagga $(1)/etc/init.d/S49quagga + install -d -m0755 $(1)/var/run/quagga +endef + +define Package/quagga-bgpd/install + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/ +endef + +define Package/quagga-isisd/install + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin +endef + +define Package/quagga-ospfd/install + install -d -m0755 $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(1)/usr/lib/ + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/ +endef + +define Package/quagga-ospf6d/install + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(1)/usr/sbin/ +endef + +define Package/quagga-ripd/install + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(1)/usr/sbin/ +endef + +define Package/quagga-ripngd/install + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(1)/usr/sbin/ +endef + +define Package/quagga-vtysh/install + install -d -m0755 $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/ +endef + +define Package/quagga-libospf/install + install -d -m0755 $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(1)/usr/lib/ +endef + +define Package/quagga-libzebra/install + install -d -m0755 $(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-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-vtysh)) diff --git a/files/quagga.init b/files/quagga.init new file mode 100644 index 0000000..01f8d71 --- /dev/null +++ b/files/quagga.init @@ -0,0 +1,333 @@ +#!/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 +DAEMONS="zebra ripd ripngd ospfd ospf6d bgpd" +DAEMON_FLAGS=-d +WATCHQUAGGA_FLAGS="-d -z -T 60 -R" +WATCHQUAGGA_CMD="$0 watchrestart" +if [ ${COMMAND} != "watchrestart" ] +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 quagga:quagga ${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 quagga:quagga ${CONFDIR} + [ -d ${STATEDIR} ] || mkdir -p ${STATEDIR} \ + || die "${ME}: could not create state directory ${STATEDIR} - exiting." + chown -R quagga:quagga ${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 quagga:quagga ${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 diff --git a/patches/quagga-cross.patch b/patches/quagga-cross.patch new file mode 100644 index 0000000..5b8276b --- /dev/null +++ b/patches/quagga-cross.patch @@ -0,0 +1,84 @@ +--- quagga-0.98.4/configure.orig Mon Jun 27 19:05:31 2005 ++++ quagga-0.98.4/configure Mon Jul 11 20:32:07 2005 +@@ -12623,69 +12623,6 @@ + + + +-echo "$as_me:$LINENO: checking for broken CMSG_FIRSTHDR" >&5 +-echo $ECHO_N "checking for broken CMSG_FIRSTHDR... $ECHO_C" >&6 +-if test "$cross_compiling" = yes; then +- echo "$as_me:$LINENO: result: no" >&5 +-echo "${ECHO_T}no" >&6 +-else +- cat >conftest.$ac_ext <<_ACEOF +-/* confdefs.h. */ +-_ACEOF +-cat confdefs.h >>conftest.$ac_ext +-cat >>conftest.$ac_ext <<_ACEOF +-/* end confdefs.h. */ +- +-#ifdef SUNOS_5 +-#define _XPG4_2 +-#define __EXTENSIONS__ +-#endif +-#include +-#include +-#include +- +-main() +-{ +- struct msghdr msg; +- char buf[4]; +- +- msg.msg_control = buf; +- msg.msg_controllen = 0; +- +- if (CMSG_FIRSTHDR(&msg) != NULL) +- exit(0); +- exit (1); +-} +-_ACEOF +-rm -f conftest$ac_exeext +-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 +- ac_status=$? +- echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' +- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +- (eval $ac_try) 2>&5 +- ac_status=$? +- echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); }; }; then +- echo "$as_me:$LINENO: result: yes - using workaround" >&5 +-echo "${ECHO_T}yes - using workaround" >&6 +-cat >>confdefs.h <<\_ACEOF +-#define HAVE_BROKEN_CMSG_FIRSTHDR +-_ACEOF +- +-else +- echo "$as_me: program exited with status $ac_status" >&5 +-echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +-( exit $ac_status ) +-echo "$as_me:$LINENO: result: no" >&5 +-echo "${ECHO_T}no" >&6 +-fi +-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +-fi +- + echo "$as_me:$LINENO: checking route read method check" >&5 + echo $ECHO_N "checking route read method check... $ECHO_C" >&6 + if test "${zebra_rtread+set}" = set; then +@@ -12783,10 +12720,7 @@ + if test "${zebra_ipforward_path+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null; +-do +- test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break +-done ++ zebra_ipforward_path="/proc/net/snmp" + case $zebra_ipforward_path in + "/proc/net/snmp") IPFORWARD=ipforward_proc.o + zebra_ipforward_path="proc";; diff --git a/patches/quagga-readline.patch b/patches/quagga-readline.patch new file mode 100644 index 0000000..8e3b805 --- /dev/null +++ b/patches/quagga-readline.patch @@ -0,0 +1,58 @@ +--- quagga-0.98.4/configure.orig Mon Jun 27 19:05:31 2005 ++++ quagga-0.98.4/configure Thu Jul 28 07:02:12 2005 +@@ -10937,7 +10937,7 @@ + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_check_lib_save_LIBS=$LIBS +-LIBS="-lcurses $LIBS" ++#LIBS="-lcurses $LIBS" + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF +@@ -11071,7 +11071,8 @@ + #define HAVE_LIBNCURSES 1 + _ACEOF + +- LIBS="-lncurses $LIBS" ++# LIBS="-lncurses $LIBS" ++CURSES=-lncurses + + fi + +@@ -11088,7 +11089,7 @@ + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_check_lib_save_LIBS=$LIBS +-LIBS="-lreadline $LIBS" ++LIBS="-lreadline $CURSES $LIBS" + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF +@@ -11144,7 +11145,8 @@ + #define HAVE_LIBREADLINE 1 + _ACEOF + +- LIBS="-lreadline $LIBS" ++# LIBS="-lreadline $LIBS" ++CURSES="$CURSES -lreadline" + + fi + +@@ -11303,7 +11305,7 @@ + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_check_lib_save_LIBS=$LIBS +-LIBS="-lreadline $LIBS" ++LIBS="-lreadline $CURSES $LIBS" + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF +@@ -11365,7 +11367,7 @@ + #define HAVE_LIBREADLINE 1 + _ACEOF + +- LIBS="-lreadline $LIBS" ++# LIBS="-lreadline $LIBS" + + fi + From d9e2f611b0e0eff9cf53f5f0f9ca12af50b6589a Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 25 Aug 2006 07:42:55 +0000 Subject: [PATCH 002/117] Update quagga to 0.98.6 for -ng, and fix MD5SUM in whiterussian :) git-svn-id: https://svn.openwrt.org/openwrt@4657 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4236842..eb733bc 100644 --- a/Makefile +++ b/Makefile @@ -9,9 +9,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga -PKG_VERSION:=0.98.5 +PKG_VERSION:=0.98.6 PKG_RELEASE:=1 -PKG_MD5SUM:=ec09c1ec624aea98e18aa19282666784 +PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 PKG_SOURCE_URL:=http://www.quagga.net/download/ \ http://www.de.quagga.net/download/ \ From 992774ad23696848397d68af3ee5f090146e0043 Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 15 Oct 2006 21:03:30 +0000 Subject: [PATCH 003/117] init script cleanup, use /etc/rc.d/ for enabled scripts, /etc/init.d/ (enable|disable) manages symlinks git-svn-id: https://svn.openwrt.org/openwrt@5128 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- files/quagga | 333 +++++++++++++++++++++++++++++++++++++++++++++ files/quagga.init | 336 +--------------------------------------------- 3 files changed, 341 insertions(+), 330 deletions(-) create mode 100644 files/quagga diff --git a/Makefile b/Makefile index eb733bc..33bb2e1 100644 --- a/Makefile +++ b/Makefile @@ -124,8 +124,8 @@ define Package/quagga/install install -d -m0755 $(1)/etc/quagga/ chmod 0750 $(1)/etc/quagga/ install -d -m0755 $(1)/etc/init.d/ + install -m0755 ./files/quagga $(1)/usr/sbin/quagga.init install -m0755 ./files/quagga.init $(1)/etc/init.d/quagga - ln -sf quagga $(1)/etc/init.d/S49quagga install -d -m0755 $(1)/var/run/quagga endef diff --git a/files/quagga b/files/quagga new file mode 100644 index 0000000..01f8d71 --- /dev/null +++ b/files/quagga @@ -0,0 +1,333 @@ +#!/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 +DAEMONS="zebra ripd ripngd ospfd ospf6d bgpd" +DAEMON_FLAGS=-d +WATCHQUAGGA_FLAGS="-d -z -T 60 -R" +WATCHQUAGGA_CMD="$0 watchrestart" +if [ ${COMMAND} != "watchrestart" ] +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 quagga:quagga ${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 quagga:quagga ${CONFDIR} + [ -d ${STATEDIR} ] || mkdir -p ${STATEDIR} \ + || die "${ME}: could not create state directory ${STATEDIR} - exiting." + chown -R quagga:quagga ${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 quagga:quagga ${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 diff --git a/files/quagga.init b/files/quagga.init index 01f8d71..21fbf2c 100644 --- a/files/quagga.init +++ b/files/quagga.init @@ -1,333 +1,11 @@ -#!/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. -# +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org -ME=$(basename $0) - -usage() { - echo "Usage: ${ME} {start|stop|restart} [daemon ...]" - exit 2 +START=60 +start() { + /usr/sbin/quagga.init start } -if [ -z "$1" ] -then - usage -else - COMMAND=$1 -fi -shift -ARG_DAEMONS=$* -BINDIR=/usr/sbin -CONFDIR=/etc/quagga -STATEDIR=/var/run/quagga -DAEMONS="zebra ripd ripngd ospfd ospf6d bgpd" -DAEMON_FLAGS=-d -WATCHQUAGGA_FLAGS="-d -z -T 60 -R" -WATCHQUAGGA_CMD="$0 watchrestart" -if [ ${COMMAND} != "watchrestart" ] -then - DAEMONS="${DAEMONS} watchquagga" -fi -DAEMONS_STARTSEQ=${DAEMONS} - -reverse() -{ - local revlist r - revlist= - for r - do - revlist="$r $revlist" - done - echo $revlist +stop() { + /usr/sbin/quagga.init stop } - -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 quagga:quagga ${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 quagga:quagga ${CONFDIR} - [ -d ${STATEDIR} ] || mkdir -p ${STATEDIR} \ - || die "${ME}: could not create state directory ${STATEDIR} - exiting." - chown -R quagga:quagga ${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 quagga:quagga ${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 From 2bc4c2c645472fd4182044bdbcdcaaf844a48316 Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 24 Oct 2006 14:17:04 +0000 Subject: [PATCH 004/117] add patch from #873 git-svn-id: https://svn.openwrt.org/openwrt@5281 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 33bb2e1..e72fb68 100644 --- a/Makefile +++ b/Makefile @@ -100,14 +100,17 @@ define Package/quagga-vtysh endef define Build/Configure -$(call Build/Configure/Default, --enable-shared \ + $(call Build/Configure/Default, \ + --sysconfdir=/etc/quagga/ \ + --enable-shared \ --disable-static \ --enable-ipv6 \ --enable-vtysh \ --enable-user=quagga \ --enable-group=quagga \ --enable-multipath=8 \ - --enable-isisd) + --enable-isisd \ + ) endef define Build/Compile @@ -129,6 +132,54 @@ define Package/quagga/install install -d -m0755 $(1)/var/run/quagga endef +define Package/quagga/postinst +#!/bin/sh + +name=quagga +id=51 + +# do not change below +# check if we are on real system +if [ -z "$${IPKG_INSTROOT}" ]; then + # create copies of passwd and group, if we use squashfs + rootfs=`mount |awk '/root/ { print $$5 }'` + if [ "$$rootfs" = "squashfs" ]; then + if [ -h /etc/group ]; then + rm /etc/group + cp /rom/etc/group /etc/group + fi + if [ -h /etc/passwd ]; then + rm /etc/passwd + cp /rom/etc/passwd /etc/passwd + fi + fi +fi + +echo "" +if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then + echo "adding group $$name to /etc/group" + echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group +fi + +if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then + echo "adding user $$name to /etc/passwd" + echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd +fi + +grep -q '^zebra[[:space:]]*2601/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null +if [ $$? -ne 0 ]; then +echo "zebrasrv 2600/tcp" >>$${IPKG_INSTROOT}/etc/services +echo "zebra 2601/tcp" >>$${IPKG_INSTROOT}/etc/services +echo "ripd 2602/tcp" >>$${IPKG_INSTROOT}/etc/services +echo "ripngd 2603/tcp" >>$${IPKG_INSTROOT}/etc/services +echo "ospfd 2604/tcp" >>$${IPKG_INSTROOT}/etc/services +echo "bgpd 2605/tcp" >>$${IPKG_INSTROOT}/etc/services +echo "ospf6d 2606/tcp" >>$${IPKG_INSTROOT}/etc/services +echo "ospfapi 2607/tcp" >>$${IPKG_INSTROOT}/etc/services +echo "isisd 2608/tcp" >>$${IPKG_INSTROOT}/etc/services +fi +endef + define Package/quagga-bgpd/install install -d -m0755 $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/ From e9ea244d219444b2a297fd2119ad3855e37d37c6 Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 23 Nov 2006 00:29:07 +0000 Subject: [PATCH 005/117] replace lots of manual install commands with INSTALL_* variables git-svn-id: https://svn.openwrt.org/openwrt@5624 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index e72fb68..8fd7708 100644 --- a/Makefile +++ b/Makefile @@ -120,16 +120,16 @@ define Build/Compile endef define Package/quagga/install - install -d -m0755 $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(1)/usr/sbin/ # avoid /etc being set to 0750 - install -d -m0755 $(1)/etc/quagga/ + $(INSTALL_DIR) $(1)/etc/quagga/ chmod 0750 $(1)/etc/quagga/ - install -d -m0755 $(1)/etc/init.d/ - install -m0755 ./files/quagga $(1)/usr/sbin/quagga.init - install -m0755 ./files/quagga.init $(1)/etc/init.d/quagga - install -d -m0755 $(1)/var/run/quagga + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/quagga $(1)/usr/sbin/quagga.init + $(INSTALL_BIN) ./files/quagga.init $(1)/etc/init.d/quagga + $(INSTALL_DIR) $(1)/var/run/quagga endef define Package/quagga/postinst @@ -181,49 +181,49 @@ fi endef define Package/quagga-bgpd/install - install -d -m0755 $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/ endef define Package/quagga-isisd/install - install -d -m0755 $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin endef define Package/quagga-ospfd/install - install -d -m0755 $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(1)/usr/lib/ - install -d -m0755 $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/ endef define Package/quagga-ospf6d/install - install -d -m0755 $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(1)/usr/sbin/ endef define Package/quagga-ripd/install - install -d -m0755 $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(1)/usr/sbin/ endef define Package/quagga-ripngd/install - install -d -m0755 $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(1)/usr/sbin/ endef define Package/quagga-vtysh/install - install -d -m0755 $(1)/usr/bin + $(INSTALL_DIR) $(1)/usr/bin $(CP) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/ endef define Package/quagga-libospf/install - install -d -m0755 $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(1)/usr/lib/ endef define Package/quagga-libzebra/install - install -d -m0755 $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(1)/usr/lib endef From 2925c9e05cac6a42a63f693da720f18a5021e7fe Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 7 Dec 2006 21:18:21 +0000 Subject: [PATCH 006/117] Add libzebra dependencies (#1015) git-svn-id: https://svn.openwrt.org/openwrt@5716 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 8fd7708..c23f59c 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ endef define Package/quagga-bgpd SECTION:=net CATEGORY:=Network - DEPENDS:=quagga + DEPENDS:=quagga quagga-libzebra TITLE:=BGPv4, BGPv4+, BGPv4- routing engine endef @@ -67,35 +67,35 @@ endef define Package/quagga-ospfd SECTION:=net CATEGORY:=Network - DEPENDS:=quagga quagga-libospf + DEPENDS:=quagga quagga-libospf quagga-libzebra TITLE:=OSPFv2 routing engine endef define Package/quagga-ospf6d SECTION:=net CATEGORY:=Network - DEPENDS:=quagga quagga-libospf + DEPENDS:=quagga quagga-libospf quagga-libzebra TITLE:=OSPFv3 routing engine endef define Package/quagga-ripd SECTION:=net CATEGORY:=Network - DEPENDS:=quagga + DEPENDS:=quagga quagga-libzebra TITLE:=RIP routing engine endef define Package/quagga-ripngd SECTION:=net CATEGORY:=Network - DEPENDS:=quagga + DEPENDS:=quagga +quagga-libzebra TITLE:=RIPNG routing engine endef define Package/quagga-vtysh SECTION:=net CATEGORY:=Network - DEPENDS:=quagga +libreadline +libncurses + DEPENDS:=quagga quagga-libzebra +libreadline +libncurses TITLE:=integrated shell for Quagga routing software endef From 3ce9e21bda2527fe833d88f277f4e178500eee13 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 11 Jan 2007 17:28:45 +0000 Subject: [PATCH 007/117] Rename patches to match conventions, second round; *ouch* git-svn-id: https://svn.openwrt.org/openwrt@6081 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 1 + patches/{quagga-cross.patch => 01-quagga_cross.patch} | 0 patches/{quagga-readline.patch => 01-quagga_readline.patch} | 0 3 files changed, 1 insertion(+) rename patches/{quagga-cross.patch => 01-quagga_cross.patch} (100%) rename patches/{quagga-readline.patch => 01-quagga_readline.patch} (100%) diff --git a/Makefile b/Makefile index c23f59c..21cb357 100644 --- a/Makefile +++ b/Makefile @@ -101,6 +101,7 @@ endef define Build/Configure $(call Build/Configure/Default, \ + --localstatedir=/var/run/quagga \ --sysconfdir=/etc/quagga/ \ --enable-shared \ --disable-static \ diff --git a/patches/quagga-cross.patch b/patches/01-quagga_cross.patch similarity index 100% rename from patches/quagga-cross.patch rename to patches/01-quagga_cross.patch diff --git a/patches/quagga-readline.patch b/patches/01-quagga_readline.patch similarity index 100% rename from patches/quagga-readline.patch rename to patches/01-quagga_readline.patch From 2674e63e00138730190df6eb6bd4db68b0d5cecb Mon Sep 17 00:00:00 2001 From: pavlov Date: Mon, 5 Mar 2007 01:34:12 +0000 Subject: [PATCH 008/117] patch file cleanup... ick.. kaloz you owe me some love git-svn-id: https://svn.openwrt.org/openwrt@6526 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/{01-quagga_cross.patch => 001-quagga_cross.patch} | 0 patches/{01-quagga_readline.patch => 001-quagga_readline.patch} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename patches/{01-quagga_cross.patch => 001-quagga_cross.patch} (100%) rename patches/{01-quagga_readline.patch => 001-quagga_readline.patch} (100%) diff --git a/patches/01-quagga_cross.patch b/patches/001-quagga_cross.patch similarity index 100% rename from patches/01-quagga_cross.patch rename to patches/001-quagga_cross.patch diff --git a/patches/01-quagga_readline.patch b/patches/001-quagga_readline.patch similarity index 100% rename from patches/01-quagga_readline.patch rename to patches/001-quagga_readline.patch From a57c4f582a2fc6687176fa98ed597a47134c59bb Mon Sep 17 00:00:00 2001 From: ryd Date: Mon, 23 Apr 2007 22:45:11 +0000 Subject: [PATCH 009/117] add olsr patch for quagga git-svn-id: https://svn.openwrt.org/openwrt@7040 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/002-quagga_olsr.patch | 717 ++++++++++++++++++++++++++++++++++ 1 file changed, 717 insertions(+) create mode 100644 patches/002-quagga_olsr.patch diff --git a/patches/002-quagga_olsr.patch b/patches/002-quagga_olsr.patch new file mode 100644 index 0000000..81be34a --- /dev/null +++ b/patches/002-quagga_olsr.patch @@ -0,0 +1,717 @@ +diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c +--- quagga-0.98.6.orig/bgpd/bgp_vty.c 2006-03-30 18:12:25.000000000 +0200 ++++ quagga-0.98.6/bgpd/bgp_vty.c 2006-12-02 10:52:14.000000000 +0100 +@@ -7793,7 +7793,9 @@ + return ZEBRA_ROUTE_STATIC; + else if (strncmp (str, "r", 1) == 0) + return ZEBRA_ROUTE_RIP; +- else if (strncmp (str, "o", 1) == 0) ++ else if (strncmp (str, "ol", 2) == 0) ++ return ZEBRA_ROUTE_OLSR; ++ else if (strncmp (str, "os", 2) == 0) + return ZEBRA_ROUTE_OSPF; + } + if (afi == AFI_IP6) +@@ -7806,20 +7808,23 @@ + return ZEBRA_ROUTE_STATIC; + else if (strncmp (str, "r", 1) == 0) + return ZEBRA_ROUTE_RIPNG; +- else if (strncmp (str, "o", 1) == 0) ++ else if (strncmp (str, "os", 2) == 0) + return ZEBRA_ROUTE_OSPF6; ++ else if (strncmp (str, "ol", 2) == 0) ++ return ZEBRA_ROUTE_OLSR; + } + return 0; + } + + DEFUN (bgp_redistribute_ipv4, + bgp_redistribute_ipv4_cmd, +- "redistribute (connected|kernel|ospf|rip|static)", ++ "redistribute (connected|kernel|ospf|rip|static|olsr)", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" ++ "Optimized Link State Routing (OLSR)\n" + "Static routes\n") + { + int type; +@@ -7835,13 +7840,14 @@ + + DEFUN (bgp_redistribute_ipv4_rmap, + bgp_redistribute_ipv4_rmap_cmd, +- "redistribute (connected|kernel|ospf|rip|static) route-map WORD", ++ "redistribute (connected|kernel|ospf|rip|static|olsr) route-map WORD", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Route map reference\n" + "Pointer to route-map entries\n") + { +@@ -7860,13 +7866,14 @@ + + DEFUN (bgp_redistribute_ipv4_metric, + bgp_redistribute_ipv4_metric_cmd, +- "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf|rip|static|olsr) metric <0-4294967295>", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Metric for redistributed routes\n" + "Default metric\n") + { +@@ -7887,13 +7894,14 @@ + + DEFUN (bgp_redistribute_ipv4_rmap_metric, + bgp_redistribute_ipv4_rmap_metric_cmd, +- "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf|rip|static|olsr) route-map WORD metric <0-4294967295>", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Route map reference\n" + "Pointer to route-map entries\n" + "Metric for redistributed routes\n" +@@ -7917,13 +7925,14 @@ + + DEFUN (bgp_redistribute_ipv4_metric_rmap, + bgp_redistribute_ipv4_metric_rmap_cmd, +- "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", ++ "redistribute (connected|kernel|ospf|rip|static|olsr) metric <0-4294967295> route-map WORD", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" +@@ -7947,14 +7956,16 @@ + + DEFUN (no_bgp_redistribute_ipv4, + no_bgp_redistribute_ipv4_cmd, +- "no redistribute (connected|kernel|ospf|rip|static)", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr)", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" +- "Static routes\n") ++ "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ ) + { + int type; + +@@ -7970,7 +7981,7 @@ + + DEFUN (no_bgp_redistribute_ipv4_rmap, + no_bgp_redistribute_ipv4_rmap_cmd, +- "no redistribute (connected|kernel|ospf|rip|static) route-map WORD", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr) route-map WORD", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -7978,6 +7989,7 @@ + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Route map reference\n" + "Pointer to route-map entries\n") + { +@@ -7996,7 +8008,7 @@ + + DEFUN (no_bgp_redistribute_ipv4_metric, + no_bgp_redistribute_ipv4_metric_cmd, +- "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr) metric <0-4294967295>", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8004,6 +8016,7 @@ + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Metric for redistributed routes\n" + "Default metric\n") + { +@@ -8022,7 +8035,7 @@ + + DEFUN (no_bgp_redistribute_ipv4_rmap_metric, + no_bgp_redistribute_ipv4_rmap_metric_cmd, +- "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr) route-map WORD metric <0-4294967295>", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8030,6 +8043,7 @@ + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Route map reference\n" + "Pointer to route-map entries\n" + "Metric for redistributed routes\n" +@@ -8051,7 +8065,7 @@ + + ALIAS (no_bgp_redistribute_ipv4_rmap_metric, + no_bgp_redistribute_ipv4_metric_rmap_cmd, +- "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr) metric <0-4294967295> route-map WORD", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8059,6 +8073,7 @@ + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" +@@ -8067,13 +8082,15 @@ + #ifdef HAVE_IPV6 + DEFUN (bgp_redistribute_ipv6, + bgp_redistribute_ipv6_cmd, +- "redistribute (connected|kernel|ospf6|ripng|static)", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr)", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" +- "Static routes\n") ++ "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ ) + { + int type; + +@@ -8089,13 +8106,14 @@ + + DEFUN (bgp_redistribute_ipv6_rmap, + bgp_redistribute_ipv6_rmap_cmd, +- "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr) route-map WORD", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Route map reference\n" + "Pointer to route-map entries\n") + { +@@ -8114,13 +8132,14 @@ + + DEFUN (bgp_redistribute_ipv6_metric, + bgp_redistribute_ipv6_metric_cmd, +- "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr) metric <0-4294967295>", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Metric for redistributed routes\n" + "Default metric\n") + { +@@ -8141,13 +8160,14 @@ + + DEFUN (bgp_redistribute_ipv6_rmap_metric, + bgp_redistribute_ipv6_rmap_metric_cmd, +- "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf6|ripng|static|ols) route-map WORD metric <0-4294967295>", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Route map reference\n" + "Pointer to route-map entries\n" + "Metric for redistributed routes\n" +@@ -8171,13 +8191,14 @@ + + DEFUN (bgp_redistribute_ipv6_metric_rmap, + bgp_redistribute_ipv6_metric_rmap_cmd, +- "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr) metric <0-4294967295> route-map WORD", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" +@@ -8201,14 +8222,16 @@ + + DEFUN (no_bgp_redistribute_ipv6, + no_bgp_redistribute_ipv6_cmd, +- "no redistribute (connected|kernel|ospf6|ripng|static)", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr)", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" +- "Static routes\n") ++ "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ ) + { + int type; + +@@ -8224,7 +8247,7 @@ + + DEFUN (no_bgp_redistribute_ipv6_rmap, + no_bgp_redistribute_ipv6_rmap_cmd, +- "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr) route-map WORD", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8232,6 +8255,7 @@ + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Route map reference\n" + "Pointer to route-map entries\n") + { +@@ -8250,7 +8274,7 @@ + + DEFUN (no_bgp_redistribute_ipv6_metric, + no_bgp_redistribute_ipv6_metric_cmd, +- "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr) metric <0-4294967295>", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8258,6 +8282,7 @@ + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Metric for redistributed routes\n" + "Default metric\n") + { +@@ -8276,7 +8301,7 @@ + + DEFUN (no_bgp_redistribute_ipv6_rmap_metric, + no_bgp_redistribute_ipv6_rmap_metric_cmd, +- "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr) route-map WORD metric <0-4294967295>", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8284,6 +8309,7 @@ + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Route map reference\n" + "Pointer to route-map entries\n" + "Metric for redistributed routes\n" +@@ -8305,7 +8331,7 @@ + + ALIAS (no_bgp_redistribute_ipv6_rmap_metric, + no_bgp_redistribute_ipv6_metric_rmap_cmd, +- "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr) metric <0-4294967295> route-map WORD", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8313,6 +8339,7 @@ + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" +@@ -8325,7 +8352,7 @@ + { + int i; + const char *str[] = { "system", "kernel", "connected", "static", "rip", +- "ripng", "ospf", "ospf6", "isis", "bgp"}; ++ "ripng", "ospf", "ospf6", "isis", "bgp", "hsls", "olsr"}; + + /* Unicast redistribution only. */ + if (safi != SAFI_UNICAST) +diff -Nur quagga-0.98.6.orig/lib/zebra.h quagga-0.98.6/lib/zebra.h +--- quagga-0.98.6.orig/lib/zebra.h 2005-06-15 13:54:18.000000000 +0200 ++++ quagga-0.98.6/lib/zebra.h 2006-12-02 10:48:51.000000000 +0100 +@@ -378,7 +378,8 @@ + #define ZEBRA_ROUTE_ISIS 8 + #define ZEBRA_ROUTE_BGP 9 + #define ZEBRA_ROUTE_HSLS 10 +-#define ZEBRA_ROUTE_MAX 11 ++#define ZEBRA_ROUTE_OLSR 11 ++#define ZEBRA_ROUTE_MAX 12 + + /* Zebra's family types. */ + #define ZEBRA_FAMILY_IPV4 1 +diff -Nur quagga-0.98.6.orig/ospfd/ospf_vty.c quagga-0.98.6/ospfd/ospf_vty.c +--- quagga-0.98.6.orig/ospfd/ospf_vty.c 2006-03-30 17:41:20.000000000 +0200 ++++ quagga-0.98.6/ospfd/ospf_vty.c 2006-12-02 10:48:51.000000000 +0100 +@@ -108,9 +108,11 @@ + *source = ZEBRA_ROUTE_RIP; + else if (strncmp (str, "b", 1) == 0) + *source = ZEBRA_ROUTE_BGP; ++ else if (strncmp (str, "ol", 2) == 0) ++ *source = ZEBRA_ROUTE_OLSR; + else + return 0; +- ++ + return 1; + } + +@@ -5302,13 +5304,14 @@ + + DEFUN (ospf_redistribute_source_metric_type, + ospf_redistribute_source_metric_type_routemap_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr) metric <0-16777214> metric-type (1|2) route-map WORD", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" + "Metric for redistributed routes\n" + "OSPF default metric\n" + "OSPF exterior metric type for redistributed routes\n" +@@ -5346,13 +5349,14 @@ + + ALIAS (ospf_redistribute_source_metric_type, + ospf_redistribute_source_metric_type_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)", ++ "redistribute (kernel|connected|static|rip|bgp|olsr) metric <0-16777214> metric-type (1|2)", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" + "Metric for redistributed routes\n" + "OSPF default metric\n" + "OSPF exterior metric type for redistributed routes\n" +@@ -5368,18 +5372,20 @@ + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" + "Metric for redistributed routes\n" + "OSPF default metric\n") + + DEFUN (ospf_redistribute_source_type_metric, + ospf_redistribute_source_type_metric_routemap_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr) metric-type (1|2) metric <0-16777214> route-map WORD", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" + "OSPF exterior metric type for redistributed routes\n" + "Set OSPF External Type 1 metrics\n" + "Set OSPF External Type 2 metrics\n" +@@ -5417,13 +5423,14 @@ + + ALIAS (ospf_redistribute_source_type_metric, + ospf_redistribute_source_type_metric_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>", ++ "redistribute (kernel|connected|static|rip|bgp|olsr) metric-type (1|2) metric <0-16777214>", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" + "OSPF exterior metric type for redistributed routes\n" + "Set OSPF External Type 1 metrics\n" + "Set OSPF External Type 2 metrics\n" +@@ -5432,7 +5439,7 @@ + + ALIAS (ospf_redistribute_source_type_metric, + ospf_redistribute_source_type_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)", ++ "redistribute (kernel|connected|static|rip|bgp|olsr) metric-type (1|2)", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" +@@ -5440,28 +5447,31 @@ + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" + "OSPF exterior metric type for redistributed routes\n" ++ "Optimized Link State Routing (OLSR)\n" + "Set OSPF External Type 1 metrics\n" + "Set OSPF External Type 2 metrics\n") + + ALIAS (ospf_redistribute_source_type_metric, + ospf_redistribute_source_cmd, +- "redistribute (kernel|connected|static|rip|bgp)", ++ "redistribute (kernel|connected|static|rip|bgp|olsr)", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" +- "Border Gateway Protocol (BGP)\n") ++ "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n") + + DEFUN (ospf_redistribute_source_metric_routemap, + ospf_redistribute_source_metric_routemap_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr) metric <0-16777214> route-map WORD", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" + "Metric for redistributed routes\n" + "OSPF default metric\n" + "Route map reference\n" +@@ -5490,13 +5500,14 @@ + + DEFUN (ospf_redistribute_source_type_routemap, + ospf_redistribute_source_type_routemap_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr) metric-type (1|2) route-map WORD", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" + "OSPF exterior metric type for redistributed routes\n" + "Set OSPF External Type 1 metrics\n" + "Set OSPF External Type 2 metrics\n" +@@ -5526,13 +5537,14 @@ + + DEFUN (ospf_redistribute_source_routemap, + ospf_redistribute_source_routemap_cmd, +- "redistribute (kernel|connected|static|rip|bgp) route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr) route-map WORD", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" + "Route map reference\n" + "Pointer to route-map entries\n") + { +@@ -5553,14 +5565,16 @@ + + DEFUN (no_ospf_redistribute_source, + no_ospf_redistribute_source_cmd, +- "no redistribute (kernel|connected|static|rip|bgp)", ++ "no redistribute (kernel|connected|static|rip|bgp|olsr)", + NO_STR + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" +- "Border Gateway Protocol (BGP)\n") ++ "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (olsr)\n" ++ ) + { + struct ospf *ospf = vty->index; + int source; +@@ -5574,7 +5588,7 @@ + + DEFUN (ospf_distribute_list_out, + ospf_distribute_list_out_cmd, +- "distribute-list WORD out (kernel|connected|static|rip|bgp)", ++ "distribute-list WORD out (kernel|connected|static|rip|bgp|olsr)", + "Filter networks in routing updates\n" + "Access-list name\n" + OUT_STR +@@ -5582,7 +5596,8 @@ + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" +- "Border Gateway Protocol (BGP)\n") ++ "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n") + { + struct ospf *ospf = vty->index; + int source; +@@ -5596,7 +5611,7 @@ + + DEFUN (no_ospf_distribute_list_out, + no_ospf_distribute_list_out_cmd, +- "no distribute-list WORD out (kernel|connected|static|rip|bgp)", ++ "no distribute-list WORD out (kernel|connected|static|rip|bgp|olsr)", + NO_STR + "Filter networks in routing updates\n" + "Access-list name\n" +@@ -5605,7 +5620,8 @@ + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" +- "Border Gateway Protocol (BGP)\n") ++ "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n") + { + struct ospf *ospf = vty->index; + int source; +@@ -7121,7 +7137,8 @@ + + + const char *distribute_str[] = { "system", "kernel", "connected", "static", +- "rip", "ripng", "ospf", "ospf6", "isis", "bgp"}; ++ "rip", "ripng", "ospf", "ospf6", "isis", "bgp", ++ "hsls","olsr"}; + int + config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) + { +diff -Nur quagga-0.98.6.orig/zebra/zebra_vty.c quagga-0.98.6/zebra/zebra_vty.c +--- quagga-0.98.6.orig/zebra/zebra_vty.c 2004-12-18 17:03:29.000000000 +0100 ++++ quagga-0.98.6/zebra/zebra_vty.c 2006-12-02 10:49:45.000000000 +0100 +@@ -53,6 +53,8 @@ + return "isis"; + case ZEBRA_ROUTE_BGP: + return "bgp"; ++ case ZEBRA_ROUTE_OLSR: ++ return "olsr"; + default: + return "unknown"; + } +@@ -84,6 +86,10 @@ + return 'I'; + case ZEBRA_ROUTE_BGP: + return 'B'; ++ case ZEBRA_ROUTE_HSLS: ++ return 'H'; ++ case ZEBRA_ROUTE_OLSR: ++ return 'L'; + default: + return '?'; + } +@@ -755,8 +761,8 @@ + } + + #define SHOW_ROUTE_V4_HEADER "Codes: K - kernel route, C - connected, " \ +- "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, " \ +- "> - selected route, * - FIB route%s%s" ++ "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, H - HSLS, " \ ++ "L - OLSR, > - selected route, * - FIB route%s%s" + + DEFUN (show_ip_route, + show_ip_route_cmd, +@@ -874,7 +880,7 @@ + + DEFUN (show_ip_route_protocol, + show_ip_route_protocol_cmd, +- "show ip route (bgp|connected|isis|kernel|ospf|rip|static)", ++ "show ip route (bgp|connected|isis|kernel|ospf|rip|olsr|static)", + SHOW_STR + IP_STR + "IP routing table\n" +@@ -884,6 +890,7 @@ + "Kernel\n" + "Open Shortest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" ++ "Optimized Link State Routing (OLSR)\n" + "Static routes\n") + { + int type; +@@ -898,7 +905,7 @@ + type = ZEBRA_ROUTE_CONNECT; + else if (strncmp (argv[0], "k", 1) ==0) + type = ZEBRA_ROUTE_KERNEL; +- else if (strncmp (argv[0], "o", 1) == 0) ++ else if (strncmp (argv[0], "os", 2) == 0) + type = ZEBRA_ROUTE_OSPF; + else if (strncmp (argv[0], "i", 1) == 0) + type = ZEBRA_ROUTE_ISIS; +@@ -906,6 +913,8 @@ + type = ZEBRA_ROUTE_RIP; + else if (strncmp (argv[0], "s", 1) == 0) + type = ZEBRA_ROUTE_STATIC; ++ else if (strncmp (argv[0], "ol", 2) == 0) ++ type = ZEBRA_ROUTE_OLSR; + else + { + vty_out (vty, "Unknown route type%s", VTY_NEWLINE); +@@ -1732,7 +1741,7 @@ + + DEFUN (show_ipv6_route_protocol, + show_ipv6_route_protocol_cmd, +- "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|static)", ++ "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|olsr|static)", + SHOW_STR + IP_STR + "IP routing table\n" +@@ -1742,6 +1751,7 @@ + "Kernel\n" + "Open Shortest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" ++ "Optimized Link State Routing (olsr)\n" + "Static routes\n") + { + int type; +@@ -1756,7 +1766,7 @@ + type = ZEBRA_ROUTE_CONNECT; + else if (strncmp (argv[0], "k", 1) ==0) + type = ZEBRA_ROUTE_KERNEL; +- else if (strncmp (argv[0], "o", 1) == 0) ++ else if (strncmp (argv[0], "os", 2) == 0) + type = ZEBRA_ROUTE_OSPF6; + else if (strncmp (argv[0], "i", 1) == 0) + type = ZEBRA_ROUTE_ISIS; +@@ -1764,7 +1774,9 @@ + type = ZEBRA_ROUTE_RIPNG; + else if (strncmp (argv[0], "s", 1) == 0) + type = ZEBRA_ROUTE_STATIC; +- else ++ else if (strncmp (argv[0], "ol", 2) == 0) ++ type = ZEBRA_ROUTE_OLSR; ++ else + { + vty_out (vty, "Unknown route type%s", VTY_NEWLINE); + return CMD_WARNING; From 160dbd5c93089e2a19970fe2850b0bdadbf11736 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 14 May 2007 17:50:17 +0000 Subject: [PATCH 010/117] Do not package twice libospf #1688 git-svn-id: https://svn.openwrt.org/openwrt@7230 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile b/Makefile index 21cb357..6ac455b 100644 --- a/Makefile +++ b/Makefile @@ -192,8 +192,6 @@ define Package/quagga-isisd/install endef define Package/quagga-ospfd/install - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(1)/usr/lib/ $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/ endef From 05965fc1d42e452f0c3a09a367fa004f425286e8 Mon Sep 17 00:00:00 2001 From: blogic Date: Sun, 14 Oct 2007 04:32:56 +0000 Subject: [PATCH 011/117] DESCRIPTION:= is obselete git-svn-id: https://svn.openwrt.org/openwrt@9304 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6ac455b..53e9460 100644 --- a/Makefile +++ b/Makefile @@ -29,13 +29,17 @@ define Package/quagga SECTION:=net CATEGORY:=Network TITLE:=The Quagga Software Routing Suite - 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+\\\ URL:=http://www.quagga.net 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-libzebra SECTION:=net CATEGORY:=Network From 21d2f7cd715ee9cc31faf0e0ddeb7c09cf9c726d Mon Sep 17 00:00:00 2001 From: blogic Date: Thu, 18 Oct 2007 18:46:37 +0000 Subject: [PATCH 012/117] remove PKG_CAT from packages git-svn-id: https://svn.openwrt.org/openwrt@9349 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 53e9460..56d0560 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,6 @@ PKG_SOURCE_URL:=http://www.quagga.net/download/ \ http://www.uk.quagga.net/download/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) -PKG_CAT:=zcat PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install From 3779bcea76497001132ea837a3c7c27e2ba5c5a8 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 21 Oct 2007 14:14:00 +0000 Subject: [PATCH 013/117] Fix typo, thanks florida ! (#2581) git-svn-id: https://svn.openwrt.org/openwrt@9393 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/002-quagga_olsr.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/002-quagga_olsr.patch b/patches/002-quagga_olsr.patch index 81be34a..5bbe47c 100644 --- a/patches/002-quagga_olsr.patch +++ b/patches/002-quagga_olsr.patch @@ -244,7 +244,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c DEFUN (bgp_redistribute_ipv6_rmap_metric, bgp_redistribute_ipv6_rmap_metric_cmd, - "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf6|ripng|static|ols) route-map WORD metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr) route-map WORD metric <0-4294967295>", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" From e09dfae83e81fcd692e43475770ac0b9d51b710a Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 9 Dec 2007 18:59:01 +0000 Subject: [PATCH 014/117] packages: Use $(CP) instead of $(INSTALL_BIN) for binaries. Signed-off-by: Andy Boyett git-svn-id: https://svn.openwrt.org/openwrt@9695 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 56d0560..156de97 100644 --- a/Makefile +++ b/Makefile @@ -125,8 +125,8 @@ endef define Package/quagga/install $(INSTALL_DIR) $(1)/usr/sbin - $(CP) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/ - $(CP) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(1)/usr/sbin/ # avoid /etc being set to 0750 $(INSTALL_DIR) $(1)/etc/quagga/ chmod 0750 $(1)/etc/quagga/ @@ -186,37 +186,37 @@ endef define Package/quagga-bgpd/install $(INSTALL_DIR) $(1)/usr/sbin - $(CP) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/ endef define Package/quagga-isisd/install $(INSTALL_DIR) $(1)/usr/sbin - $(CP) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin endef define Package/quagga-ospfd/install $(INSTALL_DIR) $(1)/usr/sbin - $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/ endef define Package/quagga-ospf6d/install $(INSTALL_DIR) $(1)/usr/sbin - $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(1)/usr/sbin/ endef define Package/quagga-ripd/install $(INSTALL_DIR) $(1)/usr/sbin - $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(1)/usr/sbin/ endef define Package/quagga-ripngd/install $(INSTALL_DIR) $(1)/usr/sbin - $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(1)/usr/sbin/ endef define Package/quagga-vtysh/install $(INSTALL_DIR) $(1)/usr/bin - $(CP) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/ endef define Package/quagga-libospf/install From f25c89cc7c7e223d5068c6a80ce8c4b12c530a15 Mon Sep 17 00:00:00 2001 From: thepeople Date: Wed, 26 Mar 2008 23:35:06 +0000 Subject: [PATCH 015/117] Fix Quagga OLSR route redistribution toother protocols Signed-off-by: Vasilis Tsiligiannis git-svn-id: https://svn.openwrt.org/openwrt@10664 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/002-quagga_olsr.patch | 106 ++++++++++++++++++++-------------- 1 file changed, 64 insertions(+), 42 deletions(-) diff --git a/patches/002-quagga_olsr.patch b/patches/002-quagga_olsr.patch index 5bbe47c..d4edf09 100644 --- a/patches/002-quagga_olsr.patch +++ b/patches/002-quagga_olsr.patch @@ -1,6 +1,6 @@ -diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c ---- quagga-0.98.6.orig/bgpd/bgp_vty.c 2006-03-30 18:12:25.000000000 +0200 -+++ quagga-0.98.6/bgpd/bgp_vty.c 2006-12-02 10:52:14.000000000 +0100 +diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c +--- quagga-0.98.6/bgpd/bgp_vty.c 2006-03-30 19:12:25.000000000 +0300 ++++ quagga-0.98.6-patched/bgpd/bgp_vty.c 2007-04-05 01:26:42.000000000 +0300 @@ -7793,7 +7793,9 @@ return ZEBRA_ROUTE_STATIC; else if (strncmp (str, "r", 1) == 0) @@ -12,7 +12,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c return ZEBRA_ROUTE_OSPF; } if (afi == AFI_IP6) -@@ -7806,20 +7808,23 @@ +@@ -7806,21 +7808,25 @@ return ZEBRA_ROUTE_STATIC; else if (strncmp (str, "r", 1) == 0) return ZEBRA_ROUTE_RIPNG; @@ -34,11 +34,14 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Kernel routes\n" "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" +- "Static routes\n") ++ "Static routes\n" + "Optimized Link State Routing (OLSR)\n" - "Static routes\n") ++ ) { int type; -@@ -7835,13 +7840,14 @@ + +@@ -7835,13 +7841,14 @@ DEFUN (bgp_redistribute_ipv4_rmap, bgp_redistribute_ipv4_rmap_cmd, @@ -54,7 +57,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n") { -@@ -7860,13 +7866,14 @@ +@@ -7860,13 +7867,14 @@ DEFUN (bgp_redistribute_ipv4_metric, bgp_redistribute_ipv4_metric_cmd, @@ -70,7 +73,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n") { -@@ -7887,13 +7894,14 @@ +@@ -7887,13 +7895,14 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric, bgp_redistribute_ipv4_rmap_metric_cmd, @@ -86,7 +89,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -7917,13 +7925,14 @@ +@@ -7917,13 +7926,14 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap, bgp_redistribute_ipv4_metric_rmap_cmd, @@ -102,7 +105,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -7947,14 +7956,16 @@ +@@ -7947,14 +7957,16 @@ DEFUN (no_bgp_redistribute_ipv4, no_bgp_redistribute_ipv4_cmd, @@ -121,7 +124,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c { int type; -@@ -7970,7 +7981,7 @@ +@@ -7970,7 +7982,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, no_bgp_redistribute_ipv4_rmap_cmd, @@ -130,7 +133,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -7978,6 +7989,7 @@ +@@ -7978,6 +7990,7 @@ "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" @@ -138,7 +141,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n") { -@@ -7996,7 +8008,7 @@ +@@ -7996,7 +8009,7 @@ DEFUN (no_bgp_redistribute_ipv4_metric, no_bgp_redistribute_ipv4_metric_cmd, @@ -147,7 +150,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8004,6 +8016,7 @@ +@@ -8004,6 +8017,7 @@ "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" @@ -155,7 +158,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n") { -@@ -8022,7 +8035,7 @@ +@@ -8022,7 +8036,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_metric, no_bgp_redistribute_ipv4_rmap_metric_cmd, @@ -164,7 +167,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8030,6 +8043,7 @@ +@@ -8030,6 +8044,7 @@ "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" @@ -172,7 +175,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8051,7 +8065,7 @@ +@@ -8051,7 +8066,7 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_metric, no_bgp_redistribute_ipv4_metric_rmap_cmd, @@ -181,7 +184,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8059,6 +8073,7 @@ +@@ -8059,6 +8074,7 @@ "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" @@ -189,7 +192,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8067,13 +8082,15 @@ +@@ -8067,13 +8083,15 @@ #ifdef HAVE_IPV6 DEFUN (bgp_redistribute_ipv6, bgp_redistribute_ipv6_cmd, @@ -207,7 +210,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c { int type; -@@ -8089,13 +8106,14 @@ +@@ -8089,13 +8107,14 @@ DEFUN (bgp_redistribute_ipv6_rmap, bgp_redistribute_ipv6_rmap_cmd, @@ -223,7 +226,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n") { -@@ -8114,13 +8132,14 @@ +@@ -8114,13 +8133,14 @@ DEFUN (bgp_redistribute_ipv6_metric, bgp_redistribute_ipv6_metric_cmd, @@ -239,7 +242,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n") { -@@ -8141,13 +8160,14 @@ +@@ -8141,13 +8161,14 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric, bgp_redistribute_ipv6_rmap_metric_cmd, @@ -255,7 +258,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8171,13 +8191,14 @@ +@@ -8171,13 +8192,14 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap, bgp_redistribute_ipv6_metric_rmap_cmd, @@ -271,7 +274,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8201,14 +8222,16 @@ +@@ -8201,14 +8223,16 @@ DEFUN (no_bgp_redistribute_ipv6, no_bgp_redistribute_ipv6_cmd, @@ -290,7 +293,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c { int type; -@@ -8224,7 +8247,7 @@ +@@ -8224,7 +8248,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, no_bgp_redistribute_ipv6_rmap_cmd, @@ -299,7 +302,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8232,6 +8255,7 @@ +@@ -8232,6 +8256,7 @@ "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" @@ -307,7 +310,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n") { -@@ -8250,7 +8274,7 @@ +@@ -8250,7 +8275,7 @@ DEFUN (no_bgp_redistribute_ipv6_metric, no_bgp_redistribute_ipv6_metric_cmd, @@ -316,7 +319,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8258,6 +8282,7 @@ +@@ -8258,6 +8283,7 @@ "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" @@ -324,7 +327,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n") { -@@ -8276,7 +8301,7 @@ +@@ -8276,7 +8302,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_metric, no_bgp_redistribute_ipv6_rmap_metric_cmd, @@ -333,7 +336,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8284,6 +8309,7 @@ +@@ -8284,6 +8310,7 @@ "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" @@ -341,7 +344,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8305,7 +8331,7 @@ +@@ -8305,7 +8332,7 @@ ALIAS (no_bgp_redistribute_ipv6_rmap_metric, no_bgp_redistribute_ipv6_metric_rmap_cmd, @@ -350,7 +353,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8313,6 +8339,7 @@ +@@ -8313,6 +8340,7 @@ "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" @@ -358,7 +361,7 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8325,7 +8352,7 @@ +@@ -8325,7 +8353,7 @@ { int i; const char *str[] = { "system", "kernel", "connected", "static", "rip", @@ -367,9 +370,9 @@ diff -Nur quagga-0.98.6.orig/bgpd/bgp_vty.c quagga-0.98.6/bgpd/bgp_vty.c /* Unicast redistribution only. */ if (safi != SAFI_UNICAST) -diff -Nur quagga-0.98.6.orig/lib/zebra.h quagga-0.98.6/lib/zebra.h ---- quagga-0.98.6.orig/lib/zebra.h 2005-06-15 13:54:18.000000000 +0200 -+++ quagga-0.98.6/lib/zebra.h 2006-12-02 10:48:51.000000000 +0100 +diff -Nur quagga-0.98.6/lib/zebra.h quagga-0.98.6-patched/lib/zebra.h +--- quagga-0.98.6/lib/zebra.h 2005-06-15 14:54:18.000000000 +0300 ++++ quagga-0.98.6-patched/lib/zebra.h 2007-04-05 01:23:59.000000000 +0300 @@ -378,7 +378,8 @@ #define ZEBRA_ROUTE_ISIS 8 #define ZEBRA_ROUTE_BGP 9 @@ -380,9 +383,9 @@ diff -Nur quagga-0.98.6.orig/lib/zebra.h quagga-0.98.6/lib/zebra.h /* Zebra's family types. */ #define ZEBRA_FAMILY_IPV4 1 -diff -Nur quagga-0.98.6.orig/ospfd/ospf_vty.c quagga-0.98.6/ospfd/ospf_vty.c ---- quagga-0.98.6.orig/ospfd/ospf_vty.c 2006-03-30 17:41:20.000000000 +0200 -+++ quagga-0.98.6/ospfd/ospf_vty.c 2006-12-02 10:48:51.000000000 +0100 +diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6-patched/ospfd/ospf_vty.c +--- quagga-0.98.6/ospfd/ospf_vty.c 2006-03-30 18:41:20.000000000 +0300 ++++ quagga-0.98.6-patched/ospfd/ospf_vty.c 2007-04-05 01:23:59.000000000 +0300 @@ -108,9 +108,11 @@ *source = ZEBRA_ROUTE_RIP; else if (strncmp (str, "b", 1) == 0) @@ -609,9 +612,28 @@ diff -Nur quagga-0.98.6.orig/ospfd/ospf_vty.c quagga-0.98.6/ospfd/ospf_vty.c int config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) { -diff -Nur quagga-0.98.6.orig/zebra/zebra_vty.c quagga-0.98.6/zebra/zebra_vty.c ---- quagga-0.98.6.orig/zebra/zebra_vty.c 2004-12-18 17:03:29.000000000 +0100 -+++ quagga-0.98.6/zebra/zebra_vty.c 2006-12-02 10:49:45.000000000 +0100 +diff -Nur quagga-0.98.6/zebra/redistribute.c quagga-0.98.6-patched/zebra/redistribute.c +--- quagga-0.98.6/zebra/redistribute.c 2005-06-15 14:54:51.000000000 +0300 ++++ quagga-0.98.6-patched/zebra/redistribute.c 2007-04-05 01:27:23.000000000 +0300 +@@ -253,6 +253,7 @@ + case ZEBRA_ROUTE_OSPF: + case ZEBRA_ROUTE_OSPF6: + case ZEBRA_ROUTE_BGP: ++ case ZEBRA_ROUTE_OLSR: + if (! client->redist[type]) + { + client->redist[type] = 1; +@@ -281,6 +282,7 @@ + case ZEBRA_ROUTE_OSPF: + case ZEBRA_ROUTE_OSPF6: + case ZEBRA_ROUTE_BGP: ++ case ZEBRA_ROUTE_OLSR: + client->redist[type] = 0; + break; + default: +diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6-patched/zebra/zebra_vty.c +--- quagga-0.98.6/zebra/zebra_vty.c 2004-12-18 18:03:29.000000000 +0200 ++++ quagga-0.98.6-patched/zebra/zebra_vty.c 2007-04-05 01:23:59.000000000 +0300 @@ -53,6 +53,8 @@ return "isis"; case ZEBRA_ROUTE_BGP: From 97485d4f1b6c7fb3482ed900c1d557e94102359f Mon Sep 17 00:00:00 2001 From: thepeople Date: Wed, 26 Mar 2008 23:39:12 +0000 Subject: [PATCH 016/117] Fix nexthop reachability check for BGP confederations Signed-off-by: Vasilis Tsiligiannis git-svn-id: https://svn.openwrt.org/openwrt@10665 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/100-confederation.patch | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 patches/100-confederation.patch diff --git a/patches/100-confederation.patch b/patches/100-confederation.patch new file mode 100644 index 0000000..73d75c5 --- /dev/null +++ b/patches/100-confederation.patch @@ -0,0 +1,19 @@ +diff -Nur quagga-0.98.6/bgpd/bgp_route.c quagga-0.98.6-patched/bgpd/bgp_route.c +--- quagga-0.98.6/bgpd/bgp_route.c 2006-05-08 18:03:25.000000000 +0300 ++++ quagga-0.98.6-patched/bgpd/bgp_route.c 2006-12-08 23:10:37.000000000 +0200 +@@ -1815,6 +1815,7 @@ + if ((afi == AFI_IP || afi == AFI_IP6) + && safi == SAFI_UNICAST + && (peer_sort (peer) == BGP_PEER_IBGP ++ || peer_sort (peer) == BGP_PEER_CONFED + || (peer_sort (peer) == BGP_PEER_EBGP && peer->ttl != 1) + || CHECK_FLAG (peer->flags, PEER_FLAG_ENFORCE_MULTIHOP))) + { +@@ -1862,6 +1863,7 @@ + if ((afi == AFI_IP || afi == AFI_IP6) + && safi == SAFI_UNICAST + && (peer_sort (peer) == BGP_PEER_IBGP ++ || peer_sort (peer) == BGP_PEER_CONFED + || (peer_sort (peer) == BGP_PEER_EBGP && peer->ttl != 1) + || CHECK_FLAG (peer->flags, PEER_FLAG_ENFORCE_MULTIHOP))) + { From c7654df7ac29288b65f0b1ba8669a6db61950386 Mon Sep 17 00:00:00 2001 From: thepeople Date: Wed, 26 Mar 2008 23:42:25 +0000 Subject: [PATCH 017/117] Implement BGP confederationerror handling (RFC5065, Par. 5) Signed-off-by: Vasilis Tsiligiannis git-svn-id: https://svn.openwrt.org/openwrt@10666 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/120-confed_errorhandle.patch | 93 ++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 patches/120-confed_errorhandle.patch diff --git a/patches/120-confed_errorhandle.patch b/patches/120-confed_errorhandle.patch new file mode 100644 index 0000000..bb100b8 --- /dev/null +++ b/patches/120-confed_errorhandle.patch @@ -0,0 +1,93 @@ +diff -Nur quagga-0.98.6/bgpd/bgp_aspath.c quagga-0.98.6-patched/bgpd/bgp_aspath.c +--- quagga-0.98.6/bgpd/bgp_aspath.c 2005-06-15 14:53:50.000000000 +0300 ++++ quagga-0.98.6-patched/bgpd/bgp_aspath.c 2007-11-24 03:20:02.000000000 +0200 +@@ -614,6 +614,47 @@ + return 1; + } + ++/* AS path confed check. If aspath contains confed set or sequence then return 1. */ ++int ++aspath_confed_check (struct aspath *aspath) ++{ ++ caddr_t pnt; ++ caddr_t end; ++ struct assegment *assegment; ++ ++ if (aspath == NULL) ++ return 0; ++ ++ pnt = aspath->data; ++ end = aspath->data + aspath->length; ++ ++ while (pnt < end) ++ { ++ assegment = (struct assegment *) pnt; ++ if (assegment->type == AS_CONFED_SET || assegment->type == AS_CONFED_SEQUENCE) ++ return 1; ++ pnt += (assegment->length * AS_VALUE_SIZE) + AS_HEADER_SIZE; ++ } ++ return 0; ++} ++ ++/* Leftmost AS path segment confed check. If leftmost AS segment is of type ++ AS_CONFED_SEQUENCE or AS_CONFED_SET then return 1. */ ++int ++aspath_left_confed_check (struct aspath *aspath) ++{ ++ struct assegment *assegment; ++ ++ if (aspath == NULL) ++ return 0; ++ ++ assegment = (struct assegment *) aspath->data; ++ if (assegment->type == AS_CONFED_SEQUENCE || assegment->type == AS_CONFED_SET) ++ return 1; ++ ++ return 0; ++} ++ + /* Merge as1 to as2. as2 should be uninterned aspath. */ + struct aspath * + aspath_merge (struct aspath *as1, struct aspath *as2) +@@ -671,6 +712,10 @@ + if (seg1 == NULL) + return as2; + ++ /* Delete any AS_CONFED_SEQUENCE segment from as2. */ ++ if (seg1->type == AS_SEQUENCE && seg2->type == AS_CONFED_SEQUENCE) ++ as2 = aspath_delete_confed_seq (as2); ++ + /* Compare last segment type of as1 and first segment type of as2. */ + if (seg1->type != seg2->type) + return aspath_merge (as1, as2); +diff -Nur quagga-0.98.6/bgpd/bgp_aspath.h quagga-0.98.6-patched/bgpd/bgp_aspath.h +--- quagga-0.98.6/bgpd/bgp_aspath.h 2005-06-15 14:53:50.000000000 +0300 ++++ quagga-0.98.6-patched/bgpd/bgp_aspath.h 2007-11-24 03:21:24.000000000 +0200 +@@ -76,4 +76,6 @@ + int aspath_loop_check (struct aspath *, as_t); + int aspath_private_as_check (struct aspath *); + int aspath_firstas_check (struct aspath *, as_t); ++int aspath_confed_check (struct aspath *); ++int aspath_left_confed_check (struct aspath *); + unsigned long aspath_count (); +diff -Nur quagga-0.98.6/bgpd/bgp_attr.c quagga-0.98.6-patched/bgpd/bgp_attr.c +--- quagga-0.98.6/bgpd/bgp_attr.c 2006-05-03 01:37:47.000000000 +0300 ++++ quagga-0.98.6-patched/bgpd/bgp_attr.c 2007-11-24 03:09:56.000000000 +0200 +@@ -673,6 +673,17 @@ + return -1; + } + ++ /* Confederation sanity check. */ ++ if ((peer_sort (peer) == BGP_PEER_CONFED && ! aspath_left_confed_check (attr->aspath)) || ++ (peer_sort (peer) == BGP_PEER_EBGP && aspath_confed_check (attr->aspath))) ++ { ++ zlog (peer->log, LOG_ERR, "Malformed AS path from %s", peer->host); ++ bgp_notify_send (peer, ++ BGP_NOTIFY_UPDATE_ERR, ++ BGP_NOTIFY_UPDATE_MAL_AS_PATH); ++ return -1; ++ } ++ + bgp = peer->bgp; + + /* First AS check for EBGP. */ From fcce6d46922958b061455eb8381a4c265a9bd428 Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 2 Apr 2008 18:33:34 +0000 Subject: [PATCH 018/117] Clean the quagga package git-svn-id: https://svn.openwrt.org/openwrt@10713 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 50 ++++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 156de97..119c1d8 100644 --- a/Makefile +++ b/Makefile @@ -24,11 +24,17 @@ PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install include $(INCLUDE_DIR)/package.mk -define Package/quagga +define Package/quagga/Default SECTION:=net CATEGORY:=Network + DEPENDS:=quagga TITLE:=The Quagga Software Routing Suite URL:=http://www.quagga.net +endef + +define Package/quagga + $(call Package/quagga/Default) + DEPENDS:= MENU:=1 endef @@ -40,65 +46,53 @@ A routing software package that provides TCP/IP based routing services endef define Package/quagga-libzebra - SECTION:=net - CATEGORY:=Network - DEPENDS:=quagga + $(call Package/quagga/Default) TITLE:=zebra library endef define Package/quagga-libospf - SECTION:=net - CATEGORY:=Network - DEPENDS:=quagga + $(call Package/quagga/Default) TITLE:=OSPF library endef define Package/quagga-bgpd - SECTION:=net - CATEGORY:=Network - DEPENDS:=quagga quagga-libzebra + $(call Package/quagga/Default) + DEPENDS += quagga-libzebra TITLE:=BGPv4, BGPv4+, BGPv4- routing engine endef define Package/quagga-isisd - SECTION:=net - CATEGORY:=Network - DEPENDS:=quagga + $(call Package/quagga/Default) TITLE:=IS-IS routing engine endef define Package/quagga-ospfd - SECTION:=net - CATEGORY:=Network - DEPENDS:=quagga quagga-libospf quagga-libzebra + $(call Package/quagga/Default) + DEPENDS += quagga-libospf quagga-libzebra TITLE:=OSPFv2 routing engine endef define Package/quagga-ospf6d - SECTION:=net - CATEGORY:=Network - DEPENDS:=quagga quagga-libospf quagga-libzebra + $(call Package/quagga/Default) + DEPENDS += quagga-libospf quagga-libzebra TITLE:=OSPFv3 routing engine endef define Package/quagga-ripd - SECTION:=net - CATEGORY:=Network - DEPENDS:=quagga quagga-libzebra + $(call Package/quagga/Default) + DEPENDS += quagga-libzebra TITLE:=RIP routing engine endef define Package/quagga-ripngd - SECTION:=net - CATEGORY:=Network - DEPENDS:=quagga +quagga-libzebra + $(call Package/quagga/Default) + DEPENDS += quagga-libzebra TITLE:=RIPNG routing engine endef define Package/quagga-vtysh - SECTION:=net - CATEGORY:=Network - DEPENDS:=quagga quagga-libzebra +libreadline +libncurses + $(call Package/quagga/Default) + DEPENDS += quagga-libzebra +libreadline +libncurses TITLE:=integrated shell for Quagga routing software endef From feaae75cf4c17bda96e3f2ef96810f24fe35e780 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 5 Aug 2008 22:04:10 +0000 Subject: [PATCH 019/117] Makefile cleanups, round 6 and last git-svn-id: https://svn.openwrt.org/openwrt@12175 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile b/Makefile index 119c1d8..9c84cf2 100644 --- a/Makefile +++ b/Makefile @@ -19,9 +19,6 @@ PKG_SOURCE_URL:=http://www.quagga.net/download/ \ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) -PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install - include $(INCLUDE_DIR)/package.mk define Package/quagga/Default From a93c756df2e5544ffade7a43f9ea6843ff07a96d Mon Sep 17 00:00:00 2001 From: nbd Date: Fri, 17 Apr 2009 14:22:30 +0000 Subject: [PATCH 020/117] nuke $Id$ in /packages as well git-svn-id: svn://svn.openwrt.org/openwrt@15244 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 9c84cf2..4864f57 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,6 @@ # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # -# $Id$ include $(TOPDIR)/rules.mk From ccb081a9a04756c6b7849888a3856f6153341a4b Mon Sep 17 00:00:00 2001 From: jow Date: Thu, 7 May 2009 13:35:13 +0000 Subject: [PATCH 021/117] [Quagga] Fix typo when executing watchquagga Signed-off-by: Vasilis Tsiligiannis git-svn-id: svn://svn.openwrt.org/openwrt@15674 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- files/quagga | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/quagga b/files/quagga index 01f8d71..cf6855c 100644 --- a/files/quagga +++ b/files/quagga @@ -310,13 +310,13 @@ then then if [ "${d}" = "watchquagga" ] then - $("${BINDIR}/${d}" \ + "${BINDIR}/${d}" \ ${WATCHQUAGGA_FLAGS} \ "${WATCHQUAGGA_CMD}" \ - ${WATCHQUAGGA_DAEMONS}) + ${WATCHQUAGGA_DAEMONS} status=$? else - $("${BINDIR}/${d}" ${DAEMON_FLAGS}) + "${BINDIR}/${d}" ${DAEMON_FLAGS} status=$? fi if [ $status -eq 0 ] From f642786b3fcf19d70b0e04ecae08ea4d562f1682 Mon Sep 17 00:00:00 2001 From: jow Date: Thu, 7 May 2009 13:40:30 +0000 Subject: [PATCH 022/117] [Quagga] Ignore wireless netlink messages This patch fixes a bug where zebra terminates randomly with SIGABRT. The problem originates from zebra trying to parse wireless netlink messages. The following patch makes zebra ignore these messages. Signed-off-by: Acinonyx git-svn-id: svn://svn.openwrt.org/openwrt@15676 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/130-netlink_ignore_wireless.patch | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 patches/130-netlink_ignore_wireless.patch diff --git a/patches/130-netlink_ignore_wireless.patch b/patches/130-netlink_ignore_wireless.patch new file mode 100644 index 0000000..27a271e --- /dev/null +++ b/patches/130-netlink_ignore_wireless.patch @@ -0,0 +1,40 @@ +diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c +index 61b2505..e766259 100644 +--- a/zebra/rt_netlink.c ++++ b/zebra/rt_netlink.c +@@ -487,6 +487,17 @@ netlink_interface (struct sockaddr_nl *snl, struct nlmsghdr *h) + /* Looking up interface name. */ + memset (tb, 0, sizeof tb); + netlink_parse_rtattr (tb, IFLA_MAX, IFLA_RTA (ifi), len); ++ ++#ifdef IFLA_WIRELESS ++ /* check for wireless messages to ignore */ ++ if ((tb[IFLA_WIRELESS] != NULL) && (ifi->ifi_change == 0)) ++ { ++ if (IS_ZEBRA_DEBUG_KERNEL) ++ zlog_debug ("%s: ignoring IFLA_WIRELESS message", __func__); ++ return 0; ++ } ++#endif /* IFLA_WIRELESS */ ++ + if (tb[IFLA_IFNAME] == NULL) + return -1; + name = (char *) RTA_DATA (tb[IFLA_IFNAME]); +@@ -943,6 +954,17 @@ netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h) + /* Looking up interface name. */ + memset (tb, 0, sizeof tb); + netlink_parse_rtattr (tb, IFLA_MAX, IFLA_RTA (ifi), len); ++ ++#ifdef IFLA_WIRELESS ++ /* check for wireless messages to ignore */ ++ if ((tb[IFLA_WIRELESS] != NULL) && (ifi->ifi_change == 0)) ++ { ++ if (IS_ZEBRA_DEBUG_KERNEL) ++ zlog_debug ("%s: ignoring IFLA_WIRELESS message", __func__); ++ return 0; ++ } ++#endif /* IFLA_WIRELESS */ ++ + if (tb[IFLA_IFNAME] == NULL) + return -1; + name = (char *) RTA_DATA (tb[IFLA_IFNAME]); From 318f6c16995c45f3c645add76d83df01354538b9 Mon Sep 17 00:00:00 2001 From: jow Date: Thu, 7 May 2009 13:42:44 +0000 Subject: [PATCH 023/117] Add default configuration for Quagga daemons This patch adds default configs for quagga daemons. It adds password zebra and restricts vty access to everyone except localhost. If these confs do not exist the daemons do not start when running quagga init script. git-svn-id: svn://svn.openwrt.org/openwrt@15678 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 19 + files/quagga.conf | 6 + ...agga_olsr.patch => 002-quagga_manet.patch} | 351 ++++++++++++------ 3 files changed, 261 insertions(+), 115 deletions(-) create mode 100644 files/quagga.conf rename patches/{002-quagga_olsr.patch => 002-quagga_manet.patch} (68%) diff --git a/Makefile b/Makefile index 4864f57..1346b10 100644 --- a/Makefile +++ b/Makefile @@ -120,6 +120,7 @@ define Package/quagga/install # avoid /etc being set to 0750 $(INSTALL_DIR) $(1)/etc/quagga/ chmod 0750 $(1)/etc/quagga/ + $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/zebra.conf $(INSTALL_DIR) $(1)/etc/init.d/ $(INSTALL_BIN) ./files/quagga $(1)/usr/sbin/quagga.init $(INSTALL_BIN) ./files/quagga.init $(1)/etc/init.d/quagga @@ -177,31 +178,49 @@ 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_DATA) ./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_DATA) ./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_DATA) ./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_DATA) ./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_DATA) ./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_DATA) ./files/quagga.conf $(1)/etc/quagga/ripngd.conf endef define Package/quagga-vtysh/install diff --git a/files/quagga.conf b/files/quagga.conf new file mode 100644 index 0000000..e847c5a --- /dev/null +++ b/files/quagga.conf @@ -0,0 +1,6 @@ +password zebra +! +access-list vty permit 127.0.0.0/8 +! +line vty + access-class vty diff --git a/patches/002-quagga_olsr.patch b/patches/002-quagga_manet.patch similarity index 68% rename from patches/002-quagga_olsr.patch rename to patches/002-quagga_manet.patch index d4edf09..5140193 100644 --- a/patches/002-quagga_olsr.patch +++ b/patches/002-quagga_manet.patch @@ -1,7 +1,17 @@ -diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c ---- quagga-0.98.6/bgpd/bgp_vty.c 2006-03-30 19:12:25.000000000 +0300 -+++ quagga-0.98.6-patched/bgpd/bgp_vty.c 2007-04-05 01:26:42.000000000 +0300 -@@ -7793,7 +7793,9 @@ +diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c +--- quagga-0.98.6/bgpd/bgp_vty.c 2006-03-30 18:12:25.000000000 +0200 ++++ quagga-0.98.6.patched/bgpd/bgp_vty.c 2007-12-30 14:18:22.000000000 +0200 +@@ -3,6 +3,9 @@ + + This file is part of GNU Zebra. + ++This file was modified from the original on 30/12/2007 ++by Vasilis Tsiligiannis ++ + GNU Zebra is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any +@@ -7793,8 +7796,12 @@ return ZEBRA_ROUTE_STATIC; else if (strncmp (str, "r", 1) == 0) return ZEBRA_ROUTE_RIP; @@ -10,9 +20,12 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c + return ZEBRA_ROUTE_OLSR; + else if (strncmp (str, "os", 2) == 0) return ZEBRA_ROUTE_OSPF; ++ else if (strncmp (str, "ba", 2) == 0) ++ return ZEBRA_ROUTE_BATMAN; } if (afi == AFI_IP6) -@@ -7806,21 +7808,25 @@ + { +@@ -7806,21 +7813,28 @@ return ZEBRA_ROUTE_STATIC; else if (strncmp (str, "r", 1) == 0) return ZEBRA_ROUTE_RIPNG; @@ -21,6 +34,8 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c return ZEBRA_ROUTE_OSPF6; + else if (strncmp (str, "ol", 2) == 0) + return ZEBRA_ROUTE_OLSR; ++ else if (strncmp (str, "ba", 2) == 0) ++ return ZEBRA_ROUTE_BATMAN; } return 0; } @@ -28,7 +43,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c DEFUN (bgp_redistribute_ipv4, bgp_redistribute_ipv4_cmd, - "redistribute (connected|kernel|ospf|rip|static)", -+ "redistribute (connected|kernel|ospf|rip|static|olsr)", ++ "redistribute (connected|kernel|ospf|rip|static|olsr|batman)", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" @@ -37,16 +52,17 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c - "Static routes\n") + "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + ) { int type; -@@ -7835,13 +7841,14 @@ +@@ -7835,13 +7849,15 @@ DEFUN (bgp_redistribute_ipv4_rmap, bgp_redistribute_ipv4_rmap_cmd, - "redistribute (connected|kernel|ospf|rip|static) route-map WORD", -+ "redistribute (connected|kernel|ospf|rip|static|olsr) route-map WORD", ++ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" @@ -54,15 +70,16 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c "Routing Information Protocol (RIP)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n") { -@@ -7860,13 +7867,14 @@ +@@ -7860,13 +7876,15 @@ DEFUN (bgp_redistribute_ipv4_metric, bgp_redistribute_ipv4_metric_cmd, - "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf|rip|static|olsr) metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295>", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" @@ -70,15 +87,16 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c "Routing Information Protocol (RIP)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n") { -@@ -7887,13 +7895,14 @@ +@@ -7887,13 +7905,15 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric, bgp_redistribute_ipv4_rmap_metric_cmd, - "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf|rip|static|olsr) route-map WORD metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD metric <0-4294967295>", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" @@ -86,15 +104,16 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c "Routing Information Protocol (RIP)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -7917,13 +7926,14 @@ +@@ -7917,13 +7937,15 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap, bgp_redistribute_ipv4_metric_rmap_cmd, - "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", -+ "redistribute (connected|kernel|ospf|rip|static|olsr) metric <0-4294967295> route-map WORD", ++ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295> route-map WORD", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" @@ -102,15 +121,16 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c "Routing Information Protocol (RIP)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -7947,14 +7957,16 @@ +@@ -7947,14 +7969,17 @@ DEFUN (no_bgp_redistribute_ipv4, no_bgp_redistribute_ipv4_cmd, - "no redistribute (connected|kernel|ospf|rip|static)", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr)", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman)", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" @@ -120,84 +140,89 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c - "Static routes\n") + "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + ) { int type; -@@ -7970,7 +7982,7 @@ +@@ -7970,7 +7995,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, no_bgp_redistribute_ipv4_rmap_cmd, - "no redistribute (connected|kernel|ospf|rip|static) route-map WORD", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr) route-map WORD", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -7978,6 +7990,7 @@ +@@ -7978,6 +8003,8 @@ "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n") { -@@ -7996,7 +8009,7 @@ +@@ -7996,7 +8023,7 @@ DEFUN (no_bgp_redistribute_ipv4_metric, no_bgp_redistribute_ipv4_metric_cmd, - "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr) metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295>", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8004,6 +8017,7 @@ +@@ -8004,6 +8031,8 @@ "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n") { -@@ -8022,7 +8036,7 @@ +@@ -8022,7 +8051,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_metric, no_bgp_redistribute_ipv4_rmap_metric_cmd, - "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr) route-map WORD metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD metric <0-4294967295>", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8030,6 +8044,7 @@ +@@ -8030,6 +8059,8 @@ "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8051,7 +8066,7 @@ +@@ -8051,7 +8082,7 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_metric, no_bgp_redistribute_ipv4_metric_rmap_cmd, - "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr) metric <0-4294967295> route-map WORD", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295> route-map WORD", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8059,6 +8074,7 @@ +@@ -8059,6 +8090,8 @@ "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8067,13 +8083,15 @@ +@@ -8067,13 +8100,16 @@ #ifdef HAVE_IPV6 DEFUN (bgp_redistribute_ipv6, bgp_redistribute_ipv6_cmd, - "redistribute (connected|kernel|ospf6|ripng|static)", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr)", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman)", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" @@ -206,16 +231,17 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c - "Static routes\n") + "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + ) { int type; -@@ -8089,13 +8107,14 @@ +@@ -8089,13 +8125,15 @@ DEFUN (bgp_redistribute_ipv6_rmap, bgp_redistribute_ipv6_rmap_cmd, - "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr) route-map WORD", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" @@ -223,15 +249,16 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c "Routing Information Protocol (RIPng)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n") { -@@ -8114,13 +8133,14 @@ +@@ -8114,13 +8152,15 @@ DEFUN (bgp_redistribute_ipv6_metric, bgp_redistribute_ipv6_metric_cmd, - "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr) metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295>", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" @@ -239,15 +266,16 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c "Routing Information Protocol (RIPng)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n") { -@@ -8141,13 +8161,14 @@ +@@ -8141,13 +8181,15 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric, bgp_redistribute_ipv6_rmap_metric_cmd, - "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr) route-map WORD metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD metric <0-4294967295>", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" @@ -255,15 +283,16 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c "Routing Information Protocol (RIPng)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8171,13 +8192,14 @@ +@@ -8171,13 +8213,15 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap, bgp_redistribute_ipv6_metric_rmap_cmd, - "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr) metric <0-4294967295> route-map WORD", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295> route-map WORD", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" @@ -271,15 +300,16 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c "Routing Information Protocol (RIPng)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8201,14 +8223,16 @@ +@@ -8201,14 +8245,17 @@ DEFUN (no_bgp_redistribute_ipv6, no_bgp_redistribute_ipv6_cmd, - "no redistribute (connected|kernel|ospf6|ripng|static)", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr)", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman)", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" @@ -289,109 +319,140 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6-patched/bgpd/bgp_vty.c - "Static routes\n") + "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + ) { int type; -@@ -8224,7 +8248,7 @@ +@@ -8224,7 +8271,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, no_bgp_redistribute_ipv6_rmap_cmd, - "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr) route-map WORD", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8232,6 +8256,7 @@ +@@ -8232,6 +8279,8 @@ "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n") { -@@ -8250,7 +8275,7 @@ +@@ -8250,7 +8299,7 @@ DEFUN (no_bgp_redistribute_ipv6_metric, no_bgp_redistribute_ipv6_metric_cmd, - "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr) metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295>", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8258,6 +8283,7 @@ +@@ -8258,6 +8307,8 @@ "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n") { -@@ -8276,7 +8302,7 @@ +@@ -8276,7 +8327,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_metric, no_bgp_redistribute_ipv6_rmap_metric_cmd, - "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr) route-map WORD metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD metric <0-4294967295>", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8284,6 +8310,7 @@ +@@ -8284,6 +8335,8 @@ "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8305,7 +8332,7 @@ +@@ -8305,7 +8358,7 @@ ALIAS (no_bgp_redistribute_ipv6_rmap_metric, no_bgp_redistribute_ipv6_metric_rmap_cmd, - "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr) metric <0-4294967295> route-map WORD", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295> route-map WORD", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8313,6 +8340,7 @@ +@@ -8313,6 +8366,8 @@ "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8325,7 +8353,7 @@ +@@ -8325,7 +8380,7 @@ { int i; const char *str[] = { "system", "kernel", "connected", "static", "rip", - "ripng", "ospf", "ospf6", "isis", "bgp"}; -+ "ripng", "ospf", "ospf6", "isis", "bgp", "hsls", "olsr"}; ++ "ripng", "ospf", "ospf6", "isis", "bgp", "hsls", "olsr", "batman"}; /* Unicast redistribution only. */ if (safi != SAFI_UNICAST) -diff -Nur quagga-0.98.6/lib/zebra.h quagga-0.98.6-patched/lib/zebra.h +diff -Nur quagga-0.98.6/lib/zebra.h quagga-0.98.6.patched/lib/zebra.h --- quagga-0.98.6/lib/zebra.h 2005-06-15 14:54:18.000000000 +0300 -+++ quagga-0.98.6-patched/lib/zebra.h 2007-04-05 01:23:59.000000000 +0300 -@@ -378,7 +378,8 @@ ++++ quagga-0.98.6.patched/lib/zebra.h 2007-12-30 14:18:22.000000000 +0200 +@@ -3,6 +3,9 @@ + + This file is part of GNU Zebra. + ++This file was modified from the original on 30/12/2007 ++by Vasilis Tsiligiannis ++ + GNU Zebra is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any +@@ -378,7 +381,9 @@ #define ZEBRA_ROUTE_ISIS 8 #define ZEBRA_ROUTE_BGP 9 #define ZEBRA_ROUTE_HSLS 10 -#define ZEBRA_ROUTE_MAX 11 +#define ZEBRA_ROUTE_OLSR 11 -+#define ZEBRA_ROUTE_MAX 12 ++#define ZEBRA_ROUTE_BATMAN 12 ++#define ZEBRA_ROUTE_MAX 13 /* Zebra's family types. */ #define ZEBRA_FAMILY_IPV4 1 -diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6-patched/ospfd/ospf_vty.c ---- quagga-0.98.6/ospfd/ospf_vty.c 2006-03-30 18:41:20.000000000 +0300 -+++ quagga-0.98.6-patched/ospfd/ospf_vty.c 2007-04-05 01:23:59.000000000 +0300 -@@ -108,9 +108,11 @@ +diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c +--- quagga-0.98.6/ospfd/ospf_vty.c 2006-03-30 17:41:20.000000000 +0200 ++++ quagga-0.98.6.patched/ospfd/ospf_vty.c 2007-12-30 14:18:22.000000000 +0200 +@@ -3,6 +3,9 @@ + * + * This file is part of GNU Zebra. + * ++ * This file was modified from the original on 30/12/2007 ++ * by Vasilis Tsiligiannis ++ * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any +@@ -106,11 +109,15 @@ + *source = ZEBRA_ROUTE_STATIC; + else if (strncmp (str, "r", 1) == 0) *source = ZEBRA_ROUTE_RIP; - else if (strncmp (str, "b", 1) == 0) +- else if (strncmp (str, "b", 1) == 0) ++ else if (strncmp (str, "bg", 2) == 0) *source = ZEBRA_ROUTE_BGP; + else if (strncmp (str, "ol", 2) == 0) + *source = ZEBRA_ROUTE_OLSR; ++ else if (strncmp (str, "ba", 2) == 0) ++ *source = ZEBRA_ROUTE_BATMAN; else return 0; - @@ -399,12 +460,12 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6-patched/ospfd/ospf_vty.c return 1; } -@@ -5302,13 +5304,14 @@ +@@ -5302,13 +5309,15 @@ DEFUN (ospf_redistribute_source_metric_type, ospf_redistribute_source_metric_type_routemap_cmd, - "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr) metric <0-16777214> metric-type (1|2) route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214> metric-type (1|2) route-map WORD", "Redistribute information from another routing protocol\n" "Kernel routes\n" "Connected\n" @@ -412,15 +473,16 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6-patched/ospfd/ospf_vty.c "Routing Information Protocol (RIP)\n" "Border Gateway Protocol (BGP)\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "OSPF default metric\n" "OSPF exterior metric type for redistributed routes\n" -@@ -5346,13 +5349,14 @@ +@@ -5346,13 +5355,15 @@ ALIAS (ospf_redistribute_source_metric_type, ospf_redistribute_source_metric_type_cmd, - "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)", -+ "redistribute (kernel|connected|static|rip|bgp|olsr) metric <0-16777214> metric-type (1|2)", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214> metric-type (1|2)", "Redistribute information from another routing protocol\n" "Kernel routes\n" "Connected\n" @@ -428,21 +490,31 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6-patched/ospfd/ospf_vty.c "Routing Information Protocol (RIP)\n" "Border Gateway Protocol (BGP)\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "OSPF default metric\n" "OSPF exterior metric type for redistributed routes\n" -@@ -5368,18 +5372,20 @@ +@@ -5361,25 +5372,29 @@ + + ALIAS (ospf_redistribute_source_metric_type, + ospf_redistribute_source_metric_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214>", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" "Static routes\n" "Routing Information Protocol (RIP)\n" "Border Gateway Protocol (BGP)\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "OSPF default metric\n") DEFUN (ospf_redistribute_source_type_metric, ospf_redistribute_source_type_metric_routemap_cmd, - "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr) metric-type (1|2) metric <0-16777214> route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2) metric <0-16777214> route-map WORD", "Redistribute information from another routing protocol\n" "Kernel routes\n" "Connected\n" @@ -450,15 +522,16 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6-patched/ospfd/ospf_vty.c "Routing Information Protocol (RIP)\n" "Border Gateway Protocol (BGP)\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "OSPF exterior metric type for redistributed routes\n" "Set OSPF External Type 1 metrics\n" "Set OSPF External Type 2 metrics\n" -@@ -5417,13 +5423,14 @@ +@@ -5417,13 +5432,15 @@ ALIAS (ospf_redistribute_source_type_metric, ospf_redistribute_source_type_metric_cmd, - "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>", -+ "redistribute (kernel|connected|static|rip|bgp|olsr) metric-type (1|2) metric <0-16777214>", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2) metric <0-16777214>", "Redistribute information from another routing protocol\n" "Kernel routes\n" "Connected\n" @@ -466,30 +539,32 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6-patched/ospfd/ospf_vty.c "Routing Information Protocol (RIP)\n" "Border Gateway Protocol (BGP)\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "OSPF exterior metric type for redistributed routes\n" "Set OSPF External Type 1 metrics\n" "Set OSPF External Type 2 metrics\n" -@@ -5432,7 +5439,7 @@ +@@ -5432,7 +5449,7 @@ ALIAS (ospf_redistribute_source_type_metric, ospf_redistribute_source_type_cmd, - "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)", -+ "redistribute (kernel|connected|static|rip|bgp|olsr) metric-type (1|2)", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2)", "Redistribute information from another routing protocol\n" "Kernel routes\n" "Connected\n" -@@ -5440,28 +5447,31 @@ +@@ -5440,28 +5457,35 @@ "Routing Information Protocol (RIP)\n" "Border Gateway Protocol (BGP)\n" "OSPF exterior metric type for redistributed routes\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Set OSPF External Type 1 metrics\n" "Set OSPF External Type 2 metrics\n") ALIAS (ospf_redistribute_source_type_metric, ospf_redistribute_source_cmd, - "redistribute (kernel|connected|static|rip|bgp)", -+ "redistribute (kernel|connected|static|rip|bgp|olsr)", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman)", "Redistribute information from another routing protocol\n" "Kernel routes\n" "Connected\n" @@ -497,12 +572,14 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6-patched/ospfd/ospf_vty.c "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n") + "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n") ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" ++ ) DEFUN (ospf_redistribute_source_metric_routemap, ospf_redistribute_source_metric_routemap_cmd, - "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr) metric <0-16777214> route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214> route-map WORD", "Redistribute information from another routing protocol\n" "Kernel routes\n" "Connected\n" @@ -510,15 +587,16 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6-patched/ospfd/ospf_vty.c "Routing Information Protocol (RIP)\n" "Border Gateway Protocol (BGP)\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "OSPF default metric\n" "Route map reference\n" -@@ -5490,13 +5500,14 @@ +@@ -5490,13 +5514,15 @@ DEFUN (ospf_redistribute_source_type_routemap, ospf_redistribute_source_type_routemap_cmd, - "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr) metric-type (1|2) route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2) route-map WORD", "Redistribute information from another routing protocol\n" "Kernel routes\n" "Connected\n" @@ -526,15 +604,16 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6-patched/ospfd/ospf_vty.c "Routing Information Protocol (RIP)\n" "Border Gateway Protocol (BGP)\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "OSPF exterior metric type for redistributed routes\n" "Set OSPF External Type 1 metrics\n" "Set OSPF External Type 2 metrics\n" -@@ -5526,13 +5537,14 @@ +@@ -5526,13 +5552,15 @@ DEFUN (ospf_redistribute_source_routemap, ospf_redistribute_source_routemap_cmd, - "redistribute (kernel|connected|static|rip|bgp) route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr) route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) route-map WORD", "Redistribute information from another routing protocol\n" "Kernel routes\n" "Connected\n" @@ -542,15 +621,16 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6-patched/ospfd/ospf_vty.c "Routing Information Protocol (RIP)\n" "Border Gateway Protocol (BGP)\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n") { -@@ -5553,14 +5565,16 @@ +@@ -5553,14 +5581,17 @@ DEFUN (no_ospf_redistribute_source, no_ospf_redistribute_source_cmd, - "no redistribute (kernel|connected|static|rip|bgp)", -+ "no redistribute (kernel|connected|static|rip|bgp|olsr)", ++ "no redistribute (kernel|connected|static|rip|bgp|olsr|batman)", NO_STR "Redistribute information from another routing protocol\n" "Kernel routes\n" @@ -559,91 +639,110 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6-patched/ospfd/ospf_vty.c "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n") + "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (olsr)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + ) { struct ospf *ospf = vty->index; int source; -@@ -5574,7 +5588,7 @@ +@@ -5574,7 +5605,7 @@ DEFUN (ospf_distribute_list_out, ospf_distribute_list_out_cmd, - "distribute-list WORD out (kernel|connected|static|rip|bgp)", -+ "distribute-list WORD out (kernel|connected|static|rip|bgp|olsr)", ++ "distribute-list WORD out (kernel|connected|static|rip|bgp|olsr|batman)", "Filter networks in routing updates\n" "Access-list name\n" OUT_STR -@@ -5582,7 +5596,8 @@ +@@ -5582,7 +5613,10 @@ "Connected\n" "Static routes\n" "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n") + "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n") ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" ++) { struct ospf *ospf = vty->index; int source; -@@ -5596,7 +5611,7 @@ +@@ -5596,7 +5630,7 @@ DEFUN (no_ospf_distribute_list_out, no_ospf_distribute_list_out_cmd, - "no distribute-list WORD out (kernel|connected|static|rip|bgp)", -+ "no distribute-list WORD out (kernel|connected|static|rip|bgp|olsr)", ++ "no distribute-list WORD out (kernel|connected|static|rip|bgp|olsr|batman)", NO_STR "Filter networks in routing updates\n" "Access-list name\n" -@@ -5605,7 +5620,8 @@ +@@ -5605,7 +5639,10 @@ "Connected\n" "Static routes\n" "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n") + "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n") ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" ++) { struct ospf *ospf = vty->index; int source; -@@ -7121,7 +7137,8 @@ +@@ -7121,7 +7158,8 @@ const char *distribute_str[] = { "system", "kernel", "connected", "static", - "rip", "ripng", "ospf", "ospf6", "isis", "bgp"}; + "rip", "ripng", "ospf", "ospf6", "isis", "bgp", -+ "hsls","olsr"}; ++ "hsls","olsr","batman"}; int config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) { -diff -Nur quagga-0.98.6/zebra/redistribute.c quagga-0.98.6-patched/zebra/redistribute.c +diff -Nur quagga-0.98.6/zebra/redistribute.c quagga-0.98.6.patched/zebra/redistribute.c --- quagga-0.98.6/zebra/redistribute.c 2005-06-15 14:54:51.000000000 +0300 -+++ quagga-0.98.6-patched/zebra/redistribute.c 2007-04-05 01:27:23.000000000 +0300 -@@ -253,6 +253,7 @@ ++++ quagga-0.98.6.patched/zebra/redistribute.c 2007-12-30 14:18:22.000000000 +0200 +@@ -3,6 +3,9 @@ + * + * This file is part of GNU Zebra. + * ++ * This file was modified from the original on 30/12/2007 ++ * by Vasilis Tsiligiannis ++ * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any +@@ -253,6 +256,8 @@ case ZEBRA_ROUTE_OSPF: case ZEBRA_ROUTE_OSPF6: case ZEBRA_ROUTE_BGP: + case ZEBRA_ROUTE_OLSR: ++ case ZEBRA_ROUTE_BATMAN: if (! client->redist[type]) { client->redist[type] = 1; -@@ -281,6 +282,7 @@ +@@ -281,6 +286,8 @@ case ZEBRA_ROUTE_OSPF: case ZEBRA_ROUTE_OSPF6: case ZEBRA_ROUTE_BGP: + case ZEBRA_ROUTE_OLSR: ++ case ZEBRA_ROUTE_BATMAN: client->redist[type] = 0; break; default: -diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6-patched/zebra/zebra_vty.c +diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6.patched/zebra/zebra_vty.c --- quagga-0.98.6/zebra/zebra_vty.c 2004-12-18 18:03:29.000000000 +0200 -+++ quagga-0.98.6-patched/zebra/zebra_vty.c 2007-04-05 01:23:59.000000000 +0300 -@@ -53,6 +53,8 @@ ++++ quagga-0.98.6.patched/zebra/zebra_vty.c 2007-12-30 14:25:48.000000000 +0200 +@@ -53,6 +53,10 @@ return "isis"; case ZEBRA_ROUTE_BGP: return "bgp"; + case ZEBRA_ROUTE_OLSR: + return "olsr"; ++ case ZEBRA_ROUTE_BATMAN: ++ return "batman"; default: return "unknown"; } -@@ -84,6 +86,10 @@ +@@ -84,6 +88,12 @@ return 'I'; case ZEBRA_ROUTE_BGP: return 'B'; @@ -651,38 +750,48 @@ diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6-patched/zebra/zebra_vty. + return 'H'; + case ZEBRA_ROUTE_OLSR: + return 'L'; ++ case ZEBRA_ROUTE_BATMAN: ++ return 'M'; default: return '?'; } -@@ -755,8 +761,8 @@ +@@ -755,8 +765,8 @@ } #define SHOW_ROUTE_V4_HEADER "Codes: K - kernel route, C - connected, " \ - "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, " \ - "> - selected route, * - FIB route%s%s" + "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, H - HSLS, " \ -+ "L - OLSR, > - selected route, * - FIB route%s%s" ++ "L - OLSR, M - BATMAN, > - selected route, * - FIB route%s%s" DEFUN (show_ip_route, show_ip_route_cmd, -@@ -874,7 +880,7 @@ +@@ -874,7 +884,7 @@ DEFUN (show_ip_route_protocol, show_ip_route_protocol_cmd, - "show ip route (bgp|connected|isis|kernel|ospf|rip|static)", -+ "show ip route (bgp|connected|isis|kernel|ospf|rip|olsr|static)", ++ "show ip route (bgp|connected|isis|kernel|ospf|rip|olsr|batman|static)", SHOW_STR IP_STR "IP routing table\n" -@@ -884,6 +890,7 @@ +@@ -884,6 +894,8 @@ "Kernel\n" "Open Shortest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" + "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Static routes\n") { int type; -@@ -898,7 +905,7 @@ +@@ -892,13 +904,13 @@ + struct rib *rib; + int first = 1; + +- if (strncmp (argv[0], "b", 1) == 0) ++ if (strncmp (argv[0], "bg", 2) == 0) + type = ZEBRA_ROUTE_BGP; + else if (strncmp (argv[0], "c", 1) == 0) type = ZEBRA_ROUTE_CONNECT; else if (strncmp (argv[0], "k", 1) ==0) type = ZEBRA_ROUTE_KERNEL; @@ -691,33 +800,43 @@ diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6-patched/zebra/zebra_vty. type = ZEBRA_ROUTE_OSPF; else if (strncmp (argv[0], "i", 1) == 0) type = ZEBRA_ROUTE_ISIS; -@@ -906,6 +913,8 @@ +@@ -906,6 +918,10 @@ type = ZEBRA_ROUTE_RIP; else if (strncmp (argv[0], "s", 1) == 0) type = ZEBRA_ROUTE_STATIC; + else if (strncmp (argv[0], "ol", 2) == 0) + type = ZEBRA_ROUTE_OLSR; ++ else if (strncmp (argv[0], "ba", 2) == 0) ++ type = ZEBRA_ROUTE_BATMAN; else { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); -@@ -1732,7 +1741,7 @@ +@@ -1732,7 +1748,7 @@ DEFUN (show_ipv6_route_protocol, show_ipv6_route_protocol_cmd, - "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|static)", -+ "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|olsr|static)", ++ "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|olsr|batman|static)", SHOW_STR IP_STR "IP routing table\n" -@@ -1742,6 +1751,7 @@ +@@ -1742,6 +1758,8 @@ "Kernel\n" "Open Shortest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" -+ "Optimized Link State Routing (olsr)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Static routes\n") { int type; -@@ -1756,7 +1766,7 @@ +@@ -1750,13 +1768,13 @@ + struct rib *rib; + int first = 1; + +- if (strncmp (argv[0], "b", 1) == 0) ++ if (strncmp (argv[0], "bg", 2) == 0) + type = ZEBRA_ROUTE_BGP; + else if (strncmp (argv[0], "c", 1) == 0) type = ZEBRA_ROUTE_CONNECT; else if (strncmp (argv[0], "k", 1) ==0) type = ZEBRA_ROUTE_KERNEL; @@ -726,13 +845,15 @@ diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6-patched/zebra/zebra_vty. type = ZEBRA_ROUTE_OSPF6; else if (strncmp (argv[0], "i", 1) == 0) type = ZEBRA_ROUTE_ISIS; -@@ -1764,7 +1774,9 @@ +@@ -1764,7 +1782,11 @@ type = ZEBRA_ROUTE_RIPNG; else if (strncmp (argv[0], "s", 1) == 0) type = ZEBRA_ROUTE_STATIC; - else + else if (strncmp (argv[0], "ol", 2) == 0) + type = ZEBRA_ROUTE_OLSR; ++ else if (strncmp (argv[0], "ba", 2) == 0) ++ type = ZEBRA_ROUTE_BATMAN; + else { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); From 2a847242481dcd3f8f654259b718943de5ddc8b2 Mon Sep 17 00:00:00 2001 From: jow Date: Wed, 20 May 2009 21:08:51 +0000 Subject: [PATCH 024/117] [PATCH] [Quagga] Add missing vty access list line Signed-off-by: Vasilis Tsiligiannis git-svn-id: svn://svn.openwrt.org/openwrt@15943 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- files/quagga.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/files/quagga.conf b/files/quagga.conf index e847c5a..fb7a54e 100644 --- a/files/quagga.conf +++ b/files/quagga.conf @@ -1,6 +1,7 @@ password zebra ! access-list vty permit 127.0.0.0/8 +access-list vty deny any ! line vty access-class vty From 9dc3de800e48f38ad3e00ae893dc08520db8a59b Mon Sep 17 00:00:00 2001 From: acinonyx Date: Wed, 10 Jun 2009 12:30:49 +0000 Subject: [PATCH 025/117] [packages] quagga: Set BGP Hold Timer to a large value on OpenSent state (RFC1771, Par.8) git-svn-id: svn+ssh://svn.openwrt.org/openwrt@16398 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/140-holdtimer-set.patch | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 patches/140-holdtimer-set.patch diff --git a/patches/140-holdtimer-set.patch b/patches/140-holdtimer-set.patch new file mode 100644 index 0000000..bfc95d5 --- /dev/null +++ b/patches/140-holdtimer-set.patch @@ -0,0 +1,24 @@ +diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c +index df37783..c4d5a61 100644 +--- a/bgpd/bgp_network.c ++++ b/bgpd/bgp_network.c +@@ -109,6 +109,7 @@ bgp_accept (struct thread *thread) + peer->fd = bgp_sock; + peer->status = Active; + peer->local_id = peer1->local_id; ++ peer->v_holdtime = BGP_LARGE_HOLDTIME; + + /* Make peer's address string. */ + sockunion2str (&su, buf, SU_ADDRSTRLEN); +diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h +index 4137baf..8615ac8 100644 +--- a/bgpd/bgpd.h ++++ b/bgpd/bgpd.h +@@ -656,6 +656,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 From 7704199cde33f8e3400cbeb67cdfea77455e1c46 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Wed, 10 Jun 2009 12:32:35 +0000 Subject: [PATCH 026/117] [packages] quagga: refresh patches git-svn-id: svn+ssh://svn.openwrt.org/openwrt@16399 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/001-quagga_cross.patch | 8 +- patches/001-quagga_readline.patch | 16 +-- patches/002-quagga_manet.patch | 143 +++++++++++----------- patches/100-confederation.patch | 9 +- patches/120-confed_errorhandle.patch | 23 ++-- patches/130-netlink_ignore_wireless.patch | 6 +- patches/140-holdtimer-set.patch | 4 - 7 files changed, 97 insertions(+), 112 deletions(-) diff --git a/patches/001-quagga_cross.patch b/patches/001-quagga_cross.patch index 5b8276b..b6d5b20 100644 --- a/patches/001-quagga_cross.patch +++ b/patches/001-quagga_cross.patch @@ -1,6 +1,6 @@ ---- quagga-0.98.4/configure.orig Mon Jun 27 19:05:31 2005 -+++ quagga-0.98.4/configure Mon Jul 11 20:32:07 2005 -@@ -12623,69 +12623,6 @@ +--- a/configure ++++ b/configure +@@ -12675,69 +12675,6 @@ fi @@ -70,7 +70,7 @@ echo "$as_me:$LINENO: checking route read method check" >&5 echo $ECHO_N "checking route read method check... $ECHO_C" >&6 if test "${zebra_rtread+set}" = set; then -@@ -12783,10 +12720,7 @@ +@@ -12835,10 +12772,7 @@ echo $ECHO_N "checking ipforward method if test "${zebra_ipforward_path+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else diff --git a/patches/001-quagga_readline.patch b/patches/001-quagga_readline.patch index 8e3b805..68113fd 100644 --- a/patches/001-quagga_readline.patch +++ b/patches/001-quagga_readline.patch @@ -1,6 +1,6 @@ ---- quagga-0.98.4/configure.orig Mon Jun 27 19:05:31 2005 -+++ quagga-0.98.4/configure Thu Jul 28 07:02:12 2005 -@@ -10937,7 +10937,7 @@ +--- a/configure ++++ b/configure +@@ -10972,7 +10972,7 @@ if test "${ac_cv_lib_curses_tputs+set}" echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9,7 +9,7 @@ cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF -@@ -11071,7 +11071,8 @@ +@@ -11108,7 +11108,8 @@ if test $ac_cv_lib_ncurses_tputs = yes; #define HAVE_LIBNCURSES 1 _ACEOF @@ -19,7 +19,7 @@ fi -@@ -11088,7 +11089,7 @@ +@@ -11125,7 +11126,7 @@ if test "${ac_cv_lib_readline_main+set}" echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS @@ -28,7 +28,7 @@ cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF -@@ -11144,7 +11145,8 @@ +@@ -11182,7 +11183,8 @@ if test $ac_cv_lib_readline_main = yes; #define HAVE_LIBREADLINE 1 _ACEOF @@ -38,7 +38,7 @@ fi -@@ -11303,7 +11305,7 @@ +@@ -11342,7 +11344,7 @@ if test "${ac_cv_lib_readline_rl_complet echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS @@ -47,7 +47,7 @@ cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF -@@ -11365,7 +11367,7 @@ +@@ -11405,7 +11407,7 @@ if test $ac_cv_lib_readline_rl_completio #define HAVE_LIBREADLINE 1 _ACEOF diff --git a/patches/002-quagga_manet.patch b/patches/002-quagga_manet.patch index 5140193..8fe07ac 100644 --- a/patches/002-quagga_manet.patch +++ b/patches/002-quagga_manet.patch @@ -1,6 +1,5 @@ -diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c ---- quagga-0.98.6/bgpd/bgp_vty.c 2006-03-30 18:12:25.000000000 +0200 -+++ quagga-0.98.6.patched/bgpd/bgp_vty.c 2007-12-30 14:18:22.000000000 +0200 +--- a/bgpd/bgp_vty.c ++++ b/bgpd/bgp_vty.c @@ -3,6 +3,9 @@ This file is part of GNU Zebra. @@ -11,7 +10,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c GNU Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any -@@ -7793,8 +7796,12 @@ +@@ -7793,8 +7796,12 @@ bgp_str2route_type (int afi, const char return ZEBRA_ROUTE_STATIC; else if (strncmp (str, "r", 1) == 0) return ZEBRA_ROUTE_RIP; @@ -25,7 +24,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c } if (afi == AFI_IP6) { -@@ -7806,21 +7813,28 @@ +@@ -7806,21 +7813,28 @@ bgp_str2route_type (int afi, const char return ZEBRA_ROUTE_STATIC; else if (strncmp (str, "r", 1) == 0) return ZEBRA_ROUTE_RIPNG; @@ -57,7 +56,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c { int type; -@@ -7835,13 +7849,15 @@ +@@ -7835,13 +7849,15 @@ DEFUN (bgp_redistribute_ipv4, DEFUN (bgp_redistribute_ipv4_rmap, bgp_redistribute_ipv4_rmap_cmd, @@ -74,7 +73,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n") { -@@ -7860,13 +7876,15 @@ +@@ -7860,13 +7876,15 @@ DEFUN (bgp_redistribute_ipv4_rmap, DEFUN (bgp_redistribute_ipv4_metric, bgp_redistribute_ipv4_metric_cmd, @@ -91,7 +90,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n") { -@@ -7887,13 +7905,15 @@ +@@ -7887,13 +7905,15 @@ DEFUN (bgp_redistribute_ipv4_metric, DEFUN (bgp_redistribute_ipv4_rmap_metric, bgp_redistribute_ipv4_rmap_metric_cmd, @@ -108,7 +107,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -7917,13 +7937,15 @@ +@@ -7917,13 +7937,15 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric DEFUN (bgp_redistribute_ipv4_metric_rmap, bgp_redistribute_ipv4_metric_rmap_cmd, @@ -125,7 +124,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -7947,14 +7969,17 @@ +@@ -7947,14 +7969,17 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap DEFUN (no_bgp_redistribute_ipv4, no_bgp_redistribute_ipv4_cmd, @@ -145,7 +144,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c { int type; -@@ -7970,7 +7995,7 @@ +@@ -7970,7 +7995,7 @@ DEFUN (no_bgp_redistribute_ipv4, DEFUN (no_bgp_redistribute_ipv4_rmap, no_bgp_redistribute_ipv4_rmap_cmd, @@ -154,7 +153,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -7978,6 +8003,8 @@ +@@ -7978,6 +8003,8 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" @@ -163,7 +162,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n") { -@@ -7996,7 +8023,7 @@ +@@ -7996,7 +8023,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, DEFUN (no_bgp_redistribute_ipv4_metric, no_bgp_redistribute_ipv4_metric_cmd, @@ -172,7 +171,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8004,6 +8031,8 @@ +@@ -8004,6 +8031,8 @@ DEFUN (no_bgp_redistribute_ipv4_metric, "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" @@ -181,7 +180,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n") { -@@ -8022,7 +8051,7 @@ +@@ -8022,7 +8051,7 @@ DEFUN (no_bgp_redistribute_ipv4_metric, DEFUN (no_bgp_redistribute_ipv4_rmap_metric, no_bgp_redistribute_ipv4_rmap_metric_cmd, @@ -190,7 +189,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8030,6 +8059,8 @@ +@@ -8030,6 +8059,8 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" @@ -199,7 +198,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8051,7 +8082,7 @@ +@@ -8051,7 +8082,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met ALIAS (no_bgp_redistribute_ipv4_rmap_metric, no_bgp_redistribute_ipv4_metric_rmap_cmd, @@ -208,7 +207,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8059,6 +8090,8 @@ +@@ -8059,6 +8090,8 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" @@ -217,7 +216,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8067,13 +8100,16 @@ +@@ -8067,13 +8100,16 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met #ifdef HAVE_IPV6 DEFUN (bgp_redistribute_ipv6, bgp_redistribute_ipv6_cmd, @@ -236,7 +235,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c { int type; -@@ -8089,13 +8125,15 @@ +@@ -8089,13 +8125,15 @@ DEFUN (bgp_redistribute_ipv6, DEFUN (bgp_redistribute_ipv6_rmap, bgp_redistribute_ipv6_rmap_cmd, @@ -253,7 +252,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n") { -@@ -8114,13 +8152,15 @@ +@@ -8114,13 +8152,15 @@ DEFUN (bgp_redistribute_ipv6_rmap, DEFUN (bgp_redistribute_ipv6_metric, bgp_redistribute_ipv6_metric_cmd, @@ -270,7 +269,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n") { -@@ -8141,13 +8181,15 @@ +@@ -8141,13 +8181,15 @@ DEFUN (bgp_redistribute_ipv6_metric, DEFUN (bgp_redistribute_ipv6_rmap_metric, bgp_redistribute_ipv6_rmap_metric_cmd, @@ -287,7 +286,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8171,13 +8213,15 @@ +@@ -8171,13 +8213,15 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric DEFUN (bgp_redistribute_ipv6_metric_rmap, bgp_redistribute_ipv6_metric_rmap_cmd, @@ -304,7 +303,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8201,14 +8245,17 @@ +@@ -8201,14 +8245,17 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap DEFUN (no_bgp_redistribute_ipv6, no_bgp_redistribute_ipv6_cmd, @@ -324,7 +323,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c { int type; -@@ -8224,7 +8271,7 @@ +@@ -8224,7 +8271,7 @@ DEFUN (no_bgp_redistribute_ipv6, DEFUN (no_bgp_redistribute_ipv6_rmap, no_bgp_redistribute_ipv6_rmap_cmd, @@ -333,7 +332,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8232,6 +8279,8 @@ +@@ -8232,6 +8279,8 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" @@ -342,7 +341,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n") { -@@ -8250,7 +8299,7 @@ +@@ -8250,7 +8299,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, DEFUN (no_bgp_redistribute_ipv6_metric, no_bgp_redistribute_ipv6_metric_cmd, @@ -351,7 +350,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8258,6 +8307,8 @@ +@@ -8258,6 +8307,8 @@ DEFUN (no_bgp_redistribute_ipv6_metric, "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" @@ -360,7 +359,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n") { -@@ -8276,7 +8327,7 @@ +@@ -8276,7 +8327,7 @@ DEFUN (no_bgp_redistribute_ipv6_metric, DEFUN (no_bgp_redistribute_ipv6_rmap_metric, no_bgp_redistribute_ipv6_rmap_metric_cmd, @@ -369,7 +368,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8284,6 +8335,8 @@ +@@ -8284,6 +8335,8 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" @@ -378,7 +377,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8305,7 +8358,7 @@ +@@ -8305,7 +8358,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met ALIAS (no_bgp_redistribute_ipv6_rmap_metric, no_bgp_redistribute_ipv6_metric_rmap_cmd, @@ -387,7 +386,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8313,6 +8366,8 @@ +@@ -8313,6 +8366,8 @@ ALIAS (no_bgp_redistribute_ipv6_rmap_met "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" @@ -396,7 +395,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8325,7 +8380,7 @@ +@@ -8325,7 +8380,7 @@ bgp_config_write_redistribute (struct vt { int i; const char *str[] = { "system", "kernel", "connected", "static", "rip", @@ -405,9 +404,8 @@ diff -Nur quagga-0.98.6/bgpd/bgp_vty.c quagga-0.98.6.patched/bgpd/bgp_vty.c /* Unicast redistribution only. */ if (safi != SAFI_UNICAST) -diff -Nur quagga-0.98.6/lib/zebra.h quagga-0.98.6.patched/lib/zebra.h ---- quagga-0.98.6/lib/zebra.h 2005-06-15 14:54:18.000000000 +0300 -+++ quagga-0.98.6.patched/lib/zebra.h 2007-12-30 14:18:22.000000000 +0200 +--- a/lib/zebra.h ++++ b/lib/zebra.h @@ -3,6 +3,9 @@ This file is part of GNU Zebra. @@ -418,7 +416,7 @@ diff -Nur quagga-0.98.6/lib/zebra.h quagga-0.98.6.patched/lib/zebra.h GNU Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any -@@ -378,7 +381,9 @@ +@@ -378,7 +381,9 @@ struct in_pktinfo #define ZEBRA_ROUTE_ISIS 8 #define ZEBRA_ROUTE_BGP 9 #define ZEBRA_ROUTE_HSLS 10 @@ -429,9 +427,8 @@ diff -Nur quagga-0.98.6/lib/zebra.h quagga-0.98.6.patched/lib/zebra.h /* Zebra's family types. */ #define ZEBRA_FAMILY_IPV4 1 -diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c ---- quagga-0.98.6/ospfd/ospf_vty.c 2006-03-30 17:41:20.000000000 +0200 -+++ quagga-0.98.6.patched/ospfd/ospf_vty.c 2007-12-30 14:18:22.000000000 +0200 +--- a/ospfd/ospf_vty.c ++++ b/ospfd/ospf_vty.c @@ -3,6 +3,9 @@ * * This file is part of GNU Zebra. @@ -442,7 +439,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c * GNU Zebra is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any -@@ -106,11 +109,15 @@ +@@ -106,11 +109,15 @@ str2distribute_source (const char *str, *source = ZEBRA_ROUTE_STATIC; else if (strncmp (str, "r", 1) == 0) *source = ZEBRA_ROUTE_RIP; @@ -460,7 +457,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c return 1; } -@@ -5302,13 +5309,15 @@ +@@ -5302,13 +5309,15 @@ ALIAS (no_ip_ospf_transmit_delay, DEFUN (ospf_redistribute_source_metric_type, ospf_redistribute_source_metric_type_routemap_cmd, @@ -477,7 +474,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c "Metric for redistributed routes\n" "OSPF default metric\n" "OSPF exterior metric type for redistributed routes\n" -@@ -5346,13 +5355,15 @@ +@@ -5346,13 +5355,15 @@ DEFUN (ospf_redistribute_source_metric_t ALIAS (ospf_redistribute_source_metric_type, ospf_redistribute_source_metric_type_cmd, @@ -494,7 +491,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c "Metric for redistributed routes\n" "OSPF default metric\n" "OSPF exterior metric type for redistributed routes\n" -@@ -5361,25 +5372,29 @@ +@@ -5361,25 +5372,29 @@ ALIAS (ospf_redistribute_source_metric_t ALIAS (ospf_redistribute_source_metric_type, ospf_redistribute_source_metric_cmd, @@ -526,7 +523,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c "OSPF exterior metric type for redistributed routes\n" "Set OSPF External Type 1 metrics\n" "Set OSPF External Type 2 metrics\n" -@@ -5417,13 +5432,15 @@ +@@ -5417,13 +5432,15 @@ DEFUN (ospf_redistribute_source_type_met ALIAS (ospf_redistribute_source_type_metric, ospf_redistribute_source_type_metric_cmd, @@ -543,7 +540,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c "OSPF exterior metric type for redistributed routes\n" "Set OSPF External Type 1 metrics\n" "Set OSPF External Type 2 metrics\n" -@@ -5432,7 +5449,7 @@ +@@ -5432,7 +5449,7 @@ ALIAS (ospf_redistribute_source_type_met ALIAS (ospf_redistribute_source_type_metric, ospf_redistribute_source_type_cmd, @@ -552,7 +549,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c "Redistribute information from another routing protocol\n" "Kernel routes\n" "Connected\n" -@@ -5440,28 +5457,35 @@ +@@ -5440,28 +5457,35 @@ ALIAS (ospf_redistribute_source_type_met "Routing Information Protocol (RIP)\n" "Border Gateway Protocol (BGP)\n" "OSPF exterior metric type for redistributed routes\n" @@ -591,7 +588,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c "Metric for redistributed routes\n" "OSPF default metric\n" "Route map reference\n" -@@ -5490,13 +5514,15 @@ +@@ -5490,13 +5514,15 @@ DEFUN (ospf_redistribute_source_metric_r DEFUN (ospf_redistribute_source_type_routemap, ospf_redistribute_source_type_routemap_cmd, @@ -608,7 +605,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c "OSPF exterior metric type for redistributed routes\n" "Set OSPF External Type 1 metrics\n" "Set OSPF External Type 2 metrics\n" -@@ -5526,13 +5552,15 @@ +@@ -5526,13 +5552,15 @@ DEFUN (ospf_redistribute_source_type_rou DEFUN (ospf_redistribute_source_routemap, ospf_redistribute_source_routemap_cmd, @@ -625,7 +622,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c "Route map reference\n" "Pointer to route-map entries\n") { -@@ -5553,14 +5581,17 @@ +@@ -5553,14 +5581,17 @@ DEFUN (ospf_redistribute_source_routemap DEFUN (no_ospf_redistribute_source, no_ospf_redistribute_source_cmd, @@ -645,7 +642,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c { struct ospf *ospf = vty->index; int source; -@@ -5574,7 +5605,7 @@ +@@ -5574,7 +5605,7 @@ DEFUN (no_ospf_redistribute_source, DEFUN (ospf_distribute_list_out, ospf_distribute_list_out_cmd, @@ -654,7 +651,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c "Filter networks in routing updates\n" "Access-list name\n" OUT_STR -@@ -5582,7 +5613,10 @@ +@@ -5582,7 +5613,10 @@ DEFUN (ospf_distribute_list_out, "Connected\n" "Static routes\n" "Routing Information Protocol (RIP)\n" @@ -666,7 +663,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c { struct ospf *ospf = vty->index; int source; -@@ -5596,7 +5630,7 @@ +@@ -5596,7 +5630,7 @@ DEFUN (ospf_distribute_list_out, DEFUN (no_ospf_distribute_list_out, no_ospf_distribute_list_out_cmd, @@ -675,7 +672,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c NO_STR "Filter networks in routing updates\n" "Access-list name\n" -@@ -5605,7 +5639,10 @@ +@@ -5605,7 +5639,10 @@ DEFUN (no_ospf_distribute_list_out, "Connected\n" "Static routes\n" "Routing Information Protocol (RIP)\n" @@ -687,7 +684,7 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c { struct ospf *ospf = vty->index; int source; -@@ -7121,7 +7158,8 @@ +@@ -7121,7 +7158,8 @@ config_write_virtual_link (struct vty *v const char *distribute_str[] = { "system", "kernel", "connected", "static", @@ -697,9 +694,8 @@ diff -Nur quagga-0.98.6/ospfd/ospf_vty.c quagga-0.98.6.patched/ospfd/ospf_vty.c int config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) { -diff -Nur quagga-0.98.6/zebra/redistribute.c quagga-0.98.6.patched/zebra/redistribute.c ---- quagga-0.98.6/zebra/redistribute.c 2005-06-15 14:54:51.000000000 +0300 -+++ quagga-0.98.6.patched/zebra/redistribute.c 2007-12-30 14:18:22.000000000 +0200 +--- a/zebra/redistribute.c ++++ b/zebra/redistribute.c @@ -3,6 +3,9 @@ * * This file is part of GNU Zebra. @@ -710,7 +706,7 @@ diff -Nur quagga-0.98.6/zebra/redistribute.c quagga-0.98.6.patched/zebra/redistr * GNU Zebra is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any -@@ -253,6 +256,8 @@ +@@ -253,6 +256,8 @@ zebra_redistribute_add (int command, str case ZEBRA_ROUTE_OSPF: case ZEBRA_ROUTE_OSPF6: case ZEBRA_ROUTE_BGP: @@ -719,7 +715,7 @@ diff -Nur quagga-0.98.6/zebra/redistribute.c quagga-0.98.6.patched/zebra/redistr if (! client->redist[type]) { client->redist[type] = 1; -@@ -281,6 +286,8 @@ +@@ -281,6 +286,8 @@ zebra_redistribute_delete (int command, case ZEBRA_ROUTE_OSPF: case ZEBRA_ROUTE_OSPF6: case ZEBRA_ROUTE_BGP: @@ -728,10 +724,9 @@ diff -Nur quagga-0.98.6/zebra/redistribute.c quagga-0.98.6.patched/zebra/redistr client->redist[type] = 0; break; default: -diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6.patched/zebra/zebra_vty.c ---- quagga-0.98.6/zebra/zebra_vty.c 2004-12-18 18:03:29.000000000 +0200 -+++ quagga-0.98.6.patched/zebra/zebra_vty.c 2007-12-30 14:25:48.000000000 +0200 -@@ -53,6 +53,10 @@ +--- a/zebra/zebra_vty.c ++++ b/zebra/zebra_vty.c +@@ -53,6 +53,10 @@ route_type_str (u_char type) return "isis"; case ZEBRA_ROUTE_BGP: return "bgp"; @@ -742,7 +737,7 @@ diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6.patched/zebra/zebra_vty. default: return "unknown"; } -@@ -84,6 +88,12 @@ +@@ -84,6 +88,12 @@ route_type_char (u_char type) return 'I'; case ZEBRA_ROUTE_BGP: return 'B'; @@ -755,7 +750,7 @@ diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6.patched/zebra/zebra_vty. default: return '?'; } -@@ -755,8 +765,8 @@ +@@ -755,8 +765,8 @@ vty_show_ip_route (struct vty *vty, stru } #define SHOW_ROUTE_V4_HEADER "Codes: K - kernel route, C - connected, " \ @@ -766,7 +761,7 @@ diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6.patched/zebra/zebra_vty. DEFUN (show_ip_route, show_ip_route_cmd, -@@ -874,7 +884,7 @@ +@@ -874,7 +884,7 @@ DEFUN (show_ip_route_supernets, DEFUN (show_ip_route_protocol, show_ip_route_protocol_cmd, @@ -775,7 +770,7 @@ diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6.patched/zebra/zebra_vty. SHOW_STR IP_STR "IP routing table\n" -@@ -884,6 +894,8 @@ +@@ -884,6 +894,8 @@ DEFUN (show_ip_route_protocol, "Kernel\n" "Open Shortest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" @@ -784,7 +779,7 @@ diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6.patched/zebra/zebra_vty. "Static routes\n") { int type; -@@ -892,13 +904,13 @@ +@@ -892,13 +904,13 @@ DEFUN (show_ip_route_protocol, struct rib *rib; int first = 1; @@ -800,7 +795,7 @@ diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6.patched/zebra/zebra_vty. type = ZEBRA_ROUTE_OSPF; else if (strncmp (argv[0], "i", 1) == 0) type = ZEBRA_ROUTE_ISIS; -@@ -906,6 +918,10 @@ +@@ -906,6 +918,10 @@ DEFUN (show_ip_route_protocol, type = ZEBRA_ROUTE_RIP; else if (strncmp (argv[0], "s", 1) == 0) type = ZEBRA_ROUTE_STATIC; @@ -811,7 +806,7 @@ diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6.patched/zebra/zebra_vty. else { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); -@@ -1732,7 +1748,7 @@ +@@ -1732,7 +1748,7 @@ DEFUN (show_ipv6_route_prefix_longer, DEFUN (show_ipv6_route_protocol, show_ipv6_route_protocol_cmd, @@ -820,7 +815,7 @@ diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6.patched/zebra/zebra_vty. SHOW_STR IP_STR "IP routing table\n" -@@ -1742,6 +1758,8 @@ +@@ -1742,6 +1758,8 @@ DEFUN (show_ipv6_route_protocol, "Kernel\n" "Open Shortest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" @@ -829,7 +824,7 @@ diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6.patched/zebra/zebra_vty. "Static routes\n") { int type; -@@ -1750,13 +1768,13 @@ +@@ -1750,13 +1768,13 @@ DEFUN (show_ipv6_route_protocol, struct rib *rib; int first = 1; @@ -845,7 +840,7 @@ diff -Nur quagga-0.98.6/zebra/zebra_vty.c quagga-0.98.6.patched/zebra/zebra_vty. type = ZEBRA_ROUTE_OSPF6; else if (strncmp (argv[0], "i", 1) == 0) type = ZEBRA_ROUTE_ISIS; -@@ -1764,7 +1782,11 @@ +@@ -1764,7 +1782,11 @@ DEFUN (show_ipv6_route_protocol, type = ZEBRA_ROUTE_RIPNG; else if (strncmp (argv[0], "s", 1) == 0) type = ZEBRA_ROUTE_STATIC; diff --git a/patches/100-confederation.patch b/patches/100-confederation.patch index 73d75c5..6a98653 100644 --- a/patches/100-confederation.patch +++ b/patches/100-confederation.patch @@ -1,7 +1,6 @@ -diff -Nur quagga-0.98.6/bgpd/bgp_route.c quagga-0.98.6-patched/bgpd/bgp_route.c ---- quagga-0.98.6/bgpd/bgp_route.c 2006-05-08 18:03:25.000000000 +0300 -+++ quagga-0.98.6-patched/bgpd/bgp_route.c 2006-12-08 23:10:37.000000000 +0200 -@@ -1815,6 +1815,7 @@ +--- a/bgpd/bgp_route.c ++++ b/bgpd/bgp_route.c +@@ -1815,6 +1815,7 @@ bgp_update_main (struct peer *peer, stru if ((afi == AFI_IP || afi == AFI_IP6) && safi == SAFI_UNICAST && (peer_sort (peer) == BGP_PEER_IBGP @@ -9,7 +8,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_route.c quagga-0.98.6-patched/bgpd/bgp_route.c || (peer_sort (peer) == BGP_PEER_EBGP && peer->ttl != 1) || CHECK_FLAG (peer->flags, PEER_FLAG_ENFORCE_MULTIHOP))) { -@@ -1862,6 +1863,7 @@ +@@ -1862,6 +1863,7 @@ bgp_update_main (struct peer *peer, stru if ((afi == AFI_IP || afi == AFI_IP6) && safi == SAFI_UNICAST && (peer_sort (peer) == BGP_PEER_IBGP diff --git a/patches/120-confed_errorhandle.patch b/patches/120-confed_errorhandle.patch index bb100b8..a3cb65c 100644 --- a/patches/120-confed_errorhandle.patch +++ b/patches/120-confed_errorhandle.patch @@ -1,7 +1,6 @@ -diff -Nur quagga-0.98.6/bgpd/bgp_aspath.c quagga-0.98.6-patched/bgpd/bgp_aspath.c ---- quagga-0.98.6/bgpd/bgp_aspath.c 2005-06-15 14:53:50.000000000 +0300 -+++ quagga-0.98.6-patched/bgpd/bgp_aspath.c 2007-11-24 03:20:02.000000000 +0200 -@@ -614,6 +614,47 @@ +--- a/bgpd/bgp_aspath.c ++++ b/bgpd/bgp_aspath.c +@@ -614,6 +614,47 @@ aspath_private_as_check (struct aspath * return 1; } @@ -49,7 +48,7 @@ diff -Nur quagga-0.98.6/bgpd/bgp_aspath.c quagga-0.98.6-patched/bgpd/bgp_aspath. /* Merge as1 to as2. as2 should be uninterned aspath. */ struct aspath * aspath_merge (struct aspath *as1, struct aspath *as2) -@@ -671,6 +712,10 @@ +@@ -671,6 +712,10 @@ aspath_prepend (struct aspath *as1, stru if (seg1 == NULL) return as2; @@ -60,20 +59,18 @@ diff -Nur quagga-0.98.6/bgpd/bgp_aspath.c quagga-0.98.6-patched/bgpd/bgp_aspath. /* Compare last segment type of as1 and first segment type of as2. */ if (seg1->type != seg2->type) return aspath_merge (as1, as2); -diff -Nur quagga-0.98.6/bgpd/bgp_aspath.h quagga-0.98.6-patched/bgpd/bgp_aspath.h ---- quagga-0.98.6/bgpd/bgp_aspath.h 2005-06-15 14:53:50.000000000 +0300 -+++ quagga-0.98.6-patched/bgpd/bgp_aspath.h 2007-11-24 03:21:24.000000000 +0200 -@@ -76,4 +76,6 @@ +--- a/bgpd/bgp_aspath.h ++++ b/bgpd/bgp_aspath.h +@@ -76,4 +76,6 @@ unsigned int aspath_key_make (struct asp int aspath_loop_check (struct aspath *, as_t); int aspath_private_as_check (struct aspath *); int aspath_firstas_check (struct aspath *, as_t); +int aspath_confed_check (struct aspath *); +int aspath_left_confed_check (struct aspath *); unsigned long aspath_count (); -diff -Nur quagga-0.98.6/bgpd/bgp_attr.c quagga-0.98.6-patched/bgpd/bgp_attr.c ---- quagga-0.98.6/bgpd/bgp_attr.c 2006-05-03 01:37:47.000000000 +0300 -+++ quagga-0.98.6-patched/bgpd/bgp_attr.c 2007-11-24 03:09:56.000000000 +0200 -@@ -673,6 +673,17 @@ +--- a/bgpd/bgp_attr.c ++++ b/bgpd/bgp_attr.c +@@ -673,6 +673,17 @@ bgp_attr_aspath (struct peer *peer, bgp_ return -1; } diff --git a/patches/130-netlink_ignore_wireless.patch b/patches/130-netlink_ignore_wireless.patch index 27a271e..59315d6 100644 --- a/patches/130-netlink_ignore_wireless.patch +++ b/patches/130-netlink_ignore_wireless.patch @@ -1,8 +1,6 @@ -diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c -index 61b2505..e766259 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c -@@ -487,6 +487,17 @@ netlink_interface (struct sockaddr_nl *snl, struct nlmsghdr *h) +@@ -487,6 +487,17 @@ netlink_interface (struct sockaddr_nl *s /* Looking up interface name. */ memset (tb, 0, sizeof tb); netlink_parse_rtattr (tb, IFLA_MAX, IFLA_RTA (ifi), len); @@ -20,7 +18,7 @@ index 61b2505..e766259 100644 if (tb[IFLA_IFNAME] == NULL) return -1; name = (char *) RTA_DATA (tb[IFLA_IFNAME]); -@@ -943,6 +954,17 @@ netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h) +@@ -943,6 +954,17 @@ netlink_link_change (struct sockaddr_nl /* Looking up interface name. */ memset (tb, 0, sizeof tb); netlink_parse_rtattr (tb, IFLA_MAX, IFLA_RTA (ifi), len); diff --git a/patches/140-holdtimer-set.patch b/patches/140-holdtimer-set.patch index bfc95d5..1264f5b 100644 --- a/patches/140-holdtimer-set.patch +++ b/patches/140-holdtimer-set.patch @@ -1,5 +1,3 @@ -diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c -index df37783..c4d5a61 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -109,6 +109,7 @@ bgp_accept (struct thread *thread) @@ -10,8 +8,6 @@ index df37783..c4d5a61 100644 /* Make peer's address string. */ sockunion2str (&su, buf, SU_ADDRSTRLEN); -diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h -index 4137baf..8615ac8 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -656,6 +656,7 @@ struct bgp_nlri From eccb5f1b29e732c80417cd53a639a8967cf0e24c Mon Sep 17 00:00:00 2001 From: hauke Date: Sat, 13 Jun 2009 17:01:55 +0000 Subject: [PATCH 027/117] [packages] Various Makefile cleanups. Thanks to swalker. git-svn-id: svn+ssh://svn.openwrt.org/openwrt@16438 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 1346b10..c32a86c 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,6 @@ PKG_SOURCE_URL:=http://www.quagga.net/download/ \ http://www.de.quagga.net/download/ \ http://www.uk.quagga.net/download/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) include $(INCLUDE_DIR)/package.mk From 2b522810afc607539f5b39f7c0f4dc503ab1bfa8 Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 19 Jun 2009 10:26:33 +0000 Subject: [PATCH 028/117] [package] bump quagga release number as suggested in #5251 git-svn-id: svn+ssh://svn.openwrt.org/openwrt@16513 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c32a86c..ca482f3 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2006-2009 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga PKG_VERSION:=0.98.6 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 PKG_SOURCE_URL:=http://www.quagga.net/download/ \ From 4f5610f184c4cfd74281d03fa5171c72cb6ddf04 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 26 Jul 2009 10:35:28 +0000 Subject: [PATCH 029/117] [package] whitespace cleanups in quagga git-svn-id: svn+ssh://svn.openwrt.org/openwrt@16996 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index ca482f3..903f8da 100644 --- a/Makefile +++ b/Makefile @@ -34,10 +34,9 @@ define Package/quagga endef define Package/quagga/description -A routing software package that provides TCP/IP based routing services + 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-libzebra @@ -106,13 +105,13 @@ define Build/Configure ) endef -define Build/Compile +define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR) \ DESTDIR=$(PKG_INSTALL_DIR) \ all install endef -define Package/quagga/install +define Package/quagga/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(1)/usr/sbin/ @@ -174,7 +173,7 @@ echo "isisd 2608/tcp" >>$${IPKG_INSTROOT}/etc/services fi endef -define Package/quagga-bgpd/install +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/ @@ -190,7 +189,7 @@ define Package/quagga-isisd/install $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/isisd.conf endef -define Package/quagga-ospfd/install +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/ @@ -198,7 +197,7 @@ define Package/quagga-ospfd/install $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/ospfd.conf endef -define Package/quagga-ospf6d/install +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/ @@ -206,7 +205,7 @@ define Package/quagga-ospf6d/install $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/ospf6d.conf endef -define Package/quagga-ripd/install +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/ @@ -214,7 +213,7 @@ define Package/quagga-ripd/install $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/ripd.conf endef -define Package/quagga-ripngd/install +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/ @@ -222,7 +221,7 @@ define Package/quagga-ripngd/install $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/ripngd.conf endef -define Package/quagga-vtysh/install +define Package/quagga-vtysh/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/ endef From a2b914be78cba3e4ab7e3b0ec24fcbff87f77ee3 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 26 Jul 2009 11:57:29 +0000 Subject: [PATCH 030/117] [package] get the enable/disable ipv6 configure option from the build system, do not override it locally git-svn-id: svn+ssh://svn.openwrt.org/openwrt@17009 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 903f8da..0815eba 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga PKG_VERSION:=0.98.6 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 PKG_SOURCE_URL:=http://www.quagga.net/download/ \ @@ -96,7 +96,6 @@ define Build/Configure --sysconfdir=/etc/quagga/ \ --enable-shared \ --disable-static \ - --enable-ipv6 \ --enable-vtysh \ --enable-user=quagga \ --enable-group=quagga \ From 9edc6d08d0d375714f288c3a9fb508dbaf1de996 Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 3 Sep 2009 01:14:04 +0000 Subject: [PATCH 031/117] quagga: do not install anything to /var git-svn-id: svn+ssh://svn.openwrt.org/openwrt@17499 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 0815eba..4c2e10f 100644 --- a/Makefile +++ b/Makefile @@ -121,7 +121,6 @@ define Package/quagga/install $(INSTALL_DIR) $(1)/etc/init.d/ $(INSTALL_BIN) ./files/quagga $(1)/usr/sbin/quagga.init $(INSTALL_BIN) ./files/quagga.init $(1)/etc/init.d/quagga - $(INSTALL_DIR) $(1)/var/run/quagga endef define Package/quagga/postinst From d2249eac762aa1500b99745258db93f1a75c138b Mon Sep 17 00:00:00 2001 From: acinonyx Date: Sat, 5 Sep 2009 19:55:05 +0000 Subject: [PATCH 032/117] [packages] quagga, quagga-unstable: Add dependency on IPv6 support to ospf6d git-svn-id: svn+ssh://svn.openwrt.org/openwrt@17520 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4c2e10f..911c4f5 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ endef define Package/quagga-ospf6d $(call Package/quagga/Default) - DEPENDS += quagga-libospf quagga-libzebra + DEPENDS += quagga-libospf quagga-libzebra @IPV6 TITLE:=OSPFv3 routing engine endef From c15b41e393306e1c741de2aca04037e2fa2c3e4d Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 6 Oct 2009 04:40:28 +0000 Subject: [PATCH 033/117] quagga: mark ripngd as broken in the old version as well git-svn-id: svn+ssh://svn.openwrt.org/openwrt@17950 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 911c4f5..10f7376 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,7 @@ endef define Package/quagga-ripngd $(call Package/quagga/Default) - DEPENDS += quagga-libzebra + DEPENDS += quagga-libzebra @BROKEN TITLE:=RIPNG routing engine endef From 41c9bd07db4fa04ed21c919344a726c92978a85e Mon Sep 17 00:00:00 2001 From: acinonyx Date: Tue, 20 Oct 2009 09:11:29 +0000 Subject: [PATCH 034/117] [packages] quagga, quagga-unstable: Clean up packages git-svn-id: svn+ssh://svn.openwrt.org/openwrt@18095 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 86 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/Makefile b/Makefile index 10f7376..3bab669 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,10 @@ PKG_SOURCE_URL:=http://www.quagga.net/download/ \ http://www.uk.quagga.net/download/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_CONFIG_DEPENDS:= \ + CONFIG_PACKAGE_quagga-unstable-isisd \ + CONFIG_PACKAGE_quagga-unstable-ripngd + include $(INCLUDE_DIR)/package.mk define Package/quagga/Default @@ -34,9 +38,9 @@ define Package/quagga 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+ + 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-libzebra @@ -90,19 +94,23 @@ define Package/quagga-vtysh TITLE:=integrated shell for Quagga routing software endef -define Build/Configure - $(call Build/Configure/Default, \ - --localstatedir=/var/run/quagga \ - --sysconfdir=/etc/quagga/ \ - --enable-shared \ - --disable-static \ - --enable-vtysh \ - --enable-user=quagga \ - --enable-group=quagga \ - --enable-multipath=8 \ - --enable-isisd \ - ) -endef +CONFIGURE_ARGS+= \ + --localstatedir=/var/run/quagga \ + --sysconfdir=/etc/quagga/ \ + --enable-shared \ + --disable-static \ + --enable-vtysh \ + --enable-user=quagga \ + --enable-group=quagga \ + --enable-multipath=8 \ + +ifneq ($(CONFIG_PACKAGE_quagga-isisd),) + CONFIGURE_ARGS+= --enable-isisd +endif + +ifneq ($(CONFIG_PACKAGE_quagga-ripngd),) + CONFIGURE_ARGS+= --enable-ripngd +endif define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR) \ @@ -115,20 +123,20 @@ define Package/quagga/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(1)/usr/sbin/ # avoid /etc being set to 0750 - $(INSTALL_DIR) $(1)/etc/quagga/ - chmod 0750 $(1)/etc/quagga/ + $(INSTALL_DIR) $(1)/etc/quagga + chmod 0750 $(1)/etc/quagga $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/zebra.conf - $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/quagga $(1)/usr/sbin/quagga.init $(INSTALL_BIN) ./files/quagga.init $(1)/etc/init.d/quagga endef define Package/quagga/postinst #!/bin/sh - + name=quagga id=51 - + # do not change below # check if we are on real system if [ -z "$${IPKG_INSTROOT}" ]; then @@ -147,18 +155,18 @@ if [ -z "$${IPKG_INSTROOT}" ]; then fi echo "" -if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then +if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then echo "adding group $$name to /etc/group" - echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group + echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group fi -if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then +if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then echo "adding user $$name to /etc/passwd" echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd fi grep -q '^zebra[[:space:]]*2601/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null -if [ $$? -ne 0 ]; then +if [ $$? -ne 0 ]; then echo "zebrasrv 2600/tcp" >>$${IPKG_INSTROOT}/etc/services echo "zebra 2601/tcp" >>$${IPKG_INSTROOT}/etc/services echo "ripd 2602/tcp" >>$${IPKG_INSTROOT}/etc/services @@ -174,48 +182,48 @@ 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_DIR) $(1)/etc/quagga + chmod 0750 $(1)/etc/quagga $(INSTALL_DATA) ./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_BIN) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/quagga + chmod 0750 $(1)/etc/quagga $(INSTALL_DATA) ./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_DIR) $(1)/etc/quagga + chmod 0750 $(1)/etc/quagga $(INSTALL_DATA) ./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_DIR) $(1)/etc/quagga + chmod 0750 $(1)/etc/quagga $(INSTALL_DATA) ./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_DIR) $(1)/etc/quagga + chmod 0750 $(1)/etc/quagga $(INSTALL_DATA) ./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_DIR) $(1)/etc/quagga + chmod 0750 $(1)/etc/quagga $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/ripngd.conf endef @@ -231,7 +239,7 @@ endef define Package/quagga-libzebra/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(1)/usr/lib/ endef $(eval $(call BuildPackage,quagga)) From 62ed30adf43b8f0224ffd067e010a9b8df7166ac Mon Sep 17 00:00:00 2001 From: jow Date: Thu, 14 Jan 2010 19:19:10 +0000 Subject: [PATCH 035/117] [packages] quagga: fix mini_fo assertion triggered by cross-fs link() (#5960) git-svn-id: svn+ssh://svn.openwrt.org/openwrt@19136 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 4 +-- patches/150-no-cross-fs-link.patch | 40 ++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 patches/150-no-cross-fs-link.patch diff --git a/Makefile b/Makefile index 3bab669..97ce8cd 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2009 OpenWrt.org +# Copyright (C) 2006-2010 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga PKG_VERSION:=0.98.6 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 PKG_SOURCE_URL:=http://www.quagga.net/download/ \ diff --git a/patches/150-no-cross-fs-link.patch b/patches/150-no-cross-fs-link.patch new file mode 100644 index 0000000..53ba929 --- /dev/null +++ b/patches/150-no-cross-fs-link.patch @@ -0,0 +1,40 @@ +--- a/lib/command.c ++++ b/lib/command.c +@@ -2567,6 +2567,13 @@ + unlink (config_file_tmp); + return CMD_WARNING; + } ++ ++#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, +@@ -2586,7 +2593,23 @@ + unlink (config_file_tmp); + return CMD_WARNING; + } ++#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); From 9e83cb73085c119217dda5dda84bd083dce228e4 Mon Sep 17 00:00:00 2001 From: lars Date: Fri, 19 Feb 2010 00:14:01 +0000 Subject: [PATCH 036/117] [packages] Add missing libtool fixups git-svn-id: svn+ssh://svn.openwrt.org/openwrt@19714 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 97ce8cd..7a637ef 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga PKG_VERSION:=0.98.6 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 PKG_SOURCE_URL:=http://www.quagga.net/download/ \ @@ -21,6 +21,8 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_quagga-unstable-isisd \ CONFIG_PACKAGE_quagga-unstable-ripngd +PKG_FIXUP:=libtool + include $(INCLUDE_DIR)/package.mk define Package/quagga/Default From 11d01f7f9e2ecbbe424a59d51524757891406cc6 Mon Sep 17 00:00:00 2001 From: lars Date: Mon, 22 Feb 2010 00:41:15 +0000 Subject: [PATCH 037/117] [packages] quagga: Fix compile git-svn-id: svn+ssh://svn.openwrt.org/openwrt@19810 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/150-no-cross-fs-link.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/150-no-cross-fs-link.patch b/patches/150-no-cross-fs-link.patch index 53ba929..1988f2e 100644 --- a/patches/150-no-cross-fs-link.patch +++ b/patches/150-no-cross-fs-link.patch @@ -24,7 +24,7 @@ + { + vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav, + VTY_NEWLINE); -+ goto finished; ++ return CMD_WARNING; + } + sync (); +#endif From 15aeca05614f7ad386c55d17f32ae8b022376510 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Tue, 16 Mar 2010 23:27:17 +0000 Subject: [PATCH 038/117] [packages] quagga{,-unstable}: Install config files with proper permissions git-svn-id: svn+ssh://svn.openwrt.org/openwrt@20249 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 7a637ef..752b48e 100644 --- a/Makefile +++ b/Makefile @@ -127,7 +127,7 @@ define Package/quagga/install # avoid /etc being set to 0750 $(INSTALL_DIR) $(1)/etc/quagga chmod 0750 $(1)/etc/quagga - $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/zebra.conf + $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/zebra.conf $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/quagga $(1)/usr/sbin/quagga.init $(INSTALL_BIN) ./files/quagga.init $(1)/etc/init.d/quagga @@ -186,7 +186,7 @@ define Package/quagga-bgpd/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/quagga chmod 0750 $(1)/etc/quagga - $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/bgpd.conf + $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/bgpd.conf endef define Package/quagga-isisd/install @@ -194,7 +194,7 @@ define Package/quagga-isisd/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/quagga chmod 0750 $(1)/etc/quagga - $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/isisd.conf + $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/isisd.conf endef define Package/quagga-ospfd/install @@ -202,7 +202,7 @@ define Package/quagga-ospfd/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/quagga chmod 0750 $(1)/etc/quagga - $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/ospfd.conf + $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ospfd.conf endef define Package/quagga-ospf6d/install @@ -210,7 +210,7 @@ define Package/quagga-ospf6d/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/quagga chmod 0750 $(1)/etc/quagga - $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/ospf6d.conf + $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ospf6d.conf endef define Package/quagga-ripd/install @@ -218,7 +218,7 @@ define Package/quagga-ripd/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/quagga chmod 0750 $(1)/etc/quagga - $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/ripd.conf + $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ripd.conf endef define Package/quagga-ripngd/install @@ -226,7 +226,7 @@ define Package/quagga-ripngd/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/quagga chmod 0750 $(1)/etc/quagga - $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/ripngd.conf + $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ripngd.conf endef define Package/quagga-vtysh/install From cde8df593d9586618aa67d68f46ef7363e36be52 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Tue, 16 Mar 2010 23:27:22 +0000 Subject: [PATCH 039/117] [packages] quagga{,-unstable}: Add conffiles sections to prevent overwritting of config files git-svn-id: svn+ssh://svn.openwrt.org/openwrt@20250 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Makefile b/Makefile index 752b48e..cb9261a 100644 --- a/Makefile +++ b/Makefile @@ -96,6 +96,34 @@ define Package/quagga-vtysh TITLE:=integrated shell for Quagga routing software endef +define Package/quagga/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 + CONFIGURE_ARGS+= \ --localstatedir=/var/run/quagga \ --sysconfdir=/etc/quagga/ \ From 215fbb99be18ba8b3755e8946f51ef3ed74cf6e5 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Sat, 3 Apr 2010 18:08:58 +0000 Subject: [PATCH 040/117] [packages] quagga{,-unstable}: Add package maintainer git-svn-id: svn+ssh://svn.openwrt.org/openwrt@20678 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index cb9261a..3f592d6 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ define Package/quagga/Default DEPENDS:=quagga TITLE:=The Quagga Software Routing Suite URL:=http://www.quagga.net + MAINTAINER:=Vasilis Tsiligiannis endef define Package/quagga From 63b44f4cc779c222f4f752e357925065a8b157ae Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 10 Jul 2010 01:08:43 +0000 Subject: [PATCH 041/117] [packages] quagga: rebuild when CONFIG_IPV6 is changed git-svn-id: svn+ssh://svn.openwrt.org/openwrt@22115 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 3f592d6..75fad9b 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,7 @@ PKG_SOURCE_URL:=http://www.quagga.net/download/ \ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_CONFIG_DEPENDS:= \ + CONFIG_IPV6 \ CONFIG_PACKAGE_quagga-unstable-isisd \ CONFIG_PACKAGE_quagga-unstable-ripngd From 70a93509f5f1c6b1e8ec582dd81dfea7a2c89808 Mon Sep 17 00:00:00 2001 From: nico Date: Tue, 3 Aug 2010 12:04:11 +0000 Subject: [PATCH 042/117] [packages] quagga: use PKG_INSTALL git-svn-id: svn+ssh://svn.openwrt.org/openwrt@22472 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 75fad9b..a2bf963 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_quagga-unstable-ripngd PKG_FIXUP:=libtool +PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk @@ -144,12 +145,6 @@ ifneq ($(CONFIG_PACKAGE_quagga-ripngd),) CONFIGURE_ARGS+= --enable-ripngd endif -define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR) \ - DESTDIR=$(PKG_INSTALL_DIR) \ - all install -endef - define Package/quagga/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/ From 98a6f72ce9d7962b0372c119b03d4e405ccd39c7 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 15 Oct 2010 21:43:27 +0000 Subject: [PATCH 043/117] [packages] quagga{,-unstable}: Merge quagga-unstable package with quagga package * Switch to quagga 0.99.x for stable version * Add menuconfig option to allow selection of old 0.98.6 version * Makefile cleanups git-svn-id: svn+ssh://svn.openwrt.org/openwrt@23464 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Config.in | 17 + Makefile | 38 +- .../001-quagga_cross.patch | 0 .../001-quagga_readline.patch | 0 patches-old/002-quagga_manet.patch | 855 ++++++++++++++++++ .../100-confederation.patch | 0 .../120-confed_errorhandle.patch | 0 .../130-netlink_ignore_wireless.patch | 0 patches-old/140-holdtimer-set.patch | 20 + patches-old/150-no-cross-fs-link.patch | 40 + patches/000-upstream-bogus_cond.patch | 11 + patches/000-upstream-miss_str.patch | 11 + patches/000-upstream-set_null.patch | 16 + patches/001-fix_ipctl_forwarding.patch | 27 + patches/002-quagga_manet.patch | 814 ++++++++--------- patches/010-fix_cpp.patch | 11 + .../100-quagga_multipath_caching_policy.patch | 297 ++++++ patches/140-holdtimer-set.patch | 6 +- patches/150-no-cross-fs-link.patch | 14 +- 19 files changed, 1743 insertions(+), 434 deletions(-) create mode 100644 Config.in rename {patches => patches-old}/001-quagga_cross.patch (100%) rename {patches => patches-old}/001-quagga_readline.patch (100%) create mode 100644 patches-old/002-quagga_manet.patch rename {patches => patches-old}/100-confederation.patch (100%) rename {patches => patches-old}/120-confed_errorhandle.patch (100%) rename {patches => patches-old}/130-netlink_ignore_wireless.patch (100%) create mode 100644 patches-old/140-holdtimer-set.patch create mode 100644 patches-old/150-no-cross-fs-link.patch create mode 100644 patches/000-upstream-bogus_cond.patch create mode 100644 patches/000-upstream-miss_str.patch create mode 100644 patches/000-upstream-set_null.patch create mode 100644 patches/001-fix_ipctl_forwarding.patch create mode 100644 patches/010-fix_cpp.patch create mode 100644 patches/100-quagga_multipath_caching_policy.patch diff --git a/Config.in b/Config.in new file mode 100644 index 0000000..7f29e3d --- /dev/null +++ b/Config.in @@ -0,0 +1,17 @@ +# Quagga configuration + +choice + prompt "Quagga version" + depends on PACKAGE_quagga + default QUAGGA_STABLE + help + This option allows you to select the version of Quagga to be built. + +config QUAGGA_STABLE + bool "Use the latest stable version of Quagga" + +config QUAGGA_OLD + depends BROKEN + bool "Use the old release version 0.98.6" + +endchoice diff --git a/Makefile b/Makefile index a2bf963..e4a79c7 100644 --- a/Makefile +++ b/Makefile @@ -8,20 +8,27 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga -PKG_VERSION:=0.98.6 -PKG_RELEASE:=5 -PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 +ifneq ($(CONFIG_QUAGGA_OLD),) + PKG_VERSION:=0.98.6 + PKG_RELEASE:=5 + PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 + PATCH_DIR:=./patches-old +else + PKG_VERSION:=0.99.17 + PKG_RELEASE:=1 + PKG_MD5SUM:=37b9022adca04b03863d2d79787e643f +endif +PKG_SOURCE:=quagga-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.quagga.net/download/ \ http://www.de.quagga.net/download/ \ http://www.uk.quagga.net/download/ -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz - PKG_CONFIG_DEPENDS:= \ + CONFIG_QUAGGA_STABLE \ CONFIG_IPV6 \ CONFIG_PACKAGE_quagga-unstable-isisd \ CONFIG_PACKAGE_quagga-unstable-ripngd - +PKG_BUILD_PARALLEL:=1 PKG_FIXUP:=libtool PKG_INSTALL:=1 @@ -38,7 +45,7 @@ endef define Package/quagga $(call Package/quagga/Default) - DEPENDS:= + DEPENDS:=+QUAGGA_STABLE:librt MENU:=1 endef @@ -48,6 +55,10 @@ define Package/quagga/description OSPFv3, BGP-4, and BGP-4+ endef +define Package/quagga/config + source "$(SOURCE)/Config.in" +endef + define Package/quagga-libzebra $(call Package/quagga/Default) TITLE:=zebra library @@ -60,7 +71,7 @@ endef define Package/quagga-bgpd $(call Package/quagga/Default) - DEPENDS += quagga-libzebra + DEPENDS+=+quagga-libzebra TITLE:=BGPv4, BGPv4+, BGPv4- routing engine endef @@ -71,31 +82,31 @@ endef define Package/quagga-ospfd $(call Package/quagga/Default) - DEPENDS += quagga-libospf quagga-libzebra + DEPENDS+=+quagga-libospf +quagga-libzebra TITLE:=OSPFv2 routing engine endef define Package/quagga-ospf6d $(call Package/quagga/Default) - DEPENDS += quagga-libospf quagga-libzebra @IPV6 + DEPENDS+=+quagga-libospf +quagga-libzebra @IPV6 TITLE:=OSPFv3 routing engine endef define Package/quagga-ripd $(call Package/quagga/Default) - DEPENDS += quagga-libzebra + DEPENDS+=+quagga-libzebra TITLE:=RIP routing engine endef define Package/quagga-ripngd $(call Package/quagga/Default) - DEPENDS += quagga-libzebra @BROKEN + DEPENDS+=+quagga-libzebra @BROKEN TITLE:=RIPNG routing engine endef define Package/quagga-vtysh $(call Package/quagga/Default) - DEPENDS += quagga-libzebra +libreadline +libncurses + DEPENDS+=quagga-libzebra +libreadline +libncurses TITLE:=integrated shell for Quagga routing software endef @@ -135,6 +146,7 @@ CONFIGURE_ARGS+= \ --enable-vtysh \ --enable-user=quagga \ --enable-group=quagga \ + --enable-pie=no \ --enable-multipath=8 \ ifneq ($(CONFIG_PACKAGE_quagga-isisd),) diff --git a/patches/001-quagga_cross.patch b/patches-old/001-quagga_cross.patch similarity index 100% rename from patches/001-quagga_cross.patch rename to patches-old/001-quagga_cross.patch diff --git a/patches/001-quagga_readline.patch b/patches-old/001-quagga_readline.patch similarity index 100% rename from patches/001-quagga_readline.patch rename to patches-old/001-quagga_readline.patch diff --git a/patches-old/002-quagga_manet.patch b/patches-old/002-quagga_manet.patch new file mode 100644 index 0000000..8fe07ac --- /dev/null +++ b/patches-old/002-quagga_manet.patch @@ -0,0 +1,855 @@ +--- a/bgpd/bgp_vty.c ++++ b/bgpd/bgp_vty.c +@@ -3,6 +3,9 @@ + + This file is part of GNU Zebra. + ++This file was modified from the original on 30/12/2007 ++by Vasilis Tsiligiannis ++ + GNU Zebra is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any +@@ -7793,8 +7796,12 @@ bgp_str2route_type (int afi, const char + return ZEBRA_ROUTE_STATIC; + else if (strncmp (str, "r", 1) == 0) + return ZEBRA_ROUTE_RIP; +- else if (strncmp (str, "o", 1) == 0) ++ else if (strncmp (str, "ol", 2) == 0) ++ return ZEBRA_ROUTE_OLSR; ++ else if (strncmp (str, "os", 2) == 0) + return ZEBRA_ROUTE_OSPF; ++ else if (strncmp (str, "ba", 2) == 0) ++ return ZEBRA_ROUTE_BATMAN; + } + if (afi == AFI_IP6) + { +@@ -7806,21 +7813,28 @@ bgp_str2route_type (int afi, const char + return ZEBRA_ROUTE_STATIC; + else if (strncmp (str, "r", 1) == 0) + return ZEBRA_ROUTE_RIPNG; +- else if (strncmp (str, "o", 1) == 0) ++ else if (strncmp (str, "os", 2) == 0) + return ZEBRA_ROUTE_OSPF6; ++ else if (strncmp (str, "ol", 2) == 0) ++ return ZEBRA_ROUTE_OLSR; ++ else if (strncmp (str, "ba", 2) == 0) ++ return ZEBRA_ROUTE_BATMAN; + } + return 0; + } + + DEFUN (bgp_redistribute_ipv4, + bgp_redistribute_ipv4_cmd, +- "redistribute (connected|kernel|ospf|rip|static)", ++ "redistribute (connected|kernel|ospf|rip|static|olsr|batman)", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" +- "Static routes\n") ++ "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" ++ ) + { + int type; + +@@ -7835,13 +7849,15 @@ DEFUN (bgp_redistribute_ipv4, + + DEFUN (bgp_redistribute_ipv4_rmap, + bgp_redistribute_ipv4_rmap_cmd, +- "redistribute (connected|kernel|ospf|rip|static) route-map WORD", ++ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Route map reference\n" + "Pointer to route-map entries\n") + { +@@ -7860,13 +7876,15 @@ DEFUN (bgp_redistribute_ipv4_rmap, + + DEFUN (bgp_redistribute_ipv4_metric, + bgp_redistribute_ipv4_metric_cmd, +- "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295>", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Metric for redistributed routes\n" + "Default metric\n") + { +@@ -7887,13 +7905,15 @@ DEFUN (bgp_redistribute_ipv4_metric, + + DEFUN (bgp_redistribute_ipv4_rmap_metric, + bgp_redistribute_ipv4_rmap_metric_cmd, +- "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD metric <0-4294967295>", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Route map reference\n" + "Pointer to route-map entries\n" + "Metric for redistributed routes\n" +@@ -7917,13 +7937,15 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric + + DEFUN (bgp_redistribute_ipv4_metric_rmap, + bgp_redistribute_ipv4_metric_rmap_cmd, +- "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", ++ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295> route-map WORD", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" +@@ -7947,14 +7969,17 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap + + DEFUN (no_bgp_redistribute_ipv4, + no_bgp_redistribute_ipv4_cmd, +- "no redistribute (connected|kernel|ospf|rip|static)", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman)", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" +- "Static routes\n") ++ "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" ++ ) + { + int type; + +@@ -7970,7 +7995,7 @@ DEFUN (no_bgp_redistribute_ipv4, + + DEFUN (no_bgp_redistribute_ipv4_rmap, + no_bgp_redistribute_ipv4_rmap_cmd, +- "no redistribute (connected|kernel|ospf|rip|static) route-map WORD", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -7978,6 +8003,8 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Route map reference\n" + "Pointer to route-map entries\n") + { +@@ -7996,7 +8023,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, + + DEFUN (no_bgp_redistribute_ipv4_metric, + no_bgp_redistribute_ipv4_metric_cmd, +- "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295>", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8004,6 +8031,8 @@ DEFUN (no_bgp_redistribute_ipv4_metric, + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Metric for redistributed routes\n" + "Default metric\n") + { +@@ -8022,7 +8051,7 @@ DEFUN (no_bgp_redistribute_ipv4_metric, + + DEFUN (no_bgp_redistribute_ipv4_rmap_metric, + no_bgp_redistribute_ipv4_rmap_metric_cmd, +- "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD metric <0-4294967295>", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8030,6 +8059,8 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Route map reference\n" + "Pointer to route-map entries\n" + "Metric for redistributed routes\n" +@@ -8051,7 +8082,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met + + ALIAS (no_bgp_redistribute_ipv4_rmap_metric, + no_bgp_redistribute_ipv4_metric_rmap_cmd, +- "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", ++ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295> route-map WORD", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8059,6 +8090,8 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met + "Open Shurtest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" +@@ -8067,13 +8100,16 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met + #ifdef HAVE_IPV6 + DEFUN (bgp_redistribute_ipv6, + bgp_redistribute_ipv6_cmd, +- "redistribute (connected|kernel|ospf6|ripng|static)", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman)", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" +- "Static routes\n") ++ "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" ++ ) + { + int type; + +@@ -8089,13 +8125,15 @@ DEFUN (bgp_redistribute_ipv6, + + DEFUN (bgp_redistribute_ipv6_rmap, + bgp_redistribute_ipv6_rmap_cmd, +- "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Route map reference\n" + "Pointer to route-map entries\n") + { +@@ -8114,13 +8152,15 @@ DEFUN (bgp_redistribute_ipv6_rmap, + + DEFUN (bgp_redistribute_ipv6_metric, + bgp_redistribute_ipv6_metric_cmd, +- "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295>", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Metric for redistributed routes\n" + "Default metric\n") + { +@@ -8141,13 +8181,15 @@ DEFUN (bgp_redistribute_ipv6_metric, + + DEFUN (bgp_redistribute_ipv6_rmap_metric, + bgp_redistribute_ipv6_rmap_metric_cmd, +- "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD metric <0-4294967295>", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Route map reference\n" + "Pointer to route-map entries\n" + "Metric for redistributed routes\n" +@@ -8171,13 +8213,15 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric + + DEFUN (bgp_redistribute_ipv6_metric_rmap, + bgp_redistribute_ipv6_metric_rmap_cmd, +- "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", ++ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295> route-map WORD", + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" +@@ -8201,14 +8245,17 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap + + DEFUN (no_bgp_redistribute_ipv6, + no_bgp_redistribute_ipv6_cmd, +- "no redistribute (connected|kernel|ospf6|ripng|static)", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman)", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" + "Kernel routes\n" + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" +- "Static routes\n") ++ "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" ++ ) + { + int type; + +@@ -8224,7 +8271,7 @@ DEFUN (no_bgp_redistribute_ipv6, + + DEFUN (no_bgp_redistribute_ipv6_rmap, + no_bgp_redistribute_ipv6_rmap_cmd, +- "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8232,6 +8279,8 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Route map reference\n" + "Pointer to route-map entries\n") + { +@@ -8250,7 +8299,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, + + DEFUN (no_bgp_redistribute_ipv6_metric, + no_bgp_redistribute_ipv6_metric_cmd, +- "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295>", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8258,6 +8307,8 @@ DEFUN (no_bgp_redistribute_ipv6_metric, + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Metric for redistributed routes\n" + "Default metric\n") + { +@@ -8276,7 +8327,7 @@ DEFUN (no_bgp_redistribute_ipv6_metric, + + DEFUN (no_bgp_redistribute_ipv6_rmap_metric, + no_bgp_redistribute_ipv6_rmap_metric_cmd, +- "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD metric <0-4294967295>", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8284,6 +8335,8 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Route map reference\n" + "Pointer to route-map entries\n" + "Metric for redistributed routes\n" +@@ -8305,7 +8358,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met + + ALIAS (no_bgp_redistribute_ipv6_rmap_metric, + no_bgp_redistribute_ipv6_metric_rmap_cmd, +- "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", ++ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295> route-map WORD", + NO_STR + "Redistribute information from another routing protocol\n" + "Connected\n" +@@ -8313,6 +8366,8 @@ ALIAS (no_bgp_redistribute_ipv6_rmap_met + "Open Shurtest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" + "Static routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" +@@ -8325,7 +8380,7 @@ bgp_config_write_redistribute (struct vt + { + int i; + const char *str[] = { "system", "kernel", "connected", "static", "rip", +- "ripng", "ospf", "ospf6", "isis", "bgp"}; ++ "ripng", "ospf", "ospf6", "isis", "bgp", "hsls", "olsr", "batman"}; + + /* Unicast redistribution only. */ + if (safi != SAFI_UNICAST) +--- a/lib/zebra.h ++++ b/lib/zebra.h +@@ -3,6 +3,9 @@ + + This file is part of GNU Zebra. + ++This file was modified from the original on 30/12/2007 ++by Vasilis Tsiligiannis ++ + GNU Zebra is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any +@@ -378,7 +381,9 @@ struct in_pktinfo + #define ZEBRA_ROUTE_ISIS 8 + #define ZEBRA_ROUTE_BGP 9 + #define ZEBRA_ROUTE_HSLS 10 +-#define ZEBRA_ROUTE_MAX 11 ++#define ZEBRA_ROUTE_OLSR 11 ++#define ZEBRA_ROUTE_BATMAN 12 ++#define ZEBRA_ROUTE_MAX 13 + + /* Zebra's family types. */ + #define ZEBRA_FAMILY_IPV4 1 +--- a/ospfd/ospf_vty.c ++++ b/ospfd/ospf_vty.c +@@ -3,6 +3,9 @@ + * + * This file is part of GNU Zebra. + * ++ * This file was modified from the original on 30/12/2007 ++ * by Vasilis Tsiligiannis ++ * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any +@@ -106,11 +109,15 @@ str2distribute_source (const char *str, + *source = ZEBRA_ROUTE_STATIC; + else if (strncmp (str, "r", 1) == 0) + *source = ZEBRA_ROUTE_RIP; +- else if (strncmp (str, "b", 1) == 0) ++ else if (strncmp (str, "bg", 2) == 0) + *source = ZEBRA_ROUTE_BGP; ++ else if (strncmp (str, "ol", 2) == 0) ++ *source = ZEBRA_ROUTE_OLSR; ++ else if (strncmp (str, "ba", 2) == 0) ++ *source = ZEBRA_ROUTE_BATMAN; + else + return 0; +- ++ + return 1; + } + +@@ -5302,13 +5309,15 @@ ALIAS (no_ip_ospf_transmit_delay, + + DEFUN (ospf_redistribute_source_metric_type, + ospf_redistribute_source_metric_type_routemap_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214> metric-type (1|2) route-map WORD", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Metric for redistributed routes\n" + "OSPF default metric\n" + "OSPF exterior metric type for redistributed routes\n" +@@ -5346,13 +5355,15 @@ DEFUN (ospf_redistribute_source_metric_t + + ALIAS (ospf_redistribute_source_metric_type, + ospf_redistribute_source_metric_type_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214> metric-type (1|2)", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Metric for redistributed routes\n" + "OSPF default metric\n" + "OSPF exterior metric type for redistributed routes\n" +@@ -5361,25 +5372,29 @@ ALIAS (ospf_redistribute_source_metric_t + + ALIAS (ospf_redistribute_source_metric_type, + ospf_redistribute_source_metric_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214>", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Metric for redistributed routes\n" + "OSPF default metric\n") + + DEFUN (ospf_redistribute_source_type_metric, + ospf_redistribute_source_type_metric_routemap_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2) metric <0-16777214> route-map WORD", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "OSPF exterior metric type for redistributed routes\n" + "Set OSPF External Type 1 metrics\n" + "Set OSPF External Type 2 metrics\n" +@@ -5417,13 +5432,15 @@ DEFUN (ospf_redistribute_source_type_met + + ALIAS (ospf_redistribute_source_type_metric, + ospf_redistribute_source_type_metric_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2) metric <0-16777214>", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "OSPF exterior metric type for redistributed routes\n" + "Set OSPF External Type 1 metrics\n" + "Set OSPF External Type 2 metrics\n" +@@ -5432,7 +5449,7 @@ ALIAS (ospf_redistribute_source_type_met + + ALIAS (ospf_redistribute_source_type_metric, + ospf_redistribute_source_type_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2)", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" +@@ -5440,28 +5457,35 @@ ALIAS (ospf_redistribute_source_type_met + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" + "OSPF exterior metric type for redistributed routes\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Set OSPF External Type 1 metrics\n" + "Set OSPF External Type 2 metrics\n") + + ALIAS (ospf_redistribute_source_type_metric, + ospf_redistribute_source_cmd, +- "redistribute (kernel|connected|static|rip|bgp)", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman)", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" +- "Border Gateway Protocol (BGP)\n") ++ "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" ++ ) + + DEFUN (ospf_redistribute_source_metric_routemap, + ospf_redistribute_source_metric_routemap_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214> route-map WORD", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Metric for redistributed routes\n" + "OSPF default metric\n" + "Route map reference\n" +@@ -5490,13 +5514,15 @@ DEFUN (ospf_redistribute_source_metric_r + + DEFUN (ospf_redistribute_source_type_routemap, + ospf_redistribute_source_type_routemap_cmd, +- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2) route-map WORD", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "OSPF exterior metric type for redistributed routes\n" + "Set OSPF External Type 1 metrics\n" + "Set OSPF External Type 2 metrics\n" +@@ -5526,13 +5552,15 @@ DEFUN (ospf_redistribute_source_type_rou + + DEFUN (ospf_redistribute_source_routemap, + ospf_redistribute_source_routemap_cmd, +- "redistribute (kernel|connected|static|rip|bgp) route-map WORD", ++ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) route-map WORD", + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" + "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Route map reference\n" + "Pointer to route-map entries\n") + { +@@ -5553,14 +5581,17 @@ DEFUN (ospf_redistribute_source_routemap + + DEFUN (no_ospf_redistribute_source, + no_ospf_redistribute_source_cmd, +- "no redistribute (kernel|connected|static|rip|bgp)", ++ "no redistribute (kernel|connected|static|rip|bgp|olsr|batman)", + NO_STR + "Redistribute information from another routing protocol\n" + "Kernel routes\n" + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" +- "Border Gateway Protocol (BGP)\n") ++ "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" ++ ) + { + struct ospf *ospf = vty->index; + int source; +@@ -5574,7 +5605,7 @@ DEFUN (no_ospf_redistribute_source, + + DEFUN (ospf_distribute_list_out, + ospf_distribute_list_out_cmd, +- "distribute-list WORD out (kernel|connected|static|rip|bgp)", ++ "distribute-list WORD out (kernel|connected|static|rip|bgp|olsr|batman)", + "Filter networks in routing updates\n" + "Access-list name\n" + OUT_STR +@@ -5582,7 +5613,10 @@ DEFUN (ospf_distribute_list_out, + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" +- "Border Gateway Protocol (BGP)\n") ++ "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" ++) + { + struct ospf *ospf = vty->index; + int source; +@@ -5596,7 +5630,7 @@ DEFUN (ospf_distribute_list_out, + + DEFUN (no_ospf_distribute_list_out, + no_ospf_distribute_list_out_cmd, +- "no distribute-list WORD out (kernel|connected|static|rip|bgp)", ++ "no distribute-list WORD out (kernel|connected|static|rip|bgp|olsr|batman)", + NO_STR + "Filter networks in routing updates\n" + "Access-list name\n" +@@ -5605,7 +5639,10 @@ DEFUN (no_ospf_distribute_list_out, + "Connected\n" + "Static routes\n" + "Routing Information Protocol (RIP)\n" +- "Border Gateway Protocol (BGP)\n") ++ "Border Gateway Protocol (BGP)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" ++) + { + struct ospf *ospf = vty->index; + int source; +@@ -7121,7 +7158,8 @@ config_write_virtual_link (struct vty *v + + + const char *distribute_str[] = { "system", "kernel", "connected", "static", +- "rip", "ripng", "ospf", "ospf6", "isis", "bgp"}; ++ "rip", "ripng", "ospf", "ospf6", "isis", "bgp", ++ "hsls","olsr","batman"}; + int + config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) + { +--- a/zebra/redistribute.c ++++ b/zebra/redistribute.c +@@ -3,6 +3,9 @@ + * + * This file is part of GNU Zebra. + * ++ * This file was modified from the original on 30/12/2007 ++ * by Vasilis Tsiligiannis ++ * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any +@@ -253,6 +256,8 @@ zebra_redistribute_add (int command, str + case ZEBRA_ROUTE_OSPF: + case ZEBRA_ROUTE_OSPF6: + case ZEBRA_ROUTE_BGP: ++ case ZEBRA_ROUTE_OLSR: ++ case ZEBRA_ROUTE_BATMAN: + if (! client->redist[type]) + { + client->redist[type] = 1; +@@ -281,6 +286,8 @@ zebra_redistribute_delete (int command, + case ZEBRA_ROUTE_OSPF: + case ZEBRA_ROUTE_OSPF6: + case ZEBRA_ROUTE_BGP: ++ case ZEBRA_ROUTE_OLSR: ++ case ZEBRA_ROUTE_BATMAN: + client->redist[type] = 0; + break; + default: +--- a/zebra/zebra_vty.c ++++ b/zebra/zebra_vty.c +@@ -53,6 +53,10 @@ route_type_str (u_char type) + return "isis"; + case ZEBRA_ROUTE_BGP: + return "bgp"; ++ case ZEBRA_ROUTE_OLSR: ++ return "olsr"; ++ case ZEBRA_ROUTE_BATMAN: ++ return "batman"; + default: + return "unknown"; + } +@@ -84,6 +88,12 @@ route_type_char (u_char type) + return 'I'; + case ZEBRA_ROUTE_BGP: + return 'B'; ++ case ZEBRA_ROUTE_HSLS: ++ return 'H'; ++ case ZEBRA_ROUTE_OLSR: ++ return 'L'; ++ case ZEBRA_ROUTE_BATMAN: ++ return 'M'; + default: + return '?'; + } +@@ -755,8 +765,8 @@ vty_show_ip_route (struct vty *vty, stru + } + + #define SHOW_ROUTE_V4_HEADER "Codes: K - kernel route, C - connected, " \ +- "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, " \ +- "> - selected route, * - FIB route%s%s" ++ "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, H - HSLS, " \ ++ "L - OLSR, M - BATMAN, > - selected route, * - FIB route%s%s" + + DEFUN (show_ip_route, + show_ip_route_cmd, +@@ -874,7 +884,7 @@ DEFUN (show_ip_route_supernets, + + DEFUN (show_ip_route_protocol, + show_ip_route_protocol_cmd, +- "show ip route (bgp|connected|isis|kernel|ospf|rip|static)", ++ "show ip route (bgp|connected|isis|kernel|ospf|rip|olsr|batman|static)", + SHOW_STR + IP_STR + "IP routing table\n" +@@ -884,6 +894,8 @@ DEFUN (show_ip_route_protocol, + "Kernel\n" + "Open Shortest Path First (OSPF)\n" + "Routing Information Protocol (RIP)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Static routes\n") + { + int type; +@@ -892,13 +904,13 @@ DEFUN (show_ip_route_protocol, + struct rib *rib; + int first = 1; + +- if (strncmp (argv[0], "b", 1) == 0) ++ if (strncmp (argv[0], "bg", 2) == 0) + type = ZEBRA_ROUTE_BGP; + else if (strncmp (argv[0], "c", 1) == 0) + type = ZEBRA_ROUTE_CONNECT; + else if (strncmp (argv[0], "k", 1) ==0) + type = ZEBRA_ROUTE_KERNEL; +- else if (strncmp (argv[0], "o", 1) == 0) ++ else if (strncmp (argv[0], "os", 2) == 0) + type = ZEBRA_ROUTE_OSPF; + else if (strncmp (argv[0], "i", 1) == 0) + type = ZEBRA_ROUTE_ISIS; +@@ -906,6 +918,10 @@ DEFUN (show_ip_route_protocol, + type = ZEBRA_ROUTE_RIP; + else if (strncmp (argv[0], "s", 1) == 0) + type = ZEBRA_ROUTE_STATIC; ++ else if (strncmp (argv[0], "ol", 2) == 0) ++ type = ZEBRA_ROUTE_OLSR; ++ else if (strncmp (argv[0], "ba", 2) == 0) ++ type = ZEBRA_ROUTE_BATMAN; + else + { + vty_out (vty, "Unknown route type%s", VTY_NEWLINE); +@@ -1732,7 +1748,7 @@ DEFUN (show_ipv6_route_prefix_longer, + + DEFUN (show_ipv6_route_protocol, + show_ipv6_route_protocol_cmd, +- "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|static)", ++ "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|olsr|batman|static)", + SHOW_STR + IP_STR + "IP routing table\n" +@@ -1742,6 +1758,8 @@ DEFUN (show_ipv6_route_protocol, + "Kernel\n" + "Open Shortest Path First (OSPFv3)\n" + "Routing Information Protocol (RIPng)\n" ++ "Optimized Link State Routing (OLSR)\n" ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" + "Static routes\n") + { + int type; +@@ -1750,13 +1768,13 @@ DEFUN (show_ipv6_route_protocol, + struct rib *rib; + int first = 1; + +- if (strncmp (argv[0], "b", 1) == 0) ++ if (strncmp (argv[0], "bg", 2) == 0) + type = ZEBRA_ROUTE_BGP; + else if (strncmp (argv[0], "c", 1) == 0) + type = ZEBRA_ROUTE_CONNECT; + else if (strncmp (argv[0], "k", 1) ==0) + type = ZEBRA_ROUTE_KERNEL; +- else if (strncmp (argv[0], "o", 1) == 0) ++ else if (strncmp (argv[0], "os", 2) == 0) + type = ZEBRA_ROUTE_OSPF6; + else if (strncmp (argv[0], "i", 1) == 0) + type = ZEBRA_ROUTE_ISIS; +@@ -1764,7 +1782,11 @@ DEFUN (show_ipv6_route_protocol, + type = ZEBRA_ROUTE_RIPNG; + else if (strncmp (argv[0], "s", 1) == 0) + type = ZEBRA_ROUTE_STATIC; +- else ++ else if (strncmp (argv[0], "ol", 2) == 0) ++ type = ZEBRA_ROUTE_OLSR; ++ else if (strncmp (argv[0], "ba", 2) == 0) ++ type = ZEBRA_ROUTE_BATMAN; ++ else + { + vty_out (vty, "Unknown route type%s", VTY_NEWLINE); + return CMD_WARNING; diff --git a/patches/100-confederation.patch b/patches-old/100-confederation.patch similarity index 100% rename from patches/100-confederation.patch rename to patches-old/100-confederation.patch diff --git a/patches/120-confed_errorhandle.patch b/patches-old/120-confed_errorhandle.patch similarity index 100% rename from patches/120-confed_errorhandle.patch rename to patches-old/120-confed_errorhandle.patch diff --git a/patches/130-netlink_ignore_wireless.patch b/patches-old/130-netlink_ignore_wireless.patch similarity index 100% rename from patches/130-netlink_ignore_wireless.patch rename to patches-old/130-netlink_ignore_wireless.patch diff --git a/patches-old/140-holdtimer-set.patch b/patches-old/140-holdtimer-set.patch new file mode 100644 index 0000000..1264f5b --- /dev/null +++ b/patches-old/140-holdtimer-set.patch @@ -0,0 +1,20 @@ +--- a/bgpd/bgp_network.c ++++ b/bgpd/bgp_network.c +@@ -109,6 +109,7 @@ bgp_accept (struct thread *thread) + peer->fd = bgp_sock; + peer->status = Active; + peer->local_id = peer1->local_id; ++ peer->v_holdtime = BGP_LARGE_HOLDTIME; + + /* Make peer's address string. */ + sockunion2str (&su, buf, SU_ADDRSTRLEN); +--- a/bgpd/bgpd.h ++++ b/bgpd/bgpd.h +@@ -656,6 +656,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 diff --git a/patches-old/150-no-cross-fs-link.patch b/patches-old/150-no-cross-fs-link.patch new file mode 100644 index 0000000..1988f2e --- /dev/null +++ b/patches-old/150-no-cross-fs-link.patch @@ -0,0 +1,40 @@ +--- a/lib/command.c ++++ b/lib/command.c +@@ -2567,6 +2567,13 @@ + unlink (config_file_tmp); + return CMD_WARNING; + } ++ ++#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, +@@ -2586,7 +2593,23 @@ + unlink (config_file_tmp); + return CMD_WARNING; + } ++#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); ++ return CMD_WARNING; ++ } ++ 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); diff --git a/patches/000-upstream-bogus_cond.patch b/patches/000-upstream-bogus_cond.patch new file mode 100644 index 0000000..c35ffdb --- /dev/null +++ b/patches/000-upstream-bogus_cond.patch @@ -0,0 +1,11 @@ +--- a/zebra/zserv.c ++++ b/zebra/zserv.c +@@ -451,7 +451,7 @@ zsend_route_multipath (int cmd, struct zserv *client, struct prefix *p, + } + + /* Metric */ +- if (cmd == ZEBRA_IPV4_ROUTE_ADD || ZEBRA_IPV6_ROUTE_ADD) ++ if (cmd == ZEBRA_IPV4_ROUTE_ADD || cmd == ZEBRA_IPV6_ROUTE_ADD) + { + SET_FLAG (zapi_flags, ZAPI_MESSAGE_DISTANCE); + stream_putc (s, rib->distance); diff --git a/patches/000-upstream-miss_str.patch b/patches/000-upstream-miss_str.patch new file mode 100644 index 0000000..6ad3575 --- /dev/null +++ b/patches/000-upstream-miss_str.patch @@ -0,0 +1,11 @@ +--- a/lib/vty.c ++++ b/lib/vty.c +@@ -250,7 +250,7 @@ vty_hello (struct vty *vty) + vty_out (vty, "MOTD file not found%s", VTY_NEWLINE); + } + else if (host.motd) +- vty_out (vty, host.motd); ++ vty_out (vty, "%s", host.motd); + } + + /* Put out prompt and wait input from user. */ diff --git a/patches/000-upstream-set_null.patch b/patches/000-upstream-set_null.patch new file mode 100644 index 0000000..3d0eaeb --- /dev/null +++ b/patches/000-upstream-set_null.patch @@ -0,0 +1,16 @@ +--- a/bgpd/bgp_packet.c ++++ b/bgpd/bgp_packet.c +@@ -177,10 +177,11 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi) + + if (rn->prn) + prd = (struct prefix_rd *) &rn->prn->p; +- if (binfo && binfo->extra) ++ if (binfo) + { +- tag = binfo->extra->tag; + from = binfo->peer; ++ if (binfo->extra) ++ tag = binfo->extra->tag; + } + + bgp_packet_set_marker (s, BGP_MSG_UPDATE); diff --git a/patches/001-fix_ipctl_forwarding.patch b/patches/001-fix_ipctl_forwarding.patch new file mode 100644 index 0000000..e9a9864 --- /dev/null +++ b/patches/001-fix_ipctl_forwarding.patch @@ -0,0 +1,27 @@ +Add definitions for IPCTL_FORWARDING and IP6CTL_FORWARDING. + +Inspired from +http://svn.gnumonks.org/trunk/grouter/build/src/quagga/quagga/quagga-0.99.1-forward_sysctl-2.6.14.patch + +Signed-off-by: Thomas Petazzoni + +Index: quagga-0.99.16/zebra/ipforward_sysctl.c +=================================================================== +--- quagga-0.99.16.orig/zebra/ipforward_sysctl.c 2010-06-20 23:40:45.000000000 +0200 ++++ quagga-0.99.16/zebra/ipforward_sysctl.c 2010-06-20 23:41:37.000000000 +0200 +@@ -31,6 +31,15 @@ + + #define MIB_SIZ 4 + ++/* Fix for recent (2.6.14) kernel headers */ ++#ifndef IPCTL_FORWARDING ++#define IPCTL_FORWARDING NET_IPV4_FORWARD ++#endif ++ ++#ifndef IP6CTL_FORWARDING ++#define IP6CTL_FORWARDING NET_IPV6_FORWARDING ++#endif ++ + extern struct zebra_privs_t zserv_privs; + + /* IPv4 forwarding control MIB. */ diff --git a/patches/002-quagga_manet.patch b/patches/002-quagga_manet.patch index 8fe07ac..abbcd48 100644 --- a/patches/002-quagga_manet.patch +++ b/patches/002-quagga_manet.patch @@ -1,39 +1,33 @@ --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c -@@ -3,6 +3,9 @@ - - This file is part of GNU Zebra. - -+This file was modified from the original on 30/12/2007 -+by Vasilis Tsiligiannis -+ - GNU Zebra is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any -@@ -7793,8 +7796,12 @@ bgp_str2route_type (int afi, const char +@@ -8228,8 +8228,14 @@ bgp_str2route_type (int afi, const char return ZEBRA_ROUTE_STATIC; else if (strncmp (str, "r", 1) == 0) return ZEBRA_ROUTE_RIP; - else if (strncmp (str, "o", 1) == 0) -+ else if (strncmp (str, "ol", 2) == 0) -+ return ZEBRA_ROUTE_OLSR; + else if (strncmp (str, "os", 2) == 0) return ZEBRA_ROUTE_OSPF; -+ else if (strncmp (str, "ba", 2) == 0) ++ else if (strncmp (str, "h", 1) == 0) ++ return ZEBRA_ROUTE_HSLS; ++ else if (strncmp (str, "ol", 2) == 0) ++ return ZEBRA_ROUTE_OLSR; ++ else if (strncmp (str, "b", 1) == 0) + return ZEBRA_ROUTE_BATMAN; } if (afi == AFI_IP6) { -@@ -7806,21 +7813,28 @@ bgp_str2route_type (int afi, const char +@@ -8241,21 +8247,30 @@ bgp_str2route_type (int afi, const char return ZEBRA_ROUTE_STATIC; else if (strncmp (str, "r", 1) == 0) return ZEBRA_ROUTE_RIPNG; - else if (strncmp (str, "o", 1) == 0) + else if (strncmp (str, "os", 2) == 0) return ZEBRA_ROUTE_OSPF6; ++ else if (strncmp (str, "h", 1) == 0) ++ return ZEBRA_ROUTE_HSLS; + else if (strncmp (str, "ol", 2) == 0) + return ZEBRA_ROUTE_OLSR; -+ else if (strncmp (str, "ba", 2) == 0) ++ else if (strncmp (str, "b", 1) == 0) + return ZEBRA_ROUTE_BATMAN; } return 0; @@ -42,7 +36,7 @@ DEFUN (bgp_redistribute_ipv4, bgp_redistribute_ipv4_cmd, - "redistribute (connected|kernel|ospf|rip|static)", -+ "redistribute (connected|kernel|ospf|rip|static|olsr|batman)", ++ "redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman)", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" @@ -50,86 +44,90 @@ "Routing Information Protocol (RIP)\n" - "Static routes\n") + "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+ ) ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n") { int type; -@@ -7835,13 +7849,15 @@ DEFUN (bgp_redistribute_ipv4, +@@ -8270,13 +8285,16 @@ DEFUN (bgp_redistribute_ipv4, DEFUN (bgp_redistribute_ipv4_rmap, bgp_redistribute_ipv4_rmap_cmd, - "redistribute (connected|kernel|ospf|rip|static) route-map WORD", -+ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD", ++ "redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) route-map WORD", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n") { -@@ -7860,13 +7876,15 @@ DEFUN (bgp_redistribute_ipv4_rmap, +@@ -8295,13 +8313,16 @@ DEFUN (bgp_redistribute_ipv4_rmap, DEFUN (bgp_redistribute_ipv4_metric, bgp_redistribute_ipv4_metric_cmd, - "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) metric <0-4294967295>", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n") { -@@ -7887,13 +7905,15 @@ DEFUN (bgp_redistribute_ipv4_metric, +@@ -8322,13 +8343,16 @@ DEFUN (bgp_redistribute_ipv4_metric, DEFUN (bgp_redistribute_ipv4_rmap_metric, bgp_redistribute_ipv4_rmap_metric_cmd, - "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) route-map WORD metric <0-4294967295>", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -7917,13 +7937,15 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric +@@ -8352,13 +8376,16 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric DEFUN (bgp_redistribute_ipv4_metric_rmap, bgp_redistribute_ipv4_metric_rmap_cmd, - "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", -+ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295> route-map WORD", ++ "redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) metric <0-4294967295> route-map WORD", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -7947,14 +7969,17 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap +@@ -8382,14 +8409,17 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap DEFUN (no_bgp_redistribute_ipv4, no_bgp_redistribute_ipv4_cmd, - "no redistribute (connected|kernel|ospf|rip|static)", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman)", ++ "no redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman)", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" @@ -138,90 +136,94 @@ "Routing Information Protocol (RIP)\n" - "Static routes\n") + "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+ ) ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n") { int type; -@@ -7970,7 +7995,7 @@ DEFUN (no_bgp_redistribute_ipv4, +@@ -8405,7 +8435,7 @@ DEFUN (no_bgp_redistribute_ipv4, DEFUN (no_bgp_redistribute_ipv4_rmap, no_bgp_redistribute_ipv4_rmap_cmd, - "no redistribute (connected|kernel|ospf|rip|static) route-map WORD", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD", ++ "no redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) route-map WORD", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -7978,6 +8003,8 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, +@@ -8413,6 +8443,9 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n") { -@@ -7996,7 +8023,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, +@@ -8431,7 +8464,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, DEFUN (no_bgp_redistribute_ipv4_metric, no_bgp_redistribute_ipv4_metric_cmd, - "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) metric <0-4294967295>", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8004,6 +8031,8 @@ DEFUN (no_bgp_redistribute_ipv4_metric, +@@ -8439,6 +8472,9 @@ DEFUN (no_bgp_redistribute_ipv4_metric, "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n") { -@@ -8022,7 +8051,7 @@ DEFUN (no_bgp_redistribute_ipv4_metric, +@@ -8457,7 +8493,7 @@ DEFUN (no_bgp_redistribute_ipv4_metric, DEFUN (no_bgp_redistribute_ipv4_rmap_metric, no_bgp_redistribute_ipv4_rmap_metric_cmd, - "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) route-map WORD metric <0-4294967295>", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8030,6 +8059,8 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met +@@ -8465,6 +8501,9 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8051,7 +8082,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met +@@ -8486,7 +8525,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met ALIAS (no_bgp_redistribute_ipv4_rmap_metric, no_bgp_redistribute_ipv4_metric_rmap_cmd, - "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295> route-map WORD", ++ "no redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) metric <0-4294967295> route-map WORD", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8059,6 +8090,8 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met +@@ -8494,6 +8533,9 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8067,13 +8100,16 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met +@@ -8502,13 +8544,16 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met #ifdef HAVE_IPV6 DEFUN (bgp_redistribute_ipv6, bgp_redistribute_ipv6_cmd, - "redistribute (connected|kernel|ospf6|ripng|static)", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman)", ++ "redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman)", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" @@ -229,86 +231,90 @@ "Routing Information Protocol (RIPng)\n" - "Static routes\n") + "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+ ) ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n") { int type; -@@ -8089,13 +8125,15 @@ DEFUN (bgp_redistribute_ipv6, +@@ -8524,13 +8569,16 @@ DEFUN (bgp_redistribute_ipv6, DEFUN (bgp_redistribute_ipv6_rmap, bgp_redistribute_ipv6_rmap_cmd, - "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD", ++ "redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) route-map WORD", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n") { -@@ -8114,13 +8152,15 @@ DEFUN (bgp_redistribute_ipv6_rmap, +@@ -8549,13 +8597,16 @@ DEFUN (bgp_redistribute_ipv6_rmap, DEFUN (bgp_redistribute_ipv6_metric, bgp_redistribute_ipv6_metric_cmd, - "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) metric <0-4294967295>", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n") { -@@ -8141,13 +8181,15 @@ DEFUN (bgp_redistribute_ipv6_metric, +@@ -8576,13 +8627,16 @@ DEFUN (bgp_redistribute_ipv6_metric, DEFUN (bgp_redistribute_ipv6_rmap_metric, bgp_redistribute_ipv6_rmap_metric_cmd, - "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD metric <0-4294967295>", ++ "redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) route-map WORD metric <0-4294967295>", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8171,13 +8213,15 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric +@@ -8606,13 +8660,16 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric DEFUN (bgp_redistribute_ipv6_metric_rmap, bgp_redistribute_ipv6_metric_rmap_cmd, - "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295> route-map WORD", ++ "redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) metric <0-4294967295> route-map WORD", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8201,14 +8245,17 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap +@@ -8636,14 +8693,17 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap DEFUN (no_bgp_redistribute_ipv6, no_bgp_redistribute_ipv6_cmd, - "no redistribute (connected|kernel|ospf6|ripng|static)", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman)", ++ "no redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman)", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" @@ -317,106 +323,128 @@ "Routing Information Protocol (RIPng)\n" - "Static routes\n") + "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+ ) ++ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n") { int type; -@@ -8224,7 +8271,7 @@ DEFUN (no_bgp_redistribute_ipv6, +@@ -8659,7 +8719,7 @@ DEFUN (no_bgp_redistribute_ipv6, DEFUN (no_bgp_redistribute_ipv6_rmap, no_bgp_redistribute_ipv6_rmap_cmd, - "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD", ++ "no redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) route-map WORD", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8232,6 +8279,8 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, +@@ -8667,6 +8727,9 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n") { -@@ -8250,7 +8299,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, +@@ -8685,7 +8748,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, DEFUN (no_bgp_redistribute_ipv6_metric, no_bgp_redistribute_ipv6_metric_cmd, - "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) metric <0-4294967295>", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8258,6 +8307,8 @@ DEFUN (no_bgp_redistribute_ipv6_metric, +@@ -8693,6 +8756,9 @@ DEFUN (no_bgp_redistribute_ipv6_metric, "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n") { -@@ -8276,7 +8327,7 @@ DEFUN (no_bgp_redistribute_ipv6_metric, +@@ -8711,7 +8777,7 @@ DEFUN (no_bgp_redistribute_ipv6_metric, DEFUN (no_bgp_redistribute_ipv6_rmap_metric, no_bgp_redistribute_ipv6_rmap_metric_cmd, - "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD metric <0-4294967295>", ++ "no redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) route-map WORD metric <0-4294967295>", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8284,6 +8335,8 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met +@@ -8719,6 +8785,9 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8305,7 +8358,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met +@@ -8740,7 +8809,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met ALIAS (no_bgp_redistribute_ipv6_rmap_metric, no_bgp_redistribute_ipv6_metric_rmap_cmd, - "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295> route-map WORD", ++ "no redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) metric <0-4294967295> route-map WORD", NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8313,6 +8366,8 @@ ALIAS (no_bgp_redistribute_ipv6_rmap_met +@@ -8748,6 +8817,9 @@ ALIAS (no_bgp_redistribute_ipv6_rmap_met "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" ++ "Hazy-Sighted Link State Protocol (HSLS)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8325,7 +8380,7 @@ bgp_config_write_redistribute (struct vt - { - int i; - const char *str[] = { "system", "kernel", "connected", "static", "rip", -- "ripng", "ospf", "ospf6", "isis", "bgp"}; -+ "ripng", "ospf", "ospf6", "isis", "bgp", "hsls", "olsr", "batman"}; +--- a/lib/log.c ++++ b/lib/log.c +@@ -835,6 +835,8 @@ static const struct zebra_desc_table rou + DESC_ENTRY (ZEBRA_ROUTE_ISIS, "isis", 'I' ), + DESC_ENTRY (ZEBRA_ROUTE_BGP, "bgp", 'B' ), + DESC_ENTRY (ZEBRA_ROUTE_HSLS, "hsls", 'H' ), ++ DESC_ENTRY (ZEBRA_ROUTE_OLSR, "olsr", 'o' ), ++ DESC_ENTRY (ZEBRA_ROUTE_BATMAN, "batman", 'b' ), + }; + #undef DESC_ENTRY - /* Unicast redistribution only. */ - if (safi != SAFI_UNICAST) +--- 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, "OSPF" + 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, oslrd, '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" + + ## help strings + ZEBRA_ROUTE_SYSTEM, "Reserved route type, for internal use only" +@@ -71,4 +67,5 @@ 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)" --- a/lib/zebra.h +++ b/lib/zebra.h -@@ -3,6 +3,9 @@ - - This file is part of GNU Zebra. - -+This file was modified from the original on 30/12/2007 -+by Vasilis Tsiligiannis -+ - GNU Zebra is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any -@@ -378,7 +381,9 @@ struct in_pktinfo +@@ -441,7 +441,9 @@ struct in_pktinfo #define ZEBRA_ROUTE_ISIS 8 #define ZEBRA_ROUTE_BGP 9 #define ZEBRA_ROUTE_HSLS 10 @@ -425,361 +453,288 @@ +#define ZEBRA_ROUTE_BATMAN 12 +#define ZEBRA_ROUTE_MAX 13 - /* Zebra's family types. */ - #define ZEBRA_FAMILY_IPV4 1 + /* Note: whenever a new route-type or zserv-command is added the + * corresponding {command,route}_types[] table in lib/log.c MUST be +--- a/ospf6d/ospf6_asbr.c ++++ b/ospf6d/ospf6_asbr.c +@@ -616,13 +616,16 @@ ospf6_asbr_redistribute_remove (int type + + DEFUN (ospf6_redistribute, + ospf6_redistribute_cmd, +- "redistribute (static|kernel|connected|ripng|bgp)", ++ "redistribute (static|kernel|connected|ripng|bgp|hsls|olsr|batman)", + "Redistribute\n" + "Static route\n" + "Kernel route\n" + "Connected route\n" + "RIPng route\n" + "BGP route\n" ++ "HSLS route\n" ++ "OLSR route\n" ++ "BATMAN route\n" + ) + { + int type = 0; +@@ -637,6 +640,12 @@ DEFUN (ospf6_redistribute, + type = ZEBRA_ROUTE_RIPNG; + else if (strncmp (argv[0], "bgp", 3) == 0) + type = ZEBRA_ROUTE_BGP; ++ else if (strncmp (argv[0], "h", 1) == 0) ++ type = ZEBRA_ROUTE_HSLS; ++ else if (strncmp (argv[0], "o", 1) == 0) ++ type = ZEBRA_ROUTE_OLSR; ++ else if (strncmp (argv[0], "ba", 2) == 0) ++ type = ZEBRA_ROUTE_BATMAN; + + ospf6_asbr_redistribute_unset (type); + ospf6_asbr_routemap_unset (type); +@@ -646,13 +655,16 @@ DEFUN (ospf6_redistribute, + + DEFUN (ospf6_redistribute_routemap, + ospf6_redistribute_routemap_cmd, +- "redistribute (static|kernel|connected|ripng|bgp) route-map WORD", ++ "redistribute (static|kernel|connected|ripng|bgp|hsls|olsr|batman) route-map WORD", + "Redistribute\n" + "Static routes\n" + "Kernel route\n" + "Connected route\n" + "RIPng route\n" + "BGP route\n" ++ "HSLS route\n" ++ "OLSR route\n" ++ "BATMAN route\n" + "Route map reference\n" + "Route map name\n" + ) +@@ -669,6 +681,12 @@ DEFUN (ospf6_redistribute_routemap, + type = ZEBRA_ROUTE_RIPNG; + else if (strncmp (argv[0], "bgp", 3) == 0) + type = ZEBRA_ROUTE_BGP; ++ else if (strncmp (argv[0], "h", 1) == 0) ++ type = ZEBRA_ROUTE_HSLS; ++ else if (strncmp (argv[0], "o", 1) == 0) ++ type = ZEBRA_ROUTE_OLSR; ++ else if (strncmp (argv[0], "ba", 2) == 0) ++ type = ZEBRA_ROUTE_BATMAN; + + ospf6_asbr_redistribute_unset (type); + ospf6_asbr_routemap_set (type, argv[1]); +@@ -678,7 +696,7 @@ DEFUN (ospf6_redistribute_routemap, + + DEFUN (no_ospf6_redistribute, + no_ospf6_redistribute_cmd, +- "no redistribute (static|kernel|connected|ripng|bgp)", ++ "no redistribute (static|kernel|connected|ripng|bgp|hsls|olsr|batman)", + NO_STR + "Redistribute\n" + "Static route\n" +@@ -686,6 +704,9 @@ DEFUN (no_ospf6_redistribute, + "Connected route\n" + "RIPng route\n" + "BGP route\n" ++ "HSLS route\n" ++ "OLSR route\n" ++ "BATMAN route\n" + ) + { + int type = 0; +@@ -700,6 +721,12 @@ DEFUN (no_ospf6_redistribute, + type = ZEBRA_ROUTE_RIPNG; + else if (strncmp (argv[0], "bgp", 3) == 0) + type = ZEBRA_ROUTE_BGP; ++ else if (strncmp (argv[0], "h", 1) == 0) ++ type = ZEBRA_ROUTE_HSLS; ++ else if (strncmp (argv[0], "o", 1) == 0) ++ type = ZEBRA_ROUTE_OLSR; ++ else if (strncmp (argv[0], "ba", 2) == 0) ++ type = ZEBRA_ROUTE_BATMAN; + + ospf6_asbr_redistribute_unset (type); + ospf6_asbr_routemap_unset (type); --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c -@@ -3,6 +3,9 @@ - * - * This file is part of GNU Zebra. - * -+ * This file was modified from the original on 30/12/2007 -+ * by Vasilis Tsiligiannis -+ * - * GNU Zebra is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any -@@ -106,11 +109,15 @@ str2distribute_source (const char *str, +@@ -107,8 +107,14 @@ str2distribute_source (const char *str, *source = ZEBRA_ROUTE_STATIC; else if (strncmp (str, "r", 1) == 0) *source = ZEBRA_ROUTE_RIP; - else if (strncmp (str, "b", 1) == 0) + else if (strncmp (str, "bg", 2) == 0) *source = ZEBRA_ROUTE_BGP; -+ else if (strncmp (str, "ol", 2) == 0) ++ else if (strncmp (str, "h", 1) == 0) ++ *source = ZEBRA_ROUTE_HSLS; ++ else if (strncmp (str, "o", 1) == 0) + *source = ZEBRA_ROUTE_OLSR; + else if (strncmp (str, "ba", 2) == 0) + *source = ZEBRA_ROUTE_BATMAN; else return 0; -- -+ - return 1; - } -@@ -5302,13 +5309,15 @@ ALIAS (no_ip_ospf_transmit_delay, - - DEFUN (ospf_redistribute_source_metric_type, - ospf_redistribute_source_metric_type_routemap_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214> metric-type (1|2) route-map WORD", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "OSPF default metric\n" - "OSPF exterior metric type for redistributed routes\n" -@@ -5346,13 +5355,15 @@ DEFUN (ospf_redistribute_source_metric_t +--- a/ripd/rip_zebra.c ++++ b/ripd/rip_zebra.c +@@ -204,8 +204,11 @@ static struct { + {ZEBRA_ROUTE_KERNEL, 1, "kernel"}, + {ZEBRA_ROUTE_CONNECT, 1, "connected"}, + {ZEBRA_ROUTE_STATIC, 1, "static"}, +- {ZEBRA_ROUTE_OSPF, 1, "ospf"}, +- {ZEBRA_ROUTE_BGP, 1, "bgp"}, ++ {ZEBRA_ROUTE_OSPF, 2, "ospf"}, ++ {ZEBRA_ROUTE_BGP, 2, "bgp"}, ++ {ZEBRA_ROUTE_HSLS, 1, "hsls"}, ++ {ZEBRA_ROUTE_OLSR, 2, "olsr"}, ++ {ZEBRA_ROUTE_BATMAN, 2, "batman"}, + {0, 0, NULL} + }; - ALIAS (ospf_redistribute_source_metric_type, - ospf_redistribute_source_metric_type_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214> metric-type (1|2)", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "OSPF default metric\n" - "OSPF exterior metric type for redistributed routes\n" -@@ -5361,25 +5372,29 @@ ALIAS (ospf_redistribute_source_metric_t +--- a/ripngd/ripng_zebra.c ++++ b/ripngd/ripng_zebra.c +@@ -214,8 +214,11 @@ static struct { + {ZEBRA_ROUTE_KERNEL, 1, "kernel"}, + {ZEBRA_ROUTE_CONNECT, 1, "connected"}, + {ZEBRA_ROUTE_STATIC, 1, "static"}, +- {ZEBRA_ROUTE_OSPF6, 1, "ospf6"}, +- {ZEBRA_ROUTE_BGP, 1, "bgp"}, ++ {ZEBRA_ROUTE_OSPF6, 2, "ospf6"}, ++ {ZEBRA_ROUTE_BGP, 2, "bgp"}, ++ {ZEBRA_ROUTE_HSLS, 1, "hsls"}, ++ {ZEBRA_ROUTE_OLSR, 2, "olsr"}, ++ {ZEBRA_ROUTE_BATMAN, 2, "batman"}, + {0, 0, NULL} + }; - ALIAS (ospf_redistribute_source_metric_type, - ospf_redistribute_source_metric_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214>", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "OSPF default metric\n") - - DEFUN (ospf_redistribute_source_type_metric, - ospf_redistribute_source_type_metric_routemap_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2) metric <0-16777214> route-map WORD", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "OSPF exterior metric type for redistributed routes\n" - "Set OSPF External Type 1 metrics\n" - "Set OSPF External Type 2 metrics\n" -@@ -5417,13 +5432,15 @@ DEFUN (ospf_redistribute_source_type_met - - ALIAS (ospf_redistribute_source_type_metric, - ospf_redistribute_source_type_metric_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2) metric <0-16777214>", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "OSPF exterior metric type for redistributed routes\n" - "Set OSPF External Type 1 metrics\n" - "Set OSPF External Type 2 metrics\n" -@@ -5432,7 +5449,7 @@ ALIAS (ospf_redistribute_source_type_met - - ALIAS (ospf_redistribute_source_type_metric, - ospf_redistribute_source_type_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2)", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" -@@ -5440,28 +5457,35 @@ ALIAS (ospf_redistribute_source_type_met - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" - "OSPF exterior metric type for redistributed routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Set OSPF External Type 1 metrics\n" - "Set OSPF External Type 2 metrics\n") - - ALIAS (ospf_redistribute_source_type_metric, - ospf_redistribute_source_cmd, -- "redistribute (kernel|connected|static|rip|bgp)", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman)", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" -- "Border Gateway Protocol (BGP)\n") -+ "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+ ) - - DEFUN (ospf_redistribute_source_metric_routemap, - ospf_redistribute_source_metric_routemap_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214> route-map WORD", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "OSPF default metric\n" - "Route map reference\n" -@@ -5490,13 +5514,15 @@ DEFUN (ospf_redistribute_source_metric_r - - DEFUN (ospf_redistribute_source_type_routemap, - ospf_redistribute_source_type_routemap_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2) route-map WORD", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "OSPF exterior metric type for redistributed routes\n" - "Set OSPF External Type 1 metrics\n" - "Set OSPF External Type 2 metrics\n" -@@ -5526,13 +5552,15 @@ DEFUN (ospf_redistribute_source_type_rou - - DEFUN (ospf_redistribute_source_routemap, - ospf_redistribute_source_routemap_cmd, -- "redistribute (kernel|connected|static|rip|bgp) route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) route-map WORD", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n") - { -@@ -5553,14 +5581,17 @@ DEFUN (ospf_redistribute_source_routemap - - DEFUN (no_ospf_redistribute_source, - no_ospf_redistribute_source_cmd, -- "no redistribute (kernel|connected|static|rip|bgp)", -+ "no redistribute (kernel|connected|static|rip|bgp|olsr|batman)", - NO_STR - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" -- "Border Gateway Protocol (BGP)\n") -+ "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+ ) - { - struct ospf *ospf = vty->index; - int source; -@@ -5574,7 +5605,7 @@ DEFUN (no_ospf_redistribute_source, - - DEFUN (ospf_distribute_list_out, - ospf_distribute_list_out_cmd, -- "distribute-list WORD out (kernel|connected|static|rip|bgp)", -+ "distribute-list WORD out (kernel|connected|static|rip|bgp|olsr|batman)", - "Filter networks in routing updates\n" - "Access-list name\n" - OUT_STR -@@ -5582,7 +5613,10 @@ DEFUN (ospf_distribute_list_out, - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" -- "Border Gateway Protocol (BGP)\n") -+ "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+) - { - struct ospf *ospf = vty->index; - int source; -@@ -5596,7 +5630,7 @@ DEFUN (ospf_distribute_list_out, - - DEFUN (no_ospf_distribute_list_out, - no_ospf_distribute_list_out_cmd, -- "no distribute-list WORD out (kernel|connected|static|rip|bgp)", -+ "no distribute-list WORD out (kernel|connected|static|rip|bgp|olsr|batman)", - NO_STR - "Filter networks in routing updates\n" - "Access-list name\n" -@@ -5605,7 +5639,10 @@ DEFUN (no_ospf_distribute_list_out, - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" -- "Border Gateway Protocol (BGP)\n") -+ "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+) - { - struct ospf *ospf = vty->index; - int source; -@@ -7121,7 +7158,8 @@ config_write_virtual_link (struct vty *v - - - const char *distribute_str[] = { "system", "kernel", "connected", "static", -- "rip", "ripng", "ospf", "ospf6", "isis", "bgp"}; -+ "rip", "ripng", "ospf", "ospf6", "isis", "bgp", -+ "hsls","olsr","batman"}; - int - config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) - { --- a/zebra/redistribute.c +++ b/zebra/redistribute.c -@@ -3,6 +3,9 @@ - * - * This file is part of GNU Zebra. - * -+ * This file was modified from the original on 30/12/2007 -+ * by Vasilis Tsiligiannis -+ * - * GNU Zebra is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any -@@ -253,6 +256,8 @@ zebra_redistribute_add (int command, str +@@ -255,6 +255,9 @@ zebra_redistribute_add (int command, str case ZEBRA_ROUTE_OSPF: case ZEBRA_ROUTE_OSPF6: case ZEBRA_ROUTE_BGP: ++ case ZEBRA_ROUTE_HSLS: + case ZEBRA_ROUTE_OLSR: + case ZEBRA_ROUTE_BATMAN: if (! client->redist[type]) { client->redist[type] = 1; -@@ -281,6 +286,8 @@ zebra_redistribute_delete (int command, +@@ -283,6 +286,9 @@ zebra_redistribute_delete (int command, case ZEBRA_ROUTE_OSPF: case ZEBRA_ROUTE_OSPF6: case ZEBRA_ROUTE_BGP: ++ case ZEBRA_ROUTE_HSLS: + case ZEBRA_ROUTE_OLSR: + case ZEBRA_ROUTE_BATMAN: client->redist[type] = 0; break; default: +--- a/zebra/zebra_rib.c ++++ b/zebra/zebra_rib.c +@@ -66,7 +66,10 @@ static const struct + {ZEBRA_ROUTE_OSPF, 110}, + {ZEBRA_ROUTE_OSPF6, 110}, + {ZEBRA_ROUTE_ISIS, 115}, +- {ZEBRA_ROUTE_BGP, 20 /* IBGP is 200. */} ++ {ZEBRA_ROUTE_BGP, 20 /* IBGP is 200. */}, ++ {ZEBRA_ROUTE_HSLS, 0}, ++ {ZEBRA_ROUTE_OLSR, 0}, ++ {ZEBRA_ROUTE_BATMAN, 0} + }; + + /* Vector for routing table. */ +@@ -1229,6 +1232,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, + }; + + /* Look into the RN and queue it into one or more priority queues, +--- a/zebra/zebra_snmp.c ++++ b/zebra/zebra_snmp.c +@@ -251,6 +251,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 -@@ -53,6 +53,10 @@ route_type_str (u_char type) - return "isis"; - case ZEBRA_ROUTE_BGP: - return "bgp"; -+ case ZEBRA_ROUTE_OLSR: -+ return "olsr"; -+ case ZEBRA_ROUTE_BATMAN: -+ return "batman"; - default: - return "unknown"; - } -@@ -84,6 +88,12 @@ route_type_char (u_char type) - return 'I'; - case ZEBRA_ROUTE_BGP: - return 'B'; -+ case ZEBRA_ROUTE_HSLS: -+ return 'H'; -+ case ZEBRA_ROUTE_OLSR: -+ return 'L'; -+ case ZEBRA_ROUTE_BATMAN: -+ return 'M'; - default: - return '?'; - } -@@ -755,8 +765,8 @@ vty_show_ip_route (struct vty *vty, stru +@@ -557,7 +557,10 @@ vty_show_ip_route_detail (struct vty *vt + if (rib->type == ZEBRA_ROUTE_RIP + || rib->type == ZEBRA_ROUTE_OSPF + || 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; +@@ -775,7 +778,10 @@ vty_show_ip_route (struct vty *vty, stru + if (rib->type == ZEBRA_ROUTE_RIP + || rib->type == ZEBRA_ROUTE_OSPF + || 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; +@@ -803,8 +809,8 @@ vty_show_ip_route (struct vty *vty, stru } #define SHOW_ROUTE_V4_HEADER "Codes: K - kernel route, C - connected, " \ - "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, " \ - "> - selected route, * - FIB route%s%s" + "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, H - HSLS, " \ -+ "L - OLSR, M - BATMAN, > - selected route, * - FIB route%s%s" ++ "o - OLSR, b - BATMAN,%s > - selected route, * - FIB route%s%s" DEFUN (show_ip_route, show_ip_route_cmd, -@@ -874,7 +884,7 @@ DEFUN (show_ip_route_supernets, +@@ -829,7 +835,7 @@ DEFUN (show_ip_route, + if (first) + { + vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE, VTY_NEWLINE, +- VTY_NEWLINE); ++ VTY_NEWLINE, VTY_NEWLINE); + first = 0; + } + vty_show_ip_route (vty, rn, rib); +@@ -872,7 +878,7 @@ DEFUN (show_ip_route_prefix_longer, + if (first) + { + vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE, +- VTY_NEWLINE, VTY_NEWLINE); ++ VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + first = 0; + } + vty_show_ip_route (vty, rn, rib); +@@ -911,7 +917,7 @@ DEFUN (show_ip_route_supernets, + if (first) + { + vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE, +- VTY_NEWLINE, VTY_NEWLINE); ++ VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + first = 0; + } + vty_show_ip_route (vty, rn, rib); +@@ -922,7 +928,7 @@ DEFUN (show_ip_route_supernets, DEFUN (show_ip_route_protocol, show_ip_route_protocol_cmd, - "show ip route (bgp|connected|isis|kernel|ospf|rip|static)", -+ "show ip route (bgp|connected|isis|kernel|ospf|rip|olsr|batman|static)", ++ "show ip route (bgp|connected|isis|kernel|ospf|rip|static|hsls|olsr|batman)", SHOW_STR IP_STR "IP routing table\n" -@@ -884,6 +894,8 @@ DEFUN (show_ip_route_protocol, - "Kernel\n" - "Open Shortest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Static routes\n") - { - int type; -@@ -892,13 +904,13 @@ DEFUN (show_ip_route_protocol, +@@ -940,13 +946,13 @@ DEFUN (show_ip_route_protocol, struct rib *rib; int first = 1; @@ -795,10 +750,12 @@ type = ZEBRA_ROUTE_OSPF; else if (strncmp (argv[0], "i", 1) == 0) type = ZEBRA_ROUTE_ISIS; -@@ -906,6 +918,10 @@ DEFUN (show_ip_route_protocol, +@@ -954,6 +960,12 @@ DEFUN (show_ip_route_protocol, type = ZEBRA_ROUTE_RIP; else if (strncmp (argv[0], "s", 1) == 0) type = ZEBRA_ROUTE_STATIC; ++ else if (strncmp (argv[0], "h", 1) == 0) ++ type = ZEBRA_ROUTE_HSLS; + else if (strncmp (argv[0], "ol", 2) == 0) + type = ZEBRA_ROUTE_OLSR; + else if (strncmp (argv[0], "ba", 2) == 0) @@ -806,25 +763,58 @@ else { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); -@@ -1732,7 +1748,7 @@ DEFUN (show_ipv6_route_prefix_longer, +@@ -971,7 +983,7 @@ DEFUN (show_ip_route_protocol, + { + if (first) + { +- vty_out (vty, SHOW_ROUTE_V4_HEADER, ++ vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE, + VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + first = 0; + } +@@ -1560,7 +1572,10 @@ vty_show_ipv6_route_detail (struct vty * + if (rib->type == ZEBRA_ROUTE_RIPNG + || rib->type == ZEBRA_ROUTE_OSPF6 + || 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; +@@ -1739,7 +1754,10 @@ vty_show_ipv6_route (struct vty *vty, st + if (rib->type == ZEBRA_ROUTE_RIPNG + || rib->type == ZEBRA_ROUTE_OSPF6 + || 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; +@@ -1766,7 +1784,7 @@ vty_show_ipv6_route (struct vty *vty, st + } + } + +-#define SHOW_ROUTE_V6_HEADER "Codes: K - kernel route, C - connected, S - static, R - RIPng, O - OSPFv3,%s I - ISIS, B - BGP, * - FIB route.%s%s" ++#define SHOW_ROUTE_V6_HEADER "Codes: K - kernel route, C - connected, S - static, R - RIPng, O - OSPFv3,%s I - ISIS, B - BGP, H - HSLS, o - OLSR, b - BATMAN, * - FIB route.%s%s" + + DEFUN (show_ipv6_route, + show_ipv6_route_cmd, +@@ -1842,7 +1860,7 @@ DEFUN (show_ipv6_route_prefix_longer, DEFUN (show_ipv6_route_protocol, show_ipv6_route_protocol_cmd, - "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|static)", -+ "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|olsr|batman|static)", ++ "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|static|hsls|olsr|batman)", SHOW_STR IP_STR "IP routing table\n" -@@ -1742,6 +1758,8 @@ DEFUN (show_ipv6_route_protocol, - "Kernel\n" - "Open Shortest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Static routes\n") - { - int type; -@@ -1750,13 +1768,13 @@ DEFUN (show_ipv6_route_protocol, +@@ -1860,13 +1878,13 @@ DEFUN (show_ipv6_route_protocol, struct rib *rib; int first = 1; @@ -840,16 +830,16 @@ type = ZEBRA_ROUTE_OSPF6; else if (strncmp (argv[0], "i", 1) == 0) type = ZEBRA_ROUTE_ISIS; -@@ -1764,7 +1782,11 @@ DEFUN (show_ipv6_route_protocol, +@@ -1874,6 +1892,12 @@ DEFUN (show_ipv6_route_protocol, type = ZEBRA_ROUTE_RIPNG; else if (strncmp (argv[0], "s", 1) == 0) type = ZEBRA_ROUTE_STATIC; -- else ++ else if (strncmp (argv[0], "h", 1) == 0) ++ type = ZEBRA_ROUTE_HSLS; + else if (strncmp (argv[0], "ol", 2) == 0) -+ type = ZEBRA_ROUTE_OLSR; ++ type = ZEBRA_ROUTE_OLSR; + else if (strncmp (argv[0], "ba", 2) == 0) -+ type = ZEBRA_ROUTE_BATMAN; -+ else ++ type = ZEBRA_ROUTE_BATMAN; + else { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); - return CMD_WARNING; diff --git a/patches/010-fix_cpp.patch b/patches/010-fix_cpp.patch new file mode 100644 index 0000000..3660bf8 --- /dev/null +++ b/patches/010-fix_cpp.patch @@ -0,0 +1,11 @@ +--- a/vtysh/extract.pl.in ++++ b/vtysh/extract.pl.in +@@ -62,7 +62,7 @@ $ignore{'"show history"'} = "ignore"; + foreach (@ARGV) { + $file = $_; + +- open (FH, "cpp -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_srcdir@/isisd/topology @SNMP_INCLUDES@ $file |"); ++ open (FH, "@CPP@ @CPPFLAGS@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_srcdir@/isisd/topology @SNMP_INCLUDES@ $file |"); + local $/; undef $/; + $line = ; + close (FH); diff --git a/patches/100-quagga_multipath_caching_policy.patch b/patches/100-quagga_multipath_caching_policy.patch new file mode 100644 index 0000000..dae45e2 --- /dev/null +++ b/patches/100-quagga_multipath_caching_policy.patch @@ -0,0 +1,297 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -397,7 +397,7 @@ dnl ------------------------- + AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \ + sys/types.h linux/version.h netdb.h asm/types.h \ + sys/param.h limits.h signal.h libutil.h \ +- sys/socket.h netinet/in.h time.h sys/time.h]) ++ sys/socket.h netinet/in.h time.h sys/time.h linux/ip_mp_alg.h]) + + dnl Utility macro to avoid retyping includes all the time + m4_define([QUAGGA_INCLUDES], +@@ -779,6 +779,17 @@ AC_SUBST(RT_METHOD) + AC_SUBST(KERNEL_METHOD) + AC_SUBST(OTHER_METHOD) + ++dnl ---------- ++dnl Check for RTA_MP_ALGO in linux/rtnetlink.h ++dnl ---------- ++AC_MSG_CHECKING(for support of multipath alg. in netlink) ++ if grep RTA_MP_ALGO linux/rtnetlink.h >/dev/null 2>&1; then ++ AC_DEFINE(HAVE_RT_MP_ALGO,,RTA_MP exist in rtnetlink) ++ AC_MSG_RESULT(yes) ++ else ++ AC_MSG_RESULT(no) ++ fi ++ + dnl -------------------------- + dnl Determine IS-IS I/O method + dnl -------------------------- +--- a/lib/command.h ++++ b/lib/command.h +@@ -101,6 +101,7 @@ enum node_type + DUMP_NODE, /* Packet dump node. */ + FORWARDING_NODE, /* IP forwarding node. */ + PROTOCOL_NODE, /* protocol filtering node */ ++ MULTIPATH_NODE, /* Multipath policy node */ + VTY_NODE, /* Vty node. */ + }; + +@@ -272,6 +273,7 @@ struct desc + /* Common descriptions. */ + #define SHOW_STR "Show running system information\n" + #define IP_STR "IP information\n" ++#define MULTIPATH_STR "Configure multipath policy\n" + #define IPV6_STR "IPv6 information\n" + #define NO_STR "Negate a command or set its defaults\n" + #define REDIST_STR "Redistribute information from another routing protocol\n" +--- a/lib/zebra.h ++++ b/lib/zebra.h +@@ -176,6 +176,10 @@ typedef int socklen_t; + #define RT_TABLE_MAIN 0 + #endif /* HAVE_NETLINK */ + ++#ifdef HAVE_LINUX_IP_MP_ALG_H ++#include ++#endif /* HAVE_LINUX_IP_MP_ALG_H */ ++ + #ifdef HAVE_NETDB_H + #include + #endif /* HAVE_NETDB_H */ +--- a/zebra/main.c ++++ b/zebra/main.c +@@ -44,6 +44,7 @@ + struct zebra_t zebrad = + { + .rtm_table_default = 0, ++ .mpath = 0, + }; + + /* process id. */ +--- /dev/null ++++ b/zebra/multipath.h +@@ -0,0 +1,37 @@ ++/* ++ * multipath policy names. ++ * ++ * This file is part of Quagga routing suite. ++ * ++ * Quagga is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2, or (at your option) any ++ * later version. ++ * ++ * Quagga is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GNU Zebra; see the file COPYING. If not, write to the Free ++ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ++ * 02111-1307, USA. ++ */ ++ ++#ifndef ZEBRA_MULTIPATH_H ++#define ZEBRA_MULTIPATH_H ++#include ++ ++#ifdef HAVE_LINUX_IP_MP_ALG_H ++ ++static char *mp_alg_names[IP_MP_ALG_MAX+1] = { ++ [IP_MP_ALG_NONE] = "none", ++ [IP_MP_ALG_RR] = "rr", ++ [IP_MP_ALG_DRR] = "drr", ++ [IP_MP_ALG_RANDOM] = "random", ++ [IP_MP_ALG_WRANDOM] = "wrandom" ++ }; ++#endif ++#endif ++ +--- a/zebra/rt_netlink.c ++++ b/zebra/rt_netlink.c +@@ -36,6 +36,7 @@ + #include "thread.h" + #include "privs.h" + ++#include "multipath.h" + #include "zebra/zserv.h" + #include "zebra/rt.h" + #include "zebra/redistribute.h" +@@ -1694,6 +1695,16 @@ netlink_route_multipath (int cmd, struct + if (src) + addattr_l (&req.n, sizeof req, RTA_PREFSRC, &src->ipv4, bytelen); + ++#ifdef HAVE_RT_MP_ALGO ++ if (zebrad.mpath != IP_MP_ALG_NONE) ++ { ++ if (IS_ZEBRA_DEBUG_KERNEL) ++ zlog_debug("netlink_route_multipath() (multihop): " ++ "multipath policy : %s",mp_alg_names[zebrad.mpath]); ++ ++ addattr_l (&req.n, 1024, RTA_MP_ALGO, &zebrad.mpath, sizeof(zebrad.mpath)); ++ } ++#endif + if (rta->rta_len > RTA_LENGTH (0)) + addattr_l (&req.n, 1024, RTA_MULTIPATH, RTA_DATA (rta), + RTA_PAYLOAD (rta)); +--- a/zebra/zserv.c ++++ b/zebra/zserv.c +@@ -36,6 +36,7 @@ + #include "privs.h" + #include "network.h" + #include "buffer.h" ++#include "multipath.h" + + #include "zebra/zserv.h" + #include "zebra/router-id.h" +@@ -1120,6 +1121,9 @@ zebra_client_create (int sock) + /* Set table number. */ + client->rtm_table = zebrad.rtm_table_default; + ++ /* Set multipath policy */ ++ client->mpath = zebrad.mpath; ++ + /* Add this client to linked list. */ + listnode_add (zebrad.client_list, client); + +@@ -1697,6 +1701,91 @@ static struct cmd_node forwarding_node = + }; + + ++#ifdef HAVE_RT_MP_ALGO ++DEFUN (multipath_rr, ++ multipath_rr_cmd, ++ "multipath rr", ++ MULTIPATH_STR ++ "Round Robin multipath policy") ++{ ++ zebrad.mpath=IP_MP_ALG_RR; ++ return CMD_SUCCESS; ++} ++ ++DEFUN (multipath_drr, ++ multipath_drr_cmd, ++ "multipath drr", ++ MULTIPATH_STR ++ "Device round robin multipath policy") ++{ ++ zebrad.mpath=IP_MP_ALG_DRR; ++ return CMD_SUCCESS; ++} ++ ++DEFUN (multipath_random, ++ multipath_random_cmd, ++ "multipath random", ++ MULTIPATH_STR ++ "Random multipath policy") ++{ ++ zebrad.mpath=IP_MP_ALG_RANDOM; ++ return CMD_SUCCESS; ++} ++ ++DEFUN (multipath_wrandom, ++ multipath_wrandom_cmd, ++ "multipath wrandom", ++ MULTIPATH_STR ++ "Weighted random multipath policy") ++{ ++ zebrad.mpath=IP_MP_ALG_WRANDOM; ++ return CMD_SUCCESS; ++} ++ ++DEFUN (no_multipath, ++ no_multipath_cmd, ++ "no multipath", ++ NO_STR ++ MULTIPATH_STR ++ "Remove multipath policy") ++{ ++ zebrad.mpath=IP_MP_ALG_NONE; ++ return CMD_SUCCESS; ++} ++ ++DEFUN (show_multipath, ++ show_multipath_cmd, ++ "show multipath", ++ SHOW_STR ++ "Show multipath policy") ++{ ++ vty_out (vty, "multipath %s%s", mp_alg_names[zebrad.mpath], ++ VTY_NEWLINE); ++ return CMD_SUCCESS; ++} ++ ++/* multipath policy configuration write function. */ ++static int ++config_write_multipath (struct vty *vty) ++{ ++ ++ ++ if (zebrad.mpath) ++ vty_out (vty, "multipath %s%s", mp_alg_names[zebrad.mpath], ++ VTY_NEWLINE); ++ return 0; ++} ++ ++/* table node for multipath policy. */ ++struct cmd_node multipath_node = ++{ ++ MULTIPATH_NODE, ++ "", ++ 1 ++}; ++ ++#endif /* HAVE_RT_MP_ALGO */ ++ + /* Initialisation of zebra and installation of commands. */ + void + zebra_init (void) +@@ -1708,6 +1797,10 @@ zebra_init (void) + install_node (&table_node, config_write_table); + install_node (&forwarding_node, config_write_forwarding); + ++#ifdef HAVE_RT_MP_ALGO ++ install_node (&multipath_node, config_write_multipath); ++#endif ++ + install_element (VIEW_NODE, &show_ip_forwarding_cmd); + install_element (ENABLE_NODE, &show_ip_forwarding_cmd); + install_element (CONFIG_NODE, &ip_forwarding_cmd); +@@ -1718,6 +1811,14 @@ zebra_init (void) + install_element (VIEW_NODE, &show_table_cmd); + install_element (ENABLE_NODE, &show_table_cmd); + install_element (CONFIG_NODE, &config_table_cmd); ++#ifdef HAVE_RT_MP_ALGO ++ install_element (CONFIG_NODE, &multipath_rr_cmd); ++ install_element (CONFIG_NODE, &multipath_drr_cmd); ++ install_element (CONFIG_NODE, &multipath_random_cmd); ++ install_element (CONFIG_NODE, &multipath_wrandom_cmd); ++ install_element (CONFIG_NODE, &no_multipath_cmd); ++ install_element (ENABLE_NODE, &show_multipath_cmd); ++#endif /* HAVE_RT_MP_ALGO */ + #endif /* HAVE_NETLINK */ + + #ifdef HAVE_IPV6 +--- a/zebra/zserv.h ++++ b/zebra/zserv.h +@@ -55,6 +55,9 @@ struct zserv + /* default routing table this client munges */ + int rtm_table; + ++ /* multipath policy */ ++ u_int32_t mpath; ++ + /* This client's redistribute flag. */ + u_char redist[ZEBRA_ROUTE_MAX]; + +@@ -78,6 +81,9 @@ struct zebra_t + /* default table */ + int rtm_table_default; + ++ /* multipath policy */ ++ u_int32_t mpath; ++ + /* rib work queue */ + struct work_queue *ribq; + struct meta_queue *mq; diff --git a/patches/140-holdtimer-set.patch b/patches/140-holdtimer-set.patch index 1264f5b..8642bbf 100644 --- a/patches/140-holdtimer-set.patch +++ b/patches/140-holdtimer-set.patch @@ -1,16 +1,18 @@ --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c -@@ -109,6 +109,7 @@ bgp_accept (struct thread *thread) +@@ -188,8 +188,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 -@@ -656,6 +656,7 @@ struct bgp_nlri +@@ -709,6 +709,7 @@ struct bgp_nlri /* BGP timers default value. */ #define BGP_INIT_START_TIMER 5 #define BGP_ERROR_START_TIMER 30 diff --git a/patches/150-no-cross-fs-link.patch b/patches/150-no-cross-fs-link.patch index 1988f2e..c3f29c3 100644 --- a/patches/150-no-cross-fs-link.patch +++ b/patches/150-no-cross-fs-link.patch @@ -1,8 +1,8 @@ --- a/lib/command.c +++ b/lib/command.c -@@ -2567,6 +2567,13 @@ - unlink (config_file_tmp); - return CMD_WARNING; +@@ -2601,6 +2601,13 @@ DEFUN (config_write_file, + VTY_NEWLINE); + goto finished; } + +#if 0 @@ -14,9 +14,9 @@ if (link (config_file, config_file_sav) != 0) { vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav, -@@ -2586,7 +2593,23 @@ - unlink (config_file_tmp); - return CMD_WARNING; +@@ -2614,7 +2621,23 @@ DEFUN (config_write_file, + VTY_NEWLINE); + goto finished; } +#else + /* And this is the code that hopefully does work */ @@ -24,7 +24,7 @@ + { + vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav, + VTY_NEWLINE); -+ return CMD_WARNING; ++ goto finished; + } + sync (); +#endif From 46a8ddd1d2f6daecd0ae1f2aa038443f767458bd Mon Sep 17 00:00:00 2001 From: acoul Date: Thu, 21 Oct 2010 13:03:12 +0000 Subject: [PATCH 044/117] net/quagga: fix default options git-svn-id: svn+ssh://svn.openwrt.org/openwrt@23569 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e4a79c7..19f6f4c 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ endef define Package/quagga $(call Package/quagga/Default) - DEPENDS:=+QUAGGA_STABLE:librt + DEPENDS:=+!QUAGGA_OLD:librt MENU:=1 endef From 8366cece9a1093dadf9b683198af761ec8fec340 Mon Sep 17 00:00:00 2001 From: acoul Date: Mon, 25 Oct 2010 11:07:24 +0000 Subject: [PATCH 045/117] net/quagga: include another upstream patch git-svn-id: svn+ssh://svn.openwrt.org/openwrt@23629 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/000-upstream-clock_fix.patch | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 patches/000-upstream-clock_fix.patch diff --git a/patches/000-upstream-clock_fix.patch b/patches/000-upstream-clock_fix.patch new file mode 100644 index 0000000..58fea85 --- /dev/null +++ b/patches/000-upstream-clock_fix.patch @@ -0,0 +1,29 @@ +From 213b6cd9fb24381563d6d44c7ddc4700abfae676 Mon Sep 17 00:00:00 2001 +From: Vladimir L Ivanov +Date: Thu, 21 Oct 2010 14:59:54 +0400 +Subject: [PATCH] bgpd: fix printed value of last-update timestamp + +* bgp_route.c: (route_vty_out_detail) calculate time value + in a way, which works regardless of monotonic clock + being used or not +--- + bgpd/bgp_route.c | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c +index 2391f74..1cfc451 100644 +--- a/bgpd/bgp_route.c ++++ b/bgpd/bgp_route.c +@@ -6145,7 +6145,8 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p, + bgp_damp_info_vty (vty, binfo); + + /* Line 7 display Uptime */ +- vty_out (vty, " Last update: %s", ctime (&binfo->uptime)); ++ time_t tbuf = time(NULL) - (bgp_clock() - binfo->uptime); ++ vty_out (vty, " Last update: %s", ctime(&tbuf)); + } + vty_out (vty, "%s", VTY_NEWLINE); + } +-- +1.7.2.3 + From c561848329455dc569e6e6fb56a81c0b1f36a416 Mon Sep 17 00:00:00 2001 From: acoul Date: Wed, 27 Oct 2010 10:34:32 +0000 Subject: [PATCH 046/117] net/quagga: fix multipath detection. (closes #8136) git-svn-id: svn+ssh://svn.openwrt.org/openwrt@23654 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/100-quagga_multipath_caching_policy.patch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/patches/100-quagga_multipath_caching_policy.patch b/patches/100-quagga_multipath_caching_policy.patch index dae45e2..1d4a4ef 100644 --- a/patches/100-quagga_multipath_caching_policy.patch +++ b/patches/100-quagga_multipath_caching_policy.patch @@ -18,7 +18,7 @@ +dnl ---------- +AC_MSG_CHECKING(for support of multipath alg. in netlink) + if grep RTA_MP_ALGO linux/rtnetlink.h >/dev/null 2>&1; then -+ AC_DEFINE(HAVE_RT_MP_ALGO,,RTA_MP exist in rtnetlink) ++ AC_DEFINE(HAVE_LINUX_IP_MP_ALG_H,,RTA_MP exist in rtnetlink) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) @@ -122,7 +122,7 @@ if (src) addattr_l (&req.n, sizeof req, RTA_PREFSRC, &src->ipv4, bytelen); -+#ifdef HAVE_RT_MP_ALGO ++#ifdef HAVE_LINUX_IP_MP_ALG_H + if (zebrad.mpath != IP_MP_ALG_NONE) + { + if (IS_ZEBRA_DEBUG_KERNEL) @@ -159,7 +159,7 @@ }; -+#ifdef HAVE_RT_MP_ALGO ++#ifdef HAVE_LINUX_IP_MP_ALG_H +DEFUN (multipath_rr, + multipath_rr_cmd, + "multipath rr", @@ -242,7 +242,7 @@ + 1 +}; + -+#endif /* HAVE_RT_MP_ALGO */ ++#endif /* HAVE_LINUX_IP_MP_ALG_H */ + /* Initialisation of zebra and installation of commands. */ void @@ -251,7 +251,7 @@ install_node (&table_node, config_write_table); install_node (&forwarding_node, config_write_forwarding); -+#ifdef HAVE_RT_MP_ALGO ++#ifdef HAVE_LINUX_IP_MP_ALG_H + install_node (&multipath_node, config_write_multipath); +#endif + @@ -262,14 +262,14 @@ install_element (VIEW_NODE, &show_table_cmd); install_element (ENABLE_NODE, &show_table_cmd); install_element (CONFIG_NODE, &config_table_cmd); -+#ifdef HAVE_RT_MP_ALGO ++#ifdef HAVE_LINUX_IP_MP_ALG_H + install_element (CONFIG_NODE, &multipath_rr_cmd); + install_element (CONFIG_NODE, &multipath_drr_cmd); + install_element (CONFIG_NODE, &multipath_random_cmd); + install_element (CONFIG_NODE, &multipath_wrandom_cmd); + install_element (CONFIG_NODE, &no_multipath_cmd); + install_element (ENABLE_NODE, &show_multipath_cmd); -+#endif /* HAVE_RT_MP_ALGO */ ++#endif /* HAVE_LINUX_IP_MP_ALG_H */ #endif /* HAVE_NETLINK */ #ifdef HAVE_IPV6 From 26ff1371f8c80d9c71b498034f64110ad107ddd5 Mon Sep 17 00:00:00 2001 From: acoul Date: Wed, 27 Oct 2010 13:13:05 +0000 Subject: [PATCH 047/117] net/quagga: fix r23654 git-svn-id: svn+ssh://svn.openwrt.org/openwrt@23664 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../100-quagga_multipath_caching_policy.patch | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/patches/100-quagga_multipath_caching_policy.patch b/patches/100-quagga_multipath_caching_policy.patch index 1d4a4ef..157bfc6 100644 --- a/patches/100-quagga_multipath_caching_policy.patch +++ b/patches/100-quagga_multipath_caching_policy.patch @@ -9,24 +9,6 @@ dnl Utility macro to avoid retyping includes all the time m4_define([QUAGGA_INCLUDES], -@@ -779,6 +779,17 @@ AC_SUBST(RT_METHOD) - AC_SUBST(KERNEL_METHOD) - AC_SUBST(OTHER_METHOD) - -+dnl ---------- -+dnl Check for RTA_MP_ALGO in linux/rtnetlink.h -+dnl ---------- -+AC_MSG_CHECKING(for support of multipath alg. in netlink) -+ if grep RTA_MP_ALGO linux/rtnetlink.h >/dev/null 2>&1; then -+ AC_DEFINE(HAVE_LINUX_IP_MP_ALG_H,,RTA_MP exist in rtnetlink) -+ AC_MSG_RESULT(yes) -+ else -+ AC_MSG_RESULT(no) -+ fi -+ - dnl -------------------------- - dnl Determine IS-IS I/O method - dnl -------------------------- --- a/lib/command.h +++ b/lib/command.h @@ -101,6 +101,7 @@ enum node_type From 093a3d434eb37f32ca60e0c7ff02e3c50b8e5345 Mon Sep 17 00:00:00 2001 From: acoul Date: Wed, 27 Oct 2010 13:20:36 +0000 Subject: [PATCH 048/117] net/quagga: honor configure.ac patch changes git-svn-id: svn+ssh://svn.openwrt.org/openwrt@23665 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 19f6f4c..4fe10f4 100644 --- a/Makefile +++ b/Makefile @@ -157,6 +157,13 @@ ifneq ($(CONFIG_PACKAGE_quagga-ripngd),) CONFIGURE_ARGS+= --enable-ripngd endif +define Build/Configure + (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \ + autoconf \ + ); + $(call Build/Configure/Default) +endef + define Package/quagga/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/ From 87af4f6539eb6eeb041fb4b5da1bc2565b2d5eca Mon Sep 17 00:00:00 2001 From: acinonyx Date: Sat, 30 Oct 2010 19:25:34 +0000 Subject: [PATCH 049/117] [packages] quagga: Remove multipath caching policy patch since it is unsupported in recent kernels (#8136) git-svn-id: svn+ssh://svn.openwrt.org/openwrt@23722 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../100-quagga_multipath_caching_policy.patch | 279 ------------------ 1 file changed, 279 deletions(-) delete mode 100644 patches/100-quagga_multipath_caching_policy.patch diff --git a/patches/100-quagga_multipath_caching_policy.patch b/patches/100-quagga_multipath_caching_policy.patch deleted file mode 100644 index 157bfc6..0000000 --- a/patches/100-quagga_multipath_caching_policy.patch +++ /dev/null @@ -1,279 +0,0 @@ ---- a/configure.ac -+++ b/configure.ac -@@ -397,7 +397,7 @@ dnl ------------------------- - AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \ - sys/types.h linux/version.h netdb.h asm/types.h \ - sys/param.h limits.h signal.h libutil.h \ -- sys/socket.h netinet/in.h time.h sys/time.h]) -+ sys/socket.h netinet/in.h time.h sys/time.h linux/ip_mp_alg.h]) - - dnl Utility macro to avoid retyping includes all the time - m4_define([QUAGGA_INCLUDES], ---- a/lib/command.h -+++ b/lib/command.h -@@ -101,6 +101,7 @@ enum node_type - DUMP_NODE, /* Packet dump node. */ - FORWARDING_NODE, /* IP forwarding node. */ - PROTOCOL_NODE, /* protocol filtering node */ -+ MULTIPATH_NODE, /* Multipath policy node */ - VTY_NODE, /* Vty node. */ - }; - -@@ -272,6 +273,7 @@ struct desc - /* Common descriptions. */ - #define SHOW_STR "Show running system information\n" - #define IP_STR "IP information\n" -+#define MULTIPATH_STR "Configure multipath policy\n" - #define IPV6_STR "IPv6 information\n" - #define NO_STR "Negate a command or set its defaults\n" - #define REDIST_STR "Redistribute information from another routing protocol\n" ---- a/lib/zebra.h -+++ b/lib/zebra.h -@@ -176,6 +176,10 @@ typedef int socklen_t; - #define RT_TABLE_MAIN 0 - #endif /* HAVE_NETLINK */ - -+#ifdef HAVE_LINUX_IP_MP_ALG_H -+#include -+#endif /* HAVE_LINUX_IP_MP_ALG_H */ -+ - #ifdef HAVE_NETDB_H - #include - #endif /* HAVE_NETDB_H */ ---- a/zebra/main.c -+++ b/zebra/main.c -@@ -44,6 +44,7 @@ - struct zebra_t zebrad = - { - .rtm_table_default = 0, -+ .mpath = 0, - }; - - /* process id. */ ---- /dev/null -+++ b/zebra/multipath.h -@@ -0,0 +1,37 @@ -+/* -+ * multipath policy names. -+ * -+ * This file is part of Quagga routing suite. -+ * -+ * Quagga is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2, or (at your option) any -+ * later version. -+ * -+ * Quagga is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GNU Zebra; see the file COPYING. If not, write to the Free -+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -+ * 02111-1307, USA. -+ */ -+ -+#ifndef ZEBRA_MULTIPATH_H -+#define ZEBRA_MULTIPATH_H -+#include -+ -+#ifdef HAVE_LINUX_IP_MP_ALG_H -+ -+static char *mp_alg_names[IP_MP_ALG_MAX+1] = { -+ [IP_MP_ALG_NONE] = "none", -+ [IP_MP_ALG_RR] = "rr", -+ [IP_MP_ALG_DRR] = "drr", -+ [IP_MP_ALG_RANDOM] = "random", -+ [IP_MP_ALG_WRANDOM] = "wrandom" -+ }; -+#endif -+#endif -+ ---- a/zebra/rt_netlink.c -+++ b/zebra/rt_netlink.c -@@ -36,6 +36,7 @@ - #include "thread.h" - #include "privs.h" - -+#include "multipath.h" - #include "zebra/zserv.h" - #include "zebra/rt.h" - #include "zebra/redistribute.h" -@@ -1694,6 +1695,16 @@ netlink_route_multipath (int cmd, struct - if (src) - addattr_l (&req.n, sizeof req, RTA_PREFSRC, &src->ipv4, bytelen); - -+#ifdef HAVE_LINUX_IP_MP_ALG_H -+ if (zebrad.mpath != IP_MP_ALG_NONE) -+ { -+ if (IS_ZEBRA_DEBUG_KERNEL) -+ zlog_debug("netlink_route_multipath() (multihop): " -+ "multipath policy : %s",mp_alg_names[zebrad.mpath]); -+ -+ addattr_l (&req.n, 1024, RTA_MP_ALGO, &zebrad.mpath, sizeof(zebrad.mpath)); -+ } -+#endif - if (rta->rta_len > RTA_LENGTH (0)) - addattr_l (&req.n, 1024, RTA_MULTIPATH, RTA_DATA (rta), - RTA_PAYLOAD (rta)); ---- a/zebra/zserv.c -+++ b/zebra/zserv.c -@@ -36,6 +36,7 @@ - #include "privs.h" - #include "network.h" - #include "buffer.h" -+#include "multipath.h" - - #include "zebra/zserv.h" - #include "zebra/router-id.h" -@@ -1120,6 +1121,9 @@ zebra_client_create (int sock) - /* Set table number. */ - client->rtm_table = zebrad.rtm_table_default; - -+ /* Set multipath policy */ -+ client->mpath = zebrad.mpath; -+ - /* Add this client to linked list. */ - listnode_add (zebrad.client_list, client); - -@@ -1697,6 +1701,91 @@ static struct cmd_node forwarding_node = - }; - - -+#ifdef HAVE_LINUX_IP_MP_ALG_H -+DEFUN (multipath_rr, -+ multipath_rr_cmd, -+ "multipath rr", -+ MULTIPATH_STR -+ "Round Robin multipath policy") -+{ -+ zebrad.mpath=IP_MP_ALG_RR; -+ return CMD_SUCCESS; -+} -+ -+DEFUN (multipath_drr, -+ multipath_drr_cmd, -+ "multipath drr", -+ MULTIPATH_STR -+ "Device round robin multipath policy") -+{ -+ zebrad.mpath=IP_MP_ALG_DRR; -+ return CMD_SUCCESS; -+} -+ -+DEFUN (multipath_random, -+ multipath_random_cmd, -+ "multipath random", -+ MULTIPATH_STR -+ "Random multipath policy") -+{ -+ zebrad.mpath=IP_MP_ALG_RANDOM; -+ return CMD_SUCCESS; -+} -+ -+DEFUN (multipath_wrandom, -+ multipath_wrandom_cmd, -+ "multipath wrandom", -+ MULTIPATH_STR -+ "Weighted random multipath policy") -+{ -+ zebrad.mpath=IP_MP_ALG_WRANDOM; -+ return CMD_SUCCESS; -+} -+ -+DEFUN (no_multipath, -+ no_multipath_cmd, -+ "no multipath", -+ NO_STR -+ MULTIPATH_STR -+ "Remove multipath policy") -+{ -+ zebrad.mpath=IP_MP_ALG_NONE; -+ return CMD_SUCCESS; -+} -+ -+DEFUN (show_multipath, -+ show_multipath_cmd, -+ "show multipath", -+ SHOW_STR -+ "Show multipath policy") -+{ -+ vty_out (vty, "multipath %s%s", mp_alg_names[zebrad.mpath], -+ VTY_NEWLINE); -+ return CMD_SUCCESS; -+} -+ -+/* multipath policy configuration write function. */ -+static int -+config_write_multipath (struct vty *vty) -+{ -+ -+ -+ if (zebrad.mpath) -+ vty_out (vty, "multipath %s%s", mp_alg_names[zebrad.mpath], -+ VTY_NEWLINE); -+ return 0; -+} -+ -+/* table node for multipath policy. */ -+struct cmd_node multipath_node = -+{ -+ MULTIPATH_NODE, -+ "", -+ 1 -+}; -+ -+#endif /* HAVE_LINUX_IP_MP_ALG_H */ -+ - /* Initialisation of zebra and installation of commands. */ - void - zebra_init (void) -@@ -1708,6 +1797,10 @@ zebra_init (void) - install_node (&table_node, config_write_table); - install_node (&forwarding_node, config_write_forwarding); - -+#ifdef HAVE_LINUX_IP_MP_ALG_H -+ install_node (&multipath_node, config_write_multipath); -+#endif -+ - install_element (VIEW_NODE, &show_ip_forwarding_cmd); - install_element (ENABLE_NODE, &show_ip_forwarding_cmd); - install_element (CONFIG_NODE, &ip_forwarding_cmd); -@@ -1718,6 +1811,14 @@ zebra_init (void) - install_element (VIEW_NODE, &show_table_cmd); - install_element (ENABLE_NODE, &show_table_cmd); - install_element (CONFIG_NODE, &config_table_cmd); -+#ifdef HAVE_LINUX_IP_MP_ALG_H -+ install_element (CONFIG_NODE, &multipath_rr_cmd); -+ install_element (CONFIG_NODE, &multipath_drr_cmd); -+ install_element (CONFIG_NODE, &multipath_random_cmd); -+ install_element (CONFIG_NODE, &multipath_wrandom_cmd); -+ install_element (CONFIG_NODE, &no_multipath_cmd); -+ install_element (ENABLE_NODE, &show_multipath_cmd); -+#endif /* HAVE_LINUX_IP_MP_ALG_H */ - #endif /* HAVE_NETLINK */ - - #ifdef HAVE_IPV6 ---- a/zebra/zserv.h -+++ b/zebra/zserv.h -@@ -55,6 +55,9 @@ struct zserv - /* default routing table this client munges */ - int rtm_table; - -+ /* multipath policy */ -+ u_int32_t mpath; -+ - /* This client's redistribute flag. */ - u_char redist[ZEBRA_ROUTE_MAX]; - -@@ -78,6 +81,9 @@ struct zebra_t - /* default table */ - int rtm_table_default; - -+ /* multipath policy */ -+ u_int32_t mpath; -+ - /* rib work queue */ - struct work_queue *ribq; - struct meta_queue *mq; From 15eaab40d840c0ab791131492c00009c66232eff Mon Sep 17 00:00:00 2001 From: acoul Date: Mon, 1 Nov 2010 13:58:39 +0000 Subject: [PATCH 050/117] net/quagga: cosmetic git-svn-id: svn+ssh://svn.openwrt.org/openwrt@23763 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4fe10f4..ab9bc49 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ else PKG_MD5SUM:=37b9022adca04b03863d2d79787e643f endif -PKG_SOURCE:=quagga-$(PKG_VERSION).tar.gz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.quagga.net/download/ \ http://www.de.quagga.net/download/ \ http://www.uk.quagga.net/download/ From ad63a0e00e7c828b1b645272dae1432fac2e2ced Mon Sep 17 00:00:00 2001 From: acoul Date: Tue, 9 Nov 2010 09:07:09 +0000 Subject: [PATCH 051/117] net/quagga: fix an SDK compile issue git-svn-id: svn+ssh://svn.openwrt.org/openwrt@23936 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index ab9bc49..131b5ce 100644 --- a/Makefile +++ b/Makefile @@ -159,7 +159,6 @@ endif define Build/Configure (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \ - autoconf \ ); $(call Build/Configure/Default) endef From f6293f297038e22df4497a4338b4d774f6b65124 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Tue, 9 Nov 2010 09:59:31 +0000 Subject: [PATCH 052/117] [packages] quagga: Fix PKG_CONFIG_DEPENDS on isisd and ripngd (thanks acoul) git-svn-id: svn+ssh://svn.openwrt.org/openwrt@23937 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 131b5ce..6b73d93 100644 --- a/Makefile +++ b/Makefile @@ -10,12 +10,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga ifneq ($(CONFIG_QUAGGA_OLD),) PKG_VERSION:=0.98.6 - PKG_RELEASE:=5 + PKG_RELEASE:=6 PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 PATCH_DIR:=./patches-old else PKG_VERSION:=0.99.17 - PKG_RELEASE:=1 + PKG_RELEASE:=2 PKG_MD5SUM:=37b9022adca04b03863d2d79787e643f endif @@ -26,8 +26,8 @@ PKG_SOURCE_URL:=http://www.quagga.net/download/ \ PKG_CONFIG_DEPENDS:= \ CONFIG_QUAGGA_STABLE \ CONFIG_IPV6 \ - CONFIG_PACKAGE_quagga-unstable-isisd \ - CONFIG_PACKAGE_quagga-unstable-ripngd + CONFIG_PACKAGE_quagga-isisd \ + CONFIG_PACKAGE_quagga-ripngd PKG_BUILD_PARALLEL:=1 PKG_FIXUP:=libtool PKG_INSTALL:=1 From 4b0145b0d8f5cadcd1b5e6149d1b2db292e3edaf Mon Sep 17 00:00:00 2001 From: acoul Date: Fri, 26 Nov 2010 09:30:51 +0000 Subject: [PATCH 053/117] net/quagga: fix some compile issues on SDK git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24147 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6b73d93..bd6e3a8 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,7 @@ endef define Package/quagga-ripngd $(call Package/quagga/Default) - DEPENDS+=+quagga-libzebra @BROKEN + DEPENDS+=+quagga-libzebra @IPV6 TITLE:=RIPNG routing engine endef @@ -287,6 +287,7 @@ define Package/quagga-libzebra/install $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(1)/usr/lib/ endef +ifeq ($(CONFIG_IPV6),y) $(eval $(call BuildPackage,quagga)) $(eval $(call BuildPackage,quagga-libzebra)) $(eval $(call BuildPackage,quagga-libospf)) @@ -297,3 +298,13 @@ $(eval $(call BuildPackage,quagga-ospf6d)) $(eval $(call BuildPackage,quagga-ripd)) $(eval $(call BuildPackage,quagga-ripngd)) $(eval $(call BuildPackage,quagga-vtysh)) +else +$(eval $(call BuildPackage,quagga)) +$(eval $(call BuildPackage,quagga-libzebra)) +$(eval $(call BuildPackage,quagga-libospf)) +$(eval $(call BuildPackage,quagga-bgpd)) +$(eval $(call BuildPackage,quagga-isisd)) +$(eval $(call BuildPackage,quagga-ospfd)) +$(eval $(call BuildPackage,quagga-ripd)) +$(eval $(call BuildPackage,quagga-vtysh)) +endif From fa01cf89706e300ef6ac466a4f628ad34a0dd554 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 26 Nov 2010 22:59:01 +0000 Subject: [PATCH 054/117] Revert "net/quagga: fix some compile issues on SDK" This reverts commit r24147. git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24150 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Makefile b/Makefile index bd6e3a8..6b73d93 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,7 @@ endef define Package/quagga-ripngd $(call Package/quagga/Default) - DEPENDS+=+quagga-libzebra @IPV6 + DEPENDS+=+quagga-libzebra @BROKEN TITLE:=RIPNG routing engine endef @@ -287,7 +287,6 @@ define Package/quagga-libzebra/install $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(1)/usr/lib/ endef -ifeq ($(CONFIG_IPV6),y) $(eval $(call BuildPackage,quagga)) $(eval $(call BuildPackage,quagga-libzebra)) $(eval $(call BuildPackage,quagga-libospf)) @@ -298,13 +297,3 @@ $(eval $(call BuildPackage,quagga-ospf6d)) $(eval $(call BuildPackage,quagga-ripd)) $(eval $(call BuildPackage,quagga-ripngd)) $(eval $(call BuildPackage,quagga-vtysh)) -else -$(eval $(call BuildPackage,quagga)) -$(eval $(call BuildPackage,quagga-libzebra)) -$(eval $(call BuildPackage,quagga-libospf)) -$(eval $(call BuildPackage,quagga-bgpd)) -$(eval $(call BuildPackage,quagga-isisd)) -$(eval $(call BuildPackage,quagga-ospfd)) -$(eval $(call BuildPackage,quagga-ripd)) -$(eval $(call BuildPackage,quagga-vtysh)) -endif From dfa8d3ee4030b9c3fffceeabaa2158ed0c0bfd3d Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 26 Nov 2010 23:03:20 +0000 Subject: [PATCH 055/117] [packages] quagga: Move package config in Makefile git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24151 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6b73d93..b947c97 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ PKG_SOURCE_URL:=http://www.quagga.net/download/ \ http://www.de.quagga.net/download/ \ http://www.uk.quagga.net/download/ PKG_CONFIG_DEPENDS:= \ - CONFIG_QUAGGA_STABLE \ + CONFIG_QUAGGA_OLD \ CONFIG_IPV6 \ CONFIG_PACKAGE_quagga-isisd \ CONFIG_PACKAGE_quagga-ripngd @@ -56,7 +56,12 @@ define Package/quagga/description endef define Package/quagga/config - source "$(SOURCE)/Config.in" +config QUAGGA_OLD + depends on (PACKAGE_quagga && BROKEN) + default n + bool "Use the old release version 0.98.6" + help + This option allows you to select the old version of Quagga to be built. endef define Package/quagga-libzebra From cdba79cd00313fc7dbe48208f095409dadaa87be Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 26 Nov 2010 23:05:47 +0000 Subject: [PATCH 056/117] [packages] quagga: Build daemons of selected packages only git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24152 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index b947c97..d3cb914 100644 --- a/Makefile +++ b/Makefile @@ -10,12 +10,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga ifneq ($(CONFIG_QUAGGA_OLD),) PKG_VERSION:=0.98.6 - PKG_RELEASE:=6 + PKG_RELEASE:=7 PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 PATCH_DIR:=./patches-old else PKG_VERSION:=0.99.17 - PKG_RELEASE:=2 + PKG_RELEASE:=3 PKG_MD5SUM:=37b9022adca04b03863d2d79787e643f endif @@ -26,8 +26,14 @@ PKG_SOURCE_URL:=http://www.quagga.net/download/ \ PKG_CONFIG_DEPENDS:= \ CONFIG_QUAGGA_OLD \ CONFIG_IPV6 \ + CONFIG_PACKAGE_quagga-libzebra \ + CONFIG_PACKAGE_quagga-libospf \ + CONFIG_PACKAGE_quagga-bgpd \ CONFIG_PACKAGE_quagga-isisd \ - CONFIG_PACKAGE_quagga-ripngd + CONFIG_PACKAGE_quagga-ospf6d \ + CONFIG_PACKAGE_quagga-ripd \ + CONFIG_PACKAGE_quagga-ripngd \ + CONFIG_PACKAGE_quagga-vtysh PKG_BUILD_PARALLEL:=1 PKG_FIXUP:=libtool PKG_INSTALL:=1 @@ -148,19 +154,18 @@ CONFIGURE_ARGS+= \ --sysconfdir=/etc/quagga/ \ --enable-shared \ --disable-static \ - --enable-vtysh \ --enable-user=quagga \ --enable-group=quagga \ --enable-pie=no \ --enable-multipath=8 \ - -ifneq ($(CONFIG_PACKAGE_quagga-isisd),) - CONFIGURE_ARGS+= --enable-isisd -endif - -ifneq ($(CONFIG_PACKAGE_quagga-ripngd),) - CONFIGURE_ARGS+= --enable-ripngd -endif + $(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-vtysh,vtysh) \ define Build/Configure (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \ From d3e10201cea2e3db611883544354f800154772cb Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 26 Nov 2010 23:08:18 +0000 Subject: [PATCH 057/117] [packages] quagga: Enable building of all daemons in SDK git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24153 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Makefile b/Makefile index d3cb914..142b9f5 100644 --- a/Makefile +++ b/Makefile @@ -149,6 +149,17 @@ define Package/quagga-ripngd/conffiles /etc/quagga/ripngd.conf endef +ifneq ($(SDK),) +CONFIG_PACKAGE_quagga-libzebra:=m +CONFIG_PACKAGE_quagga-libospf:=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-vtysh:=m +endif + CONFIGURE_ARGS+= \ --localstatedir=/var/run/quagga \ --sysconfdir=/etc/quagga/ \ From 9ebe67c4cf8a1409228c6ec5a907e03003fde9b1 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 26 Nov 2010 23:09:56 +0000 Subject: [PATCH 058/117] [packages] quagga: Generate configuration script git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24154 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 142b9f5..fffc206 100644 --- a/Makefile +++ b/Makefile @@ -180,6 +180,7 @@ CONFIGURE_ARGS+= \ define Build/Configure (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \ + autoconf \ ); $(call Build/Configure/Default) endef From 3bc9bdd4aecd40a03b1d3cb2a1345de71bfe2ba2 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 26 Nov 2010 23:11:28 +0000 Subject: [PATCH 059/117] [packages] quagga: Remove broken flag from ripngd and add IPv6 dependency git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24155 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fffc206..051177f 100644 --- a/Makefile +++ b/Makefile @@ -10,12 +10,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga ifneq ($(CONFIG_QUAGGA_OLD),) PKG_VERSION:=0.98.6 - PKG_RELEASE:=7 + PKG_RELEASE:=8 PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 PATCH_DIR:=./patches-old else PKG_VERSION:=0.99.17 - PKG_RELEASE:=3 + PKG_RELEASE:=4 PKG_MD5SUM:=37b9022adca04b03863d2d79787e643f endif @@ -111,7 +111,7 @@ endef define Package/quagga-ripngd $(call Package/quagga/Default) - DEPENDS+=+quagga-libzebra @BROKEN + DEPENDS+=+quagga-libzebra @IPV6 TITLE:=RIPNG routing engine endef From 4b9deaf86276cf3f6d8517e4d18c64fe0248b8b9 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Sat, 27 Nov 2010 08:34:29 +0000 Subject: [PATCH 060/117] [packages] quagga: Remove 'Config.in' file - not used since r24151 git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24156 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Config.in | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 Config.in diff --git a/Config.in b/Config.in deleted file mode 100644 index 7f29e3d..0000000 --- a/Config.in +++ /dev/null @@ -1,17 +0,0 @@ -# Quagga configuration - -choice - prompt "Quagga version" - depends on PACKAGE_quagga - default QUAGGA_STABLE - help - This option allows you to select the version of Quagga to be built. - -config QUAGGA_STABLE - bool "Use the latest stable version of Quagga" - -config QUAGGA_OLD - depends BROKEN - bool "Use the old release version 0.98.6" - -endchoice From 1959349c4f55fe237a814112080e763dbbec999c Mon Sep 17 00:00:00 2001 From: acoul Date: Tue, 7 Dec 2010 17:44:19 +0000 Subject: [PATCH 061/117] net/quagga: fix uClibc-0.9.32/pthreads issues, refresh patches git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24311 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 7 +- patches/000-upstream-afi_t_safi_t.patch | 161 ++++++++++++++++++++++++ patches/000-upstream-bogus_cond.patch | 2 +- patches/000-upstream-clock_fix.patch | 7 +- patches/000-upstream-set_null.patch | 2 +- patches/001-fix_ipctl_forwarding.patch | 12 +- 6 files changed, 175 insertions(+), 16 deletions(-) create mode 100644 patches/000-upstream-afi_t_safi_t.patch diff --git a/Makefile b/Makefile index 051177f..59c11a6 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ ifneq ($(CONFIG_QUAGGA_OLD),) PATCH_DIR:=./patches-old else PKG_VERSION:=0.99.17 - PKG_RELEASE:=4 + PKG_RELEASE:=5 PKG_MD5SUM:=37b9022adca04b03863d2d79787e643f endif @@ -160,6 +160,8 @@ CONFIG_PACKAGE_quagga-ripngd:=m CONFIG_PACKAGE_quagga-vtysh:=m endif +TARGET_LDFLAGS += -lpthread + CONFIGURE_ARGS+= \ --localstatedir=/var/run/quagga \ --sysconfdir=/etc/quagga/ \ @@ -178,6 +180,9 @@ CONFIGURE_ARGS+= \ $(call autoconf_bool,CONFIG_PACKAGE_quagga-ripngd,ripngd) \ $(call autoconf_bool,CONFIG_PACKAGE_quagga-vtysh,vtysh) \ +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE" + define Build/Configure (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \ autoconf \ diff --git a/patches/000-upstream-afi_t_safi_t.patch b/patches/000-upstream-afi_t_safi_t.patch new file mode 100644 index 0000000..eb2e1a7 --- /dev/null +++ b/patches/000-upstream-afi_t_safi_t.patch @@ -0,0 +1,161 @@ +From 4c9641ba4df276080c670e03f65b1d442660a50f Mon Sep 17 00:00:00 2001 +From: Michael Lambert +Date: Thu, 22 Jul 2010 13:20:55 -0400 +Subject: [PATCH] bgpd, lib: adopt afi_t and safi_t in several places + +* bgpd/bgp_attr.c, bgpd/bgp_open.h, bgpd/bgp_route.c, lib/prefix.c, + lib/prefix.h: Various integer types were being used where, if we + had strict type checking, afi_t and safi_t would be required. + +Signed-off-by: G.Balaji +(cherry picked from commit c8af35ffa2dc79ff7d7ff00b1b61f1f50a100ab6) +--- + bgpd/bgp_attr.c | 8 ++++---- + bgpd/bgp_open.h | 8 ++++---- + bgpd/bgp_route.c | 16 ++++++++-------- + lib/prefix.c | 4 ++-- + lib/prefix.h | 4 ++-- + 5 files changed, 20 insertions(+), 20 deletions(-) + +--- a/bgpd/bgp_attr.c ++++ b/bgpd/bgp_attr.c +@@ -1301,8 +1301,8 @@ int + bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr, + struct bgp_nlri *mp_update) + { +- u_int16_t afi; +- u_char safi; ++ afi_t afi; ++ safi_t safi; + bgp_size_t nlri_len; + size_t start; + int ret; +@@ -1436,8 +1436,8 @@ bgp_mp_unreach_parse (struct peer *peer, + struct bgp_nlri *mp_withdraw) + { + struct stream *s; +- u_int16_t afi; +- u_char safi; ++ afi_t afi; ++ safi_t safi; + u_int16_t withdraw_len; + int ret; + +--- a/bgpd/bgp_open.h ++++ b/bgpd/bgp_open.h +@@ -31,9 +31,9 @@ struct capability_header + /* Generic MP capability data */ + struct capability_mp_data + { +- u_int16_t afi; ++ afi_t afi; + u_char reserved; +- u_char safi; ++ safi_t safi; + }; + + #pragma pack(1) +@@ -55,8 +55,8 @@ struct capability_as4 + + struct graceful_restart_af + { +- u_int16_t afi; +- u_char safi; ++ afi_t afi; ++ safi_t safi; + u_char flag; + }; + +--- a/bgpd/bgp_route.c ++++ b/bgpd/bgp_route.c +@@ -3518,8 +3518,8 @@ bgp_static_update (struct bgp *bgp, stru + } + + static void +-bgp_static_update_vpnv4 (struct bgp *bgp, struct prefix *p, u_int16_t afi, +- u_char safi, struct prefix_rd *prd, u_char *tag) ++bgp_static_update_vpnv4 (struct bgp *bgp, struct prefix *p, afi_t afi, ++ safi_t safi, struct prefix_rd *prd, u_char *tag) + { + struct bgp_node *rn; + struct bgp_info *new; +@@ -3599,8 +3599,8 @@ bgp_check_local_routes_rsclient (struct + } + + static void +-bgp_static_withdraw_vpnv4 (struct bgp *bgp, struct prefix *p, u_int16_t afi, +- u_char safi, struct prefix_rd *prd, u_char *tag) ++bgp_static_withdraw_vpnv4 (struct bgp *bgp, struct prefix *p, afi_t afi, ++ safi_t safi, struct prefix_rd *prd, u_char *tag) + { + struct bgp_node *rn; + struct bgp_info *ri; +@@ -3653,7 +3653,7 @@ bgp_pathlimit_update_parents (struct bgp + route should be installed as valid. */ + static int + bgp_static_set (struct vty *vty, struct bgp *bgp, const char *ip_str, +- u_int16_t afi, u_char safi, const char *rmap, int backdoor, ++ afi_t afi, safi_t safi, const char *rmap, int backdoor, + u_char ttl) + { + int ret; +@@ -3798,7 +3798,7 @@ bgp_static_set (struct vty *vty, struct + /* Configure static BGP network. */ + static int + bgp_static_unset (struct vty *vty, struct bgp *bgp, const char *ip_str, +- u_int16_t afi, u_char safi) ++ afi_t afi, safi_t safi) + { + int ret; + struct prefix p; +@@ -7622,7 +7622,7 @@ DEFUN (show_ipv6_mbgp_community_all, + + static int + bgp_show_community (struct vty *vty, int argc, const char **argv, int exact, +- u_int16_t afi, u_char safi) ++ afi_t afi, safi_t safi) + { + struct community *com; + struct buffer *b; +@@ -8622,7 +8622,7 @@ ALIAS (show_ipv6_mbgp_community_exact, + + static int + bgp_show_community_list (struct vty *vty, const char *com, int exact, +- u_int16_t afi, u_char safi) ++ afi_t afi, safi_t safi) + { + struct community_list *list; + +--- a/lib/prefix.c ++++ b/lib/prefix.c +@@ -41,7 +41,7 @@ static const u_char maskbit[] = {0x00, 0 + + /* Address Famiy Identifier to Address Family converter. */ + int +-afi2family (int afi) ++afi2family (afi_t afi) + { + if (afi == AFI_IP) + return AF_INET; +@@ -52,7 +52,7 @@ afi2family (int afi) + return 0; + } + +-int ++afi_t + family2afi (int family) + { + if (family == AF_INET) +--- a/lib/prefix.h ++++ b/lib/prefix.h +@@ -144,8 +144,8 @@ prefix6_bit (const struct in6_addr *pref + } + + /* Prototypes. */ +-extern int afi2family (int); +-extern int family2afi (int); ++extern int afi2family (afi_t); ++extern afi_t family2afi (int); + + extern struct prefix *prefix_new (void); + extern void prefix_free (struct prefix *); diff --git a/patches/000-upstream-bogus_cond.patch b/patches/000-upstream-bogus_cond.patch index c35ffdb..eddf5c4 100644 --- a/patches/000-upstream-bogus_cond.patch +++ b/patches/000-upstream-bogus_cond.patch @@ -1,6 +1,6 @@ --- a/zebra/zserv.c +++ b/zebra/zserv.c -@@ -451,7 +451,7 @@ zsend_route_multipath (int cmd, struct zserv *client, struct prefix *p, +@@ -451,7 +451,7 @@ zsend_route_multipath (int cmd, struct z } /* Metric */ diff --git a/patches/000-upstream-clock_fix.patch b/patches/000-upstream-clock_fix.patch index 58fea85..f2d7db6 100644 --- a/patches/000-upstream-clock_fix.patch +++ b/patches/000-upstream-clock_fix.patch @@ -10,11 +10,9 @@ Subject: [PATCH] bgpd: fix printed value of last-update timestamp bgpd/bgp_route.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) -diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c -index 2391f74..1cfc451 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c -@@ -6145,7 +6145,8 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p, +@@ -6145,7 +6145,8 @@ route_vty_out_detail (struct vty *vty, s bgp_damp_info_vty (vty, binfo); /* Line 7 display Uptime */ @@ -24,6 +22,3 @@ index 2391f74..1cfc451 100644 } vty_out (vty, "%s", VTY_NEWLINE); } --- -1.7.2.3 - diff --git a/patches/000-upstream-set_null.patch b/patches/000-upstream-set_null.patch index 3d0eaeb..7ba1019 100644 --- a/patches/000-upstream-set_null.patch +++ b/patches/000-upstream-set_null.patch @@ -1,6 +1,6 @@ --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c -@@ -177,10 +177,11 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi) +@@ -177,10 +177,11 @@ bgp_update_packet (struct peer *peer, af if (rn->prn) prd = (struct prefix_rd *) &rn->prn->p; diff --git a/patches/001-fix_ipctl_forwarding.patch b/patches/001-fix_ipctl_forwarding.patch index e9a9864..d757312 100644 --- a/patches/001-fix_ipctl_forwarding.patch +++ b/patches/001-fix_ipctl_forwarding.patch @@ -5,14 +5,12 @@ http://svn.gnumonks.org/trunk/grouter/build/src/quagga/quagga/quagga-0.99.1-forw Signed-off-by: Thomas Petazzoni -Index: quagga-0.99.16/zebra/ipforward_sysctl.c -=================================================================== ---- quagga-0.99.16.orig/zebra/ipforward_sysctl.c 2010-06-20 23:40:45.000000000 +0200 -+++ quagga-0.99.16/zebra/ipforward_sysctl.c 2010-06-20 23:41:37.000000000 +0200 +--- a/zebra/ipforward_sysctl.c ++++ b/zebra/ipforward_sysctl.c @@ -31,6 +31,15 @@ - + #define MIB_SIZ 4 - + +/* Fix for recent (2.6.14) kernel headers */ +#ifndef IPCTL_FORWARDING +#define IPCTL_FORWARDING NET_IPV4_FORWARD @@ -23,5 +21,5 @@ Index: quagga-0.99.16/zebra/ipforward_sysctl.c +#endif + extern struct zebra_privs_t zserv_privs; - + /* IPv4 forwarding control MIB. */ From 8702b0604fc104b033421e64f28fdc296808c46c Mon Sep 17 00:00:00 2001 From: acoul Date: Thu, 16 Dec 2010 17:22:50 +0000 Subject: [PATCH 062/117] net/quagga: "Intern" communities in route maps git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24622 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...083-Intern_communities_in_route_maps.patch | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 patches/999-PW-8083-Intern_communities_in_route_maps.patch diff --git a/patches/999-PW-8083-Intern_communities_in_route_maps.patch b/patches/999-PW-8083-Intern_communities_in_route_maps.patch new file mode 100644 index 0000000..dde6f2b --- /dev/null +++ b/patches/999-PW-8083-Intern_communities_in_route_maps.patch @@ -0,0 +1,91 @@ +From patchwork Sat Jul 24 16:44:07 2010 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [quagga-dev,8083,3/3] bgpd: "Intern" communities in route maps +Date: Sat, 24 Jul 2010 15:44:07 -0000 +From: Michael Lambert +X-Patchwork-Id: 253 +Message-Id: <201007241836.o6OIa8gR023592@tesla.psc.edu> +To: quagga-dev@lists.quagga.net + +* bgp_community.[ch]: (community_lookup) New helper function to look + up a community list in the hash table. + +* bgp_routemap.c: A new community structure was being allocated for + every BGP update which matched a route map which set a community. + This behavior led to rapid growth in the memory consumed by bgpd. + Adding the communities to the hash table addresses the memory + growth, but may introduce a problem in modifying or deleting the + 'set community' statement in the route map. + +--- +bgpd/bgp_community.c | 7 +++++++ + bgpd/bgp_community.h | 1 + + bgpd/bgp_routemap.c | 8 +++++--- + 3 files changed, 13 insertions(+), 3 deletions(-) + +--- a/bgpd/bgp_community.c ++++ b/bgpd/bgp_community.c +@@ -292,6 +292,13 @@ community_com2str (struct community *co + return str; + } + ++/* Find an 'intern'ed community structure */ ++struct community * ++community_lookup (struct community *com) ++{ ++ return (struct community *) hash_lookup (comhash, com); ++} ++ + /* Intern communities attribute. */ + struct community * + community_intern (struct community *com) +--- a/bgpd/bgp_community.h ++++ b/bgpd/bgp_community.h +@@ -70,5 +70,6 @@ extern int community_include (struct com + extern void community_del_val (struct community *, u_int32_t *); + extern unsigned long community_count (void); + extern struct hash *community_hash (void); ++extern struct community *community_lookup (struct community *); + + #endif /* _QUAGGA_BGP_COMMUNITY_H */ +--- a/bgpd/bgp_routemap.c ++++ b/bgpd/bgp_routemap.c +@@ -1389,7 +1389,7 @@ route_set_community (void *rule, struct + new = community_dup (rcs->com); + + /* will be interned by caller if required */ +- attr->community = new; ++ attr->community = community_intern (new); + + attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES); + } +@@ -1403,6 +1403,7 @@ route_set_community_compile (const char + { + struct rmap_com_set *rcs; + struct community *com = NULL; ++ struct community *comint; + char *sp; + int additive = 0; + int none = 0; +@@ -1429,8 +1430,9 @@ route_set_community_compile (const char + return NULL; + } + ++ comint = community_intern (com); + rcs = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct rmap_com_set)); +- rcs->com = com; ++ rcs->com = comint; + rcs->additive = additive; + rcs->none = none; + +@@ -1493,7 +1495,7 @@ route_set_community_delete (void *rule, + } + else + { +- binfo->attr->community = new; ++ binfo->attr->community = community_intern (new); + binfo->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES); + } + } From b598c4971a77dee227d814706a772576f082125e Mon Sep 17 00:00:00 2001 From: acoul Date: Thu, 16 Dec 2010 17:23:58 +0000 Subject: [PATCH 063/117] net/quagga: fix memory leak when deleting a community git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24623 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../999-PW-8261-memleak_del_community.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 patches/999-PW-8261-memleak_del_community.patch diff --git a/patches/999-PW-8261-memleak_del_community.patch b/patches/999-PW-8261-memleak_del_community.patch new file mode 100644 index 0000000..662fe8f --- /dev/null +++ b/patches/999-PW-8261-memleak_del_community.patch @@ -0,0 +1,37 @@ +From patchwork Mon Sep 13 15:48:11 2010 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [quagga-dev,8261] bgpd: fix memory leak when deleting a community +Date: Mon, 13 Sep 2010 14:48:11 -0000 +From: Michael Lambert +X-Patchwork-Id: 281 +Message-Id: <20100913171959.5276EAAAC32@ebola.psc.edu> +To: quagga-dev@lists.quagga.net +Cc: lambert@psc.edu + +* bgp_routemap.c: (route_set_community_delete) When deleting a + community in a route-map the old community was being orphaned. Like + the description of the same code in route_set_community, this is a + hack, not a true fix. + +--- +bgpd/bgp_routemap.c | 7 +++++++ + 1 files changed, 7 insertions(+), 0 deletions(-) + +--- a/bgpd/bgp_routemap.c ++++ b/bgpd/bgp_routemap.c +@@ -1487,6 +1487,13 @@ route_set_community_delete (void *rule, + new = community_uniq_sort (merge); + community_free (merge); + ++ /* HACK: if the old community is not intern'd, ++ * we should free it here, or all reference to it may be lost. ++ * Really need to cleanup attribute caching sometime. ++ */ ++ if (old->refcnt == 0) ++ community_free (old); ++ + if (new->size == 0) + { + binfo->attr->community = NULL; From acce75dd3a5a910dee8b879d62b3c5918c0e7291 Mon Sep 17 00:00:00 2001 From: acoul Date: Tue, 21 Dec 2010 11:47:31 +0000 Subject: [PATCH 064/117] net/quagga: fix a dependency issue (thank you acinonyx) git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24747 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 59c11a6..9ad6ceb 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ include $(INCLUDE_DIR)/package.mk define Package/quagga/Default SECTION:=net CATEGORY:=Network - DEPENDS:=quagga + DEPENDS:=quagga +libpthread TITLE:=The Quagga Software Routing Suite URL:=http://www.quagga.net MAINTAINER:=Vasilis Tsiligiannis From d217d8b563d2017cdd05736641ea5333b92d0d8b Mon Sep 17 00:00:00 2001 From: acoul Date: Mon, 10 Jan 2011 12:58:09 +0000 Subject: [PATCH 065/117] net/quagga: add Pretty Good BGP patches: http://www.cs.unm.edu/~karlinjf/pgbgp/ git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24957 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/160-pgbgp.patch | 3097 +++++++++++++++++++++++++++++++++ patches/161-pgbgp-addon.patch | 317 ++++ 2 files changed, 3414 insertions(+) create mode 100644 patches/160-pgbgp.patch create mode 100644 patches/161-pgbgp-addon.patch diff --git a/patches/160-pgbgp.patch b/patches/160-pgbgp.patch new file mode 100644 index 0000000..f29ffdc --- /dev/null +++ b/patches/160-pgbgp.patch @@ -0,0 +1,3097 @@ +From: Josh Karlin +Date: Mon, 18 Aug 2008 13:17:21 +0000 (+0100) +Subject: [bgp] Add support for Pretty-Good BGP +X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705cad607f4b86ff143f7af92d538dc946 + +[bgp] Add support for Pretty-Good BGP + +2008-7-7 Josh Karlin + + * bgpd/bgp_pgbgp.c: Added file + * bgpd/bgp_pgbgp.h: Added file + * bgpd/Makefile.am: Added bgp_pgbgp.h and bgp_pgbgp.c + * bgpd/bgp_aspath.h: Externed the hash of as paths (ashash) + * bgpd/bgp_route.c: . Added PGBGP depref check to decision process. + . Informs PGBGP of new updates and selected routes + . Added anomaly status for show ip bgp + . Added PGBGP commands + * bgpd/bgp_route.h: Added suspicious route flags + * bgpd/bgp_table.h: Added PGBGP history pointer to struct bgp_node + * bgpd/bgpd.h: Defined BGP_CONFIG_PGBGP + * lib/hash.c: Added "hash_iterate_until" to be able to break out + * lib/hash.h: Definition for "hash_iterate_until" + * lib/memtypes.c: Added PGBGP memory types +--- + +--- a/bgpd/Makefile.am ++++ b/bgpd/Makefile.am +@@ -15,14 +15,14 @@ libbgp_a_SOURCES = \ + bgp_debug.c bgp_route.c bgp_zebra.c bgp_open.c bgp_routemap.c \ + bgp_packet.c bgp_network.c bgp_filter.c bgp_regex.c bgp_clist.c \ + bgp_dump.c bgp_snmp.c bgp_ecommunity.c bgp_mplsvpn.c bgp_nexthop.c \ +- bgp_damp.c bgp_table.c bgp_advertise.c bgp_vty.c ++ bgp_damp.c bgp_table.c bgp_advertise.c bgp_vty.c bgp_pgbgp.c + + noinst_HEADERS = \ + bgp_aspath.h bgp_attr.h bgp_community.h bgp_debug.h bgp_fsm.h \ + bgp_network.h bgp_open.h bgp_packet.h bgp_regex.h bgp_route.h \ + bgpd.h bgp_filter.h bgp_clist.h bgp_dump.h bgp_zebra.h \ + bgp_ecommunity.h bgp_mplsvpn.h bgp_nexthop.h bgp_damp.h bgp_table.h \ +- bgp_advertise.h bgp_snmp.h bgp_vty.h ++ bgp_advertise.h bgp_snmp.h bgp_vty.h bgp_pgbgp.h + + bgpd_SOURCES = bgp_main.c + bgpd_LDADD = libbgp.a ../lib/libzebra.la @LIBCAP@ @LIBM@ +--- /dev/null ++++ b/bgpd/bgp_pgbgp.c +@@ -0,0 +1,2401 @@ ++/* ++ BGP Pretty Good BGP ++ Copyright (C) 2008 University of New Mexico (Josh Karlin) ++ ++This file is part of GNU Zebra. ++ ++GNU Zebra is free software; you can redistribute it and/or modify it ++under the terms of the GNU General Public License as published by the ++Free Software Foundation; either version 2, or (at your option) any ++later version. ++ ++GNU Zebra is distributed in the hope that it will be useful, but ++WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GNU Zebra; see the file COPYING. If not, write to the Free ++Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ++02111-1307, USA. ++*/ ++ ++/* ++ Quagga based Pretty Good BGP: ++ ++ Summary ++ ------- ++ Pretty Good BGP (PGBGP) is a soft security enhancement to BGP. ++ It uses independently collected (therefore completely distributed) ++ historical routing information to determine network topology and ++ prefix ownership. Abberations to the historical database are considered ++ anomalous and avoided when possible. ++ ++ What PGBGP can protect against: prefix hijacks, sub-prefix hijacks, and ++ spoofed edges. ++ ++ Further reading is available at http://cs.unm.edu/~karlinjf/pgbgp/ ++ ++ Route updates are forwarded to PGBGP, which determines if the route ++ is anomalous. Anomalous routes are flagged as suspicious and ++ avoided where feasible for 24 hours. If the anomalous ++ characteristic is still in the RIB after 24 hours, consider it valid ++ and enter it into the normal database. ++ ++ Cases for anomalous routes ++ -------------------------- ++ case 1) New origin AS - prefix pair (one not recently seen in the RIB): ++ response) label the route with BGP_INFO_SUSPICIOUS_O and avoid for 24 hours if possible ++ ++ case 2) New edge in path (one not recently seen in the RIB): ++ response) label the route with BGP_INFO_SUSPICIOUS_E and avoid for 24 hours ++ if possible ++ ++ case 3) New prefix that is a sub-prefix of a prefix in recent history ++ and that path differs from the current less-specific's path ++ response) label the sub-prefix routes with BGP_INFO_IGNORED_P and ++ prevent it from entering FIB for 24 hours ++ response) label the super-net routes from the same next-hop as BGP_INFO_SUSPICIOUS_P ++ and try to avoid it for 24 hours if possible ++ response) while no super-net route is selected, remove the BGP_INFO_IGNORED_P flags ++ ++ ++ Normal Database (history) ++ ------------------------- ++ Recently Seen) A route characteristic (edge, prefix/origin pair, prefix) ++ that has resided within the RIB within the last X hours ++ where X is user defined for each characteristic. ++ Storage) Prefix and Origin history are stored in bgp_node structs with the ++ "hist" pointer. ++ Edge information is stored in a separate hash table, where the edge ++ is the key to the hash. ++ Updates) The history's primary function is the keep track of when each route ++ characteristic was last seen. For each route announcement, update ++ the history's 'last seen' time. Periodically run the garbage collector ++ which updates 'last seen' times for objects currently in the RIB. ++ ++ Garbage Collection ++ ------------------ ++ Periodically the garbage collector (gc) is called to remove stale history ++ information and update the lastSeen time of objects that reside in the RIB ++ at the time of collection. This is relatively expensive as it walks ++ the RIB as well as the list of AS paths. ++ ++ What is removed) Objects that have not been seen in the RIB within a user-defined ++ time. ++ Suspicious objcets that are 24 hours old that have not been in the RIB ++ since the last collection. ++ ++ Reuse Priority Queue ++ -------------------- ++ After 24 hours, routes that are flagged as suspicious have the flags removed. ++ This is not run on a timer. Instead, for each update that PGBGP is informed of, ++ it checks the reuse queue to determine if any routes need to be updated. ++ ++*/ ++ ++ ++/* ++ Things that must be ensured: ++ . GC updates lastSeen so it must be called at least twice as often as the lowest BUFFER_TIME ++ . GC should be called at least twice per day ++ . Delay times must be shorter than history window lengths ++*/ ++ ++ ++/* ++ Changes made to original PGBGP thinking ++ . Don't check for things in the RIB all of the time, periodically ++ update the lastSeen values and just use lastSeen ++*/ ++ ++/* ++ Changes made to original protocol ++ . sub-prefixes are only ignored while the super-net has a selected ++ route and it's non-anomalous (not to a neighbor that announced ++ the sub-prefix) ++ ++ . At point of reuse, don't delete the item if it's not in the RIB. ++ delete it if it hasn't been in the RIB since the last storage. ++ This saves a lot of processing time for new edges ++ ++ . Changed heuristic from "if new sub-prefix and trusted AS on path ++ then it's okay" to "if new sub-prefix and same path is used to reach ++ super-prefix, then it's okay". Might be better to change to "if old ++ path is prefix of new path, then okay" ++*/ ++ ++#include ++#include ++ ++#include "prefix.h" ++#include "memory.h" ++#include "command.h" ++#include "log.h" ++#include "pqueue.h" ++#include "table.h" ++#include "hash.h" ++#include "str.h" ++ ++#include "bgpd/bgpd.h" ++#include "bgpd/bgp_aspath.h" ++#include "bgpd/bgp_pgbgp.h" ++#include "bgpd/bgp_table.h" ++#include "bgpd/bgp_route.h" ++#include "bgpd/bgp_attr.h" ++#include "bgpd/bgp_advertise.h" ++ ++ ++#define true 1 ++#define false 0 ++ ++struct hash * ashash; ++ ++static void *edge_hash_alloc (void *arg); ++static unsigned int edge_key_make (void *p); ++static int edge_cmp (const void *arg1, const void *args); ++ ++// Helper Functions ++static struct bgp_pgbgp_pathSet bgp_pgbgp_pathOrigin (struct aspath *); ++static int bgp_pgbgp_pathLength (struct aspath *asp); ++static int bgp_pgbgp_gc (struct bgp_table *); ++static int bgp_pgbgp_clean (struct bgp_table *); ++static int bgp_pgbgp_reuse (time_t); ++static struct bgp_node *findSuper (struct bgp_table *table, struct prefix *p, ++ time_t t_now); ++static int bgp_pgbgp_store (struct bgp_table *table); ++static int bgp_pgbgp_restore (void); ++static struct bgp_info *bgp_pgbgp_selected (struct bgp_node *node); ++static int originInRIB (struct bgp_node *node, struct bgp_pgbgp_origin *origin); ++static int prefixInRIB (struct bgp_node *node, struct bgp_pgbgp_prefix *prefix); ++static int edgeInRIB (struct bgp_pgbgp_edge *e); ++ ++// MOAS Functions ++static void bgp_pgbgp_logOriginAnomaly (as_t asn, struct bgp_node *rn, ++ struct attr *); ++static int bgp_pgbgp_reuseOrigin (struct bgp_pgbgp_r_origin); ++static void bgp_pgbgp_cleanHistTable (struct bgp_table *); ++static int bgp_pgbgp_garbageCollectHistTable (struct bgp_table *); ++static void bgp_pgbgp_storeHistTable (struct bgp_table *table, FILE * file); ++static int bgp_pgbgp_updateOrigin (struct bgp_pgbgp_hist *, struct bgp_info *, ++ struct attr *, struct bgp_node *, time_t, int); ++ ++ ++// Sub-Prefix Hijack Detector Functions ++static int bgp_pgbgp_shouldIgnore (struct bgp_node *super, struct bgp_info *selected); ++static void bgp_pgbgp_logSubprefixAnomaly (as_t asn, struct bgp_node *rn, ++ struct attr *, struct bgp_node *super); ++static int bgp_pgbgp_reusePrefix (struct bgp_pgbgp_r_prefix); ++static int bgp_pgbgp_updatePrefix (struct bgp_pgbgp_hist *hist, struct bgp_node *, ++ struct bgp_info *, struct attr *, ++ struct bgp_node *, time_t, int); ++ ++ ++// Spoofed Edge Detector Functions ++static void bgp_pgbgp_cleanEdges (void); ++static void bgp_pgbgp_logEdgeAnomaly (struct bgp_node *rn, struct attr *, ++ struct edge *edge); ++static int bgp_pgbgp_reuseEdge (struct bgp_pgbgp_r_edge); ++static void bgp_pgbgp_storeEdges (struct bgp_table *, FILE *); ++static int bgp_pgbgp_garbageCollectEdges (struct bgp_table *); ++static int bgp_pgbgp_updateEdge (struct bgp_pgbgp_hist *hist, struct bgp_info *, ++ struct attr *, struct bgp_node *, time_t, int); ++static int bgp_pgbgp_restoreEdge (FILE * file); ++static void bgp_pgbgp_storeEdges (struct bgp_table *table, FILE * file); ++ ++ ++ ++// New Peer Detector Functions ++static int bgp_pgbgp_updatePeer (struct bgp_info *binfo, time_t now); ++ ++ ++/* --------------- Global Variables ------------------ */ ++struct bgp_pgbgp_config bgp_pgbgp_cfg; ++struct bgp_pgbgp_config *pgbgp = &bgp_pgbgp_cfg; ++/*! --------------- Global Variables ------------------ !*/ ++ ++/* --------------- VTY (others exist in bgp_route.c) ------------------ */ ++ ++struct nsearch ++{ ++ struct vty *pvty; ++ time_t time; ++ as_t asn; ++}; ++ ++static void ++edge_neighbor_iterator (struct hash_backet *backet, struct nsearch *pns) ++{ ++ struct bgp_pgbgp_edge *hedge = backet->data; ++ if ((hedge->e.a == pns->asn || hedge->e.b == pns->asn) ++ && hedge->e.a != hedge->e.b) ++ { ++ struct vty *vty = pns->pvty; ++ if (hedge->deprefUntil > pns->time) ++ vty_out (pns->pvty, "Untrusted: %d -- %d%s", hedge->e.a, hedge->e.b, ++ VTY_NEWLINE); ++ else ++ vty_out (pns->pvty, "Trusted: %d -- %d%s", hedge->e.a, hedge->e.b, ++ VTY_NEWLINE); ++ } ++} ++ ++static int ++bgp_pgbgp_stats_neighbors (struct vty *vty, afi_t afi, safi_t safi, as_t asn) ++{ ++ struct nsearch ns; ++ ns.pvty = vty; ++ ns.time = time (NULL); ++ ns.asn = asn; ++ ++ hash_iterate (pgbgp->edgeT, ++ (void (*)(struct hash_backet *, void *)) ++ edge_neighbor_iterator, &ns); ++ return CMD_SUCCESS; ++} ++ ++static int ++bgp_pgbgp_stats_origins (struct vty *vty, afi_t afi, safi_t safi, ++ const char *prefix) ++{ ++ struct bgp *bgp; ++ struct bgp_table *table; ++ time_t t_now = time (NULL); ++ bgp = bgp_get_default (); ++ if (bgp == NULL) ++ return CMD_WARNING; ++ if (bgp->rib == NULL) ++ return CMD_WARNING; ++ table = bgp->rib[afi][safi]; ++ if (table == NULL) ++ return CMD_WARNING; ++ ++ struct prefix p; ++ str2prefix (prefix, &p); ++ struct bgp_node *rn = bgp_node_match (table, &p); ++ vty_out (vty, "%s%s", prefix, VTY_NEWLINE); ++ if (rn) ++ { ++ if (rn->hist) ++ { ++ for (struct bgp_pgbgp_origin * cur = rn->hist->o; cur != NULL; ++ cur = cur->next) ++ { ++ if (cur->deprefUntil > t_now) ++ vty_out (vty, "Untrusted Origin AS: %d%s", cur->originAS, ++ VTY_NEWLINE); ++ else ++ vty_out (vty, "Trusted Origin AS: %d%s", cur->originAS, ++ VTY_NEWLINE); ++ } ++ } ++ bgp_unlock_node (rn); ++ } ++ return CMD_SUCCESS; ++} ++ ++static int ++bgp_pgbgp_stats (struct vty *vty, afi_t afi, safi_t safi) ++{ ++ struct bgp *bgp; ++ struct bgp_table *table; ++ ++ ++ bgp = bgp_get_default (); ++ if (bgp == NULL) ++ return CMD_WARNING; ++ if (bgp->rib == NULL) ++ return CMD_WARNING; ++ table = bgp->rib[afi][safi]; ++ if (table == NULL) ++ return CMD_WARNING; ++ ++ // bgp_pgbgp_store(table); ++ ++ // Print out the number of anomalous routes ++ int anomalous = 0; ++ int routes = 0; ++ int num_selected = 0; ++ int num_origin = 0; ++ int num_super = 0; ++ int num_ignored = 0; ++ int num_edge = 0; ++ ++ for (struct bgp_node * rn = bgp_table_top (table); rn; ++ rn = bgp_route_next (rn)) ++ { ++ for (struct bgp_info * ri = rn->info; ri; ri = ri->next) ++ { ++ routes += 1; ++ if (ANOMALOUS (ri->flags)) ++ { ++ anomalous += 1; ++ if (CHECK_FLAG (ri->flags, BGP_INFO_SELECTED)) ++ num_selected += 1; ++ ++ if (CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_O)) ++ num_origin += 1; ++ if (CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_E)) ++ num_edge += 1; ++ if (CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_P)) ++ num_super += 1; ++ if (CHECK_FLAG (ri->flags, BGP_INFO_IGNORED_P)) ++ num_ignored += 1; ++ } ++ } ++ } ++ ++ vty_out (vty, "%-30s: %10d%s", "Routes in the RIB", routes, VTY_NEWLINE); ++ vty_out (vty, "%-30s: %10d%s", "Anomalous routes in RIB", anomalous, ++ VTY_NEWLINE); ++ vty_out (vty, "%-30s: %10d%s", "Selected anomalous routes", num_selected, ++ VTY_NEWLINE); ++ vty_out (vty, "-----------------------------%s", VTY_NEWLINE); ++ vty_out (vty, "%-30s: %10d%s", "Routes with anomalous origins", num_origin, ++ VTY_NEWLINE); ++ vty_out (vty, "%-30s: %10d%s", "Routes with anomalous edges", num_edge, ++ VTY_NEWLINE); ++ vty_out (vty, "%-30s: %10d%s", "Routes ignored for sub-prefix", num_ignored, ++ VTY_NEWLINE); ++ vty_out (vty, "%-30s: %10d%s", "Less specific routes to avoid", num_super, ++ VTY_NEWLINE); ++ /* ++ vty_out (vty, "There are %d routes in the RIB.%s", routes, VTY_NEWLINE); ++ vty_out (vty, "%d are anomalous.%s", anomalous, VTY_NEWLINE); ++ vty_out (vty, "%d anomalous routes are selected.%s", num_selected, VTY_NEWLINE); ++ vty_out (vty, "%s", VTY_NEWLINE); ++ vty_out (vty, "Anomaly breakdown:%s", VTY_NEWLINE); ++ vty_out (vty, "%d contain anomalous origins%s", num_origin, VTY_NEWLINE); ++ vty_out (vty, "%d contain anomalous edges.%s", num_edge, VTY_NEWLINE); ++ vty_out (vty, "%d are for ignored sub-prefixes.%s", num_ignored, VTY_NEWLINE); ++ vty_out (vty, "%d are super-net routes through peers that announced anomalous sub-prefixes.%s", num_super, VTY_NEWLINE); ++ */ ++ return CMD_SUCCESS; ++} ++ ++ ++DEFUN (show_ip_bgp_pgbgp, ++ show_ip_bgp_pgbgp_cmd, ++ "show ip bgp pgbgp", ++ SHOW_STR IP_STR BGP_STR "Display PGBGP statistics\n") ++{ ++ return bgp_pgbgp_stats (vty, AFI_IP, SAFI_UNICAST); ++} ++ ++DEFUN (show_ip_bgp_pgbgp_neighbors, ++ show_ip_bgp_pgbgp_neighbors_cmd, ++ "show ip bgp pgbgp neighbors WORD", ++ SHOW_STR ++ IP_STR ++ BGP_STR ++ "BGP pgbgp\n" ++ "BGP pgbgp neighbors\n" "ASN whos neighbors should be displayed\n") ++{ ++ return bgp_pgbgp_stats_neighbors (vty, AFI_IP, SAFI_UNICAST, ++ atoi (argv[0])); ++} ++ ++DEFUN (show_ip_bgp_pgbgp_origins, ++ show_ip_bgp_pgbgp_origins_cmd, ++ "show ip bgp pgbgp origins A.B.C.D/M", ++ SHOW_STR ++ IP_STR ++ BGP_STR ++ "BGP pgbgp\n" ++ "BGP pgbgp neighbors\n" "Prefix to look up origin ASes of\n") ++{ ++ return bgp_pgbgp_stats_origins (vty, AFI_IP, SAFI_UNICAST, argv[0]); ++} ++ ++ ++ ++ ++/*! --------------- VTY (others exist in bgp_route.c) ------------------ !*/ ++ ++ ++ ++ ++ ++ ++ ++/* --------------- Helper Functions ------------------ */ ++/* ++ If the origin hasn't been seen/verified lately, look for it in the RIB ++*/ ++int ++originInRIB (struct bgp_node *node, struct bgp_pgbgp_origin *origin) ++{ ++ for (struct bgp_info * ri = node->info; ri; ri = ri->next) ++ { ++ struct bgp_pgbgp_pathSet pathOrigins; ++ pathOrigins = bgp_pgbgp_pathOrigin (ri->attr->aspath); ++ for (int i = 0; i < pathOrigins.length; ++i) ++ { ++ if (pathOrigins.ases[i] == origin->originAS) ++ { ++ return true; ++ } ++ } ++ } ++ return false; ++} ++ ++ ++/* ++ If the prefix hasn't been seen/verified lately, look for it in the RIB ++*/ ++int ++prefixInRIB (struct bgp_node *node, struct bgp_pgbgp_prefix *prefix) ++{ ++ if (node->info) ++ return true; ++ return false; ++} ++ ++static int ++edge_inRIB_iterator (struct hash_backet *backet, struct bgp_pgbgp_edge *hedge) ++{ ++ struct aspath *p = backet->data; ++ char first = true; ++ struct edge curEdge; ++ curEdge.a = 0; ++ curEdge.b = 0; ++ ++ struct assegment *seg; ++ ++ for (seg = p->segments; seg; seg = seg->next) ++ { ++ for (int i = 0; i < seg->length; i++) ++ { ++ curEdge.a = curEdge.b; ++ curEdge.b = seg->as[i]; ++ if (first) ++ { ++ first = false; ++ continue; ++ } ++ // Is this the edge we're looking for? ++ if (curEdge.a == hedge->e.a && curEdge.b == hedge->e.b) ++ { ++ hedge->lastSeen = time (NULL); ++ return false; ++ } ++ } ++ } ++ ++ return true; ++} ++ ++/* ++ If the edge hasn't been seen/verified lately, look for it in the AS path list ++ This function is expensive, use sparingly ++*/ ++int ++edgeInRIB (struct bgp_pgbgp_edge *e) ++{ ++ int completed; ++ completed = hash_iterate_until (ashash, ++ (int (*)(struct hash_backet *, void *)) ++ edge_inRIB_iterator, e); ++ if (completed) ++ return false; ++ ++ return true; ++} ++ ++ ++ ++/* ++ Return the selected route for the given route node ++ */ ++ ++struct bgp_info * ++bgp_pgbgp_selected (struct bgp_node *node) ++{ ++ for (struct bgp_info * ri = node->info; ri; ri = ri->next) ++ { ++ if (CHECK_FLAG (ri->flags, BGP_INFO_SELECTED)) ++ return ri; ++ } ++ return NULL; ++} ++ ++static int ++reuse_cmp (void *node1, void *node2) ++{ ++ struct bgp_pgbgp_reuse *a; ++ struct bgp_pgbgp_reuse *b; ++ a = (struct bgp_pgbgp_reuse *) node1; ++ b = (struct bgp_pgbgp_reuse *) node2; ++ return a->deprefUntil - b->deprefUntil; ++} ++ ++int ++bgp_pgbgp_pathLength (struct aspath *asp) ++{ ++ struct assegment *seg; ++ if ((asp == NULL) || (asp->segments == NULL)) ++ return 0; ++ int count = 0; ++ seg = asp->segments; ++ while (seg->next != NULL) ++ { ++ count += seg->length; ++ seg = seg->next; ++ } ++ return count; ++} ++ ++ ++ ++/* Find the origin(s) of the path ++ All ASes in the final set are considered origins */ ++static struct bgp_pgbgp_pathSet ++bgp_pgbgp_pathOrigin (struct aspath *asp) ++{ ++ struct assegment *seg, *last; ++ struct bgp_pgbgp_pathSet tmp; ++ tmp.length = 0; ++ tmp.ases = NULL; ++ ++ assert (asp != NULL && asp->segments != NULL); ++ ++ /* if ( (asp == NULL) || (asp->segments == NULL) ) ++ return tmp; ++ */ ++ seg = asp->segments; ++ last = NULL; ++ while (seg->next != NULL) ++ { ++ if (seg->type != AS_SET && seg->type != AS_CONFED_SET) ++ last = seg; ++ seg = seg->next; ++ } ++ ++ if (seg->type == AS_SET || seg->type == AS_CONFED_SET) ++ seg = last; ++ ++ assert (seg); ++ tmp.length = 1; ++ tmp.ases = &seg->as[seg->length - 1]; ++ ++ /* ++ if (seg->type == AS_SET || seg->type == AS_CONFED_SET) ++ { ++ tmp.length = seg->length; ++ tmp.ases = seg->as; ++ } ++ else ++ { ++ tmp.length = 1; ++ tmp.ases = &seg->as[seg->length - 1]; ++ } ++ */ ++ assert (tmp.length >= 1); ++ return tmp; ++ // return seg->as[seg->length-1]; ++} ++ ++int ++bgp_pgbgp_reuse (time_t t_now) ++{ ++ ++ struct bgp_pgbgp_reuse *cur = NULL; ++ ++ while (pgbgp->rq_size > 0) ++ { ++ cur = pqueue_dequeue (pgbgp->reuse_q); ++ pgbgp->rq_size -= 1; ++ ++ // Is the next item ready to be reused? ++ if (t_now < cur->deprefUntil) ++ { ++ pqueue_enqueue (cur, pgbgp->reuse_q); ++ pgbgp->rq_size += 1; ++ break; ++ } ++ ++ // Okay, it needs to be reused now ++ if (cur->type == PGBGP_REUSE_ORIGIN) ++ bgp_pgbgp_reuseOrigin (cur->data.origin); ++ ++ else if (cur->type == PGBGP_REUSE_PREFIX) ++ bgp_pgbgp_reusePrefix (cur->data.prefix); ++ ++ else if (cur->type == PGBGP_REUSE_EDGE) ++ bgp_pgbgp_reuseEdge (cur->data.edge); ++ ++ ++ XFREE (MTYPE_BGP_PGBGP_REUSE, cur); ++ } ++ return 0; ++} ++ ++/* Check bit of the prefix. */ ++static int ++check_bit (u_char * prefix, u_char prefixlen) ++{ ++ int offset; ++ int shift; ++ u_char *p = (u_char *) prefix; ++ ++ assert (prefixlen <= 128); ++ ++ offset = prefixlen / 8; ++ shift = 7 - (prefixlen % 8); ++ ++ return (p[offset] >> shift & 1); ++} ++ ++/* ++ Find a super-net in the tree that's not currently anomalous if one exists ++*/ ++struct bgp_node * ++findSuper (struct bgp_table *table, struct prefix *p, time_t t_now) ++{ ++ struct bgp_node *node; ++ struct bgp_node *matched; ++ ++ matched = NULL; ++ node = table->top; ++ ++ while (node && node->p.prefixlen < p->prefixlen && ++ prefix_match (&node->p, p)) ++ { ++ // Node may not yet have its info set when reading in from pgbgp log files ++ if (node->hist && node->p.prefixlen >= 8) ++ { ++ if (node->hist->p != NULL && node->hist->p->ignoreUntil < t_now) ++ //if (node->hist->p != NULL && prefixInRIB (node, NULL)) ++ //if (node->hist->p != NULL) ++ matched = node; ++ } ++ node = node->link[check_bit (&p->u.prefix, node->p.prefixlen)]; ++ } ++ if (matched) ++ return bgp_lock_node (matched); ++ return NULL; ++} ++ ++ ++ ++ ++ ++/*! --------------- Helper Functions ------------------ !*/ ++ ++ ++ ++ ++ ++ ++ ++/* --------------- Public PGBGP Interface ------------------ */ ++int ++bgp_pgbgp_enable (struct bgp *bgp, afi_t afi, safi_t safi, ++ int ost, int est, int sst, int oht, int pht, int eht, ++ const char *file, const char *anoms) ++{ ++ ++ if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP)) ++ { ++ if (pgbgp->storage && pgbgp->anomalies) ++ { ++ if (pgbgp->origin_sus_time == ost ++ && pgbgp->edge_sus_time == est ++ && pgbgp->sub_sus_time == sst ++ && pgbgp->origin_hist_time == oht ++ && pgbgp->prefix_hist_time == pht ++ && pgbgp->edge_hist_time == eht ++ && strcmp (pgbgp->storage, file) == 0 ++ && strcmp (pgbgp->anomalies, anoms) == 0) ++ ++ return 0; ++ } ++ } ++ ++ SET_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP); ++ ++#ifndef PGBGP_DEBUG ++ time_t hour = 3600; ++ time_t day = 86400; ++#endif ++#ifdef PGBGP_DEBUG ++ time_t hour = 2; ++ time_t day = 5; ++#endif ++ ++ pgbgp->origin_sus_time = ost * hour; ++ pgbgp->edge_sus_time = est * hour; ++ pgbgp->sub_sus_time = sst * hour; ++ pgbgp->origin_hist_time = oht * day; ++ pgbgp->prefix_hist_time = pht * day; ++ pgbgp->edge_hist_time = eht * day; ++ pgbgp->peer_hist_time = DEFAULT_ORIGIN_HIST; ++ ++ if (file != NULL) ++ pgbgp->storage = strdup (file); ++ else ++ pgbgp->storage = NULL; ++ ++ if (anoms != NULL) ++ pgbgp->anomalies = strdup (anoms); ++ else ++ pgbgp->anomalies = NULL; ++ ++ ++ pgbgp->reuse_q = pqueue_create (); ++ pgbgp->reuse_q->cmp = reuse_cmp; ++ pgbgp->rq_size = 0; ++ pgbgp->lastgc = time (NULL); ++ pgbgp->lastStore = time (NULL); ++ pgbgp->startTime = time (NULL); ++ install_element (VIEW_NODE, &show_ip_bgp_pgbgp_cmd); ++ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_cmd); ++ install_element (VIEW_NODE, &show_ip_bgp_pgbgp_neighbors_cmd); ++ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_neighbors_cmd); ++ install_element (VIEW_NODE, &show_ip_bgp_pgbgp_origins_cmd); ++ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_origins_cmd); ++ pgbgp->edgeT = hash_create_size (131072, edge_key_make, edge_cmp); ++ bgp_pgbgp_restore (); ++ return 0; ++} ++ ++int ++bgp_pgbgp_disable (struct bgp *bgp, afi_t afi, safi_t safi) ++{ ++ UNSET_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP); ++ ++ // Clean the tables ++ if (bgp->rib[afi][safi] != NULL) ++ bgp_pgbgp_clean (bgp->rib[afi][safi]); ++ ++ bgp_pgbgp_cleanEdges (); ++ ++ if (pgbgp->storage != NULL) ++ free (pgbgp->storage); ++ ++ if (pgbgp->anomalies != NULL) ++ free (pgbgp->anomalies); ++ ++ struct bgp_pgbgp_peerTime *pr = pgbgp->peerLast; ++ while (pr) ++ { ++ struct bgp_pgbgp_peerTime *cur = pr; ++ pr = pr->next; ++ XFREE (MTYPE_BGP_PGBGP_PEER, cur); ++ } ++ ++ return 0; ++} ++ ++int ++bgp_pgbgp_clean (struct bgp_table *table) ++{ ++ struct bgp_pgbgp_reuse *rnode = NULL; ++ ++ while (pgbgp->rq_size > 0) ++ { ++ rnode = (struct bgp_pgbgp_reuse *) pqueue_dequeue (pgbgp->reuse_q); ++ pgbgp->rq_size -= 1; ++ XFREE (MTYPE_BGP_PGBGP_REUSE, rnode); ++ } ++ pqueue_delete (pgbgp->reuse_q); ++ ++ if (table == NULL) ++ return 0; ++ ++ // Clean the detectors ++ bgp_pgbgp_cleanHistTable (table); ++ ++ bgp_pgbgp_cleanEdges (); ++ ++ ++ // Clean up the RIB nodes ++ for (struct bgp_node * rn = bgp_table_top (table); rn; ++ rn = bgp_route_next (rn)) ++ { ++ int changed = 0; ++ for (struct bgp_info * ri = rn->info; ri; ri = ri->next) ++ { ++ if (CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_O ++ | BGP_INFO_SUSPICIOUS_P | BGP_INFO_SUSPICIOUS_E ++ | BGP_INFO_IGNORED_P)) ++ { ++ changed = 1; ++ UNSET_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_O ++ | BGP_INFO_SUSPICIOUS_P | BGP_INFO_SUSPICIOUS_E ++ | BGP_INFO_IGNORED_P); ++ } ++ } ++ if (changed && rn->info) ++ { ++ struct bgp_info *ri = rn->info; ++ bgp_process (ri->peer->bgp, rn, rn->table->afi, rn->table->safi); ++ } ++ } ++ ++ hash_free (pgbgp->edgeT); ++ return 0; ++} ++ ++ ++int ++bgp_pgbgp_gc (struct bgp_table *table) ++{ ++ struct bgp *bgp = bgp_get_default (); ++ if (!bgp) ++ return 0; ++ ++ // Collect each AFI/SAFI RIB ++ for (afi_t afi = AFI_IP; afi < AFI_MAX; afi++) ++ for (safi_t safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) ++ { ++ if (!CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP)) ++ continue; ++ struct bgp_table *curTable = bgp->rib[afi][safi]; ++ if (!curTable) ++ continue; ++ bgp_pgbgp_garbageCollectHistTable (curTable); ++ } ++ ++ bgp_pgbgp_garbageCollectEdges (table); ++ ++ return 0; ++} ++ ++int ++bgp_pgbgp_restore (void) ++{ ++ ++ if (pgbgp->storage == NULL) ++ return 0; ++ FILE *file = fopen (pgbgp->storage, "r"); ++ if (!file) ++ return 0; ++ ++ int type = 0; ++ struct prefix p; ++ struct bgp *bgp = bgp_get_default (); ++ struct bgp_node *curNode = NULL; ++ ++ // Get the log store time ++ long long int writetime; ++ fscanf (file, "%lld", &writetime); ++ time_t swtime = writetime; ++ ++ // If it's too old (more than 1 week old), start fresh ++ if (time (NULL) - swtime > 86400 * 7) ++ { ++ fclose (file); ++ return 0; ++ } ++ ++ ++ // Get the PGBGP init time ++ long long int stime; ++ fscanf (file, "%lld", &stime); ++ pgbgp->startTime = stime; ++ ++ while (fscanf (file, "%d", &type) != EOF) ++ { ++ ++ if (type == PREFIX_ID) ++ { ++ char pre[128]; ++ unsigned int afi; ++ unsigned int safi; ++ long long int time; ++ fscanf (file, "%s %u %u %lld", pre, &afi, &safi, &time); ++ str2prefix (pre, &p); ++ struct bgp_table *curTable = bgp->rib[afi][safi]; ++ assert (curTable != NULL); ++ ++ // Create and lock the node ++ curNode = bgp_node_get (curTable, &p); ++ assert (curNode->hist == NULL); ++ ++ // bgp_lock_node(curNode); ++ ++ curNode->hist = ++ XCALLOC (MTYPE_BGP_PGBGP_HIST, sizeof (struct bgp_pgbgp_hist)); ++ assert (curNode->hist != NULL); ++ ++ curNode->hist->p = ++ XCALLOC (MTYPE_BGP_PGBGP_PREFIX, ++ sizeof (struct bgp_pgbgp_prefix)); ++ assert (curNode->hist->p != NULL); ++ ++ curNode->hist->p->lastSeen = time; ++ } ++ else if (type == ORIGIN_ID) ++ { ++ unsigned int ASN; ++ long long int time; ++ fscanf (file, "%u %lld", &ASN, &time); ++ struct bgp_pgbgp_origin *or = XCALLOC (MTYPE_BGP_PGBGP_ORIGIN, ++ sizeof (struct ++ bgp_pgbgp_origin)); ++ or->lastSeen = time; ++ or->originAS = ASN; ++ or->next = curNode->hist->o; ++ curNode->hist->o = or; ++ } ++ else if (type == EDGE_ID) ++ { ++ bgp_pgbgp_restoreEdge (file); ++ } ++ else if (type == PEER_ID) ++ { ++ struct bgp_pgbgp_peerTime *pr; ++ long long int time; ++ union sockunion su; ++ char szsu[128]; ++ fscanf (file, "%s %lld", szsu, &time); ++ str2sockunion (szsu, &su); ++ pr = ++ XCALLOC (MTYPE_BGP_PGBGP_PEER, ++ sizeof (struct bgp_pgbgp_peerTime)); ++ pr->su = su; ++ pr->lastSeen = time; ++ pr->next = pgbgp->peerLast; ++ pgbgp->peerLast = pr; ++ } ++ } ++ ++ fclose (file); ++ return 0; ++} ++ ++int ++bgp_pgbgp_store (struct bgp_table *table) ++{ ++ if (pgbgp->storage == NULL) ++ return 0; ++ char *tmpname = malloc (sizeof (char) * (1 + 4 + strlen (pgbgp->storage))); ++ strcpy (tmpname, pgbgp->storage); ++ strcat (tmpname, ".tmp"); ++ FILE *file = fopen (tmpname, "w"); ++ ++ if (!file) ++ { ++ free (tmpname); ++ return 0; ++ } ++ ++ // Store the current time ++ fprintf (file, "%lld\n", (long long int) time (NULL)); ++ ++ // Store the init time ++ fprintf (file, "%lld\n", (long long int) pgbgp->startTime); ++ ++ // Store the peer times ++ for (struct bgp_pgbgp_peerTime * pr = pgbgp->peerLast; pr; pr = pr->next) ++ { ++ char strSock[128]; ++ sockunion2str (&pr->su, strSock, sizeof (strSock)); ++ ++ if (pr->deprefUntil < time (NULL)) ++ { ++ fprintf (file, "%d %s %lld\n", PEER_ID, strSock, ++ (long long int) pr->lastSeen); ++ } ++ } ++ ++ // Store the tables ++ bgp_pgbgp_storeHistTable (table, file); ++ bgp_pgbgp_storeEdges (table, file); ++ ++ fclose (file); ++ ++ rename (tmpname, pgbgp->storage); ++ ++ free (tmpname); ++ return 0; ++} ++ ++/* ++ Check to see if we've seen the peer recently ++ If not, then we need to return true and not delay routes ++ for awhile ++*/ ++int ++bgp_pgbgp_updatePeer (struct bgp_info *binfo, time_t now) ++{ ++ int status = false; ++ // Find the peer ++ struct bgp_pgbgp_peerTime *pr = pgbgp->peerLast; ++ for (; pr; pr = pr->next) ++ if (sockunion_same (&pr->su, &binfo->peer->su)) ++ break; ++ ++ // If this is a new peer, create it ++ if (pr == NULL) ++ { ++ pr = XCALLOC (MTYPE_BGP_PGBGP_PEER, sizeof (struct bgp_pgbgp_peerTime)); ++ pr->su = binfo->peer->su; ++ pr->next = pgbgp->peerLast; ++ pgbgp->peerLast = pr; ++ ++ } ++ // Is it currently marked as new? ++ if (pr->deprefUntil > now) ++ goto UPPEER_DEPREF; ++ ++ // Have we seen the peer recently? ++ if (pr->lastSeen + pgbgp->peer_hist_time > now) ++ goto UPPEER_CLEAN; ++ ++ // It must not have been seen lately, depref it ++ pr->deprefUntil = now + PGBGP_PEER_GRACE; ++ ++ ++UPPEER_DEPREF: ++ status = true; ++ ++UPPEER_CLEAN: ++ pr->lastSeen = now; ++ ++ return status; ++} ++ ++ ++/* ++ Returns whether or not the sub-prefix should be ignored ++*/ ++int ++bgp_pgbgp_shouldIgnore (struct bgp_node *super, struct bgp_info *selected) ++{ ++ if (!selected || CHECK_FLAG (selected->flags, BGP_INFO_SUSPICIOUS_P)) ++ return false; ++ return true; ++} ++ ++/* ++ This is a special case function for smoothly handling sub-prefix hijacks. ++ ++ It handles the following 2 events: ++ ++ Event 1: The super-prefix of an anomalous prefix has a route through a non-anomalous ++ ++ Event 1: An anomalous sub-prefix is ignored, but no best route for the super-prefix exists ++ Response: Announce the sub-prefix until the super-prefix comes back ++ ++ Event 2: A super-prefix comes back to the RIB and its anomalous sub-prefix is in use ++ Response: Ignore the sub-prefix again ++ */ ++ ++ ++int ++bgp_pgbgp_rib_updated (struct bgp_node *rn, struct bgp_info *old_best, ++ struct bgp_info *new_best) ++{ ++ // return 0; ++ struct bgp_pgbgp_hist *hist = rn->hist; ++ if (!hist) ++ return 0; ++ if (!hist->p) ++ return 0; ++ time_t t_now = time (NULL); ++ ++ /* ++ If we can't avoid the sub-prefix by routing to the super-prefix, ++ then route as normal to the sub-prefix ++ */ ++ if (!bgp_pgbgp_shouldIgnore (rn, new_best)) ++ { ++ for (struct bgp_pgbgp_avoid * cur = hist->p->avoid; cur; ++ cur = cur->next) ++ { ++ if (cur->avoidUntil > t_now) ++ { ++ int changed = false; ++ for (struct bgp_info * ri = cur->sub->info; ri; ri = ri->next) ++ { ++ if (CHECK_FLAG (ri->flags, BGP_INFO_IGNORED_P)) ++ { ++ changed = true; ++ UNSET_FLAG (ri->flags, BGP_INFO_IGNORED_P); ++ } ++ } ++ if (changed) ++ { ++ struct bgp_info *ri = cur->sub->info; ++ if (ri && ri->peer && ri->peer->bgp) ++ bgp_process (ri->peer->bgp, cur->sub, ++ cur->sub->table->afi, cur->sub->table->safi); ++ ++ } ++ ++ } ++ } ++ } ++ ++ /* ++ If we can avoid the sub-prefix by routing to the super-prefix, ++ then do so ++ */ ++ ++ else ++ { ++ for (struct bgp_pgbgp_avoid * cur = hist->p->avoid; cur; ++ cur = cur->next) ++ { ++ if (cur->avoidUntil > t_now) ++ { ++ int changed = false; ++ for (struct bgp_info * ri = cur->sub->info; ri; ri = ri->next) ++ { ++ if (!CHECK_FLAG (ri->flags, BGP_INFO_IGNORED_P)) ++ { ++ changed = true; ++ SET_FLAG (ri->flags, BGP_INFO_IGNORED_P); ++ } ++ } ++ if (changed) ++ { ++ struct bgp_info *ri = cur->sub->info; ++ if (ri && ri->peer && ri->peer->bgp) ++ bgp_process (ri->peer->bgp, cur->sub, ++ cur->sub->table->afi, cur->sub->table->safi); ++ } ++ } ++ } ++ } ++ ++ /* ++ if (old_best && !new_best) ++ { ++ time_t t_now = time(NULL); ++ for (struct bgp_pgbgp_avoid * cur = hist->p->avoid; cur; ++ cur = cur->next) ++ { ++ if (cur->avoidUntil > t_now) ++ { ++ for (struct bgp_info * ri = cur->sub->info; ri; ri = ri->next) ++ UNSET_FLAG (ri->flags, BGP_INFO_IGNORED_P); ++ ++ struct bgp_info *ri = cur->sub->info; ++ if (ri && ri->peer && ri->peer->bgp) ++ bgp_process (ri->peer->bgp, cur->sub, cur->sub->table->afi, ++ cur->sub->table->safi); ++ } ++ } ++ } ++ ++ ++ else if (!old_best && new_best) ++ { ++ time_t t_now = time(NULL); ++ for (struct bgp_pgbgp_avoid * av = hist->p->avoid; av; av = av->next) ++ { ++ struct bgp_info * ri = av->sub->info; ++ if (av->avoidUntil > t_now && ri && !CHECK_FLAG(ri->flags, BGP_INFO_IGNORED_P)) ++ { ++ for (; ri; ri = ri->next) ++ SET_FLAG (ri->flags, BGP_INFO_IGNORED_P); ++ ri = av->sub->info; ++ if (ri && ri->peer && ri->peer->bgp) ++ bgp_process (ri->peer->bgp, av->sub, ++ av->sub->table->afi, av->sub->table->safi); ++ ++ } ++ } ++ } ++ */ ++ return 0; ++} ++ ++int ++bgp_pgbgp_update (struct bgp_info *binfo, struct attr *at, ++ struct bgp_node *rn) ++{ ++ time_t t_now = time (NULL); ++ ++ // Clean up the reuse list ++ bgp_pgbgp_reuse (t_now); ++ ++ ++ if (!rn->hist) ++ { ++ rn->hist = ++ XCALLOC (MTYPE_BGP_PGBGP_HIST, sizeof (struct bgp_pgbgp_hist)); ++ // Get the PGBGP history lock on rn ++ bgp_lock_node (rn); ++ } ++ ++ struct bgp_node *superhn = NULL; ++ ++ // implicit lock from node_get ++ superhn = findSuper (rn->table, &rn->p, t_now); ++ ++ int newPeer = bgp_pgbgp_updatePeer (binfo, t_now); ++ bgp_pgbgp_updateOrigin (rn->hist, binfo, at, rn, t_now, newPeer); ++ bgp_pgbgp_updatePrefix (rn->hist, superhn, binfo, at, rn, t_now, newPeer); ++ bgp_pgbgp_updateEdge (rn->hist, binfo, at, rn, t_now, newPeer); ++ ++ if (superhn != NULL) ++ bgp_unlock_node (superhn); ++ ++ ++ ++ // GC and storage must be last, as they update lastSeen values of objects ++ // which would cause new routes to be recently seen, which is undesired behavior ++ // Make sure you don't collect anything that might be in use! ++ if (t_now >= pgbgp->lastgc + PGBGP_GC_DELTA) ++ { ++ bgp_pgbgp_gc (rn->table); ++ pgbgp->lastgc = t_now; ++ } ++ ++ if (t_now >= pgbgp->lastStore + PGBGP_STORE_DELTA) ++ { ++ bgp_pgbgp_store (rn->table); ++ pgbgp->lastStore = t_now; ++ } ++ ++ ++ ++ return 0; ++} ++ ++ ++ ++ ++/*! --------------- Public PGBGP Interface ------------------ !*/ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++/* --------------- MOAS Detection ------------------ */ ++void ++bgp_pgbgp_storeHistTable (struct bgp_table *table, FILE * file) ++{ ++ time_t t_now; ++ t_now = time (NULL); ++ ++ struct bgp *bgp = bgp_get_default (); ++ if (!bgp) ++ return; ++ ++ // Store each AFI/SAFI RIB ++ for (afi_t afi = AFI_IP; afi < AFI_MAX; afi++) ++ for (safi_t safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) ++ { ++ if (!CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP)) ++ continue; ++ struct bgp_table *curTable = bgp->rib[afi][safi]; ++ if (!curTable) ++ continue; ++ ++ for (struct bgp_node * rn = bgp_table_top (curTable); rn; ++ rn = bgp_route_next (rn)) ++ { ++ struct bgp_pgbgp_hist *hist = rn->hist; ++ if (hist == NULL) ++ continue; ++ char szPrefix[128]; ++ prefix2str (&rn->p, szPrefix, sizeof (szPrefix)); ++ ++ ++ struct bgp_pgbgp_prefix *pre = hist->p; ++ if (pre && pre->ignoreUntil <= t_now) ++ { ++ if (pre->lastSeen + pgbgp->prefix_hist_time > t_now) ++ fprintf (file, "%d %s %u %u %lld\n", PREFIX_ID, szPrefix, ++ (unsigned int) afi, (unsigned int) safi, ++ (long long int) pre->lastSeen); ++ else ++ continue; ++ } ++ /* Need a prefix in the file before the origins, ++ if no prefix.. skip origins */ ++ else ++ continue; ++ ++ for (struct bgp_pgbgp_origin * cur = hist->o; cur; ++ cur = cur->next) ++ { ++ if (cur->deprefUntil > t_now) ++ continue; ++ ++ if (cur->lastSeen + pgbgp->origin_hist_time > t_now) ++ fprintf (file, "%d %u %lld\n", ORIGIN_ID, cur->originAS, ++ (long long int) cur->lastSeen); ++ } ++ ++ } ++ } ++} ++ ++ ++int ++bgp_pgbgp_garbageCollectHistTable (struct bgp_table *table) ++{ ++ time_t t_now; ++ t_now = time (NULL); ++ ++ ++ for (struct bgp_node * rn = bgp_table_top (table); rn; ++ rn = bgp_route_next (rn)) ++ { ++ int collect = false; ++ struct bgp_pgbgp_hist *hist = rn->hist; ++ if (hist == NULL) ++ continue; ++ ++ struct bgp_pgbgp_origin *cur = hist->o; ++ struct bgp_pgbgp_prefix *pre = hist->p; ++ struct bgp_pgbgp_origin *parent = NULL; ++ ++ int used = false; ++ if (cur != NULL || pre != NULL) ++ used = true; ++ ++ while (cur != NULL) ++ { ++ // Update the lastSeen time w/ originInRIB ++ if (originInRIB (rn, cur)) ++ cur->lastSeen = t_now; ++ ++ collect = false; ++ ++ // Collect if old ++ if (cur->lastSeen + pgbgp->origin_hist_time <= t_now) ++ collect = true; ++ ++ // Collect if anomaly just became okay but not seen since last collection ++ if (cur->deprefUntil != 0 && cur->deprefUntil < t_now) ++ { ++ if (cur->lastSeen < pgbgp->lastgc) ++ collect = true; ++ cur->deprefUntil = 0; ++ } ++ ++ if (collect) ++ { ++ if (parent == NULL) ++ hist->o = cur->next; ++ else ++ parent->next = cur->next; ++ ++ // Delete cur, parent doesn't change ++ struct bgp_pgbgp_origin *del = cur; ++ cur = cur->next; ++ XFREE (MTYPE_BGP_PGBGP_ORIGIN, del); ++ } ++ else ++ { ++ parent = cur; ++ cur = cur->next; ++ } ++ } ++ ++ // Update the lastSeen time w/ prefixInRIB ++ if (pre && prefixInRIB (rn, pre)) ++ pre->lastSeen = t_now; ++ ++ collect = false; ++ ++ // Collect if old ++ if (pre && pre->lastSeen + pgbgp->prefix_hist_time <= t_now) ++ collect = true; ++ ++ // Collect if anomaly just became okay but not seen since last collection ++ if (pre && pre->ignoreUntil != 0 && pre->ignoreUntil < t_now) ++ { ++ if (pre->lastSeen < pgbgp->lastgc) ++ collect = true; ++ pre->ignoreUntil = 0; ++ } ++ ++ if (collect) ++ { ++ for (struct bgp_pgbgp_avoid * av = pre->avoid; av;) ++ { ++ struct bgp_pgbgp_avoid *del = av; ++ av = av->next; ++ bgp_unlock_node (del->sub); ++ XFREE (MTYPE_BGP_PGBGP_AVOID, del); ++ } ++ ++ XFREE (MTYPE_BGP_PGBGP_PREFIX, pre); ++ hist->p = NULL; ++ } ++ ++ // If the node isn't in use, remove it ++ if (used && hist->o == NULL && hist->p == NULL) ++ { ++ XFREE (MTYPE_BGP_PGBGP_HIST, hist); ++ rn->hist = NULL; ++ bgp_unlock_node (rn); ++ } ++ } ++ ++ return 0; ++} ++ ++void ++bgp_pgbgp_cleanHistTable (struct bgp_table *table) ++{ ++ // Clean up the RIB nodes ++ for (struct bgp_node * rn = bgp_table_top (table); rn; ++ rn = bgp_route_next (rn)) ++ { ++ struct bgp_pgbgp_hist *hist = rn->hist; ++ if (hist == NULL) ++ continue; ++ ++ if (hist->p) ++ { ++ for (struct bgp_pgbgp_avoid * av = hist->p->avoid; av;) ++ { ++ struct bgp_pgbgp_avoid *del = av; ++ av = av->next; ++ bgp_unlock_node (del->sub); ++ XFREE (MTYPE_BGP_PGBGP_AVOID, del); ++ } ++ hist->p->avoid = NULL; ++ XFREE (MTYPE_BGP_PGBGP_PREFIX, hist->p); ++ hist->p = NULL; ++ } ++ ++ for (struct bgp_pgbgp_origin * cur = hist->o; cur;) ++ { ++ struct bgp_pgbgp_origin *next = cur->next; ++ XFREE (MTYPE_BGP_PGBGP_ORIGIN, cur); ++ cur = next; ++ } ++ hist->o = NULL; ++ XFREE (MTYPE_BGP_PGBGP_HIST, hist); ++ rn->hist = NULL; ++ bgp_unlock_node (rn); ++ } ++} ++ ++void ++bgp_pgbgp_logOriginAnomaly (as_t asn, struct bgp_node *rn, struct attr *at) ++{ ++ assert (pgbgp); ++ if (!pgbgp->anomalies) ++ return; ++ FILE *file = fopen (pgbgp->anomalies, "a"); ++ if (!file) ++ return; ++ ++ char pre[256]; ++ prefix2str (&rn->p, pre, sizeof (pre)); ++ ++ // MOAS | TIME | NEXTHOP | PREFIX | SUSPICIOUS_ORIGIN | TRUSTED_ORIGINS | PATH ++ fprintf (file, "%d|%lld|%s|%s|%d|", MOAS, (long long int) time (NULL), ++ inet_ntoa (at->nexthop), pre, asn); ++ ++ ++ // Print the trusted origins ++ assert (rn->hist); ++ assert (rn->hist->o); ++ ++ struct bgp_pgbgp_hist *hist = rn->hist; ++ ++ for (struct bgp_pgbgp_origin * cur = hist->o; cur != NULL; cur = cur->next) ++ { ++ if (cur->deprefUntil > time (NULL)) ++ continue; ++ fprintf (file, "%d", cur->originAS); ++ if (cur->next != NULL) ++ fprintf (file, " "); ++ } ++ ++ fprintf (file, " |%s\n", aspath_print (at->aspath)); ++ fclose (file); ++} ++ ++int ++bgp_pgbgp_updateOrigin (struct bgp_pgbgp_hist *hist, struct bgp_info *binfo, ++ struct attr *at, struct bgp_node *rn, time_t t_now, ++ int newPeer) ++{ ++ struct bgp_pgbgp_pathSet pathOrigins; ++ struct bgp_pgbgp_origin *pi = NULL; ++ int status = 0; ++ struct bgp_pgbgp_reuse *r; ++ pathOrigins = bgp_pgbgp_pathOrigin (at->aspath); ++ ++ ++ for (int i = 0; i < pathOrigins.length; i++) ++ { ++ as_t pathOrigin = pathOrigins.ases[i]; ++ ++ /* Is the Origin AS in the history? */ ++ for (pi = hist->o; pi; pi = pi->next) ++ if (pi->originAS == pathOrigin) ++ break; ++ ++ if (pi == NULL) ++ { ++ pi = ++ XCALLOC (MTYPE_BGP_PGBGP_ORIGIN, ++ sizeof (struct bgp_pgbgp_origin)); ++ pi->next = hist->o; ++ pi->originAS = pathOrigin; ++ hist->o = pi; ++ } ++ ++ // If this is our first origin for the prefix, let the sub-prefix ++ // check take care of it ++ if (pi->next == NULL) ++ goto UPO_CLEAN; ++ ++ /* Is the origin currently marked as suspicious? */ ++ if (pi->deprefUntil > t_now) ++ goto UPO_DEPREF; ++ ++ /* Have we seen the origin recently? */ ++ if (pi->lastSeen + pgbgp->origin_hist_time > t_now) ++ goto UPO_CLEAN; ++ ++#ifndef PGBGP_DEBUG ++ /* Are we within the initial grace period? */ ++ if (newPeer) ++ goto UPO_CLEAN; ++#endif ++ ++ /* It must not be in recent history, depref origin for first time */ ++ pi->deprefUntil = t_now + pgbgp->origin_sus_time; ++ bgp_pgbgp_logOriginAnomaly (pathOrigin, rn, at); ++ ++ r = XCALLOC (MTYPE_BGP_PGBGP_REUSE, sizeof (struct bgp_pgbgp_reuse)); ++ r->type = PGBGP_REUSE_ORIGIN; ++ r->deprefUntil = pi->deprefUntil; ++ r->data.origin.originAS = pathOrigin; ++ r->data.origin.rn = rn; ++ bgp_lock_node (rn); ++ pqueue_enqueue (r, pgbgp->reuse_q); ++ pgbgp->rq_size += 1; ++ ++ ++ UPO_DEPREF: ++ SET_FLAG (binfo->flags, BGP_INFO_SUSPICIOUS_O); ++ status = BGP_INFO_SUSPICIOUS_O; ++ ++ UPO_CLEAN: ++ pi->lastSeen = t_now; ++ } ++ return status; ++} ++ ++int ++bgp_pgbgp_reuseOrigin (struct bgp_pgbgp_r_origin data) ++{ ++ struct bgp_info *ri; ++ int numChanged = 0; ++ time_t t_now = time (NULL); ++ assert (data.rn->hist != NULL); ++ ++ // Repreference paths for this prefix that are now okay ++ for (ri = data.rn->info; ri; ri = ri->next) ++ { ++ if (CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_O)) ++ { ++ struct bgp_pgbgp_pathSet pathOrigins; ++ pathOrigins = bgp_pgbgp_pathOrigin (ri->attr->aspath); ++ int numOkay = 0; ++ for (int i = 0; i < pathOrigins.length; i++) ++ { ++ as_t pathOrigin = pathOrigins.ases[i]; ++ // Find the origin ++ struct bgp_pgbgp_origin *o = NULL; ++ for (o = data.rn->hist->o; o != NULL; o = o->next) ++ if (o->originAS == pathOrigin) ++ break; ++ /* ++ if (o == NULL) { ++ for(struct bgp_pgbgp_origin * z = data.rn->hist->o; z != NULL; z = z->next) ++ printf("Known origin: %d\n", z->originAS); ++ char pre[128]; ++ prefix2str(&data.rn->p, pre, 128); ++ printf("%s : %s : %d\n", pre, ri->attr->aspath->str, pathOrigin); ++ } ++ */ ++ assert (o != NULL); ++ ++ if (o->deprefUntil <= t_now) ++ numOkay += 1; ++ } ++ if (numOkay == pathOrigins.length) ++ { ++ UNSET_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_O); ++ numChanged += 1; ++ } ++ } ++ } ++ ++ ri = data.rn->info; ++ ++ // Rerun the decision process? ++ if (numChanged > 0) ++ bgp_process (ri->peer->bgp, data.rn, data.rn->table->afi, ++ data.rn->table->safi); ++ ++ ++ /* ++ // Remove this (origin,prefix) pair from the normal database ++ // if it's not still in the RIB ++ struct bgp_pgbgp_hist *hist = rn->hist; ++ struct bgp_pgbgp_origin * cur = hist->o; ++ struct bgp_pgbgp_origin * parent = NULL; ++ ++ // Find the origin AS node ++ while(cur != NULL) ++ { ++ if (cur->originAS == data.originAS) ++ { ++ // Delete the node if it hasn't been seen ++ // since the last storage run ++ if (cur->lastSeen < pgbgp->lastStore) { ++ // Delete this node ++ if (parent == NULL) ++ hist->o = cur->next; ++ else ++ parent->next = cur->next; ++ ++ XFREE(MTYPE_BGP_PGBGP_ORIGIN, cur); ++ } ++ break; ++ } ++ parent = cur; ++ cur = cur->next; ++ } ++ */ ++ ++ bgp_unlock_node (data.rn); ++ return 0; ++} ++ ++/*! --------------- MOAS Detection ------------------ !*/ ++ ++ ++/* --------------- Sub-Prefix Detection ------------------ */ ++ ++ ++ ++ ++ ++void ++bgp_pgbgp_logSubprefixAnomaly (as_t asn, struct bgp_node *rn, struct attr *at, ++ struct bgp_node *super) ++{ ++ assert (pgbgp); ++ if (!pgbgp->anomalies) ++ return; ++ FILE *file = fopen (pgbgp->anomalies, "a"); ++ if (!file) ++ return; ++ ++ char pre[256]; ++ prefix2str (&rn->p, pre, sizeof (pre)); ++ ++ char superpre[256]; ++ prefix2str (&super->p, superpre, sizeof (superpre)); ++ ++ // SUBPREFIX | TIME | NEXTHOP | PREFIX | SUPER-PREFIX | SUSPICIOUS_ORIGIN | TRUSTED_ORIGINS | PATH ++ fprintf (file, "%d|%lld|%s|%s|%s|%d|", SUBPREFIX, ++ (long long int) time (NULL), inet_ntoa (at->nexthop), pre, ++ superpre, asn); ++ ++ // Print the trusted origins ++ assert (super->hist); ++ assert (super->hist->o); ++ ++ struct bgp_pgbgp_hist *hist = super->hist; ++ ++ for (struct bgp_pgbgp_origin * cur = hist->o; cur != NULL; cur = cur->next) ++ { ++ if (cur->deprefUntil > time (NULL)) ++ continue; ++ fprintf (file, "%d", cur->originAS); ++ if (cur->next != NULL) ++ fprintf (file, " "); ++ } ++ ++ fprintf (file, " |%s\n", aspath_print (at->aspath)); ++ fclose (file); ++} ++ ++/* ++ If the first path is a prefix of the second, then return true ++ */ ++ ++static int ++bgp_pgbgp_pathIsPrefix(struct aspath *trusted, struct aspath * new) ++{ ++ if (trusted == new) ++ return true; ++ ++ struct assegment *seg1 = trusted->segments; ++ struct assegment *seg2 = new->segments; ++ ++ while (seg1 || seg2) ++ { ++ if ((!seg1 && seg2) || (seg1 && !seg2)) ++ return false; ++ if (seg1->type != seg2->type) ++ return false; ++ ++ if (seg1->length > seg2->length) ++ return false; ++ ++ for(int i = 0; i < seg1->length; i++) ++ if (seg1->as[i] != seg2->as[i]) ++ return false; ++ ++ seg1 = seg1->next; ++ seg2 = seg2->next; ++ } ++ ++ return true; ++} ++ ++int ++bgp_pgbgp_updatePrefix (struct bgp_pgbgp_hist *hist, ++ struct bgp_node *supernode, struct bgp_info *binfo, ++ struct attr *at, struct bgp_node *rn, time_t t_now, ++ int newPeer) ++{ ++ struct bgp_pgbgp_prefix *pre = NULL; ++ struct bgp_pgbgp_reuse *r = NULL; ++ int status = 0; ++ int changed = false; ++ ++ pre = hist->p; ++ ++ ++ /* Do we have this prefix? */ ++ if (pre == NULL) ++ { ++ pre = ++ XCALLOC (MTYPE_BGP_PGBGP_PREFIX, sizeof (struct bgp_pgbgp_prefix)); ++ hist->p = pre; ++ } ++ ++ /* Is the prefix currently marked as suspicious? */ ++ if (pre->ignoreUntil > t_now) ++ { ++ goto UPP_IGNORE; ++ } ++ ++ /* Should this neighbor be avoided for this prefix because it ++ sent us info. about a suspicious sub-prefix? */ ++ for (struct bgp_pgbgp_avoid * av = hist->p->avoid; av; av = av->next) ++ { ++ if (binfo->peer->as == av->peerASN && av->avoidUntil > t_now) ++ { ++ SET_FLAG (binfo->flags, BGP_INFO_SUSPICIOUS_P); ++ status = BGP_INFO_SUSPICIOUS_P; ++ goto UPP_DONE; ++ } ++ } ++ ++ /* Have we seen the prefix recently? */ ++ if (pre->lastSeen + pgbgp->prefix_hist_time > t_now) ++ goto UPP_DONE; ++ ++#ifndef PGBGP_DEBUG ++ /* Are we within the initial grace period? */ ++ if (newPeer) ++ goto UPP_DONE; ++#endif ++ ++ /* Is there a less specific *in recent history* that this could be hijacking? */ ++ if (supernode == NULL) ++ goto UPP_DONE; ++ ++ /* Does this path the super-net's non-anomalous path from this peer? If so it's okay */ ++ int found = false; ++ for (struct bgp_info * ri = supernode->info; ri; ri = ri->next) ++ { ++ if (ri->peer->as == binfo->peer->as) ++ { ++ if (!ANOMALOUS(ri->flags) && bgp_pgbgp_pathIsPrefix(ri->attr->aspath, at->aspath)) ++ found = true; ++ break; ++ } ++ } ++ ++ if (found) ++ goto UPP_DONE; ++ ++ /* ++ It's not in recent history, and there is a less specific currently in use ++ Response: ++ . Ignore this prefix ++ . Make the less specific's route for this neighbor suspicious ++ */ ++ ++ ++ pre->ignoreUntil = t_now + pgbgp->sub_sus_time; ++ ++ struct bgp_pgbgp_pathSet pathOrigins; ++ pathOrigins = bgp_pgbgp_pathOrigin (at->aspath); ++ for (int i = 0; i < pathOrigins.length; i++) ++ bgp_pgbgp_logSubprefixAnomaly (pathOrigins.ases[i], rn, at, supernode); ++ ++ ++ ++ r = XCALLOC (MTYPE_BGP_PGBGP_REUSE, sizeof (struct bgp_pgbgp_reuse)); ++ r->type = PGBGP_REUSE_PREFIX; ++ r->deprefUntil = pre->ignoreUntil; ++ r->data.prefix.rn = rn; ++ r->data.prefix.rnsuper = supernode; ++ bgp_lock_node (rn); ++ bgp_lock_node (supernode); ++ pqueue_enqueue (r, pgbgp->reuse_q); ++ pgbgp->rq_size += 1; ++ ++UPP_IGNORE: ++ // Sanity check ++ if (supernode == NULL) ++ goto UPP_DONE; ++ ++ /* Set the less specific's route from this peer to suspicious */ ++ changed = false; ++ ++ for (struct bgp_info * ri = supernode->info; ri; ri = ri->next) ++ { ++ if (ri->peer->as == binfo->peer->as) ++ { ++ if (!CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_P)) ++ { ++ SET_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_P); ++ changed = true; ++ } ++ break; ++ } ++ } ++ ++ // Make note of it in the less specific's history information ++ found = false; ++ struct bgp_pgbgp_hist *superhist = supernode->hist; ++ ++ if (superhist && superhist->p) ++ { ++ for (struct bgp_pgbgp_avoid * av = superhist->p->avoid; av; ++ av = av->next) ++ { ++ if (av->peerASN == binfo->peer->as) ++ { ++ if (av->avoidUntil < pre->ignoreUntil) ++ av->avoidUntil = pre->ignoreUntil; ++ found = true; ++ break; ++ } ++ } ++ if (!found) ++ { ++ struct bgp_pgbgp_avoid *newavoid = ++ XCALLOC (MTYPE_BGP_PGBGP_AVOID, sizeof (struct bgp_pgbgp_avoid)); ++ newavoid->peerASN = binfo->peer->as; ++ newavoid->avoidUntil = pre->ignoreUntil; ++ newavoid->next = superhist->p->avoid; ++ newavoid->sub = rn; ++ bgp_lock_node (rn); ++ superhist->p->avoid = newavoid; ++ } ++ } ++ /* ++ ignore this route unless the supernet's node ++ is only a placeholder from loaded pgbgp data ++ */ ++ if (bgp_pgbgp_shouldIgnore (supernode, bgp_pgbgp_selected (supernode))) ++ { ++ SET_FLAG (binfo->flags, BGP_INFO_IGNORED_P); ++ status = BGP_INFO_IGNORED_P; ++ } ++ if (changed) ++ { ++ struct bgp_info *ri = supernode->info; ++ bgp_process (ri->peer->bgp, supernode, supernode->table->afi, ++ supernode->table->safi); ++ } ++ ++UPP_DONE: ++ pre->lastSeen = t_now; ++ ++ return status; ++} ++ ++int ++bgp_pgbgp_reusePrefix (struct bgp_pgbgp_r_prefix data) ++{ ++ struct bgp_info *ri = NULL; ++ ++ time_t t_now = time (NULL); ++ ++ // Repreference all routes for this node ++ for (ri = data.rn->info; ri; ri = ri->next) ++ UNSET_FLAG (ri->flags, BGP_INFO_IGNORED_P); ++ ri = data.rn->info; ++ ++ // Rerun the decision process ++ if (ri != NULL) ++ bgp_process (ri->peer->bgp, data.rn, data.rn->table->afi, ++ data.rn->table->safi); ++ ++ ++ // Remove the avoid nodes from the super ++ struct bgp_pgbgp_hist *superhist = data.rnsuper->hist; ++ if (superhist != NULL && superhist->p != NULL) ++ { ++ struct bgp_pgbgp_avoid *parent = NULL; ++ for (struct bgp_pgbgp_avoid * av = superhist->p->avoid; av;) ++ { ++ int numChanged = 0; ++ if (av->avoidUntil <= t_now) ++ { ++ struct bgp_pgbgp_avoid *del = av; ++ av = av->next; ++ if (parent == NULL) ++ superhist->p->avoid = av; ++ else ++ parent->next = av; ++ ++ // Repreference any routes ++ for (ri = data.rnsuper->info; ri; ri = ri->next) ++ { ++ if (ri->peer->as == del->peerASN) ++ { ++ UNSET_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_P); ++ numChanged += 1; ++ break; ++ } ++ } ++ ri = data.rnsuper->info; ++ ++ if (numChanged > 0 && ri != NULL) ++ bgp_process (ri->peer->bgp, data.rnsuper, ++ data.rnsuper->table->afi, ++ data.rnsuper->table->safi); ++ bgp_unlock_node (del->sub); ++ XFREE (MTYPE_BGP_PGBGP_AVOID, del); ++ } ++ else ++ { ++ parent = av; ++ av = av->next; ++ } ++ } ++ } ++ ++ // Remove this prefix from the normal database ++ // if it hasn't been seen in the RIB since the last ++ // storage run ++ /* ++ struct bgp_pgbgp_hist *hist = rn->hist; ++ struct bgp_pgbgp_prefix * pre = hist->p; ++ ++ if (pre && pre->lastSeen < pgbgp->lastStore) ++ { ++ // Delete this node ++ for(struct bgp_pgbgp_avoid * av = hist->p->avoid; av;) ++ { ++ struct bgp_pgbgp_avoid *del = av; ++ av = av->next; ++ bgp_unlock_node(del->sub); ++ XFREE (MTYPE_BGP_PGBGP_AVOID, del); ++ } ++ XFREE(MTYPE_BGP_PGBGP_PREFIX, pre); ++ hist->p = NULL; ++ } ++ */ ++ bgp_unlock_node (data.rn); ++ bgp_unlock_node (data.rnsuper); ++ return 0; ++} ++ ++/*! --------------- Sub-Prefix Detection ------------------ !*/ ++ ++ ++ ++ ++ ++/* --------------- Edge Detection ------------------ */ ++ ++static void ++edge_store_clear_iterator (struct hash_backet *backet, void *file) ++{ ++ struct bgp_pgbgp_edge *hedge = backet->data; ++} ++ ++static void ++edge_store_iterator (struct hash_backet *backet, FILE * file) ++{ ++ struct bgp_pgbgp_edge *hedge = backet->data; ++ time_t t_now = time (NULL); ++ if (hedge->deprefUntil > t_now) ++ return; ++ if (hedge->lastSeen + pgbgp->edge_hist_time > t_now) ++ { ++ fprintf (file, "%d %u %u %lld\n", EDGE_ID, hedge->e.a, hedge->e.b, ++ (long long int) hedge->lastSeen); ++ } ++} ++ ++ ++void ++bgp_pgbgp_storeEdges (struct bgp_table *table, FILE * file) ++{ ++ hash_iterate (pgbgp->edgeT, ++ (void (*)(struct hash_backet *, void *)) ++ edge_store_iterator, file); ++ return; ++} ++ ++ ++int ++bgp_pgbgp_restoreEdge (FILE * file) ++{ ++ unsigned int a, b; ++ long long int lastSeen; ++ fscanf (file, "%u %u %lld", &a, &b, &lastSeen); ++ struct bgp_pgbgp_edge finder; ++ finder.e.a = a; ++ finder.e.b = b; ++ finder.lastSeen = lastSeen; ++ struct bgp_pgbgp_edge *hedge = ++ hash_get (pgbgp->edgeT, &finder, edge_hash_alloc); ++ hedge->lastSeen = finder.lastSeen; ++ return 0; ++} ++ ++unsigned int ++edge_key_make (void *p) ++{ ++ struct bgp_pgbgp_edge *pe = p; ++ struct edge *e = &pe->e; ++ return (e->a << 16) + e->b; ++} ++ ++static int ++edge_cmp (const void *arg1, const void *arg2) ++{ ++ ++ const struct edge *e1 = &((const struct bgp_pgbgp_edge *) arg1)->e; ++ const struct edge *e2 = &((const struct bgp_pgbgp_edge *) arg2)->e; ++ if (e1->a == e2->a && e1->b == e2->b) ++ return 1; ++ return 0; ++} ++ ++static void * ++edge_hash_alloc (void *arg) ++{ ++ struct bgp_pgbgp_edge *hedge = ++ XCALLOC (MTYPE_BGP_PGBGP_EDGE, sizeof (struct bgp_pgbgp_edge)); ++ struct bgp_pgbgp_edge *lookup = arg; ++ if (hedge == NULL) ++ return NULL; ++ hedge->e = lookup->e; ++ return hedge; ++} ++ ++ ++static void ++edge_gc_iterator (struct hash_backet *backet, time_t * time) ++{ ++ time_t t_now = *time; ++ struct bgp_pgbgp_edge *hedge = backet->data; ++ ++ int collect = false; ++ ++ // Collect if we haven't seen it in awhile ++ if (hedge->lastSeen + pgbgp->edge_hist_time <= t_now) ++ collect = true; ++ ++ // Collect if it has just gotten out of anomaly stage ++ // but hasn't been in the RIB since the last GC ++ if (hedge->deprefUntil != 0 && hedge->deprefUntil < t_now) ++ { ++ if (hedge->lastSeen < pgbgp->lastgc) ++ collect = true; ++ hedge->deprefUntil = 0; ++ } ++ ++ if (collect) ++ { ++ struct bgp_pgbgp_edge *ret = hash_release (pgbgp->edgeT, hedge); ++ assert (ret != NULL); ++ XFREE (MTYPE_BGP_PGBGP_EDGE, hedge); ++ } ++} ++ ++ ++ ++static void ++edge_update_iterator (struct hash_backet *backet, void *v) ++{ ++ struct aspath *p = backet->data; ++ time_t t_now = time (NULL); ++ int first = true; ++ ++ struct edge cur; ++ cur.a = 0; ++ cur.b = 0; ++ struct assegment *seg; ++ struct bgp_pgbgp_edge *hedge = NULL; ++ for (seg = p->segments; seg; seg = seg->next) ++ { ++ for (int i = 0; i < seg->length; i++) ++ { ++ cur.a = cur.b; ++ cur.b = seg->as[i]; ++ if (first) ++ { ++ first = false; ++ continue; ++ } ++ if (cur.a == cur.b) ++ continue; ++ // printf("%d -- %d\n", cur.a, cur.b); ++ struct bgp_pgbgp_edge finder; ++ finder.e = cur; ++ hedge = hash_lookup (pgbgp->edgeT, &finder); ++ ++ if (!hedge) ++ continue; ++ hedge->lastSeen = t_now; ++ } ++ } ++} ++ ++int ++bgp_pgbgp_garbageCollectEdges (struct bgp_table *table) ++{ ++ // Update the timings ++ hash_iterate (ashash, ++ (void (*)(struct hash_backet *, void *)) ++ edge_update_iterator, NULL); ++ ++ // Perform the collection ++ time_t t_now = time (NULL); ++ hash_iterate (pgbgp->edgeT, ++ (void (*)(struct hash_backet *, void *)) ++ edge_gc_iterator, &t_now); ++ return 0; ++} ++ ++static void ++edge_clean_iterator (struct hash_backet *backet, void *a1) ++{ ++ struct bgp_pgbgp_edge *hedge = backet->data; ++ struct bgp_pgbgp_edge *ret = hash_release (pgbgp->edgeT, hedge); ++ assert (ret != NULL); ++ XFREE (MTYPE_BGP_PGBGP_EDGE, hedge); ++} ++ ++static void ++bgp_pgbgp_cleanEdges (void) ++{ ++ if (pgbgp->edgeT != NULL) ++ { ++ hash_iterate (pgbgp->edgeT, ++ (void (*)(struct hash_backet *, void *)) ++ edge_clean_iterator, NULL); ++ hash_free (pgbgp->edgeT); ++ } ++ return; ++} ++ ++void ++bgp_pgbgp_logEdgeAnomaly (struct bgp_node *rn, struct attr *at, ++ struct edge *edge) ++{ ++ assert (pgbgp); ++ if (!pgbgp->anomalies) ++ return; ++ FILE *file = fopen (pgbgp->anomalies, "a"); ++ if (!file) ++ return; ++ ++ char pre[256]; ++ prefix2str (&rn->p, pre, sizeof (pre)); ++ ++ // EDGE | TIME | NEXTHOP | PREFIX | PATH | Edge.a | Edge.b ++ ++ fprintf (file, "%d|%lld|%s|%s|%s|%d|%d\n", EDGE, ++ (long long int) time (NULL), inet_ntoa (at->nexthop), pre, ++ aspath_print (at->aspath), edge->a, edge->b); ++ ++ fclose (file); ++} ++ ++ ++int ++bgp_pgbgp_updateEdge (struct bgp_pgbgp_hist *hist, struct bgp_info *binfo, ++ struct attr *at, struct bgp_node *rn, time_t t_now, ++ int newPeer) ++{ ++ ++ char first = true; ++ struct edge curEdge; ++ curEdge.a = 0; ++ curEdge.b = 0; ++ ++ ++ if (at->aspath == NULL) ++ return 0; ++ struct assegment *seg = at->aspath->segments; ++ if (seg == NULL) ++ return 0; ++ time_t max_depref = 0; ++ for (seg = at->aspath->segments; seg; seg = seg->next) ++ { ++ for (int i = 0; i < seg->length; i++) ++ { ++ curEdge.a = curEdge.b; ++ curEdge.b = seg->as[i]; ++ if (first) ++ { ++ first = false; ++ continue; ++ } ++ if (curEdge.a == curEdge.b) ++ continue; ++ ++ // We have an edge to consider ++ struct bgp_pgbgp_edge finder; ++ finder.e = curEdge; ++ struct bgp_pgbgp_edge *hedge = ++ hash_get (pgbgp->edgeT, &finder, edge_hash_alloc); ++ ++ // Is this edge marked as suspicious? ++ if (hedge->deprefUntil > t_now) ++ goto UPE_DEPREF; ++ ++ // Have we seen the edge recently? ++ if (hedge->lastSeen + pgbgp->edge_hist_time > t_now) ++ goto UPE_CLEAN; ++#ifndef PGBGP_DEBUG ++ /* Are we within the initial grace period? */ ++ if (newPeer) ++ goto UPE_CLEAN; ++#endif ++ // It must not be in recent history, depref edge for first time ++ hedge->deprefUntil = t_now + pgbgp->edge_sus_time; ++ bgp_pgbgp_logEdgeAnomaly (rn, at, &curEdge); ++ ++ ++ UPE_DEPREF: ++ if (hedge->deprefUntil > max_depref) ++ max_depref = hedge->deprefUntil; ++ UPE_CLEAN: ++ hedge->lastSeen = t_now; ++ } ++ } ++ if (max_depref) ++ { ++ SET_FLAG (binfo->flags, BGP_INFO_SUSPICIOUS_E); ++ if (!hist->pEdgeReuse) ++ { ++ struct bgp_pgbgp_reuse *r; ++ r = ++ XCALLOC (MTYPE_BGP_PGBGP_REUSE, sizeof (struct bgp_pgbgp_reuse)); ++ r->type = PGBGP_REUSE_EDGE; ++ r->deprefUntil = max_depref; ++ r->data.edge.rn = rn; ++ bgp_lock_node (rn); ++ pqueue_enqueue (r, pgbgp->reuse_q); ++ pgbgp->rq_size += 1; ++ hist->pEdgeReuse = r; ++ } ++ return BGP_INFO_SUSPICIOUS_E; ++ } ++ ++ return 0; ++} ++ ++int ++bgp_pgbgp_reuseEdge (struct bgp_pgbgp_r_edge data) ++{ ++ ++ // Okay, go through all of the paths for the prefix ++ // and find the path that needs to be updated next and ++ // enqueue it ++ time_t minMax = 0; ++ int numChanged = 0; ++ time_t t_now = time (NULL); ++ ++ for (struct bgp_info * ri = data.rn->info; ri; ri = ri->next) ++ { ++ char first = true; ++ struct edge curEdge = { 0, 0 }; ++ struct assegment *seg; ++ time_t max_depref = 0; ++ ++ for (seg = ri->attr->aspath->segments; seg; seg = seg->next) ++ { ++ for (int i = 0; i < seg->length; i++) ++ { ++ curEdge.a = curEdge.b; ++ curEdge.b = seg->as[i]; ++ if (first) ++ { ++ first = false; ++ continue; ++ } ++ struct bgp_pgbgp_edge finder; ++ finder.e = curEdge; ++ struct bgp_pgbgp_edge *hedge = ++ hash_lookup (pgbgp->edgeT, &finder); ++ if (!hedge) ++ continue; ++ // Is this edge suspicious? ++ if (hedge->deprefUntil > t_now ++ && hedge->deprefUntil > max_depref) ++ max_depref = hedge->deprefUntil; ++ } ++ } ++ ++ if (max_depref) ++ { ++ if (!minMax || max_depref < minMax) ++ minMax = max_depref; ++ } ++ else ++ { ++ if (CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_E)) ++ { ++ UNSET_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_E); ++ numChanged += 1; ++ } ++ } ++ } ++ struct bgp_info *ri = data.rn->info; ++ if (numChanged > 0 && ri) ++ bgp_process (ri->peer->bgp, data.rn, data.rn->table->afi, ++ data.rn->table->safi); ++ ++ struct bgp_pgbgp_hist *hist = data.rn->hist; ++ hist->pEdgeReuse = NULL; ++ ++ if (minMax) ++ { ++ struct bgp_pgbgp_reuse *r; ++ r = XCALLOC (MTYPE_BGP_PGBGP_REUSE, sizeof (struct bgp_pgbgp_reuse)); ++ r->type = PGBGP_REUSE_EDGE; ++ r->deprefUntil = minMax; ++ r->data.edge.rn = data.rn; ++ pqueue_enqueue (r, pgbgp->reuse_q); ++ pgbgp->rq_size += 1; ++ hist->pEdgeReuse = r; ++ } ++ else ++ { ++ bgp_unlock_node (data.rn); ++ } ++ ++ return 0; ++} ++ ++/*! --------------- Edge Detection ------------------ !*/ +--- /dev/null ++++ b/bgpd/bgp_pgbgp.h +@@ -0,0 +1,286 @@ ++/* BGP Pretty Good BGP ++ Copyright (C) 2008 University of New Mexico (Josh Karlin) ++ ++This file is part of GNU Zebra. ++ ++GNU Zebra is free software; you can redistribute it and/or modify it ++under the terms of the GNU General Public License as published by the ++Free Software Foundation; either version 2, or (at your option) any ++later version. ++ ++GNU Zebra is distributed in the hope that it will be useful, but ++WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GNU Zebra; see the file COPYING. If not, write to the Free ++Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ++02111-1307, USA. */ ++ ++#ifndef _QUAGGA_BGP_PGBGP_H ++#define _QUAGGA_BGP_PGBGP_H ++ ++#include "bgpd.h" ++#include "bgp_route.h" ++#include "table.h" ++ ++#define MOAS 0 ++#define SUBPREFIX 1 ++#define EDGE 2 ++ ++/* Global PGBGP data */ ++struct bgp_pgbgp_config ++{ ++ /* Depref time for a new origin AS */ ++ time_t origin_sus_time; ++ ++ /* Depref time for a new edge */ ++ time_t edge_sus_time; ++ ++ /* Depref time for a new sub-prefix */ ++ time_t sub_sus_time; ++ ++ /* Origin AS Mapping History Length */ ++ time_t origin_hist_time; ++ ++ /* Prefix Mapping History Length */ ++ time_t prefix_hist_time; ++ ++ /* Edge Mapping History Length */ ++ time_t edge_hist_time; ++ ++ /* Peer Mapping History Length */ ++ time_t peer_hist_time; ++ ++ /* The list of depreferenced routes */ ++ struct pqueue *reuse_q; ++ int rq_size; ++ ++ /* Time that the last garbage collection (gc) took place */ ++ time_t lastgc; ++ ++ /* History table */ ++ // struct route_table *histT; ++ ++ /* Edge Hash Table */ ++ struct hash *edgeT; ++ ++ /* File path for history storage */ ++ char *storage; ++ ++ /* File path for dump of anomalous routes */ ++ char *anomalies; ++ ++ /* The time that we last stored to disk */ ++ time_t lastStore; ++ ++ /* The time that PGBGP started counting */ ++ time_t startTime; ++ ++ /* Last time each peer was seen */ ++ struct bgp_pgbgp_peerTime *peerLast; ++ ++}; ++ ++ ++struct bgp_pgbgp_peerTime ++{ ++ struct bgp_pgbgp_peerTime *next; ++ time_t lastSeen; ++ union sockunion su; ++ time_t deprefUntil; ++}; ++ ++struct edge ++{ ++ as_t a; ++ as_t b; ++}; ++ ++/* ++ Avoid the neighbors for the less specific that told you about ++ the more specific ++ */ ++struct bgp_pgbgp_avoid ++{ ++ struct bgp_pgbgp_avoid *next; ++ time_t avoidUntil; ++ as_t peerASN; ++ struct bgp_node *sub; ++}; ++ ++/* A list of origin ASes for a path ++ Usually it's only one but if the last AS ++ in the path is an AS set, then the whole ++ set must be returned ++*/ ++struct bgp_pgbgp_pathSet ++{ ++ int length; ++ as_t *ases; ++}; ++ ++/* ++ Avoid paths with suspicious origins ++ */ ++struct bgp_pgbgp_origin ++{ ++ struct bgp_pgbgp_origin *next; ++ time_t lastSeen; ++ time_t deprefUntil; ++ as_t originAS; ++}; ++ ++/* ++ Ignore routes for this prefix ++ */ ++struct bgp_pgbgp_prefix ++{ ++ time_t lastSeen; ++ time_t ignoreUntil; ++ struct bgp_pgbgp_avoid *avoid; ++}; ++ ++struct bgp_pgbgp_edge ++{ ++ time_t lastSeen; ++ time_t deprefUntil; ++ struct edge e; ++}; ++ ++struct bgp_pgbgp_hist ++{ ++ struct bgp_pgbgp_origin *o; ++ struct bgp_pgbgp_prefix *p; ++ struct bgp_pgbgp_reuse *pEdgeReuse; ++}; ++ ++struct bgp_pgbgp_r_origin ++{ ++ as_t originAS; ++ struct bgp_node *rn; ++}; ++ ++struct bgp_pgbgp_r_prefix ++{ ++ struct bgp_node *rn; ++ struct bgp_node *rnsuper; ++}; ++ ++/* ++ This node contained a route with a bad edge, check ++ it again for bad edges in 24 hours ++*/ ++struct bgp_pgbgp_r_edge ++{ ++ struct bgp_node *rn; ++}; ++ ++ ++union reuseTypes ++{ ++ struct bgp_pgbgp_r_origin origin; ++ struct bgp_pgbgp_r_prefix prefix; ++ struct bgp_pgbgp_r_edge edge; ++}; ++ ++struct bgp_pgbgp_reuse ++{ ++ union reuseTypes data; ++ short type; ++ time_t deprefUntil; ++}; ++ ++#define ANOMALOUS(V) \ ++(CHECK_FLAG(V, BGP_INFO_SUSPICIOUS_O | BGP_INFO_SUSPICIOUS_P \ ++ | BGP_INFO_SUSPICIOUS_E | BGP_INFO_IGNORED_P)) ++ ++#define PGBGP_REUSE_ORIGIN 0 ++#define PGBGP_REUSE_PREFIX 1 ++#define PGBGP_REUSE_EDGE 2 ++ ++#define BGP_PGBGP_NONE 0 ++#define BGP_PGBGP_DEPREFFED 1 ++ ++// For storage ++#define ORIGIN_ID 0 ++#define PREFIX_ID 1 ++#define EDGE_ID 2 ++#define PEER_ID 3 ++ ++/* Default timing values */ ++#define DEFAULT_ORIGIN_SUS (86400 * 1) ++#define DEFAULT_EDGE_SUS (86400 * 1) ++#define DEFAULT_SUB_SUS (86400 * 1) ++#define DEFAULT_ORIGIN_HIST (86400 * 30) ++#define DEFAULT_PREFIX_HIST (86400 * 10) ++#define DEFAULT_EDGE_HIST (86400 * 60) ++// Time between garbage collections ++#define PGBGP_GC_DELTA (3600) ++// Time between file stores ++#define PGBGP_STORE_DELTA (28800) ++// Time that a new peer's routes are not considered suspicious ++#define PGBGP_PEER_GRACE (86400 * 1) ++ ++ ++ ++///////// PUBLIC PGBGP FUNCTIONS ///////// ++ ++/* ++ bgp_pgbgp_enable: ++ Enable PGBGP depreferencing / history tracking for this afi/safi ++ ++ Arguments: ++ . ost: Depref. time of new prefix origins (in hours) ++ . est: Depref. time of new edges (in hours) ++ . sst: Depref. time of new sub-prefixes (in hours) ++ . oht: Storage time of known origins for prefixes (in days) ++ . pht: Storage time of known prefixes (in days) ++ . eht: Storage time of known edges (in days) ++ . storage: File to periodically store history in (can be /dev/null) ++ . anoms: File to store history of depreferenced routes (can be /dev/null) ++ ++ Caution: ++ It is important that the storage times are longer than the depreference times ++*/ ++extern int bgp_pgbgp_enable (struct bgp *, afi_t afi, safi_t safi, int ost, ++ int est, int sst, int oht, int pht, int eht, ++ const char *storage, const char *anoms); ++extern int bgp_pgbgp_disable (struct bgp *, afi_t afi, safi_t safi); ++ ++/* ++ bgp_pgbgp_update: ++ Call on the event of an announcement update ++ ++ Arguments: ++ bgp_info: The route ++ at: The new route's attributes ++*/ ++extern int bgp_pgbgp_update (struct bgp_info *, struct attr *at, ++ struct bgp_node *); ++ ++/* ++ bgp_pgbgp_rib_updated: ++ Call upon discovery of a new best path (or lack thereof) ++ ++ This is a special case function for smoothly handling sub-prefix hijacks. ++ ++ It handles the following 2 events: ++ ++ Event 1: An anomalous sub-prefix is ignored, but no best route for the super-prefix exists ++ Response: Announce the sub-prefix until the super-prefix comes back ++ ++ Event 2: A super-prefix comes back to the RIB and its anomalous sub-prefix is in use ++ Response: Ignore the sub-prefix again ++ ++ Arguments: ++ rn: The route node that a new best path was found for ++ old_best: The old best route (NULL if one did not exist) ++ new_best: The current best route (NULL if one does not exist) ++ */ ++extern int ++bgp_pgbgp_rib_updated (struct bgp_node *rn, struct bgp_info *old_best, ++ struct bgp_info *new_best); ++ ++#endif +--- a/bgpd/bgp_route.c ++++ b/bgpd/bgp_route.c +@@ -51,6 +51,7 @@ Software Foundation, Inc., 59 Temple Pla + #include "bgpd/bgp_mplsvpn.h" + #include "bgpd/bgp_nexthop.h" + #include "bgpd/bgp_damp.h" ++#include "bgpd/bgp_pgbgp.h" + #include "bgpd/bgp_advertise.h" + #include "bgpd/bgp_zebra.h" + #include "bgpd/bgp_vty.h" +@@ -332,12 +333,19 @@ bgp_info_cmp (struct bgp *bgp, struct bg + int confed_as_route = 0; + int ret; + ++ + /* 0. Null check. */ + if (new == NULL) + return 0; + if (exist == NULL) + return 1; + ++ /* 0.5 PGBGP Depref. Check */ ++ if (ANOMALOUS(exist->flags) && !ANOMALOUS(new->flags)) ++ return 1; ++ if (!ANOMALOUS(exist->flags) && ANOMALOUS(new->flags)) ++ return 0; ++ + /* 1. Weight check. */ + if (new->attr->extra) + new_weight = new->attr->extra->weight; +@@ -1554,6 +1562,10 @@ bgp_process_main (struct work_queue *wq, + bgp_info_unset_flag (rn, new_select, BGP_INFO_ATTR_CHANGED); + } + ++ /* PGBGP needs to know about selected routes */ ++ if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP)) ++ bgp_pgbgp_rib_updated(rn, old_select, new_select); ++ + + /* Check each BGP peer. */ + for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) +@@ -1878,6 +1890,11 @@ bgp_update_rsclient (struct peer *rsclie + /* If the update is implicit withdraw. */ + if (ri) + { ++ /* Update PGBGP state, and mark the route as anomalous if necessary */ ++ if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP) ++ && peer_sort(peer) == BGP_PEER_EBGP) ++ bgp_pgbgp_update(ri, attr_new, rn); ++ + ri->uptime = bgp_clock (); + + /* Same attribute comes in. */ +@@ -2309,6 +2326,11 @@ bgp_update_main (struct peer *peer, stru + /* Increment prefix */ + bgp_aggregate_increment (bgp, p, new, afi, safi); + ++ /* Update PGBGP state, and mark the route as anomalous if necessary */ ++ if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP) ++ && peer_sort(peer) == BGP_PEER_EBGP) ++ bgp_pgbgp_update(new, attr_new, rn); ++ + /* Register new BGP information. */ + bgp_info_add (rn, new); + +@@ -5648,6 +5670,20 @@ enum bgp_display_type + static void + route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo) + { ++ if (ANOMALOUS(binfo->flags)) ++ { ++ vty_out(vty, "a["); ++ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_P)) ++ vty_out(vty, "i"); ++ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_O)) ++ vty_out(vty, "p"); ++ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_E)) ++ vty_out(vty, "e"); ++ if (CHECK_FLAG(binfo->flags, BGP_INFO_IGNORED_P)) ++ vty_out(vty, "s"); ++ vty_out(vty, "] "); ++ } ++ + /* Route status display. */ + if (CHECK_FLAG (binfo->flags, BGP_INFO_REMOVED)) + vty_out (vty, "R"); +@@ -6152,6 +6188,7 @@ route_vty_out_detail (struct vty *vty, s + } + + #define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s r RIB-failure, S Stale, R Removed%s" ++#define BGP_SHOW_PCODE_HEADER "Status code: a (anomalous) of: [p] prefix hijack, [s] sub-prefix hijack,%s [i] informant of sub-prefix [e] new edge%s" + #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s" + #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s" + #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s" +@@ -6183,7 +6220,8 @@ enum bgp_show_type + bgp_show_type_flap_route_map, + bgp_show_type_flap_neighbor, + bgp_show_type_dampend_paths, +- bgp_show_type_damp_neighbor ++ bgp_show_type_damp_neighbor, ++ bgp_show_type_anomalous_paths + }; + + static int +@@ -6350,11 +6388,17 @@ bgp_show_table (struct vty *vty, struct + || CHECK_FLAG (ri->flags, BGP_INFO_HISTORY)) + continue; + } ++ if (type == bgp_show_type_anomalous_paths) ++ { ++ if (! ANOMALOUS(ri->flags)) ++ continue; ++ } + + if (header) + { + vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id), VTY_NEWLINE); + vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); ++ vty_out (vty, BGP_SHOW_PCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); + vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); + if (type == bgp_show_type_dampend_paths + || type == bgp_show_type_damp_neighbor) +@@ -6432,6 +6476,7 @@ bgp_show (struct vty *vty, struct bgp *b + return bgp_show_table (vty, table, &bgp->router_id, type, output_arg); + } + ++ + /* Header of detailed BGP route information */ + static void + route_vty_out_detail_header (struct vty *vty, struct bgp *bgp, +@@ -11234,6 +11279,64 @@ DEFUN (bgp_damp_set, + half, reuse, suppress, max); + } + ++DEFUN (bgp_pgbgp_arg, ++ bgp_pgbgp_arg_cmd, ++ "bgp pgbgp <1-100> <1-100> <1-100> <1-365> <1-365> <1-365> WORD WORD", ++ "BGP Specific commands\n" ++ "Enable Pretty Good BGP\n" ++ "New origin depref time (in hours)\n" ++ "New edge depref time (in hours)\n" ++ "New sub-prefix depref time (in hours)\n" ++ "Origin history time (in days)\n" ++ "Prefix history time (in days)\n" ++ "Edge history time (in days)\n" ++ "Log file for history data\n" ++ "Log file of anomalies\n") ++{ ++ struct bgp *bgp; ++ ++ int ost = DEFAULT_ORIGIN_SUS; ++ int est = DEFAULT_EDGE_SUS; ++ int sst = DEFAULT_SUB_SUS; ++ int oht = DEFAULT_ORIGIN_HIST; ++ int pht = DEFAULT_PREFIX_HIST; ++ int eht = DEFAULT_EDGE_HIST; ++ const char* path = "/var/log/quagga/pgbgp_hist"; ++ const char* anoms = "/var/log/quagga/pgbgp_anomalies"; ++ ++ if (argc == 8) ++ { ++ VTY_GET_INTEGER("origin depref time", ost, argv[0]); ++ VTY_GET_INTEGER("edge depref time", est, argv[1]); ++ VTY_GET_INTEGER("sub-prefix depref time", sst, argv[2]); ++ VTY_GET_INTEGER("origin history time", oht, argv[3]); ++ VTY_GET_INTEGER("prefix history time", pht, argv[4]); ++ VTY_GET_INTEGER("edge history time", eht, argv[5]); ++ path = argv[6]; ++ anoms = argv[7]; ++ } ++ ++ bgp = vty->index; ++ return bgp_pgbgp_enable(bgp, bgp_node_afi (vty), bgp_node_safi (vty), ++ ost, est, sst, oht, pht, eht, path, anoms); ++} ++ ++ALIAS (bgp_pgbgp_arg, ++ bgp_pgbgp_cmd, ++ "bgp pgbgp", ++ "BGP specific commands\n" ++ "Enable Pretty Good BGP\n") ++ ++DEFUN (bgp_pgbgp_unset, ++ bgp_pgbgp_unset_cmd, ++ "no bgp pgbgp\n", ++ "BGP specific commands\n") ++{ ++ struct bgp *bgp; ++ bgp = vty->index; ++ return bgp_pgbgp_disable (bgp, bgp_node_afi (vty), bgp_node_safi (vty)); ++} ++ + ALIAS (bgp_damp_set, + bgp_damp_set2_cmd, + "bgp dampening <1-45>", +@@ -11283,6 +11386,19 @@ DEFUN (show_ip_bgp_dampened_paths, + NULL); + } + ++DEFUN (show_ip_bgp_anomalous_paths, ++ show_ip_bgp_anomalous_paths_cmd, ++ "show ip bgp anomalous-paths", ++ SHOW_STR ++ IP_STR ++ BGP_STR ++ "Display anomalous paths (less likely to be used)\n") ++{ ++ return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_anomalous_paths, ++ NULL); ++} ++ ++ + DEFUN (show_ip_bgp_flap_statistics, + show_ip_bgp_flap_statistics_cmd, + "show ip bgp flap-statistics", +@@ -11828,6 +11944,7 @@ bgp_route_init (void) + install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); + install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); + install_element (VIEW_NODE, &show_ip_bgp_dampened_paths_cmd); ++ install_element (VIEW_NODE, &show_ip_bgp_anomalous_paths_cmd); + install_element (VIEW_NODE, &show_ip_bgp_flap_statistics_cmd); + install_element (VIEW_NODE, &show_ip_bgp_flap_address_cmd); + install_element (VIEW_NODE, &show_ip_bgp_flap_prefix_cmd); +@@ -11935,6 +12052,7 @@ bgp_route_init (void) + install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_dampened_paths_cmd); ++ install_element (ENABLE_NODE, &show_ip_bgp_anomalous_paths_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_flap_statistics_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_flap_address_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_flap_prefix_cmd); +@@ -12293,6 +12411,10 @@ bgp_route_init (void) + install_element (BGP_IPV4_NODE, &bgp_damp_set3_cmd); + install_element (BGP_IPV4_NODE, &bgp_damp_unset_cmd); + install_element (BGP_IPV4_NODE, &bgp_damp_unset2_cmd); ++ ++ install_element (BGP_NODE, &bgp_pgbgp_cmd); ++ install_element (BGP_NODE, &bgp_pgbgp_arg_cmd); ++ install_element (BGP_NODE, &bgp_pgbgp_unset_cmd); + } + + void +--- a/bgpd/bgp_route.h ++++ b/bgpd/bgp_route.h +@@ -1,3 +1,4 @@ ++ + /* BGP routing information base + Copyright (C) 1996, 97, 98, 2000 Kunihiro Ishiguro + +@@ -76,6 +77,10 @@ struct bgp_info + #define BGP_INFO_STALE (1 << 8) + #define BGP_INFO_REMOVED (1 << 9) + #define BGP_INFO_COUNTED (1 << 10) ++#define BGP_INFO_SUSPICIOUS_O (1 << 11) ++#define BGP_INFO_SUSPICIOUS_P (1 << 12) ++#define BGP_INFO_IGNORED_P (1 << 13) ++#define BGP_INFO_SUSPICIOUS_E (1 << 14) + + /* BGP route type. This can be static, RIP, OSPF, BGP etc. */ + u_char type; +@@ -123,7 +128,7 @@ struct bgp_static + + /* Flags which indicate a route is unuseable in some form */ + #define BGP_INFO_UNUSEABLE \ +- (BGP_INFO_HISTORY|BGP_INFO_DAMPED|BGP_INFO_REMOVED) ++ (BGP_INFO_HISTORY|BGP_INFO_DAMPED|BGP_INFO_REMOVED|BGP_INFO_IGNORED_P) + /* Macro to check BGP information is alive or not. Sadly, + * not equivalent to just checking previous, because of the + * sense of the additional VALID flag. +--- a/bgpd/bgp_table.h ++++ b/bgpd/bgp_table.h +@@ -63,6 +63,8 @@ struct bgp_node + + unsigned int lock; + ++ struct bgp_pgbgp_hist *hist; ++ + u_char flags; + #define BGP_NODE_PROCESS_SCHEDULED (1 << 0) + }; +--- a/bgpd/bgpd.h ++++ b/bgpd/bgpd.h +@@ -121,6 +121,7 @@ struct bgp + /* BGP Per AF flags */ + u_int16_t af_flags[AFI_MAX][SAFI_MAX]; + #define BGP_CONFIG_DAMPENING (1 << 0) ++#define BGP_CONFIG_PGBGP (1 << 1) + + /* Static route configuration. */ + struct bgp_table *route[AFI_MAX][SAFI_MAX]; +--- a/lib/hash.c ++++ b/lib/hash.c +@@ -156,6 +156,35 @@ hash_iterate (struct hash *hash, + } + } + ++/* ++ Iterates until 0 is returned or until completion ++ Return: 1 if iteration completed ++ Return: 0 if iteration was interrupted ++*/ ++ ++int ++hash_iterate_until(struct hash *hash, ++ int (*func) (struct hash_backet *, void *), void *arg) ++{ ++ unsigned int i; ++ struct hash_backet *hb; ++ struct hash_backet *hbnext; ++ int ret; ++ ++ for (i = 0; i < hash->size; i++) ++ for (hb = hash->index[i]; hb; hb = hbnext) ++ { ++ /* get pointer to next hash backet here, in case (*func) ++ * decides to delete hb by calling hash_release ++ */ ++ hbnext = hb->next; ++ ret = (*func) (hb, arg); ++ if (!ret) ++ return 0; ++ } ++ return 1; ++} ++ + /* Clean up hash. */ + void + hash_clean (struct hash *hash, void (*free_func) (void *)) +--- a/lib/hash.h ++++ b/lib/hash.h +@@ -66,7 +66,8 @@ extern void *hash_release (struct hash *, void *); + + extern void hash_iterate (struct hash *, + void (*) (struct hash_backet *, void *), void *); +- ++extern int hash_iterate_until(struct hash *, ++ int (*) (struct hash_backet *, void *), void *); + extern void hash_clean (struct hash *, void (*) (void *)); + extern void hash_free (struct hash *); + +--- a/lib/memtypes.c ++++ b/lib/memtypes.c +@@ -147,6 +147,15 @@ struct memory_list memory_list_bgp[] = + { MTYPE_PEER_UPDATE_SOURCE, "BGP peer update interface" }, + { MTYPE_BGP_DAMP_INFO, "Dampening info" }, + { MTYPE_BGP_DAMP_ARRAY, "BGP Dampening array" }, ++ { 0, NULL }, ++ { MTYPE_BGP_PGBGP_ORIGIN, "BGP PGBGP Origin AS Node" }, ++ { MTYPE_BGP_PGBGP_PREFIX, "BGP PGBGP Prefix AS Node" }, ++ { MTYPE_BGP_PGBGP_EDGE, "BGP PGBGP Edge Node" }, ++ { MTYPE_BGP_PGBGP_REUSE, "BGP PGBGP Reuse Node" }, ++ { MTYPE_BGP_PGBGP_HIST, "BGP PGBGP History Node" }, ++ { MTYPE_BGP_PGBGP_AVOID, "BGP PGBGP Avoid Peer Node" }, ++ { MTYPE_BGP_PGBGP_PEER, "BGP PGBGP Peer Timing" }, ++ { 0, NULL }, + { MTYPE_BGP_REGEXP, "BGP regexp" }, + { MTYPE_BGP_AGGREGATE, "BGP aggregate" }, + { -1, NULL } diff --git a/patches/161-pgbgp-addon.patch b/patches/161-pgbgp-addon.patch new file mode 100644 index 0000000..f072f0e --- /dev/null +++ b/patches/161-pgbgp-addon.patch @@ -0,0 +1,317 @@ +From: Paul Jakma +Date: Thu, 4 Sep 2008 22:27:13 +0000 (+0100) +Subject: [bgp/pgbgp] Add some pgbgp commands to restricted-mode and other command tweaks +X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6021635e9e1e5105c3e22bf7eb0d6c3 + +[bgp/pgbgp] Add some pgbgp commands to restricted-mode and other command tweaks + +* bgp_pgbgp.c: + (edge_neighbor_iterator) make ASN==0 mean 'iterate over all ASNs' + (bgp_pgbgp_stats_origin_one) new function, to display one origin AS status. + (bgp_pgbgp_stats_origins) adapt to use previous. + Adapt to iterate over all stats if no prefix was giving. + (show_ip_bgp_pgbgp_neighbors_cmd) recognise no ASN argument case + (show_ip_bgp_pgbgp_neighbors_all_cmd) Iterate over all + (show_ip_bgp_pgbgp_origins_cmd) similar + (show_ip_bgp_pgbgp_origins_all_cmd) + (bgp_pgbgp_enable) install the lookup commands to ther new RESTRICTED_NODE +* bgp_route.c: + (route_vty_short_status_out) only allowed to print one char for anomalous + status. + (route_vty_out_detail) Add support for printing out more detail on + PG-BGP status +--- + +--- a/bgpd/bgp_pgbgp.c ++++ b/bgpd/bgp_pgbgp.c +@@ -225,7 +225,7 @@ static void + edge_neighbor_iterator (struct hash_backet *backet, struct nsearch *pns) + { + struct bgp_pgbgp_edge *hedge = backet->data; +- if ((hedge->e.a == pns->asn || hedge->e.b == pns->asn) ++ if ((!pns->asn || hedge->e.a == pns->asn || hedge->e.b == pns->asn) + && hedge->e.a != hedge->e.b) + { + struct vty *vty = pns->pvty; +@@ -252,13 +252,39 @@ bgp_pgbgp_stats_neighbors (struct vty *vty, afi_t afi, safi_t safi, as_t asn) + return CMD_SUCCESS; + } + ++static void ++bgp_pgbgp_stats_origin_one (struct vty *vty, struct bgp_node *rn, ++ time_t t_now) ++{ ++ char str[INET6_BUFSIZ]; ++ ++ if (!rn->hist) ++ return; ++ ++ prefix2str (&rn->p, str, sizeof(str)); ++ vty_out (vty, "%s%s", str, VTY_NEWLINE); ++ ++ for (struct bgp_pgbgp_origin * cur = rn->hist->o; cur != NULL; ++ cur = cur->next) ++ { ++ if (cur->deprefUntil > t_now) ++ vty_out (vty, "Untrusted Origin AS: %d%s", cur->originAS, ++ VTY_NEWLINE); ++ else ++ vty_out (vty, "Trusted Origin AS: %d%s", cur->originAS, ++ VTY_NEWLINE); ++ } ++} ++ + static int + bgp_pgbgp_stats_origins (struct vty *vty, afi_t afi, safi_t safi, + const char *prefix) + { + struct bgp *bgp; + struct bgp_table *table; ++ struct bgp_node *rn; + time_t t_now = time (NULL); ++ + bgp = bgp_get_default (); + if (bgp == NULL) + return CMD_WARNING; +@@ -267,28 +293,22 @@ bgp_pgbgp_stats_origins (struct vty *vty, afi_t afi, safi_t safi, + table = bgp->rib[afi][safi]; + if (table == NULL) + return CMD_WARNING; +- +- struct prefix p; +- str2prefix (prefix, &p); +- struct bgp_node *rn = bgp_node_match (table, &p); +- vty_out (vty, "%s%s", prefix, VTY_NEWLINE); +- if (rn) ++ ++ if (prefix) + { ++ struct prefix p; ++ str2prefix (prefix, &p); ++ rn = bgp_node_match (table, &p); + if (rn->hist) +- { +- for (struct bgp_pgbgp_origin * cur = rn->hist->o; cur != NULL; +- cur = cur->next) +- { +- if (cur->deprefUntil > t_now) +- vty_out (vty, "Untrusted Origin AS: %d%s", cur->originAS, +- VTY_NEWLINE); +- else +- vty_out (vty, "Trusted Origin AS: %d%s", cur->originAS, +- VTY_NEWLINE); +- } +- } ++ bgp_pgbgp_stats_origin_one (vty, rn, t_now); + bgp_unlock_node (rn); ++ return CMD_SUCCESS; + } ++ ++ for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn)) ++ if (rn->hist) ++ bgp_pgbgp_stats_origin_one (vty, rn, t_now); ++ + return CMD_SUCCESS; + } + +@@ -375,7 +395,7 @@ bgp_pgbgp_stats (struct vty *vty, afi_t afi, safi_t safi) + DEFUN (show_ip_bgp_pgbgp, + show_ip_bgp_pgbgp_cmd, + "show ip bgp pgbgp", +- SHOW_STR IP_STR BGP_STR "Display PGBGP statistics\n") ++ SHOW_STR IP_STR BGP_STR "Pretty-Good BGP statistics\n") + { + return bgp_pgbgp_stats (vty, AFI_IP, SAFI_UNICAST); + } +@@ -383,29 +403,46 @@ DEFUN (show_ip_bgp_pgbgp, + DEFUN (show_ip_bgp_pgbgp_neighbors, + show_ip_bgp_pgbgp_neighbors_cmd, + "show ip bgp pgbgp neighbors WORD", +- SHOW_STR +- IP_STR +- BGP_STR +- "BGP pgbgp\n" +- "BGP pgbgp neighbors\n" "ASN whos neighbors should be displayed\n") ++ SHOW_STR IP_STR BGP_STR ++ "Pretty-Good BGP statistics\n" ++ "PG-BGP neighbor information\n" ++ "AS to show neighbors of\n") + { + return bgp_pgbgp_stats_neighbors (vty, AFI_IP, SAFI_UNICAST, +- atoi (argv[0])); ++ argc == 1 ? atoi (argv[0]) : 0); + } + ++ALIAS (show_ip_bgp_pgbgp_neighbors, ++ show_ip_bgp_pgbgp_neighbors_all_cmd, ++ "show ip bgp pgbgp neighbors", ++ SHOW_STR ++ IP_STR ++ BGP_STR ++ "Pretty-Good BGP statistics\n" ++ "PG-BGP neighbors information\n") ++ + DEFUN (show_ip_bgp_pgbgp_origins, + show_ip_bgp_pgbgp_origins_cmd, + "show ip bgp pgbgp origins A.B.C.D/M", + SHOW_STR + IP_STR + BGP_STR +- "BGP pgbgp\n" +- "BGP pgbgp neighbors\n" "Prefix to look up origin ASes of\n") ++ "Pretty-Good BGP statistics\n" ++ "PG-BGP prefix origin information\n" ++ "Prefix to look up origin ASes of\n") + { +- return bgp_pgbgp_stats_origins (vty, AFI_IP, SAFI_UNICAST, argv[0]); ++ return bgp_pgbgp_stats_origins (vty, AFI_IP, SAFI_UNICAST, ++ argc == 1 ? argv[0] : NULL); + } + +- ++ALIAS (show_ip_bgp_pgbgp_origins, ++ show_ip_bgp_pgbgp_origins_all_cmd, ++ "show ip bgp pgbgp origins", ++ SHOW_STR ++ IP_STR ++ BGP_STR ++ "Pretty-Good BGP statistics\n" ++ "PG-BGP prefixes origin information") + + + /*! --------------- VTY (others exist in bgp_route.c) ------------------ !*/ +@@ -747,12 +784,19 @@ bgp_pgbgp_enable (struct bgp *bgp, afi_t afi, safi_t safi, + pgbgp->lastgc = time (NULL); + pgbgp->lastStore = time (NULL); + pgbgp->startTime = time (NULL); ++ install_element (RESTRICTED_NODE, &show_ip_bgp_pgbgp_cmd); ++ install_element (RESTRICTED_NODE, &show_ip_bgp_pgbgp_neighbors_cmd); ++ install_element (RESTRICTED_NODE, &show_ip_bgp_pgbgp_origins_cmd); + install_element (VIEW_NODE, &show_ip_bgp_pgbgp_cmd); +- install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_cmd); + install_element (VIEW_NODE, &show_ip_bgp_pgbgp_neighbors_cmd); +- install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_neighbors_cmd); + install_element (VIEW_NODE, &show_ip_bgp_pgbgp_origins_cmd); ++ install_element (VIEW_NODE, &show_ip_bgp_pgbgp_neighbors_all_cmd); ++ install_element (VIEW_NODE, &show_ip_bgp_pgbgp_origins_all_cmd); ++ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_cmd); ++ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_neighbors_cmd); + install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_origins_cmd); ++ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_neighbors_all_cmd); ++ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_origins_all_cmd); + pgbgp->edgeT = hash_create_size (131072, edge_key_make, edge_cmp); + bgp_pgbgp_restore (); + return 0; +--- a/bgpd/bgp_route.c ++++ b/bgpd/bgp_route.c +@@ -5670,20 +5670,6 @@ enum bgp_display_type + static void + route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo) + { +- if (ANOMALOUS(binfo->flags)) +- { +- vty_out(vty, "a["); +- if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_P)) +- vty_out(vty, "i"); +- if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_O)) +- vty_out(vty, "p"); +- if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_E)) +- vty_out(vty, "e"); +- if (CHECK_FLAG(binfo->flags, BGP_INFO_IGNORED_P)) +- vty_out(vty, "s"); +- vty_out(vty, "] "); +- } +- + /* Route status display. */ + if (CHECK_FLAG (binfo->flags, BGP_INFO_REMOVED)) + vty_out (vty, "R"); +@@ -5699,6 +5685,17 @@ route_vty_short_status_out (struct vty * + /* Selected */ + if (CHECK_FLAG (binfo->flags, BGP_INFO_HISTORY)) + vty_out (vty, "h"); ++ else if (ANOMALOUS(binfo->flags)) ++ { ++ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_O)) ++ vty_out(vty, "p"); ++ else if (CHECK_FLAG(binfo->flags, BGP_INFO_IGNORED_P)) ++ vty_out(vty, "P"); ++ else if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_P)) ++ vty_out(vty, "a"); ++ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_E)) ++ vty_out(vty, "a"); ++ } + else if (CHECK_FLAG (binfo->flags, BGP_INFO_DAMPED)) + vty_out (vty, "d"); + else if (CHECK_FLAG (binfo->flags, BGP_INFO_SELECTED)) +@@ -6180,15 +6177,31 @@ route_vty_out_detail (struct vty *vty, s + if (binfo->extra && binfo->extra->damp_info) + bgp_damp_info_vty (vty, binfo); + +- /* Line 7 display Uptime */ ++ /* 8: PGBGP status */ ++ if (ANOMALOUS(binfo->flags)) ++ { ++ vty_out (vty, " Anomalous:"); ++ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_P)) ++ vty_out (vty, " divergent sub-prefixes,"); ++ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_O)) ++ vty_out (vty, " origin AS (prefix hijack?),"); ++ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_E)) ++ vty_out (vty, " new edge in path,"); ++ if (CHECK_FLAG(binfo->flags, BGP_INFO_IGNORED_P)) ++ vty_out (vty, " origin AS (sub-prefix hijack?),"); ++ vty_out (vty, "%s", VTY_NEWLINE); ++ } ++ ++ /* Line 9 display Uptime */ + time_t tbuf = time(NULL) - (bgp_clock() - binfo->uptime); + vty_out (vty, " Last update: %s", ctime(&tbuf)); + } + vty_out (vty, "%s", VTY_NEWLINE); + } + +-#define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s r RIB-failure, S Stale, R Removed%s" +-#define BGP_SHOW_PCODE_HEADER "Status code: a (anomalous) of: [p] prefix hijack, [s] sub-prefix hijack,%s [i] informant of sub-prefix [e] new edge%s" ++#define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s" \ ++ " r RIB-failure, S Stale, R Removed, %s" \ ++ " p prefix hijack, P sub-prefix hijack, a other anomaly%s" + #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s" + #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s" + #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s" +@@ -6397,8 +6410,7 @@ bgp_show_table (struct vty *vty, struct + if (header) + { + vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id), VTY_NEWLINE); +- vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); +- vty_out (vty, BGP_SHOW_PCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); ++ vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); + if (type == bgp_show_type_dampend_paths + || type == bgp_show_type_damp_neighbor) +@@ -9663,7 +9675,7 @@ show_adj_route (struct vty *vty, struct + PEER_STATUS_DEFAULT_ORIGINATE)) + { + vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); +- vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); ++ vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); + + vty_out (vty, "Originating default network 0.0.0.0%s%s", +@@ -9680,7 +9692,7 @@ show_adj_route (struct vty *vty, struct + if (header1) + { + vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); +- vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); ++ vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); + header1 = 0; + } +@@ -9704,7 +9716,7 @@ show_adj_route (struct vty *vty, struct + if (header1) + { + vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); +- vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); ++ vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); + header1 = 0; + } From 129e1392204f5410cf20ef88543291a42dc570b1 Mon Sep 17 00:00:00 2001 From: acoul Date: Tue, 11 Jan 2011 15:37:47 +0000 Subject: [PATCH 066/117] net/quagga: fix a compile issue on pgbgp (thank you acinonyx) git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24967 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9ad6ceb..27dbd62 100644 --- a/Makefile +++ b/Makefile @@ -181,7 +181,7 @@ CONFIGURE_ARGS+= \ $(call autoconf_bool,CONFIG_PACKAGE_quagga-vtysh,vtysh) \ MAKE_FLAGS += \ - CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE" + CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE -std=gnu99" define Build/Configure (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \ From 2199ceca66001d3c63ece00704aa8440e3865b29 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Thu, 13 Jan 2011 00:13:57 +0000 Subject: [PATCH 067/117] [packages] quagga: Remove libpthread dependency and bogus make flags git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24971 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 27dbd62..50eb7a0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2010 OpenWrt.org +# Copyright (C) 2006-2011 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -10,12 +10,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga ifneq ($(CONFIG_QUAGGA_OLD),) PKG_VERSION:=0.98.6 - PKG_RELEASE:=8 + PKG_RELEASE:=9 PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 PATCH_DIR:=./patches-old else PKG_VERSION:=0.99.17 - PKG_RELEASE:=5 + PKG_RELEASE:=6 PKG_MD5SUM:=37b9022adca04b03863d2d79787e643f endif @@ -43,7 +43,7 @@ include $(INCLUDE_DIR)/package.mk define Package/quagga/Default SECTION:=net CATEGORY:=Network - DEPENDS:=quagga +libpthread + DEPENDS:=quagga TITLE:=The Quagga Software Routing Suite URL:=http://www.quagga.net MAINTAINER:=Vasilis Tsiligiannis @@ -160,8 +160,6 @@ CONFIG_PACKAGE_quagga-ripngd:=m CONFIG_PACKAGE_quagga-vtysh:=m endif -TARGET_LDFLAGS += -lpthread - CONFIGURE_ARGS+= \ --localstatedir=/var/run/quagga \ --sysconfdir=/etc/quagga/ \ @@ -181,7 +179,7 @@ CONFIGURE_ARGS+= \ $(call autoconf_bool,CONFIG_PACKAGE_quagga-vtysh,vtysh) \ MAKE_FLAGS += \ - CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE -std=gnu99" + CFLAGS="$(TARGET_CFLAGS) -std=gnu99" define Build/Configure (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \ From 008d8cb3a05a1b4e5efea4a4bc8db683760d8b81 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Thu, 13 Jan 2011 00:14:03 +0000 Subject: [PATCH 068/117] [packages] quagga: Revert community related memleak fixes until properly implemented git-svn-id: svn+ssh://svn.openwrt.org/openwrt@24972 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- ...083-Intern_communities_in_route_maps.patch | 91 ------------------- .../999-PW-8261-memleak_del_community.patch | 37 -------- 3 files changed, 1 insertion(+), 129 deletions(-) delete mode 100644 patches/999-PW-8083-Intern_communities_in_route_maps.patch delete mode 100644 patches/999-PW-8261-memleak_del_community.patch diff --git a/Makefile b/Makefile index 50eb7a0..42ad5b4 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ ifneq ($(CONFIG_QUAGGA_OLD),) PATCH_DIR:=./patches-old else PKG_VERSION:=0.99.17 - PKG_RELEASE:=6 + PKG_RELEASE:=7 PKG_MD5SUM:=37b9022adca04b03863d2d79787e643f endif diff --git a/patches/999-PW-8083-Intern_communities_in_route_maps.patch b/patches/999-PW-8083-Intern_communities_in_route_maps.patch deleted file mode 100644 index dde6f2b..0000000 --- a/patches/999-PW-8083-Intern_communities_in_route_maps.patch +++ /dev/null @@ -1,91 +0,0 @@ -From patchwork Sat Jul 24 16:44:07 2010 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [quagga-dev,8083,3/3] bgpd: "Intern" communities in route maps -Date: Sat, 24 Jul 2010 15:44:07 -0000 -From: Michael Lambert -X-Patchwork-Id: 253 -Message-Id: <201007241836.o6OIa8gR023592@tesla.psc.edu> -To: quagga-dev@lists.quagga.net - -* bgp_community.[ch]: (community_lookup) New helper function to look - up a community list in the hash table. - -* bgp_routemap.c: A new community structure was being allocated for - every BGP update which matched a route map which set a community. - This behavior led to rapid growth in the memory consumed by bgpd. - Adding the communities to the hash table addresses the memory - growth, but may introduce a problem in modifying or deleting the - 'set community' statement in the route map. - ---- -bgpd/bgp_community.c | 7 +++++++ - bgpd/bgp_community.h | 1 + - bgpd/bgp_routemap.c | 8 +++++--- - 3 files changed, 13 insertions(+), 3 deletions(-) - ---- a/bgpd/bgp_community.c -+++ b/bgpd/bgp_community.c -@@ -292,6 +292,13 @@ community_com2str (struct community *co - return str; - } - -+/* Find an 'intern'ed community structure */ -+struct community * -+community_lookup (struct community *com) -+{ -+ return (struct community *) hash_lookup (comhash, com); -+} -+ - /* Intern communities attribute. */ - struct community * - community_intern (struct community *com) ---- a/bgpd/bgp_community.h -+++ b/bgpd/bgp_community.h -@@ -70,5 +70,6 @@ extern int community_include (struct com - extern void community_del_val (struct community *, u_int32_t *); - extern unsigned long community_count (void); - extern struct hash *community_hash (void); -+extern struct community *community_lookup (struct community *); - - #endif /* _QUAGGA_BGP_COMMUNITY_H */ ---- a/bgpd/bgp_routemap.c -+++ b/bgpd/bgp_routemap.c -@@ -1389,7 +1389,7 @@ route_set_community (void *rule, struct - new = community_dup (rcs->com); - - /* will be interned by caller if required */ -- attr->community = new; -+ attr->community = community_intern (new); - - attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES); - } -@@ -1403,6 +1403,7 @@ route_set_community_compile (const char - { - struct rmap_com_set *rcs; - struct community *com = NULL; -+ struct community *comint; - char *sp; - int additive = 0; - int none = 0; -@@ -1429,8 +1430,9 @@ route_set_community_compile (const char - return NULL; - } - -+ comint = community_intern (com); - rcs = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct rmap_com_set)); -- rcs->com = com; -+ rcs->com = comint; - rcs->additive = additive; - rcs->none = none; - -@@ -1493,7 +1495,7 @@ route_set_community_delete (void *rule, - } - else - { -- binfo->attr->community = new; -+ binfo->attr->community = community_intern (new); - binfo->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES); - } - } diff --git a/patches/999-PW-8261-memleak_del_community.patch b/patches/999-PW-8261-memleak_del_community.patch deleted file mode 100644 index 662fe8f..0000000 --- a/patches/999-PW-8261-memleak_del_community.patch +++ /dev/null @@ -1,37 +0,0 @@ -From patchwork Mon Sep 13 15:48:11 2010 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [quagga-dev,8261] bgpd: fix memory leak when deleting a community -Date: Mon, 13 Sep 2010 14:48:11 -0000 -From: Michael Lambert -X-Patchwork-Id: 281 -Message-Id: <20100913171959.5276EAAAC32@ebola.psc.edu> -To: quagga-dev@lists.quagga.net -Cc: lambert@psc.edu - -* bgp_routemap.c: (route_set_community_delete) When deleting a - community in a route-map the old community was being orphaned. Like - the description of the same code in route_set_community, this is a - hack, not a true fix. - ---- -bgpd/bgp_routemap.c | 7 +++++++ - 1 files changed, 7 insertions(+), 0 deletions(-) - ---- a/bgpd/bgp_routemap.c -+++ b/bgpd/bgp_routemap.c -@@ -1487,6 +1487,13 @@ route_set_community_delete (void *rule, - new = community_uniq_sort (merge); - community_free (merge); - -+ /* HACK: if the old community is not intern'd, -+ * we should free it here, or all reference to it may be lost. -+ * Really need to cleanup attribute caching sometime. -+ */ -+ if (old->refcnt == 0) -+ community_free (old); -+ - if (new->size == 0) - { - binfo->attr->community = NULL; From a5121ada7665c93d685f11c41ebd9697a1971fd1 Mon Sep 17 00:00:00 2001 From: acoul Date: Mon, 21 Feb 2011 13:16:44 +0000 Subject: [PATCH 069/117] net/quagga: add an upstream pending patch git-svn-id: svn+ssh://svn.openwrt.org/openwrt@25650 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/000-upstream-bgp_lock_node.patch | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 patches/000-upstream-bgp_lock_node.patch diff --git a/patches/000-upstream-bgp_lock_node.patch b/patches/000-upstream-bgp_lock_node.patch new file mode 100644 index 0000000..77f6400 --- /dev/null +++ b/patches/000-upstream-bgp_lock_node.patch @@ -0,0 +1,31 @@ +From: Barry Friedman +Date: Thu, 3 Feb 2011 22:02:53 +0000 (-0800) +Subject: bgpd: Remove extra lock on interior table node +X-Git-Url: http://git.ozo.com/?p=quagga-next.git;a=commitdiff_plain;h=765ec33b44a7d8cf9290acd19dc19953df4ddb0d + +bgpd: Remove extra lock on interior table node + +If the radix tree creates an extra interior node in bgp_node_get(), +it locks the interior node even though this node is not returned to +the caller, so it may never be unlocked. The lock prevents this node +from being deleted. + +* bgpd/bgp_table.c + * bgp_node_get(): Remove lock on interior node which prevents + proper node deletion + +Signed-off-by: Barry Friedman +--- + +diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c +index 91cab60..a249c23 100644 +--- a/bgpd/bgp_table.c ++++ b/bgpd/bgp_table.c +@@ -350,7 +350,6 @@ bgp_node_get (struct bgp_table *const table, struct prefix *p) + if (new->p.prefixlen != p->prefixlen) + { + match = new; +- bgp_lock_node (match); + new = bgp_node_set (table, p); + set_link (match, new); + table->count++; From fc7fc943bce30c19728177e14f4e6e5ee63a7337 Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 13 Mar 2011 19:56:33 +0000 Subject: [PATCH 070/117] quagga: remove the postinst script git-svn-id: svn+ssh://svn.openwrt.org/openwrt@26144 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 52 ++-------------------------------------------------- 1 file changed, 2 insertions(+), 50 deletions(-) diff --git a/Makefile b/Makefile index 42ad5b4..217238c 100644 --- a/Makefile +++ b/Makefile @@ -165,8 +165,8 @@ CONFIGURE_ARGS+= \ --sysconfdir=/etc/quagga/ \ --enable-shared \ --disable-static \ - --enable-user=quagga \ - --enable-group=quagga \ + --enable-user=network \ + --enable-group=network \ --enable-pie=no \ --enable-multipath=8 \ $(call autoconf_bool,CONFIG_PACKAGE_quagga-libzebra,zebra) \ @@ -201,54 +201,6 @@ define Package/quagga/install $(INSTALL_BIN) ./files/quagga.init $(1)/etc/init.d/quagga endef -define Package/quagga/postinst -#!/bin/sh - -name=quagga -id=51 - -# do not change below -# check if we are on real system -if [ -z "$${IPKG_INSTROOT}" ]; then - # create copies of passwd and group, if we use squashfs - rootfs=`mount |awk '/root/ { print $$5 }'` - if [ "$$rootfs" = "squashfs" ]; then - if [ -h /etc/group ]; then - rm /etc/group - cp /rom/etc/group /etc/group - fi - if [ -h /etc/passwd ]; then - rm /etc/passwd - cp /rom/etc/passwd /etc/passwd - fi - fi -fi - -echo "" -if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then - echo "adding group $$name to /etc/group" - echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group -fi - -if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then - echo "adding user $$name to /etc/passwd" - echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd -fi - -grep -q '^zebra[[:space:]]*2601/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null -if [ $$? -ne 0 ]; then -echo "zebrasrv 2600/tcp" >>$${IPKG_INSTROOT}/etc/services -echo "zebra 2601/tcp" >>$${IPKG_INSTROOT}/etc/services -echo "ripd 2602/tcp" >>$${IPKG_INSTROOT}/etc/services -echo "ripngd 2603/tcp" >>$${IPKG_INSTROOT}/etc/services -echo "ospfd 2604/tcp" >>$${IPKG_INSTROOT}/etc/services -echo "bgpd 2605/tcp" >>$${IPKG_INSTROOT}/etc/services -echo "ospf6d 2606/tcp" >>$${IPKG_INSTROOT}/etc/services -echo "ospfapi 2607/tcp" >>$${IPKG_INSTROOT}/etc/services -echo "isisd 2608/tcp" >>$${IPKG_INSTROOT}/etc/services -fi -endef - define Package/quagga-bgpd/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/ From 7a5d81f35737a5262d2a6654330eb3f72340d023 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Sun, 13 Mar 2011 21:00:10 +0000 Subject: [PATCH 071/117] [packages] quagga: Fix ownership of configuration directory and files git-svn-id: svn+ssh://svn.openwrt.org/openwrt@26151 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- files/quagga | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/files/quagga b/files/quagga index cf6855c..0ccfb1c 100644 --- a/files/quagga +++ b/files/quagga @@ -27,6 +27,8 @@ 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" @@ -258,7 +260,7 @@ do then if echo "${survivors}" > ${pidfile} then - chown quagga:quagga ${pidfile} + chown ${RUNUSER}:${RUNGROUP} ${pidfile} echo -n " Wrote ${survivors} to pidfile." else echo -n " Failed to write ${survivors} to pidfile." @@ -274,10 +276,10 @@ if [ -n "$START_DAEMONS" ] then [ -d ${CONFDIR} ] \ || quit "${ME}: no config directory ${CONFDIR} - exiting." - chown -R quagga:quagga ${CONFDIR} + chown -R ${RUNUSER}:${RUNGROUP} ${CONFDIR} [ -d ${STATEDIR} ] || mkdir -p ${STATEDIR} \ || die "${ME}: could not create state directory ${STATEDIR} - exiting." - chown -R quagga:quagga ${STATEDIR} + chown -R ${RUNUSER}:${RUNGROUP} ${STATEDIR} for d in $START_DAEMONS do @@ -300,7 +302,7 @@ then then if echo "${proc_pid}" > ${pidfile} then - chown quagga:quagga ${pidfile} + chown ${RUNUSER}:${RUNGROUP} ${pidfile} echo -n " Wrote ${proc_pid} to pidfile." else echo -n " Failed to write ${proc_pid} to pidfile." From e9c87d05fbd1e304cfa454da304a8971716e1c3a Mon Sep 17 00:00:00 2001 From: acinonyx Date: Wed, 30 Mar 2011 09:27:13 +0000 Subject: [PATCH 072/117] [packages] quagga: Update to v0.99.18 git-svn-id: svn+ssh://svn.openwrt.org/openwrt@26360 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 6 +- patches/000-fix-format-warnings.patch | 22 ++++ patches/000-fix-ipv6-build-failure.patch | 31 +++++ patches/000-fix-opaque-support.patch | 91 +++++++++++++ patches/000-upstream-afi_t_safi_t.patch | 161 ----------------------- patches/000-upstream-bgp_lock_node.patch | 31 ----- patches/000-upstream-bogus_cond.patch | 11 -- patches/000-upstream-clock_fix.patch | 24 ---- patches/000-upstream-miss_str.patch | 11 -- patches/000-upstream-set_null.patch | 16 --- patches/002-quagga_manet.patch | 2 +- patches/160-pgbgp.patch | 52 ++++---- patches/161-pgbgp-addon.patch | 31 ++--- 13 files changed, 189 insertions(+), 300 deletions(-) create mode 100644 patches/000-fix-format-warnings.patch create mode 100644 patches/000-fix-ipv6-build-failure.patch create mode 100644 patches/000-fix-opaque-support.patch delete mode 100644 patches/000-upstream-afi_t_safi_t.patch delete mode 100644 patches/000-upstream-bgp_lock_node.patch delete mode 100644 patches/000-upstream-bogus_cond.patch delete mode 100644 patches/000-upstream-clock_fix.patch delete mode 100644 patches/000-upstream-miss_str.patch delete mode 100644 patches/000-upstream-set_null.patch diff --git a/Makefile b/Makefile index 217238c..4828959 100644 --- a/Makefile +++ b/Makefile @@ -14,9 +14,9 @@ ifneq ($(CONFIG_QUAGGA_OLD),) PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 PATCH_DIR:=./patches-old else - PKG_VERSION:=0.99.17 - PKG_RELEASE:=7 - PKG_MD5SUM:=37b9022adca04b03863d2d79787e643f + PKG_VERSION:=0.99.18 + PKG_RELEASE:=1 + PKG_MD5SUM:=59e306e93a4a1ce16760f20e9075d473 endif PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/patches/000-fix-format-warnings.patch b/patches/000-fix-format-warnings.patch new file mode 100644 index 0000000..ac05e17 --- /dev/null +++ b/patches/000-fix-format-warnings.patch @@ -0,0 +1,22 @@ +--- a/lib/command.c ++++ b/lib/command.c +@@ -3056,7 +3056,7 @@ DEFUN (config_logmsg, + if ((level = level_match(argv[0])) == ZLOG_DISABLED) + return CMD_ERR_NO_MATCH; + +- zlog(NULL, level, ((message = argv_concat(argv, argc, 1)) ? message : "")); ++ zlog(NULL, level, "%s", ((message = argv_concat(argv, argc, 1)) ? message : "")); + if (message) + XFREE(MTYPE_TMP, message); + return CMD_SUCCESS; +--- a/lib/if.c ++++ b/lib/if.c +@@ -664,7 +664,7 @@ connected_log (struct connected *connect + strncat (logbuf, inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ), + BUFSIZ - strlen(logbuf)); + } +- zlog (NULL, LOG_INFO, logbuf); ++ zlog (NULL, LOG_INFO, "%s", logbuf); + } + + /* If two connected address has same prefix return 1. */ diff --git a/patches/000-fix-ipv6-build-failure.patch b/patches/000-fix-ipv6-build-failure.patch new file mode 100644 index 0000000..6c3ac78 --- /dev/null +++ b/patches/000-fix-ipv6-build-failure.patch @@ -0,0 +1,31 @@ +--- a/bgpd/bgp_route.c ++++ b/bgpd/bgp_route.c +@@ -4327,6 +4327,7 @@ ALIAS_DEPRECATED (no_bgp_network_mask_na + "Specify a BGP backdoor route\n" + "AS-Path hopcount limit attribute\n" + "AS-Pathlimit TTL, in number of AS-Path hops\n") ++#ifdef HAVE_IPV6 + ALIAS_DEPRECATED (ipv6_bgp_network, + ipv6_bgp_network_ttl_cmd, + "network X:X::X:X/M pathlimit <0-255>", +@@ -4342,6 +4343,7 @@ ALIAS_DEPRECATED (no_ipv6_bgp_network, + "IPv6 prefix /\n" + "AS-Path hopcount limit attribute\n" + "AS-Pathlimit TTL, in number of AS-Path hops\n") ++#endif /* HAVE_IPV6 */ + + /* Aggreagete address: + +@@ -12133,9 +12135,11 @@ bgp_route_init (void) + install_element (BGP_IPV4M_NODE, &no_bgp_network_backdoor_ttl_cmd); + install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_backdoor_ttl_cmd); + install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_natural_backdoor_ttl_cmd); +- ++ ++#ifdef HAVE_IPV6 + install_element (BGP_IPV6_NODE, &ipv6_bgp_network_ttl_cmd); + install_element (BGP_IPV6_NODE, &no_ipv6_bgp_network_ttl_cmd); ++#endif + } + + void diff --git a/patches/000-fix-opaque-support.patch b/patches/000-fix-opaque-support.patch new file mode 100644 index 0000000..ba0081c --- /dev/null +++ b/patches/000-fix-opaque-support.patch @@ -0,0 +1,91 @@ +--- a/ospfd/ospf_lsa.h ++++ b/ospfd/ospf_lsa.h +@@ -114,6 +114,9 @@ struct ospf_lsa + + /* Refreshement List or Queue */ + int refresh_list; ++ ++ /* For Type-9 Opaque-LSAs */ ++ struct ospf_interface *oi; + }; + + /* OSPF LSA Link Type. */ +--- a/ospfd/ospf_nsm.c ++++ b/ospfd/ospf_nsm.c +@@ -216,7 +216,7 @@ ospf_db_summary_add (struct ospf_neighbo + { + case OSPF_OPAQUE_LINK_LSA: + /* Exclude type-9 LSAs that does not have the same "oi" with "nbr". */ +- if (lsa->oi != nbr->oi) ++ if (nbr->oi && ospf_if_exists (lsa->oi) != nbr->oi) + return 0; + break; + case OSPF_OPAQUE_AREA_LSA: +--- a/ospfd/ospf_opaque.c ++++ b/ospfd/ospf_opaque.c +@@ -251,7 +251,7 @@ struct ospf_opaque_functab + void (* config_write_debug )(struct vty *vty); + void (* show_opaque_info )(struct vty *vty, struct ospf_lsa *lsa); + int (* lsa_originator)(void *arg); +- void (* lsa_refresher )(struct ospf_lsa *lsa); ++ struct ospf_lsa *(* lsa_refresher )(struct ospf_lsa *lsa); + int (* new_lsa_hook)(struct ospf_lsa *lsa); + int (* del_lsa_hook)(struct ospf_lsa *lsa); + }; +@@ -354,7 +354,7 @@ ospf_register_opaque_functab ( + void (* config_write_debug )(struct vty *vty), + void (* show_opaque_info )(struct vty *vty, struct ospf_lsa *lsa), + int (* lsa_originator)(void *arg), +- void (* lsa_refresher )(struct ospf_lsa *lsa), ++ struct ospf_lsa *(* lsa_refresher )(struct ospf_lsa *lsa), + int (* new_lsa_hook)(struct ospf_lsa *lsa), + int (* del_lsa_hook)(struct ospf_lsa *lsa)) + { +@@ -1608,12 +1608,13 @@ out: + return new; + } + +-void ++struct ospf_lsa * + ospf_opaque_lsa_refresh (struct ospf_lsa *lsa) + { + struct ospf *ospf; + struct ospf_opaque_functab *functab; +- ++ struct ospf_lsa *new = NULL; ++ + ospf = ospf_lookup (); + + if ((functab = ospf_opaque_functab_lookup (lsa)) == NULL +@@ -1633,9 +1634,9 @@ ospf_opaque_lsa_refresh (struct ospf_lsa + ospf_lsa_flush (ospf, lsa); + } + else +- (* functab->lsa_refresher)(lsa); ++ new = (* functab->lsa_refresher)(lsa); + +- return; ++ return new; + } + + /*------------------------------------------------------------------------* +--- a/ospfd/ospf_opaque.h ++++ b/ospfd/ospf_opaque.h +@@ -120,7 +120,7 @@ ospf_register_opaque_functab ( + void (* config_write_debug )(struct vty *vty), + void (* show_opaque_info )(struct vty *vty, struct ospf_lsa *lsa), + int (* lsa_originator)(void *arg), +- void (* lsa_refresher )(struct ospf_lsa *lsa), ++ struct ospf_lsa *(* lsa_refresher )(struct ospf_lsa *lsa), + int (* new_lsa_hook)(struct ospf_lsa *lsa), + int (* del_lsa_hook)(struct ospf_lsa *lsa) + ); +@@ -143,7 +143,7 @@ extern void ospf_opaque_lsa_originate_sc + int *init_delay); + extern struct ospf_lsa *ospf_opaque_lsa_install (struct ospf_lsa *, + int rt_recalc); +-extern void ospf_opaque_lsa_refresh (struct ospf_lsa *lsa); ++extern struct ospf_lsa *ospf_opaque_lsa_refresh (struct ospf_lsa *lsa); + + extern void ospf_opaque_lsa_reoriginate_schedule (void *lsa_type_dependent, + u_char lsa_type, diff --git a/patches/000-upstream-afi_t_safi_t.patch b/patches/000-upstream-afi_t_safi_t.patch deleted file mode 100644 index eb2e1a7..0000000 --- a/patches/000-upstream-afi_t_safi_t.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 4c9641ba4df276080c670e03f65b1d442660a50f Mon Sep 17 00:00:00 2001 -From: Michael Lambert -Date: Thu, 22 Jul 2010 13:20:55 -0400 -Subject: [PATCH] bgpd, lib: adopt afi_t and safi_t in several places - -* bgpd/bgp_attr.c, bgpd/bgp_open.h, bgpd/bgp_route.c, lib/prefix.c, - lib/prefix.h: Various integer types were being used where, if we - had strict type checking, afi_t and safi_t would be required. - -Signed-off-by: G.Balaji -(cherry picked from commit c8af35ffa2dc79ff7d7ff00b1b61f1f50a100ab6) ---- - bgpd/bgp_attr.c | 8 ++++---- - bgpd/bgp_open.h | 8 ++++---- - bgpd/bgp_route.c | 16 ++++++++-------- - lib/prefix.c | 4 ++-- - lib/prefix.h | 4 ++-- - 5 files changed, 20 insertions(+), 20 deletions(-) - ---- a/bgpd/bgp_attr.c -+++ b/bgpd/bgp_attr.c -@@ -1301,8 +1301,8 @@ int - bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr, - struct bgp_nlri *mp_update) - { -- u_int16_t afi; -- u_char safi; -+ afi_t afi; -+ safi_t safi; - bgp_size_t nlri_len; - size_t start; - int ret; -@@ -1436,8 +1436,8 @@ bgp_mp_unreach_parse (struct peer *peer, - struct bgp_nlri *mp_withdraw) - { - struct stream *s; -- u_int16_t afi; -- u_char safi; -+ afi_t afi; -+ safi_t safi; - u_int16_t withdraw_len; - int ret; - ---- a/bgpd/bgp_open.h -+++ b/bgpd/bgp_open.h -@@ -31,9 +31,9 @@ struct capability_header - /* Generic MP capability data */ - struct capability_mp_data - { -- u_int16_t afi; -+ afi_t afi; - u_char reserved; -- u_char safi; -+ safi_t safi; - }; - - #pragma pack(1) -@@ -55,8 +55,8 @@ struct capability_as4 - - struct graceful_restart_af - { -- u_int16_t afi; -- u_char safi; -+ afi_t afi; -+ safi_t safi; - u_char flag; - }; - ---- a/bgpd/bgp_route.c -+++ b/bgpd/bgp_route.c -@@ -3518,8 +3518,8 @@ bgp_static_update (struct bgp *bgp, stru - } - - static void --bgp_static_update_vpnv4 (struct bgp *bgp, struct prefix *p, u_int16_t afi, -- u_char safi, struct prefix_rd *prd, u_char *tag) -+bgp_static_update_vpnv4 (struct bgp *bgp, struct prefix *p, afi_t afi, -+ safi_t safi, struct prefix_rd *prd, u_char *tag) - { - struct bgp_node *rn; - struct bgp_info *new; -@@ -3599,8 +3599,8 @@ bgp_check_local_routes_rsclient (struct - } - - static void --bgp_static_withdraw_vpnv4 (struct bgp *bgp, struct prefix *p, u_int16_t afi, -- u_char safi, struct prefix_rd *prd, u_char *tag) -+bgp_static_withdraw_vpnv4 (struct bgp *bgp, struct prefix *p, afi_t afi, -+ safi_t safi, struct prefix_rd *prd, u_char *tag) - { - struct bgp_node *rn; - struct bgp_info *ri; -@@ -3653,7 +3653,7 @@ bgp_pathlimit_update_parents (struct bgp - route should be installed as valid. */ - static int - bgp_static_set (struct vty *vty, struct bgp *bgp, const char *ip_str, -- u_int16_t afi, u_char safi, const char *rmap, int backdoor, -+ afi_t afi, safi_t safi, const char *rmap, int backdoor, - u_char ttl) - { - int ret; -@@ -3798,7 +3798,7 @@ bgp_static_set (struct vty *vty, struct - /* Configure static BGP network. */ - static int - bgp_static_unset (struct vty *vty, struct bgp *bgp, const char *ip_str, -- u_int16_t afi, u_char safi) -+ afi_t afi, safi_t safi) - { - int ret; - struct prefix p; -@@ -7622,7 +7622,7 @@ DEFUN (show_ipv6_mbgp_community_all, - - static int - bgp_show_community (struct vty *vty, int argc, const char **argv, int exact, -- u_int16_t afi, u_char safi) -+ afi_t afi, safi_t safi) - { - struct community *com; - struct buffer *b; -@@ -8622,7 +8622,7 @@ ALIAS (show_ipv6_mbgp_community_exact, - - static int - bgp_show_community_list (struct vty *vty, const char *com, int exact, -- u_int16_t afi, u_char safi) -+ afi_t afi, safi_t safi) - { - struct community_list *list; - ---- a/lib/prefix.c -+++ b/lib/prefix.c -@@ -41,7 +41,7 @@ static const u_char maskbit[] = {0x00, 0 - - /* Address Famiy Identifier to Address Family converter. */ - int --afi2family (int afi) -+afi2family (afi_t afi) - { - if (afi == AFI_IP) - return AF_INET; -@@ -52,7 +52,7 @@ afi2family (int afi) - return 0; - } - --int -+afi_t - family2afi (int family) - { - if (family == AF_INET) ---- a/lib/prefix.h -+++ b/lib/prefix.h -@@ -144,8 +144,8 @@ prefix6_bit (const struct in6_addr *pref - } - - /* Prototypes. */ --extern int afi2family (int); --extern int family2afi (int); -+extern int afi2family (afi_t); -+extern afi_t family2afi (int); - - extern struct prefix *prefix_new (void); - extern void prefix_free (struct prefix *); diff --git a/patches/000-upstream-bgp_lock_node.patch b/patches/000-upstream-bgp_lock_node.patch deleted file mode 100644 index 77f6400..0000000 --- a/patches/000-upstream-bgp_lock_node.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Barry Friedman -Date: Thu, 3 Feb 2011 22:02:53 +0000 (-0800) -Subject: bgpd: Remove extra lock on interior table node -X-Git-Url: http://git.ozo.com/?p=quagga-next.git;a=commitdiff_plain;h=765ec33b44a7d8cf9290acd19dc19953df4ddb0d - -bgpd: Remove extra lock on interior table node - -If the radix tree creates an extra interior node in bgp_node_get(), -it locks the interior node even though this node is not returned to -the caller, so it may never be unlocked. The lock prevents this node -from being deleted. - -* bgpd/bgp_table.c - * bgp_node_get(): Remove lock on interior node which prevents - proper node deletion - -Signed-off-by: Barry Friedman ---- - -diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c -index 91cab60..a249c23 100644 ---- a/bgpd/bgp_table.c -+++ b/bgpd/bgp_table.c -@@ -350,7 +350,6 @@ bgp_node_get (struct bgp_table *const table, struct prefix *p) - if (new->p.prefixlen != p->prefixlen) - { - match = new; -- bgp_lock_node (match); - new = bgp_node_set (table, p); - set_link (match, new); - table->count++; diff --git a/patches/000-upstream-bogus_cond.patch b/patches/000-upstream-bogus_cond.patch deleted file mode 100644 index eddf5c4..0000000 --- a/patches/000-upstream-bogus_cond.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/zebra/zserv.c -+++ b/zebra/zserv.c -@@ -451,7 +451,7 @@ zsend_route_multipath (int cmd, struct z - } - - /* Metric */ -- if (cmd == ZEBRA_IPV4_ROUTE_ADD || ZEBRA_IPV6_ROUTE_ADD) -+ if (cmd == ZEBRA_IPV4_ROUTE_ADD || cmd == ZEBRA_IPV6_ROUTE_ADD) - { - SET_FLAG (zapi_flags, ZAPI_MESSAGE_DISTANCE); - stream_putc (s, rib->distance); diff --git a/patches/000-upstream-clock_fix.patch b/patches/000-upstream-clock_fix.patch deleted file mode 100644 index f2d7db6..0000000 --- a/patches/000-upstream-clock_fix.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 213b6cd9fb24381563d6d44c7ddc4700abfae676 Mon Sep 17 00:00:00 2001 -From: Vladimir L Ivanov -Date: Thu, 21 Oct 2010 14:59:54 +0400 -Subject: [PATCH] bgpd: fix printed value of last-update timestamp - -* bgp_route.c: (route_vty_out_detail) calculate time value - in a way, which works regardless of monotonic clock - being used or not ---- - bgpd/bgp_route.c | 3 ++- - 1 files changed, 2 insertions(+), 1 deletions(-) - ---- a/bgpd/bgp_route.c -+++ b/bgpd/bgp_route.c -@@ -6145,7 +6145,8 @@ route_vty_out_detail (struct vty *vty, s - bgp_damp_info_vty (vty, binfo); - - /* Line 7 display Uptime */ -- vty_out (vty, " Last update: %s", ctime (&binfo->uptime)); -+ time_t tbuf = time(NULL) - (bgp_clock() - binfo->uptime); -+ vty_out (vty, " Last update: %s", ctime(&tbuf)); - } - vty_out (vty, "%s", VTY_NEWLINE); - } diff --git a/patches/000-upstream-miss_str.patch b/patches/000-upstream-miss_str.patch deleted file mode 100644 index 6ad3575..0000000 --- a/patches/000-upstream-miss_str.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/lib/vty.c -+++ b/lib/vty.c -@@ -250,7 +250,7 @@ vty_hello (struct vty *vty) - vty_out (vty, "MOTD file not found%s", VTY_NEWLINE); - } - else if (host.motd) -- vty_out (vty, host.motd); -+ vty_out (vty, "%s", host.motd); - } - - /* Put out prompt and wait input from user. */ diff --git a/patches/000-upstream-set_null.patch b/patches/000-upstream-set_null.patch deleted file mode 100644 index 7ba1019..0000000 --- a/patches/000-upstream-set_null.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/bgpd/bgp_packet.c -+++ b/bgpd/bgp_packet.c -@@ -177,10 +177,11 @@ bgp_update_packet (struct peer *peer, af - - if (rn->prn) - prd = (struct prefix_rd *) &rn->prn->p; -- if (binfo && binfo->extra) -+ if (binfo) - { -- tag = binfo->extra->tag; - from = binfo->peer; -+ if (binfo->extra) -+ tag = binfo->extra->tag; - } - - bgp_packet_set_marker (s, BGP_MSG_UPDATE); diff --git a/patches/002-quagga_manet.patch b/patches/002-quagga_manet.patch index abbcd48..c32af31 100644 --- a/patches/002-quagga_manet.patch +++ b/patches/002-quagga_manet.patch @@ -407,7 +407,7 @@ "Route map reference\n" --- a/lib/log.c +++ b/lib/log.c -@@ -835,6 +835,8 @@ static const struct zebra_desc_table rou +@@ -838,6 +838,8 @@ static const struct zebra_desc_table rou DESC_ENTRY (ZEBRA_ROUTE_ISIS, "isis", 'I' ), DESC_ENTRY (ZEBRA_ROUTE_BGP, "bgp", 'B' ), DESC_ENTRY (ZEBRA_ROUTE_HSLS, "hsls", 'H' ), diff --git a/patches/160-pgbgp.patch b/patches/160-pgbgp.patch index f29ffdc..c88ba98 100644 --- a/patches/160-pgbgp.patch +++ b/patches/160-pgbgp.patch @@ -2446,8 +2446,6 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c + + return 0; +} -+ -+/*! --------------- Edge Detection ------------------ !*/ --- /dev/null +++ b/bgpd/bgp_pgbgp.h @@ -0,0 +1,286 @@ @@ -2767,7 +2765,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* 1. Weight check. */ if (new->attr->extra) new_weight = new->attr->extra->weight; -@@ -1554,6 +1562,10 @@ bgp_process_main (struct work_queue *wq, +@@ -1508,6 +1516,10 @@ bgp_process_main (struct work_queue *wq, bgp_info_unset_flag (rn, new_select, BGP_INFO_ATTR_CHANGED); } @@ -2778,7 +2776,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* Check each BGP peer. */ for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) -@@ -1878,6 +1890,11 @@ bgp_update_rsclient (struct peer *rsclie +@@ -1831,6 +1843,11 @@ bgp_update_rsclient (struct peer *rsclie /* If the update is implicit withdraw. */ if (ri) { @@ -2790,7 +2788,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c ri->uptime = bgp_clock (); /* Same attribute comes in. */ -@@ -2309,6 +2326,11 @@ bgp_update_main (struct peer *peer, stru +@@ -2262,6 +2279,11 @@ bgp_update_main (struct peer *peer, stru /* Increment prefix */ bgp_aggregate_increment (bgp, p, new, afi, safi); @@ -2802,7 +2800,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* Register new BGP information. */ bgp_info_add (rn, new); -@@ -5648,6 +5670,20 @@ enum bgp_display_type +@@ -5474,6 +5496,20 @@ enum bgp_display_type static void route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo) { @@ -2823,7 +2821,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* Route status display. */ if (CHECK_FLAG (binfo->flags, BGP_INFO_REMOVED)) vty_out (vty, "R"); -@@ -6152,6 +6188,7 @@ route_vty_out_detail (struct vty *vty, s +@@ -5974,6 +6010,7 @@ route_vty_out_detail (struct vty *vty, s } #define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s r RIB-failure, S Stale, R Removed%s" @@ -2831,7 +2829,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s" #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s" #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s" -@@ -6183,7 +6220,8 @@ enum bgp_show_type +@@ -6005,7 +6042,8 @@ enum bgp_show_type bgp_show_type_flap_route_map, bgp_show_type_flap_neighbor, bgp_show_type_dampend_paths, @@ -2841,7 +2839,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c }; static int -@@ -6350,11 +6388,17 @@ bgp_show_table (struct vty *vty, struct +@@ -6172,11 +6210,17 @@ bgp_show_table (struct vty *vty, struct || CHECK_FLAG (ri->flags, BGP_INFO_HISTORY)) continue; } @@ -2859,7 +2857,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); if (type == bgp_show_type_dampend_paths || type == bgp_show_type_damp_neighbor) -@@ -6432,6 +6476,7 @@ bgp_show (struct vty *vty, struct bgp *b +@@ -6254,6 +6298,7 @@ bgp_show (struct vty *vty, struct bgp *b return bgp_show_table (vty, table, &bgp->router_id, type, output_arg); } @@ -2867,7 +2865,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* Header of detailed BGP route information */ static void route_vty_out_detail_header (struct vty *vty, struct bgp *bgp, -@@ -11234,6 +11279,64 @@ DEFUN (bgp_damp_set, +@@ -11063,6 +11108,64 @@ DEFUN (bgp_damp_set, half, reuse, suppress, max); } @@ -2932,7 +2930,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c ALIAS (bgp_damp_set, bgp_damp_set2_cmd, "bgp dampening <1-45>", -@@ -11283,6 +11386,19 @@ DEFUN (show_ip_bgp_dampened_paths, +@@ -11112,6 +11215,19 @@ DEFUN (show_ip_bgp_dampened_paths, NULL); } @@ -2952,7 +2950,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c DEFUN (show_ip_bgp_flap_statistics, show_ip_bgp_flap_statistics_cmd, "show ip bgp flap-statistics", -@@ -11828,6 +11944,7 @@ bgp_route_init (void) +@@ -11629,6 +11745,7 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_ip_bgp_dampened_paths_cmd); @@ -2960,7 +2958,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c install_element (VIEW_NODE, &show_ip_bgp_flap_statistics_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_address_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_prefix_cmd); -@@ -11935,6 +12052,7 @@ bgp_route_init (void) +@@ -11736,6 +11853,7 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_dampened_paths_cmd); @@ -2968,17 +2966,17 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c install_element (ENABLE_NODE, &show_ip_bgp_flap_statistics_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_address_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_prefix_cmd); -@@ -12293,6 +12411,10 @@ bgp_route_init (void) - install_element (BGP_IPV4_NODE, &bgp_damp_set3_cmd); +@@ -12093,6 +12211,10 @@ bgp_route_init (void) install_element (BGP_IPV4_NODE, &bgp_damp_unset_cmd); install_element (BGP_IPV4_NODE, &bgp_damp_unset2_cmd); -+ + + install_element (BGP_NODE, &bgp_pgbgp_cmd); + install_element (BGP_NODE, &bgp_pgbgp_arg_cmd); + install_element (BGP_NODE, &bgp_pgbgp_unset_cmd); - } - - void ++ + /* Deprecated AS-Pathlimit commands */ + install_element (BGP_NODE, &bgp_network_ttl_cmd); + install_element (BGP_NODE, &bgp_network_mask_ttl_cmd); --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -1,3 +1,4 @@ @@ -2997,7 +2995,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* BGP route type. This can be static, RIP, OSPF, BGP etc. */ u_char type; -@@ -123,7 +128,7 @@ struct bgp_static +@@ -120,7 +125,7 @@ struct bgp_static /* Flags which indicate a route is unuseable in some form */ #define BGP_INFO_UNUSEABLE \ @@ -3008,9 +3006,9 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c * sense of the additional VALID flag. --- a/bgpd/bgp_table.h +++ b/bgpd/bgp_table.h -@@ -63,6 +63,8 @@ struct bgp_node +@@ -65,6 +65,8 @@ struct bgp_node - unsigned int lock; + int lock; + struct bgp_pgbgp_hist *hist; + @@ -3019,7 +3017,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c }; --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h -@@ -121,6 +121,7 @@ struct bgp +@@ -123,6 +123,7 @@ struct bgp /* BGP Per AF flags */ u_int16_t af_flags[AFI_MAX][SAFI_MAX]; #define BGP_CONFIG_DAMPENING (1 << 0) @@ -3029,7 +3027,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c struct bgp_table *route[AFI_MAX][SAFI_MAX]; --- a/lib/hash.c +++ b/lib/hash.c -@@ -156,6 +156,35 @@ hash_iterate (struct hash *hash, +@@ -166,6 +166,35 @@ hash_iterate (struct hash *hash, } } @@ -3067,7 +3065,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c hash_clean (struct hash *hash, void (*free_func) (void *)) --- a/lib/hash.h +++ b/lib/hash.h -@@ -66,7 +66,8 @@ extern void *hash_release (struct hash *, void *); +@@ -66,7 +66,8 @@ extern void *hash_release (struct hash * extern void hash_iterate (struct hash *, void (*) (struct hash_backet *, void *), void *); @@ -3079,7 +3077,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c --- a/lib/memtypes.c +++ b/lib/memtypes.c -@@ -147,6 +147,15 @@ struct memory_list memory_list_bgp[] = +@@ -149,6 +149,15 @@ struct memory_list memory_list_bgp[] = { MTYPE_PEER_UPDATE_SOURCE, "BGP peer update interface" }, { MTYPE_BGP_DAMP_INFO, "Dampening info" }, { MTYPE_BGP_DAMP_ARRAY, "BGP Dampening array" }, diff --git a/patches/161-pgbgp-addon.patch b/patches/161-pgbgp-addon.patch index f072f0e..0fd8a55 100644 --- a/patches/161-pgbgp-addon.patch +++ b/patches/161-pgbgp-addon.patch @@ -24,7 +24,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 --- a/bgpd/bgp_pgbgp.c +++ b/bgpd/bgp_pgbgp.c -@@ -225,7 +225,7 @@ static void +@@ -227,7 +227,7 @@ static void edge_neighbor_iterator (struct hash_backet *backet, struct nsearch *pns) { struct bgp_pgbgp_edge *hedge = backet->data; @@ -33,7 +33,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 && hedge->e.a != hedge->e.b) { struct vty *vty = pns->pvty; -@@ -252,13 +252,39 @@ bgp_pgbgp_stats_neighbors (struct vty *vty, afi_t afi, safi_t safi, as_t asn) +@@ -254,13 +254,39 @@ bgp_pgbgp_stats_neighbors (struct vty *v return CMD_SUCCESS; } @@ -73,7 +73,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 bgp = bgp_get_default (); if (bgp == NULL) return CMD_WARNING; -@@ -267,28 +293,22 @@ bgp_pgbgp_stats_origins (struct vty *vty, afi_t afi, safi_t safi, +@@ -269,28 +295,22 @@ bgp_pgbgp_stats_origins (struct vty *vty table = bgp->rib[afi][safi]; if (table == NULL) return CMD_WARNING; @@ -114,7 +114,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 return CMD_SUCCESS; } -@@ -375,7 +395,7 @@ bgp_pgbgp_stats (struct vty *vty, afi_t afi, safi_t safi) +@@ -377,7 +397,7 @@ bgp_pgbgp_stats (struct vty *vty, afi_t DEFUN (show_ip_bgp_pgbgp, show_ip_bgp_pgbgp_cmd, "show ip bgp pgbgp", @@ -123,7 +123,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 { return bgp_pgbgp_stats (vty, AFI_IP, SAFI_UNICAST); } -@@ -383,29 +403,46 @@ DEFUN (show_ip_bgp_pgbgp, +@@ -385,29 +405,46 @@ DEFUN (show_ip_bgp_pgbgp, DEFUN (show_ip_bgp_pgbgp_neighbors, show_ip_bgp_pgbgp_neighbors_cmd, "show ip bgp pgbgp neighbors WORD", @@ -180,7 +180,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 /*! --------------- VTY (others exist in bgp_route.c) ------------------ !*/ -@@ -747,12 +784,19 @@ bgp_pgbgp_enable (struct bgp *bgp, afi_t afi, safi_t safi, +@@ -749,12 +786,19 @@ bgp_pgbgp_enable (struct bgp *bgp, afi_t pgbgp->lastgc = time (NULL); pgbgp->lastStore = time (NULL); pgbgp->startTime = time (NULL); @@ -204,7 +204,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 return 0; --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c -@@ -5670,20 +5670,6 @@ enum bgp_display_type +@@ -5496,20 +5496,6 @@ enum bgp_display_type static void route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo) { @@ -225,7 +225,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 /* Route status display. */ if (CHECK_FLAG (binfo->flags, BGP_INFO_REMOVED)) vty_out (vty, "R"); -@@ -5699,6 +5685,17 @@ route_vty_short_status_out (struct vty * +@@ -5525,6 +5511,17 @@ route_vty_short_status_out (struct vty * /* Selected */ if (CHECK_FLAG (binfo->flags, BGP_INFO_HISTORY)) vty_out (vty, "h"); @@ -243,7 +243,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 else if (CHECK_FLAG (binfo->flags, BGP_INFO_DAMPED)) vty_out (vty, "d"); else if (CHECK_FLAG (binfo->flags, BGP_INFO_SELECTED)) -@@ -6180,15 +6177,31 @@ route_vty_out_detail (struct vty *vty, s +@@ -5998,7 +5995,22 @@ route_vty_out_detail (struct vty *vty, s if (binfo->extra && binfo->extra->damp_info) bgp_damp_info_vty (vty, binfo); @@ -264,9 +264,10 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 + } + + /* Line 9 display Uptime */ - time_t tbuf = time(NULL) - (bgp_clock() - binfo->uptime); + #ifdef HAVE_CLOCK_MONOTONIC + tbuf = time(NULL) - (bgp_clock() - binfo->uptime); vty_out (vty, " Last update: %s", ctime(&tbuf)); - } +@@ -6009,8 +6021,9 @@ route_vty_out_detail (struct vty *vty, s vty_out (vty, "%s", VTY_NEWLINE); } @@ -278,7 +279,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s" #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s" #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s" -@@ -6397,8 +6410,7 @@ bgp_show_table (struct vty *vty, struct +@@ -6219,8 +6232,7 @@ bgp_show_table (struct vty *vty, struct if (header) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id), VTY_NEWLINE); @@ -288,7 +289,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); if (type == bgp_show_type_dampend_paths || type == bgp_show_type_damp_neighbor) -@@ -9663,7 +9675,7 @@ show_adj_route (struct vty *vty, struct +@@ -9492,7 +9504,7 @@ show_adj_route (struct vty *vty, struct PEER_STATUS_DEFAULT_ORIGINATE)) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); @@ -297,7 +298,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); vty_out (vty, "Originating default network 0.0.0.0%s%s", -@@ -9680,7 +9692,7 @@ show_adj_route (struct vty *vty, struct +@@ -9509,7 +9521,7 @@ show_adj_route (struct vty *vty, struct if (header1) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); @@ -306,7 +307,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); header1 = 0; } -@@ -9704,7 +9716,7 @@ show_adj_route (struct vty *vty, struct +@@ -9533,7 +9545,7 @@ show_adj_route (struct vty *vty, struct if (header1) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); From 9347e6457e01e11c786ffb1a3436eff2173944e2 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Wed, 30 Mar 2011 09:27:19 +0000 Subject: [PATCH 073/117] [packages] quagga: Change to PKG_FIXUP:=autoreconf git-svn-id: svn+ssh://svn.openwrt.org/openwrt@26361 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4828959..68e36a5 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_quagga-ripngd \ CONFIG_PACKAGE_quagga-vtysh PKG_BUILD_PARALLEL:=1 -PKG_FIXUP:=libtool +PKG_FIXUP:=autoreconf PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk From 08d7ee28088d502d50b63eacea28387187064ea1 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Wed, 30 Mar 2011 09:27:23 +0000 Subject: [PATCH 074/117] [packages] quagga: Renumber patches git-svn-id: svn+ssh://svn.openwrt.org/openwrt@26362 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...00-fix-format-warnings.patch => 010-fix-format-warnings.patch} | 0 ...-ipv6-build-failure.patch => 020-fix-ipv6-build-failure.patch} | 0 ...{000-fix-opaque-support.patch => 030-fix-opaque-support.patch} | 0 ...-fix_ipctl_forwarding.patch => 110-fix_ipctl_forwarding.patch} | 0 patches/{002-quagga_manet.patch => 120-quagga_manet.patch} | 0 patches/{010-fix_cpp.patch => 130-fix_cpp.patch} | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename patches/{000-fix-format-warnings.patch => 010-fix-format-warnings.patch} (100%) rename patches/{000-fix-ipv6-build-failure.patch => 020-fix-ipv6-build-failure.patch} (100%) rename patches/{000-fix-opaque-support.patch => 030-fix-opaque-support.patch} (100%) rename patches/{001-fix_ipctl_forwarding.patch => 110-fix_ipctl_forwarding.patch} (100%) rename patches/{002-quagga_manet.patch => 120-quagga_manet.patch} (100%) rename patches/{010-fix_cpp.patch => 130-fix_cpp.patch} (100%) diff --git a/patches/000-fix-format-warnings.patch b/patches/010-fix-format-warnings.patch similarity index 100% rename from patches/000-fix-format-warnings.patch rename to patches/010-fix-format-warnings.patch diff --git a/patches/000-fix-ipv6-build-failure.patch b/patches/020-fix-ipv6-build-failure.patch similarity index 100% rename from patches/000-fix-ipv6-build-failure.patch rename to patches/020-fix-ipv6-build-failure.patch diff --git a/patches/000-fix-opaque-support.patch b/patches/030-fix-opaque-support.patch similarity index 100% rename from patches/000-fix-opaque-support.patch rename to patches/030-fix-opaque-support.patch diff --git a/patches/001-fix_ipctl_forwarding.patch b/patches/110-fix_ipctl_forwarding.patch similarity index 100% rename from patches/001-fix_ipctl_forwarding.patch rename to patches/110-fix_ipctl_forwarding.patch diff --git a/patches/002-quagga_manet.patch b/patches/120-quagga_manet.patch similarity index 100% rename from patches/002-quagga_manet.patch rename to patches/120-quagga_manet.patch diff --git a/patches/010-fix_cpp.patch b/patches/130-fix_cpp.patch similarity index 100% rename from patches/010-fix_cpp.patch rename to patches/130-fix_cpp.patch From 414f6d081dc7e7275c40f29c7b213455bb63309c Mon Sep 17 00:00:00 2001 From: acinonyx Date: Wed, 13 Jul 2011 20:29:27 +0000 Subject: [PATCH 075/117] [packages] quagga: Move package to 'Routing and Redirection' submenu git-svn-id: svn+ssh://svn.openwrt.org/openwrt@27609 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 68e36a5..3dcf0c3 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ 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 From 37251eb7f4844f9ef57d3eaecca0a9a3feaf3431 Mon Sep 17 00:00:00 2001 From: jow Date: Tue, 26 Jul 2011 21:46:59 +0000 Subject: [PATCH 076/117] [packages] quagga, quagga-old: use "cat" as default pager and "head -n" as pager for limited amount of lines (#9814) git-svn-id: svn+ssh://svn.openwrt.org/openwrt@27790 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 4 +-- patches-old/170-use-supported-pagers.patch | 29 ++++++++++++++++++++++ patches/170-use-supported-pagers.patch | 29 ++++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 patches-old/170-use-supported-pagers.patch create mode 100644 patches/170-use-supported-pagers.patch diff --git a/Makefile b/Makefile index 3dcf0c3..52b74fc 100644 --- a/Makefile +++ b/Makefile @@ -10,12 +10,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga ifneq ($(CONFIG_QUAGGA_OLD),) PKG_VERSION:=0.98.6 - PKG_RELEASE:=9 + PKG_RELEASE:=10 PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 PATCH_DIR:=./patches-old else PKG_VERSION:=0.99.18 - PKG_RELEASE:=1 + PKG_RELEASE:=2 PKG_MD5SUM:=59e306e93a4a1ce16760f20e9075d473 endif diff --git a/patches-old/170-use-supported-pagers.patch b/patches-old/170-use-supported-pagers.patch new file mode 100644 index 0000000..fca7fc4 --- /dev/null +++ b/patches-old/170-use-supported-pagers.patch @@ -0,0 +1,29 @@ +--- a/vtysh/vtysh.c ++++ b/vtysh/vtysh.c +@@ -243,7 +243,7 @@ vtysh_pager_init () + 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. */ +@@ -1745,7 +1745,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') +@@ -1762,7 +1762,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); + } + diff --git a/patches/170-use-supported-pagers.patch b/patches/170-use-supported-pagers.patch new file mode 100644 index 0000000..fe1a4d9 --- /dev/null +++ b/patches/170-use-supported-pagers.patch @@ -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. */ +@@ -1866,7 +1866,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') +@@ -1883,7 +1883,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); + } + From 466ba0d2d1b25d2565e2fa7b495df0b513d3736c Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 5 Aug 2011 15:32:18 +0000 Subject: [PATCH 077/117] [packages] quagga: Fix installing of OLSR host routes git-svn-id: svn+ssh://svn.openwrt.org/openwrt@27913 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/120-quagga_manet.patch | 52 +++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/patches/120-quagga_manet.patch b/patches/120-quagga_manet.patch index c32af31..b9980ac 100644 --- a/patches/120-quagga_manet.patch +++ b/patches/120-quagga_manet.patch @@ -637,7 +637,45 @@ }; /* Vector for routing table. */ -@@ -1229,6 +1232,8 @@ static const u_char meta_queue_map[ZEBRA +@@ -374,6 +377,18 @@ nexthop_active_ipv4 (struct rib *rib, st + + return 1; + } ++ 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 if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_INTERNAL)) + { + for (newhop = match->nexthop; newhop; newhop = newhop->next) +@@ -476,6 +491,18 @@ nexthop_active_ipv6 (struct rib *rib, st + + return 1; + } ++ 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 if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_INTERNAL)) + { + for (newhop = match->nexthop; newhop; newhop = newhop->next) +@@ -1229,6 +1256,8 @@ static const u_char meta_queue_map[ZEBRA [ZEBRA_ROUTE_ISIS] = 2, [ZEBRA_ROUTE_BGP] = 3, [ZEBRA_ROUTE_HSLS] = 4, @@ -843,3 +881,15 @@ else { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); +--- a/zebra/rt_netlink.c ++++ b/zebra/rt_netlink.c +@@ -1488,6 +1488,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); From bba8e82cd5195406ae2c8a3b4fa0e02a44ae7c98 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Thu, 29 Sep 2011 23:44:31 +0000 Subject: [PATCH 078/117] [packages] quagga: Update to v0.99.20 git-svn-id: svn+ssh://svn.openwrt.org/openwrt@28319 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 6 +- patches/010-fix-format-warnings.patch | 22 ------ patches/020-fix-ipv6-build-failure.patch | 31 -------- patches/030-fix-opaque-support.patch | 91 ------------------------ patches/120-quagga_manet.patch | 64 ++++++++--------- patches/140-holdtimer-set.patch | 4 +- patches/150-no-cross-fs-link.patch | 4 +- patches/160-pgbgp.patch | 12 ++-- patches/161-pgbgp-addon.patch | 6 +- 9 files changed, 48 insertions(+), 192 deletions(-) delete mode 100644 patches/010-fix-format-warnings.patch delete mode 100644 patches/020-fix-ipv6-build-failure.patch delete mode 100644 patches/030-fix-opaque-support.patch diff --git a/Makefile b/Makefile index 52b74fc..645ec21 100644 --- a/Makefile +++ b/Makefile @@ -14,9 +14,9 @@ ifneq ($(CONFIG_QUAGGA_OLD),) PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 PATCH_DIR:=./patches-old else - PKG_VERSION:=0.99.18 - PKG_RELEASE:=2 - PKG_MD5SUM:=59e306e93a4a1ce16760f20e9075d473 + PKG_VERSION:=0.99.20 + PKG_RELEASE:=1 + PKG_MD5SUM:=64cc29394eb8a4e24649d19dac868f64 endif PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/patches/010-fix-format-warnings.patch b/patches/010-fix-format-warnings.patch deleted file mode 100644 index ac05e17..0000000 --- a/patches/010-fix-format-warnings.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/lib/command.c -+++ b/lib/command.c -@@ -3056,7 +3056,7 @@ DEFUN (config_logmsg, - if ((level = level_match(argv[0])) == ZLOG_DISABLED) - return CMD_ERR_NO_MATCH; - -- zlog(NULL, level, ((message = argv_concat(argv, argc, 1)) ? message : "")); -+ zlog(NULL, level, "%s", ((message = argv_concat(argv, argc, 1)) ? message : "")); - if (message) - XFREE(MTYPE_TMP, message); - return CMD_SUCCESS; ---- a/lib/if.c -+++ b/lib/if.c -@@ -664,7 +664,7 @@ connected_log (struct connected *connect - strncat (logbuf, inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ), - BUFSIZ - strlen(logbuf)); - } -- zlog (NULL, LOG_INFO, logbuf); -+ zlog (NULL, LOG_INFO, "%s", logbuf); - } - - /* If two connected address has same prefix return 1. */ diff --git a/patches/020-fix-ipv6-build-failure.patch b/patches/020-fix-ipv6-build-failure.patch deleted file mode 100644 index 6c3ac78..0000000 --- a/patches/020-fix-ipv6-build-failure.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/bgpd/bgp_route.c -+++ b/bgpd/bgp_route.c -@@ -4327,6 +4327,7 @@ ALIAS_DEPRECATED (no_bgp_network_mask_na - "Specify a BGP backdoor route\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -+#ifdef HAVE_IPV6 - ALIAS_DEPRECATED (ipv6_bgp_network, - ipv6_bgp_network_ttl_cmd, - "network X:X::X:X/M pathlimit <0-255>", -@@ -4342,6 +4343,7 @@ ALIAS_DEPRECATED (no_ipv6_bgp_network, - "IPv6 prefix /\n" - "AS-Path hopcount limit attribute\n" - "AS-Pathlimit TTL, in number of AS-Path hops\n") -+#endif /* HAVE_IPV6 */ - - /* Aggreagete address: - -@@ -12133,9 +12135,11 @@ bgp_route_init (void) - install_element (BGP_IPV4M_NODE, &no_bgp_network_backdoor_ttl_cmd); - install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_backdoor_ttl_cmd); - install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_natural_backdoor_ttl_cmd); -- -+ -+#ifdef HAVE_IPV6 - install_element (BGP_IPV6_NODE, &ipv6_bgp_network_ttl_cmd); - install_element (BGP_IPV6_NODE, &no_ipv6_bgp_network_ttl_cmd); -+#endif - } - - void diff --git a/patches/030-fix-opaque-support.patch b/patches/030-fix-opaque-support.patch deleted file mode 100644 index ba0081c..0000000 --- a/patches/030-fix-opaque-support.patch +++ /dev/null @@ -1,91 +0,0 @@ ---- a/ospfd/ospf_lsa.h -+++ b/ospfd/ospf_lsa.h -@@ -114,6 +114,9 @@ struct ospf_lsa - - /* Refreshement List or Queue */ - int refresh_list; -+ -+ /* For Type-9 Opaque-LSAs */ -+ struct ospf_interface *oi; - }; - - /* OSPF LSA Link Type. */ ---- a/ospfd/ospf_nsm.c -+++ b/ospfd/ospf_nsm.c -@@ -216,7 +216,7 @@ ospf_db_summary_add (struct ospf_neighbo - { - case OSPF_OPAQUE_LINK_LSA: - /* Exclude type-9 LSAs that does not have the same "oi" with "nbr". */ -- if (lsa->oi != nbr->oi) -+ if (nbr->oi && ospf_if_exists (lsa->oi) != nbr->oi) - return 0; - break; - case OSPF_OPAQUE_AREA_LSA: ---- a/ospfd/ospf_opaque.c -+++ b/ospfd/ospf_opaque.c -@@ -251,7 +251,7 @@ struct ospf_opaque_functab - void (* config_write_debug )(struct vty *vty); - void (* show_opaque_info )(struct vty *vty, struct ospf_lsa *lsa); - int (* lsa_originator)(void *arg); -- void (* lsa_refresher )(struct ospf_lsa *lsa); -+ struct ospf_lsa *(* lsa_refresher )(struct ospf_lsa *lsa); - int (* new_lsa_hook)(struct ospf_lsa *lsa); - int (* del_lsa_hook)(struct ospf_lsa *lsa); - }; -@@ -354,7 +354,7 @@ ospf_register_opaque_functab ( - void (* config_write_debug )(struct vty *vty), - void (* show_opaque_info )(struct vty *vty, struct ospf_lsa *lsa), - int (* lsa_originator)(void *arg), -- void (* lsa_refresher )(struct ospf_lsa *lsa), -+ struct ospf_lsa *(* lsa_refresher )(struct ospf_lsa *lsa), - int (* new_lsa_hook)(struct ospf_lsa *lsa), - int (* del_lsa_hook)(struct ospf_lsa *lsa)) - { -@@ -1608,12 +1608,13 @@ out: - return new; - } - --void -+struct ospf_lsa * - ospf_opaque_lsa_refresh (struct ospf_lsa *lsa) - { - struct ospf *ospf; - struct ospf_opaque_functab *functab; -- -+ struct ospf_lsa *new = NULL; -+ - ospf = ospf_lookup (); - - if ((functab = ospf_opaque_functab_lookup (lsa)) == NULL -@@ -1633,9 +1634,9 @@ ospf_opaque_lsa_refresh (struct ospf_lsa - ospf_lsa_flush (ospf, lsa); - } - else -- (* functab->lsa_refresher)(lsa); -+ new = (* functab->lsa_refresher)(lsa); - -- return; -+ return new; - } - - /*------------------------------------------------------------------------* ---- a/ospfd/ospf_opaque.h -+++ b/ospfd/ospf_opaque.h -@@ -120,7 +120,7 @@ ospf_register_opaque_functab ( - void (* config_write_debug )(struct vty *vty), - void (* show_opaque_info )(struct vty *vty, struct ospf_lsa *lsa), - int (* lsa_originator)(void *arg), -- void (* lsa_refresher )(struct ospf_lsa *lsa), -+ struct ospf_lsa *(* lsa_refresher )(struct ospf_lsa *lsa), - int (* new_lsa_hook)(struct ospf_lsa *lsa), - int (* del_lsa_hook)(struct ospf_lsa *lsa) - ); -@@ -143,7 +143,7 @@ extern void ospf_opaque_lsa_originate_sc - int *init_delay); - extern struct ospf_lsa *ospf_opaque_lsa_install (struct ospf_lsa *, - int rt_recalc); --extern void ospf_opaque_lsa_refresh (struct ospf_lsa *lsa); -+extern struct ospf_lsa *ospf_opaque_lsa_refresh (struct ospf_lsa *lsa); - - extern void ospf_opaque_lsa_reoriginate_schedule (void *lsa_type_dependent, - u_char lsa_type, diff --git a/patches/120-quagga_manet.patch b/patches/120-quagga_manet.patch index b9980ac..105dae4 100644 --- a/patches/120-quagga_manet.patch +++ b/patches/120-quagga_manet.patch @@ -1,6 +1,6 @@ --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c -@@ -8228,8 +8228,14 @@ bgp_str2route_type (int afi, const char +@@ -8399,8 +8399,14 @@ bgp_str2route_type (int afi, const char return ZEBRA_ROUTE_STATIC; else if (strncmp (str, "r", 1) == 0) return ZEBRA_ROUTE_RIP; @@ -16,7 +16,7 @@ } if (afi == AFI_IP6) { -@@ -8241,21 +8247,30 @@ bgp_str2route_type (int afi, const char +@@ -8412,21 +8418,30 @@ bgp_str2route_type (int afi, const char return ZEBRA_ROUTE_STATIC; else if (strncmp (str, "r", 1) == 0) return ZEBRA_ROUTE_RIPNG; @@ -50,7 +50,7 @@ { int type; -@@ -8270,13 +8285,16 @@ DEFUN (bgp_redistribute_ipv4, +@@ -8441,13 +8456,16 @@ DEFUN (bgp_redistribute_ipv4, DEFUN (bgp_redistribute_ipv4_rmap, bgp_redistribute_ipv4_rmap_cmd, @@ -68,7 +68,7 @@ "Route map reference\n" "Pointer to route-map entries\n") { -@@ -8295,13 +8313,16 @@ DEFUN (bgp_redistribute_ipv4_rmap, +@@ -8466,13 +8484,16 @@ DEFUN (bgp_redistribute_ipv4_rmap, DEFUN (bgp_redistribute_ipv4_metric, bgp_redistribute_ipv4_metric_cmd, @@ -86,7 +86,7 @@ "Metric for redistributed routes\n" "Default metric\n") { -@@ -8322,13 +8343,16 @@ DEFUN (bgp_redistribute_ipv4_metric, +@@ -8493,13 +8514,16 @@ DEFUN (bgp_redistribute_ipv4_metric, DEFUN (bgp_redistribute_ipv4_rmap_metric, bgp_redistribute_ipv4_rmap_metric_cmd, @@ -104,7 +104,7 @@ "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8352,13 +8376,16 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric +@@ -8523,13 +8547,16 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric DEFUN (bgp_redistribute_ipv4_metric_rmap, bgp_redistribute_ipv4_metric_rmap_cmd, @@ -122,7 +122,7 @@ "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8382,14 +8409,17 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap +@@ -8553,14 +8580,17 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap DEFUN (no_bgp_redistribute_ipv4, no_bgp_redistribute_ipv4_cmd, @@ -142,7 +142,7 @@ { int type; -@@ -8405,7 +8435,7 @@ DEFUN (no_bgp_redistribute_ipv4, +@@ -8576,7 +8606,7 @@ DEFUN (no_bgp_redistribute_ipv4, DEFUN (no_bgp_redistribute_ipv4_rmap, no_bgp_redistribute_ipv4_rmap_cmd, @@ -151,7 +151,7 @@ NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8413,6 +8443,9 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, +@@ -8584,6 +8614,9 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" @@ -161,7 +161,7 @@ "Route map reference\n" "Pointer to route-map entries\n") { -@@ -8431,7 +8464,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, +@@ -8602,7 +8635,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, DEFUN (no_bgp_redistribute_ipv4_metric, no_bgp_redistribute_ipv4_metric_cmd, @@ -170,7 +170,7 @@ NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8439,6 +8472,9 @@ DEFUN (no_bgp_redistribute_ipv4_metric, +@@ -8610,6 +8643,9 @@ DEFUN (no_bgp_redistribute_ipv4_metric, "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" @@ -180,7 +180,7 @@ "Metric for redistributed routes\n" "Default metric\n") { -@@ -8457,7 +8493,7 @@ DEFUN (no_bgp_redistribute_ipv4_metric, +@@ -8628,7 +8664,7 @@ DEFUN (no_bgp_redistribute_ipv4_metric, DEFUN (no_bgp_redistribute_ipv4_rmap_metric, no_bgp_redistribute_ipv4_rmap_metric_cmd, @@ -189,7 +189,7 @@ NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8465,6 +8501,9 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met +@@ -8636,6 +8672,9 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" @@ -199,7 +199,7 @@ "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8486,7 +8525,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met +@@ -8657,7 +8696,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met ALIAS (no_bgp_redistribute_ipv4_rmap_metric, no_bgp_redistribute_ipv4_metric_rmap_cmd, @@ -208,7 +208,7 @@ NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8494,6 +8533,9 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met +@@ -8665,6 +8704,9 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met "Open Shurtest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" "Static routes\n" @@ -218,7 +218,7 @@ "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8502,13 +8544,16 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met +@@ -8673,13 +8715,16 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met #ifdef HAVE_IPV6 DEFUN (bgp_redistribute_ipv6, bgp_redistribute_ipv6_cmd, @@ -237,7 +237,7 @@ { int type; -@@ -8524,13 +8569,16 @@ DEFUN (bgp_redistribute_ipv6, +@@ -8695,13 +8740,16 @@ DEFUN (bgp_redistribute_ipv6, DEFUN (bgp_redistribute_ipv6_rmap, bgp_redistribute_ipv6_rmap_cmd, @@ -255,7 +255,7 @@ "Route map reference\n" "Pointer to route-map entries\n") { -@@ -8549,13 +8597,16 @@ DEFUN (bgp_redistribute_ipv6_rmap, +@@ -8720,13 +8768,16 @@ DEFUN (bgp_redistribute_ipv6_rmap, DEFUN (bgp_redistribute_ipv6_metric, bgp_redistribute_ipv6_metric_cmd, @@ -273,7 +273,7 @@ "Metric for redistributed routes\n" "Default metric\n") { -@@ -8576,13 +8627,16 @@ DEFUN (bgp_redistribute_ipv6_metric, +@@ -8747,13 +8798,16 @@ DEFUN (bgp_redistribute_ipv6_metric, DEFUN (bgp_redistribute_ipv6_rmap_metric, bgp_redistribute_ipv6_rmap_metric_cmd, @@ -291,7 +291,7 @@ "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8606,13 +8660,16 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric +@@ -8777,13 +8831,16 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric DEFUN (bgp_redistribute_ipv6_metric_rmap, bgp_redistribute_ipv6_metric_rmap_cmd, @@ -309,7 +309,7 @@ "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" -@@ -8636,14 +8693,17 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap +@@ -8807,14 +8864,17 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap DEFUN (no_bgp_redistribute_ipv6, no_bgp_redistribute_ipv6_cmd, @@ -329,7 +329,7 @@ { int type; -@@ -8659,7 +8719,7 @@ DEFUN (no_bgp_redistribute_ipv6, +@@ -8830,7 +8890,7 @@ DEFUN (no_bgp_redistribute_ipv6, DEFUN (no_bgp_redistribute_ipv6_rmap, no_bgp_redistribute_ipv6_rmap_cmd, @@ -338,7 +338,7 @@ NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8667,6 +8727,9 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, +@@ -8838,6 +8898,9 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" @@ -348,7 +348,7 @@ "Route map reference\n" "Pointer to route-map entries\n") { -@@ -8685,7 +8748,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, +@@ -8856,7 +8919,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, DEFUN (no_bgp_redistribute_ipv6_metric, no_bgp_redistribute_ipv6_metric_cmd, @@ -357,7 +357,7 @@ NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8693,6 +8756,9 @@ DEFUN (no_bgp_redistribute_ipv6_metric, +@@ -8864,6 +8927,9 @@ DEFUN (no_bgp_redistribute_ipv6_metric, "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" @@ -367,7 +367,7 @@ "Metric for redistributed routes\n" "Default metric\n") { -@@ -8711,7 +8777,7 @@ DEFUN (no_bgp_redistribute_ipv6_metric, +@@ -8882,7 +8948,7 @@ DEFUN (no_bgp_redistribute_ipv6_metric, DEFUN (no_bgp_redistribute_ipv6_rmap_metric, no_bgp_redistribute_ipv6_rmap_metric_cmd, @@ -376,7 +376,7 @@ NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8719,6 +8785,9 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met +@@ -8890,6 +8956,9 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" @@ -386,7 +386,7 @@ "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" -@@ -8740,7 +8809,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met +@@ -8911,7 +8980,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met ALIAS (no_bgp_redistribute_ipv6_rmap_metric, no_bgp_redistribute_ipv6_metric_rmap_cmd, @@ -395,7 +395,7 @@ NO_STR "Redistribute information from another routing protocol\n" "Connected\n" -@@ -8748,6 +8817,9 @@ ALIAS (no_bgp_redistribute_ipv6_rmap_met +@@ -8919,6 +8988,9 @@ ALIAS (no_bgp_redistribute_ipv6_rmap_met "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" @@ -407,7 +407,7 @@ "Route map reference\n" --- a/lib/log.c +++ b/lib/log.c -@@ -838,6 +838,8 @@ static const struct zebra_desc_table rou +@@ -837,6 +837,8 @@ static const struct zebra_desc_table rou DESC_ENTRY (ZEBRA_ROUTE_ISIS, "isis", 'I' ), DESC_ENTRY (ZEBRA_ROUTE_BGP, "bgp", 'B' ), DESC_ENTRY (ZEBRA_ROUTE_HSLS, "hsls", 'H' ), @@ -444,7 +444,7 @@ +ZEBRA_ROUTE_BATMAN, "Better Approach to Mobile Ad-Hoc Networking (BATMAN)" --- a/lib/zebra.h +++ b/lib/zebra.h -@@ -441,7 +441,9 @@ struct in_pktinfo +@@ -437,7 +437,9 @@ struct in_pktinfo #define ZEBRA_ROUTE_ISIS 8 #define ZEBRA_ROUTE_BGP 9 #define ZEBRA_ROUTE_HSLS 10 @@ -883,7 +883,7 @@ vty_out (vty, "Unknown route type%s", VTY_NEWLINE); --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c -@@ -1488,6 +1488,9 @@ netlink_route_multipath (int cmd, struct +@@ -1494,6 +1494,9 @@ netlink_route_multipath (int cmd, struct addattr_l (&req.n, sizeof req, RTA_PREFSRC, &nexthop->src.ipv4, bytelen); diff --git a/patches/140-holdtimer-set.patch b/patches/140-holdtimer-set.patch index 8642bbf..eb85b40 100644 --- a/patches/140-holdtimer-set.patch +++ b/patches/140-holdtimer-set.patch @@ -1,6 +1,6 @@ --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c -@@ -188,8 +188,7 @@ bgp_accept (struct thread *thread) +@@ -193,8 +193,7 @@ bgp_accept (struct thread *thread) peer->fd = bgp_sock; peer->status = Active; peer->local_id = peer1->local_id; @@ -12,7 +12,7 @@ sockunion2str (&su, buf, SU_ADDRSTRLEN); --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h -@@ -709,6 +709,7 @@ struct bgp_nlri +@@ -712,6 +712,7 @@ struct bgp_nlri /* BGP timers default value. */ #define BGP_INIT_START_TIMER 5 #define BGP_ERROR_START_TIMER 30 diff --git a/patches/150-no-cross-fs-link.patch b/patches/150-no-cross-fs-link.patch index c3f29c3..d22311c 100644 --- a/patches/150-no-cross-fs-link.patch +++ b/patches/150-no-cross-fs-link.patch @@ -1,6 +1,6 @@ --- a/lib/command.c +++ b/lib/command.c -@@ -2601,6 +2601,13 @@ DEFUN (config_write_file, +@@ -2599,6 +2599,13 @@ DEFUN (config_write_file, VTY_NEWLINE); goto finished; } @@ -14,7 +14,7 @@ if (link (config_file, config_file_sav) != 0) { vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav, -@@ -2614,7 +2621,23 @@ DEFUN (config_write_file, +@@ -2612,7 +2619,23 @@ DEFUN (config_write_file, VTY_NEWLINE); goto finished; } diff --git a/patches/160-pgbgp.patch b/patches/160-pgbgp.patch index c88ba98..fcdd03b 100644 --- a/patches/160-pgbgp.patch +++ b/patches/160-pgbgp.patch @@ -2865,7 +2865,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* Header of detailed BGP route information */ static void route_vty_out_detail_header (struct vty *vty, struct bgp *bgp, -@@ -11063,6 +11108,64 @@ DEFUN (bgp_damp_set, +@@ -11823,6 +11868,64 @@ DEFUN (bgp_damp_set, half, reuse, suppress, max); } @@ -2930,7 +2930,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c ALIAS (bgp_damp_set, bgp_damp_set2_cmd, "bgp dampening <1-45>", -@@ -11112,6 +11215,19 @@ DEFUN (show_ip_bgp_dampened_paths, +@@ -11872,6 +11975,19 @@ DEFUN (show_ip_bgp_dampened_paths, NULL); } @@ -2950,7 +2950,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c DEFUN (show_ip_bgp_flap_statistics, show_ip_bgp_flap_statistics_cmd, "show ip bgp flap-statistics", -@@ -11629,6 +11745,7 @@ bgp_route_init (void) +@@ -12398,6 +12514,7 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_ip_bgp_dampened_paths_cmd); @@ -2958,7 +2958,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c install_element (VIEW_NODE, &show_ip_bgp_flap_statistics_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_address_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_prefix_cmd); -@@ -11736,6 +11853,7 @@ bgp_route_init (void) +@@ -12531,6 +12648,7 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_dampened_paths_cmd); @@ -2966,7 +2966,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c install_element (ENABLE_NODE, &show_ip_bgp_flap_statistics_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_address_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_prefix_cmd); -@@ -12093,6 +12211,10 @@ bgp_route_init (void) +@@ -12918,6 +13036,10 @@ bgp_route_init (void) install_element (BGP_IPV4_NODE, &bgp_damp_unset_cmd); install_element (BGP_IPV4_NODE, &bgp_damp_unset2_cmd); @@ -3077,7 +3077,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c --- a/lib/memtypes.c +++ b/lib/memtypes.c -@@ -149,6 +149,15 @@ struct memory_list memory_list_bgp[] = +@@ -147,6 +147,15 @@ struct memory_list memory_list_bgp[] = { MTYPE_PEER_UPDATE_SOURCE, "BGP peer update interface" }, { MTYPE_BGP_DAMP_INFO, "Dampening info" }, { MTYPE_BGP_DAMP_ARRAY, "BGP Dampening array" }, diff --git a/patches/161-pgbgp-addon.patch b/patches/161-pgbgp-addon.patch index 0fd8a55..d2202b3 100644 --- a/patches/161-pgbgp-addon.patch +++ b/patches/161-pgbgp-addon.patch @@ -289,7 +289,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); if (type == bgp_show_type_dampend_paths || type == bgp_show_type_damp_neighbor) -@@ -9492,7 +9504,7 @@ show_adj_route (struct vty *vty, struct +@@ -9761,7 +9773,7 @@ show_adj_route (struct vty *vty, struct PEER_STATUS_DEFAULT_ORIGINATE)) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); @@ -298,7 +298,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); vty_out (vty, "Originating default network 0.0.0.0%s%s", -@@ -9509,7 +9521,7 @@ show_adj_route (struct vty *vty, struct +@@ -9778,7 +9790,7 @@ show_adj_route (struct vty *vty, struct if (header1) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); @@ -307,7 +307,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); header1 = 0; } -@@ -9533,7 +9545,7 @@ show_adj_route (struct vty *vty, struct +@@ -9802,7 +9814,7 @@ show_adj_route (struct vty *vty, struct if (header1) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); From cfb8035629f1c01d0bfdc5a7fe370987c57a7448 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Mon, 14 Nov 2011 18:32:16 +0000 Subject: [PATCH 079/117] [packages] quagga: Disable ospfclient (thanks jow) git-svn-id: svn+ssh://svn.openwrt.org/openwrt@29128 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 645ec21..25525f2 100644 --- a/Makefile +++ b/Makefile @@ -10,12 +10,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga ifneq ($(CONFIG_QUAGGA_OLD),) PKG_VERSION:=0.98.6 - PKG_RELEASE:=10 + PKG_RELEASE:=11 PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 PATCH_DIR:=./patches-old else PKG_VERSION:=0.99.20 - PKG_RELEASE:=1 + PKG_RELEASE:=2 PKG_MD5SUM:=64cc29394eb8a4e24649d19dac868f64 endif @@ -170,6 +170,7 @@ CONFIGURE_ARGS+= \ --enable-group=network \ --enable-pie=no \ --enable-multipath=8 \ + --disable-ospfclient \ $(call autoconf_bool,CONFIG_PACKAGE_quagga-libzebra,zebra) \ $(call autoconf_bool,CONFIG_PACKAGE_quagga-libospf,ospfd) \ $(call autoconf_bool,CONFIG_PACKAGE_quagga-bgpd,bgpd) \ From 223314901eeefe3b4abdddf9d87ef817b9daccd3 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 2 Feb 2012 10:01:49 +0000 Subject: [PATCH 080/117] ndppd: initial import (release 0.2.1) Hi, here is a patch to add a package for ndppd: 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. http://www.priv.nu/projects/ndppd/ I tested it and it works fine. I am willing to maintain it. Note that this my first C++ package and it took a lot of trial and error to get the Build/Compile target working. Any feedback would be much welcome. Best regard, >From 689b4a52af2e25e3574d0dca7cc5e63ed100c50a Mon Sep 17 00:00:00 2001 From: Gabriel Kerneis Date: Fri, 27 Jan 2012 15:35:14 +0100 Subject: [PATCH] [packages] ndppd: initial import (release 0.2.1) git-svn-id: svn://svn.openwrt.org/openwrt/packages/ipv6/ndppd@29987 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ files/ndppd.init | 16 +++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 Makefile create mode 100644 files/ndppd.init diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..08ccc76 --- /dev/null +++ b/Makefile @@ -0,0 +1,62 @@ +# +# 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.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.priv.nu/projects/ndppd/files/ +PKG_MD5SUM:=9b65a8cccfce8689f0c1c410c20b4790 + +include $(INCLUDE_DIR)/package.mk + +define Package/ndppd + SECTION:=ipv6 + CATEGORY:=IPv6 + TITLE:=NDP Proxy Daemon + URL:=http://www.priv.nu/projects/ndppd/ + MAINTAINER:=Gabriel Kerneis + DEPENDS:=+kmod-ipv6 +confuse +uclibcxx +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_CPPFLAGS) $(TARGET_CXXFLAGS) -fno-builtin -fno-rtti -nostdinc++ \ + -I$(STAGING_DIR)/usr/include/uClibc++ -I$(LINUX_DIR)/include" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + LIBS="-nodefaultlibs -luClibc++ -lconfuse" \ + 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)) diff --git a/files/ndppd.init b/files/ndppd.init new file mode 100644 index 0000000..4cf0e8a --- /dev/null +++ b/files/ndppd.init @@ -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 +} From 6d9594238984c592fe706f7c2b1d57edb38fe14f Mon Sep 17 00:00:00 2001 From: Daniel Dickinson Date: Tue, 14 Feb 2012 17:34:08 +0000 Subject: [PATCH 081/117] [packages] Mass Fix for GCC 4.6 nodefaultlibs now includes libc so we have to add it where we want it git-svn-id: svn://svn.openwrt.org/openwrt/packages/ipv6/ndppd@30530 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 08ccc76..270f84b 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ define Build/Compile CXXFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CXXFLAGS) -fno-builtin -fno-rtti -nostdinc++ \ -I$(STAGING_DIR)/usr/include/uClibc++ -I$(LINUX_DIR)/include" \ LDFLAGS="$(TARGET_LDFLAGS)" \ - LIBS="-nodefaultlibs -luClibc++ -lconfuse" \ + LIBS="-nodefaultlibs -lc -luClibc++ -lconfuse" \ ndppd endef From 3851147cb5c08494a911ec5afbe8f916bc0de5ba Mon Sep 17 00:00:00 2001 From: Daniel Dickinson Date: Wed, 15 Feb 2012 09:34:08 +0000 Subject: [PATCH 082/117] [packages] more gcc 4.6 compilation fixes git-svn-id: svn://svn.openwrt.org/openwrt/packages/ipv6/ndppd@30548 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 270f84b..1750d24 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ define Build/Compile CXXFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CXXFLAGS) -fno-builtin -fno-rtti -nostdinc++ \ -I$(STAGING_DIR)/usr/include/uClibc++ -I$(LINUX_DIR)/include" \ LDFLAGS="$(TARGET_LDFLAGS)" \ - LIBS="-nodefaultlibs -lc -luClibc++ -lconfuse" \ + LIBS="-nodefaultlibs -lc -luClibc++ -lconfuse $(LIBGCC_S)" \ ndppd endef From 676138daf49a2281c0ba6f637c118c1253dd0035 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Thu, 16 Feb 2012 11:58:30 +0000 Subject: [PATCH 083/117] ndppd: new upstream release 0.2.2 New features in 0.2.2: - libconfuse dependency removed - Improved logging - New auto-configuration option Signed-off-by: Gabriel Kerneis git-svn-id: svn://svn.openwrt.org/openwrt/packages/ipv6/ndppd@30580 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 1750d24..7d37384 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2007-2011 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. @@ -8,12 +8,19 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ndppd -PKG_VERSION:=0.2.1 +PKG_VERSION:=0.2.2 PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +# Latest release PKG_SOURCE_URL:=http://www.priv.nu/projects/ndppd/files/ -PKG_MD5SUM:=9b65a8cccfce8689f0c1c410c20b4790 +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)/package.mk @@ -23,7 +30,7 @@ define Package/ndppd TITLE:=NDP Proxy Daemon URL:=http://www.priv.nu/projects/ndppd/ MAINTAINER:=Gabriel Kerneis - DEPENDS:=+kmod-ipv6 +confuse +uclibcxx + DEPENDS:=+kmod-ipv6 +uclibcxx endef define Package/ndppd/description @@ -44,10 +51,11 @@ endef define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR) \ CXX="$(TARGET_CXX)" \ - CXXFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CXXFLAGS) -fno-builtin -fno-rtti -nostdinc++ \ - -I$(STAGING_DIR)/usr/include/uClibc++ -I$(LINUX_DIR)/include" \ + CXXFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CXXFLAGS) $(TARGET_CFLAGS) \ + -std=c++0x -fno-builtin -fno-rtti -nostdinc++ \ + -I$(STAGING_DIR)/usr/include/uClibc++" \ LDFLAGS="$(TARGET_LDFLAGS)" \ - LIBS="-nodefaultlibs -lc -luClibc++ -lconfuse $(LIBGCC_S)" \ + LIBS="-nodefaultlibs -lc -luClibc++ $(LIBGCC_S)" \ ndppd endef From 9d73fc20349481390bdbce0b2b475705f192f307 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Tue, 21 Feb 2012 22:47:27 +0000 Subject: [PATCH 084/117] [packages] quagga: Drop support for Quagga 0.98.6 git-svn-id: svn+ssh://svn.openwrt.org/openwrt@30674 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 27 +- patches-old/001-quagga_cross.patch | 84 -- patches-old/001-quagga_readline.patch | 58 -- patches-old/002-quagga_manet.patch | 855 ------------------ patches-old/100-confederation.patch | 18 - patches-old/120-confed_errorhandle.patch | 90 -- patches-old/130-netlink_ignore_wireless.patch | 38 - patches-old/140-holdtimer-set.patch | 20 - patches-old/150-no-cross-fs-link.patch | 40 - patches-old/170-use-supported-pagers.patch | 29 - 10 files changed, 5 insertions(+), 1254 deletions(-) delete mode 100644 patches-old/001-quagga_cross.patch delete mode 100644 patches-old/001-quagga_readline.patch delete mode 100644 patches-old/002-quagga_manet.patch delete mode 100644 patches-old/100-confederation.patch delete mode 100644 patches-old/120-confed_errorhandle.patch delete mode 100644 patches-old/130-netlink_ignore_wireless.patch delete mode 100644 patches-old/140-holdtimer-set.patch delete mode 100644 patches-old/150-no-cross-fs-link.patch delete mode 100644 patches-old/170-use-supported-pagers.patch diff --git a/Makefile b/Makefile index 25525f2..3f5255a 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2011 OpenWrt.org +# Copyright (C) 2006-2012 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,23 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga -ifneq ($(CONFIG_QUAGGA_OLD),) - PKG_VERSION:=0.98.6 - PKG_RELEASE:=11 - PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68 - PATCH_DIR:=./patches-old -else - PKG_VERSION:=0.99.20 - PKG_RELEASE:=2 - PKG_MD5SUM:=64cc29394eb8a4e24649d19dac868f64 -endif +PKG_VERSION:=0.99.20 +PKG_RELEASE:=2 +PKG_MD5SUM:=64cc29394eb8a4e24649d19dac868f64 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.quagga.net/download/ \ http://www.de.quagga.net/download/ \ http://www.uk.quagga.net/download/ PKG_CONFIG_DEPENDS:= \ - CONFIG_QUAGGA_OLD \ CONFIG_IPV6 \ CONFIG_PACKAGE_quagga-libzebra \ CONFIG_PACKAGE_quagga-libospf \ @@ -52,7 +44,7 @@ endef define Package/quagga $(call Package/quagga/Default) - DEPENDS:=+!QUAGGA_OLD:librt + DEPENDS:=+librt MENU:=1 endef @@ -62,15 +54,6 @@ define Package/quagga/description OSPFv3, BGP-4, and BGP-4+ endef -define Package/quagga/config -config QUAGGA_OLD - depends on (PACKAGE_quagga && BROKEN) - default n - bool "Use the old release version 0.98.6" - help - This option allows you to select the old version of Quagga to be built. -endef - define Package/quagga-libzebra $(call Package/quagga/Default) TITLE:=zebra library diff --git a/patches-old/001-quagga_cross.patch b/patches-old/001-quagga_cross.patch deleted file mode 100644 index b6d5b20..0000000 --- a/patches-old/001-quagga_cross.patch +++ /dev/null @@ -1,84 +0,0 @@ ---- a/configure -+++ b/configure -@@ -12675,69 +12675,6 @@ fi - - - --echo "$as_me:$LINENO: checking for broken CMSG_FIRSTHDR" >&5 --echo $ECHO_N "checking for broken CMSG_FIRSTHDR... $ECHO_C" >&6 --if test "$cross_compiling" = yes; then -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --/* confdefs.h. */ --_ACEOF --cat confdefs.h >>conftest.$ac_ext --cat >>conftest.$ac_ext <<_ACEOF --/* end confdefs.h. */ -- --#ifdef SUNOS_5 --#define _XPG4_2 --#define __EXTENSIONS__ --#endif --#include --#include --#include -- --main() --{ -- struct msghdr msg; -- char buf[4]; -- -- msg.msg_control = buf; -- msg.msg_controllen = 0; -- -- if (CMSG_FIRSTHDR(&msg) != NULL) -- exit(0); -- exit (1); --} --_ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- echo "$as_me:$LINENO: result: yes - using workaround" >&5 --echo "${ECHO_T}yes - using workaround" >&6 --cat >>confdefs.h <<\_ACEOF --#define HAVE_BROKEN_CMSG_FIRSTHDR --_ACEOF -- --else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 --sed 's/^/| /' conftest.$ac_ext >&5 -- --( exit $ac_status ) --echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi --rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi -- - echo "$as_me:$LINENO: checking route read method check" >&5 - echo $ECHO_N "checking route read method check... $ECHO_C" >&6 - if test "${zebra_rtread+set}" = set; then -@@ -12835,10 +12772,7 @@ echo $ECHO_N "checking ipforward method - if test "${zebra_ipforward_path+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null; --do -- test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break --done -+ zebra_ipforward_path="/proc/net/snmp" - case $zebra_ipforward_path in - "/proc/net/snmp") IPFORWARD=ipforward_proc.o - zebra_ipforward_path="proc";; diff --git a/patches-old/001-quagga_readline.patch b/patches-old/001-quagga_readline.patch deleted file mode 100644 index 68113fd..0000000 --- a/patches-old/001-quagga_readline.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/configure -+++ b/configure -@@ -10972,7 +10972,7 @@ if test "${ac_cv_lib_curses_tputs+set}" - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lcurses $LIBS" -+#LIBS="-lcurses $LIBS" - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ - _ACEOF -@@ -11108,7 +11108,8 @@ if test $ac_cv_lib_ncurses_tputs = yes; - #define HAVE_LIBNCURSES 1 - _ACEOF - -- LIBS="-lncurses $LIBS" -+# LIBS="-lncurses $LIBS" -+CURSES=-lncurses - - fi - -@@ -11125,7 +11126,7 @@ if test "${ac_cv_lib_readline_main+set}" - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lreadline $LIBS" -+LIBS="-lreadline $CURSES $LIBS" - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ - _ACEOF -@@ -11182,7 +11183,8 @@ if test $ac_cv_lib_readline_main = yes; - #define HAVE_LIBREADLINE 1 - _ACEOF - -- LIBS="-lreadline $LIBS" -+# LIBS="-lreadline $LIBS" -+CURSES="$CURSES -lreadline" - - fi - -@@ -11342,7 +11344,7 @@ if test "${ac_cv_lib_readline_rl_complet - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lreadline $LIBS" -+LIBS="-lreadline $CURSES $LIBS" - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ - _ACEOF -@@ -11405,7 +11407,7 @@ if test $ac_cv_lib_readline_rl_completio - #define HAVE_LIBREADLINE 1 - _ACEOF - -- LIBS="-lreadline $LIBS" -+# LIBS="-lreadline $LIBS" - - fi - diff --git a/patches-old/002-quagga_manet.patch b/patches-old/002-quagga_manet.patch deleted file mode 100644 index 8fe07ac..0000000 --- a/patches-old/002-quagga_manet.patch +++ /dev/null @@ -1,855 +0,0 @@ ---- a/bgpd/bgp_vty.c -+++ b/bgpd/bgp_vty.c -@@ -3,6 +3,9 @@ - - This file is part of GNU Zebra. - -+This file was modified from the original on 30/12/2007 -+by Vasilis Tsiligiannis -+ - GNU Zebra is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any -@@ -7793,8 +7796,12 @@ bgp_str2route_type (int afi, const char - return ZEBRA_ROUTE_STATIC; - else if (strncmp (str, "r", 1) == 0) - return ZEBRA_ROUTE_RIP; -- else if (strncmp (str, "o", 1) == 0) -+ else if (strncmp (str, "ol", 2) == 0) -+ return ZEBRA_ROUTE_OLSR; -+ else if (strncmp (str, "os", 2) == 0) - return ZEBRA_ROUTE_OSPF; -+ else if (strncmp (str, "ba", 2) == 0) -+ return ZEBRA_ROUTE_BATMAN; - } - if (afi == AFI_IP6) - { -@@ -7806,21 +7813,28 @@ bgp_str2route_type (int afi, const char - return ZEBRA_ROUTE_STATIC; - else if (strncmp (str, "r", 1) == 0) - return ZEBRA_ROUTE_RIPNG; -- else if (strncmp (str, "o", 1) == 0) -+ else if (strncmp (str, "os", 2) == 0) - return ZEBRA_ROUTE_OSPF6; -+ else if (strncmp (str, "ol", 2) == 0) -+ return ZEBRA_ROUTE_OLSR; -+ else if (strncmp (str, "ba", 2) == 0) -+ return ZEBRA_ROUTE_BATMAN; - } - return 0; - } - - DEFUN (bgp_redistribute_ipv4, - bgp_redistribute_ipv4_cmd, -- "redistribute (connected|kernel|ospf|rip|static)", -+ "redistribute (connected|kernel|ospf|rip|static|olsr|batman)", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" -- "Static routes\n") -+ "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+ ) - { - int type; - -@@ -7835,13 +7849,15 @@ DEFUN (bgp_redistribute_ipv4, - - DEFUN (bgp_redistribute_ipv4_rmap, - bgp_redistribute_ipv4_rmap_cmd, -- "redistribute (connected|kernel|ospf|rip|static) route-map WORD", -+ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n") - { -@@ -7860,13 +7876,15 @@ DEFUN (bgp_redistribute_ipv4_rmap, - - DEFUN (bgp_redistribute_ipv4_metric, - bgp_redistribute_ipv4_metric_cmd, -- "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295>", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n") - { -@@ -7887,13 +7905,15 @@ DEFUN (bgp_redistribute_ipv4_metric, - - DEFUN (bgp_redistribute_ipv4_rmap_metric, - bgp_redistribute_ipv4_rmap_metric_cmd, -- "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD metric <0-4294967295>", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n" - "Metric for redistributed routes\n" -@@ -7917,13 +7937,15 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric - - DEFUN (bgp_redistribute_ipv4_metric_rmap, - bgp_redistribute_ipv4_metric_rmap_cmd, -- "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", -+ "redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295> route-map WORD", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n" - "Route map reference\n" -@@ -7947,14 +7969,17 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap - - DEFUN (no_bgp_redistribute_ipv4, - no_bgp_redistribute_ipv4_cmd, -- "no redistribute (connected|kernel|ospf|rip|static)", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman)", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" -- "Static routes\n") -+ "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+ ) - { - int type; - -@@ -7970,7 +7995,7 @@ DEFUN (no_bgp_redistribute_ipv4, - - DEFUN (no_bgp_redistribute_ipv4_rmap, - no_bgp_redistribute_ipv4_rmap_cmd, -- "no redistribute (connected|kernel|ospf|rip|static) route-map WORD", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -7978,6 +8003,8 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n") - { -@@ -7996,7 +8023,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, - - DEFUN (no_bgp_redistribute_ipv4_metric, - no_bgp_redistribute_ipv4_metric_cmd, -- "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8004,6 +8031,8 @@ DEFUN (no_bgp_redistribute_ipv4_metric, - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n") - { -@@ -8022,7 +8051,7 @@ DEFUN (no_bgp_redistribute_ipv4_metric, - - DEFUN (no_bgp_redistribute_ipv4_rmap_metric, - no_bgp_redistribute_ipv4_rmap_metric_cmd, -- "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) route-map WORD metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8030,6 +8059,8 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n" - "Metric for redistributed routes\n" -@@ -8051,7 +8082,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met - - ALIAS (no_bgp_redistribute_ipv4_rmap_metric, - no_bgp_redistribute_ipv4_metric_rmap_cmd, -- "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", -+ "no redistribute (connected|kernel|ospf|rip|static|olsr|batman) metric <0-4294967295> route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8059,6 +8090,8 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n" - "Route map reference\n" -@@ -8067,13 +8100,16 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met - #ifdef HAVE_IPV6 - DEFUN (bgp_redistribute_ipv6, - bgp_redistribute_ipv6_cmd, -- "redistribute (connected|kernel|ospf6|ripng|static)", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman)", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" -- "Static routes\n") -+ "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+ ) - { - int type; - -@@ -8089,13 +8125,15 @@ DEFUN (bgp_redistribute_ipv6, - - DEFUN (bgp_redistribute_ipv6_rmap, - bgp_redistribute_ipv6_rmap_cmd, -- "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n") - { -@@ -8114,13 +8152,15 @@ DEFUN (bgp_redistribute_ipv6_rmap, - - DEFUN (bgp_redistribute_ipv6_metric, - bgp_redistribute_ipv6_metric_cmd, -- "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295>", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n") - { -@@ -8141,13 +8181,15 @@ DEFUN (bgp_redistribute_ipv6_metric, - - DEFUN (bgp_redistribute_ipv6_rmap_metric, - bgp_redistribute_ipv6_rmap_metric_cmd, -- "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD metric <0-4294967295>", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n" - "Metric for redistributed routes\n" -@@ -8171,13 +8213,15 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric - - DEFUN (bgp_redistribute_ipv6_metric_rmap, - bgp_redistribute_ipv6_metric_rmap_cmd, -- "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", -+ "redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295> route-map WORD", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n" - "Route map reference\n" -@@ -8201,14 +8245,17 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap - - DEFUN (no_bgp_redistribute_ipv6, - no_bgp_redistribute_ipv6_cmd, -- "no redistribute (connected|kernel|ospf6|ripng|static)", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman)", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" -- "Static routes\n") -+ "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+ ) - { - int type; - -@@ -8224,7 +8271,7 @@ DEFUN (no_bgp_redistribute_ipv6, - - DEFUN (no_bgp_redistribute_ipv6_rmap, - no_bgp_redistribute_ipv6_rmap_cmd, -- "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8232,6 +8279,8 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n") - { -@@ -8250,7 +8299,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, - - DEFUN (no_bgp_redistribute_ipv6_metric, - no_bgp_redistribute_ipv6_metric_cmd, -- "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8258,6 +8307,8 @@ DEFUN (no_bgp_redistribute_ipv6_metric, - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n") - { -@@ -8276,7 +8327,7 @@ DEFUN (no_bgp_redistribute_ipv6_metric, - - DEFUN (no_bgp_redistribute_ipv6_rmap_metric, - no_bgp_redistribute_ipv6_rmap_metric_cmd, -- "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) route-map WORD metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8284,6 +8335,8 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n" - "Metric for redistributed routes\n" -@@ -8305,7 +8358,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met - - ALIAS (no_bgp_redistribute_ipv6_rmap_metric, - no_bgp_redistribute_ipv6_metric_rmap_cmd, -- "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", -+ "no redistribute (connected|kernel|ospf6|ripng|static|olsr|batman) metric <0-4294967295> route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8313,6 +8366,8 @@ ALIAS (no_bgp_redistribute_ipv6_rmap_met - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n" - "Route map reference\n" -@@ -8325,7 +8380,7 @@ bgp_config_write_redistribute (struct vt - { - int i; - const char *str[] = { "system", "kernel", "connected", "static", "rip", -- "ripng", "ospf", "ospf6", "isis", "bgp"}; -+ "ripng", "ospf", "ospf6", "isis", "bgp", "hsls", "olsr", "batman"}; - - /* Unicast redistribution only. */ - if (safi != SAFI_UNICAST) ---- a/lib/zebra.h -+++ b/lib/zebra.h -@@ -3,6 +3,9 @@ - - This file is part of GNU Zebra. - -+This file was modified from the original on 30/12/2007 -+by Vasilis Tsiligiannis -+ - GNU Zebra is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any -@@ -378,7 +381,9 @@ struct in_pktinfo - #define ZEBRA_ROUTE_ISIS 8 - #define ZEBRA_ROUTE_BGP 9 - #define ZEBRA_ROUTE_HSLS 10 --#define ZEBRA_ROUTE_MAX 11 -+#define ZEBRA_ROUTE_OLSR 11 -+#define ZEBRA_ROUTE_BATMAN 12 -+#define ZEBRA_ROUTE_MAX 13 - - /* Zebra's family types. */ - #define ZEBRA_FAMILY_IPV4 1 ---- a/ospfd/ospf_vty.c -+++ b/ospfd/ospf_vty.c -@@ -3,6 +3,9 @@ - * - * This file is part of GNU Zebra. - * -+ * This file was modified from the original on 30/12/2007 -+ * by Vasilis Tsiligiannis -+ * - * GNU Zebra is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any -@@ -106,11 +109,15 @@ str2distribute_source (const char *str, - *source = ZEBRA_ROUTE_STATIC; - else if (strncmp (str, "r", 1) == 0) - *source = ZEBRA_ROUTE_RIP; -- else if (strncmp (str, "b", 1) == 0) -+ else if (strncmp (str, "bg", 2) == 0) - *source = ZEBRA_ROUTE_BGP; -+ else if (strncmp (str, "ol", 2) == 0) -+ *source = ZEBRA_ROUTE_OLSR; -+ else if (strncmp (str, "ba", 2) == 0) -+ *source = ZEBRA_ROUTE_BATMAN; - else - return 0; -- -+ - return 1; - } - -@@ -5302,13 +5309,15 @@ ALIAS (no_ip_ospf_transmit_delay, - - DEFUN (ospf_redistribute_source_metric_type, - ospf_redistribute_source_metric_type_routemap_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214> metric-type (1|2) route-map WORD", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "OSPF default metric\n" - "OSPF exterior metric type for redistributed routes\n" -@@ -5346,13 +5355,15 @@ DEFUN (ospf_redistribute_source_metric_t - - ALIAS (ospf_redistribute_source_metric_type, - ospf_redistribute_source_metric_type_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214> metric-type (1|2)", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "OSPF default metric\n" - "OSPF exterior metric type for redistributed routes\n" -@@ -5361,25 +5372,29 @@ ALIAS (ospf_redistribute_source_metric_t - - ALIAS (ospf_redistribute_source_metric_type, - ospf_redistribute_source_metric_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214>", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "OSPF default metric\n") - - DEFUN (ospf_redistribute_source_type_metric, - ospf_redistribute_source_type_metric_routemap_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2) metric <0-16777214> route-map WORD", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "OSPF exterior metric type for redistributed routes\n" - "Set OSPF External Type 1 metrics\n" - "Set OSPF External Type 2 metrics\n" -@@ -5417,13 +5432,15 @@ DEFUN (ospf_redistribute_source_type_met - - ALIAS (ospf_redistribute_source_type_metric, - ospf_redistribute_source_type_metric_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2) metric <0-16777214>", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "OSPF exterior metric type for redistributed routes\n" - "Set OSPF External Type 1 metrics\n" - "Set OSPF External Type 2 metrics\n" -@@ -5432,7 +5449,7 @@ ALIAS (ospf_redistribute_source_type_met - - ALIAS (ospf_redistribute_source_type_metric, - ospf_redistribute_source_type_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2)", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" -@@ -5440,28 +5457,35 @@ ALIAS (ospf_redistribute_source_type_met - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" - "OSPF exterior metric type for redistributed routes\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Set OSPF External Type 1 metrics\n" - "Set OSPF External Type 2 metrics\n") - - ALIAS (ospf_redistribute_source_type_metric, - ospf_redistribute_source_cmd, -- "redistribute (kernel|connected|static|rip|bgp)", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman)", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" -- "Border Gateway Protocol (BGP)\n") -+ "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+ ) - - DEFUN (ospf_redistribute_source_metric_routemap, - ospf_redistribute_source_metric_routemap_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric <0-16777214> route-map WORD", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "OSPF default metric\n" - "Route map reference\n" -@@ -5490,13 +5514,15 @@ DEFUN (ospf_redistribute_source_metric_r - - DEFUN (ospf_redistribute_source_type_routemap, - ospf_redistribute_source_type_routemap_cmd, -- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) metric-type (1|2) route-map WORD", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "OSPF exterior metric type for redistributed routes\n" - "Set OSPF External Type 1 metrics\n" - "Set OSPF External Type 2 metrics\n" -@@ -5526,13 +5552,15 @@ DEFUN (ospf_redistribute_source_type_rou - - DEFUN (ospf_redistribute_source_routemap, - ospf_redistribute_source_routemap_cmd, -- "redistribute (kernel|connected|static|rip|bgp) route-map WORD", -+ "redistribute (kernel|connected|static|rip|bgp|olsr|batman) route-map WORD", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" - "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n") - { -@@ -5553,14 +5581,17 @@ DEFUN (ospf_redistribute_source_routemap - - DEFUN (no_ospf_redistribute_source, - no_ospf_redistribute_source_cmd, -- "no redistribute (kernel|connected|static|rip|bgp)", -+ "no redistribute (kernel|connected|static|rip|bgp|olsr|batman)", - NO_STR - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" -- "Border Gateway Protocol (BGP)\n") -+ "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+ ) - { - struct ospf *ospf = vty->index; - int source; -@@ -5574,7 +5605,7 @@ DEFUN (no_ospf_redistribute_source, - - DEFUN (ospf_distribute_list_out, - ospf_distribute_list_out_cmd, -- "distribute-list WORD out (kernel|connected|static|rip|bgp)", -+ "distribute-list WORD out (kernel|connected|static|rip|bgp|olsr|batman)", - "Filter networks in routing updates\n" - "Access-list name\n" - OUT_STR -@@ -5582,7 +5613,10 @@ DEFUN (ospf_distribute_list_out, - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" -- "Border Gateway Protocol (BGP)\n") -+ "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+) - { - struct ospf *ospf = vty->index; - int source; -@@ -5596,7 +5630,7 @@ DEFUN (ospf_distribute_list_out, - - DEFUN (no_ospf_distribute_list_out, - no_ospf_distribute_list_out_cmd, -- "no distribute-list WORD out (kernel|connected|static|rip|bgp)", -+ "no distribute-list WORD out (kernel|connected|static|rip|bgp|olsr|batman)", - NO_STR - "Filter networks in routing updates\n" - "Access-list name\n" -@@ -5605,7 +5639,10 @@ DEFUN (no_ospf_distribute_list_out, - "Connected\n" - "Static routes\n" - "Routing Information Protocol (RIP)\n" -- "Border Gateway Protocol (BGP)\n") -+ "Border Gateway Protocol (BGP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" -+) - { - struct ospf *ospf = vty->index; - int source; -@@ -7121,7 +7158,8 @@ config_write_virtual_link (struct vty *v - - - const char *distribute_str[] = { "system", "kernel", "connected", "static", -- "rip", "ripng", "ospf", "ospf6", "isis", "bgp"}; -+ "rip", "ripng", "ospf", "ospf6", "isis", "bgp", -+ "hsls","olsr","batman"}; - int - config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) - { ---- a/zebra/redistribute.c -+++ b/zebra/redistribute.c -@@ -3,6 +3,9 @@ - * - * This file is part of GNU Zebra. - * -+ * This file was modified from the original on 30/12/2007 -+ * by Vasilis Tsiligiannis -+ * - * GNU Zebra is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any -@@ -253,6 +256,8 @@ zebra_redistribute_add (int command, str - case ZEBRA_ROUTE_OSPF: - case ZEBRA_ROUTE_OSPF6: - case ZEBRA_ROUTE_BGP: -+ case ZEBRA_ROUTE_OLSR: -+ case ZEBRA_ROUTE_BATMAN: - if (! client->redist[type]) - { - client->redist[type] = 1; -@@ -281,6 +286,8 @@ zebra_redistribute_delete (int command, - case ZEBRA_ROUTE_OSPF: - case ZEBRA_ROUTE_OSPF6: - case ZEBRA_ROUTE_BGP: -+ case ZEBRA_ROUTE_OLSR: -+ case ZEBRA_ROUTE_BATMAN: - client->redist[type] = 0; - break; - default: ---- a/zebra/zebra_vty.c -+++ b/zebra/zebra_vty.c -@@ -53,6 +53,10 @@ route_type_str (u_char type) - return "isis"; - case ZEBRA_ROUTE_BGP: - return "bgp"; -+ case ZEBRA_ROUTE_OLSR: -+ return "olsr"; -+ case ZEBRA_ROUTE_BATMAN: -+ return "batman"; - default: - return "unknown"; - } -@@ -84,6 +88,12 @@ route_type_char (u_char type) - return 'I'; - case ZEBRA_ROUTE_BGP: - return 'B'; -+ case ZEBRA_ROUTE_HSLS: -+ return 'H'; -+ case ZEBRA_ROUTE_OLSR: -+ return 'L'; -+ case ZEBRA_ROUTE_BATMAN: -+ return 'M'; - default: - return '?'; - } -@@ -755,8 +765,8 @@ vty_show_ip_route (struct vty *vty, stru - } - - #define SHOW_ROUTE_V4_HEADER "Codes: K - kernel route, C - connected, " \ -- "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, " \ -- "> - selected route, * - FIB route%s%s" -+ "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, H - HSLS, " \ -+ "L - OLSR, M - BATMAN, > - selected route, * - FIB route%s%s" - - DEFUN (show_ip_route, - show_ip_route_cmd, -@@ -874,7 +884,7 @@ DEFUN (show_ip_route_supernets, - - DEFUN (show_ip_route_protocol, - show_ip_route_protocol_cmd, -- "show ip route (bgp|connected|isis|kernel|ospf|rip|static)", -+ "show ip route (bgp|connected|isis|kernel|ospf|rip|olsr|batman|static)", - SHOW_STR - IP_STR - "IP routing table\n" -@@ -884,6 +894,8 @@ DEFUN (show_ip_route_protocol, - "Kernel\n" - "Open Shortest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Static routes\n") - { - int type; -@@ -892,13 +904,13 @@ DEFUN (show_ip_route_protocol, - struct rib *rib; - int first = 1; - -- if (strncmp (argv[0], "b", 1) == 0) -+ if (strncmp (argv[0], "bg", 2) == 0) - type = ZEBRA_ROUTE_BGP; - else if (strncmp (argv[0], "c", 1) == 0) - type = ZEBRA_ROUTE_CONNECT; - else if (strncmp (argv[0], "k", 1) ==0) - type = ZEBRA_ROUTE_KERNEL; -- else if (strncmp (argv[0], "o", 1) == 0) -+ else if (strncmp (argv[0], "os", 2) == 0) - type = ZEBRA_ROUTE_OSPF; - else if (strncmp (argv[0], "i", 1) == 0) - type = ZEBRA_ROUTE_ISIS; -@@ -906,6 +918,10 @@ DEFUN (show_ip_route_protocol, - type = ZEBRA_ROUTE_RIP; - else if (strncmp (argv[0], "s", 1) == 0) - type = ZEBRA_ROUTE_STATIC; -+ else if (strncmp (argv[0], "ol", 2) == 0) -+ type = ZEBRA_ROUTE_OLSR; -+ else if (strncmp (argv[0], "ba", 2) == 0) -+ type = ZEBRA_ROUTE_BATMAN; - else - { - vty_out (vty, "Unknown route type%s", VTY_NEWLINE); -@@ -1732,7 +1748,7 @@ DEFUN (show_ipv6_route_prefix_longer, - - DEFUN (show_ipv6_route_protocol, - show_ipv6_route_protocol_cmd, -- "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|static)", -+ "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|olsr|batman|static)", - SHOW_STR - IP_STR - "IP routing table\n" -@@ -1742,6 +1758,8 @@ DEFUN (show_ipv6_route_protocol, - "Kernel\n" - "Open Shortest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Static routes\n") - { - int type; -@@ -1750,13 +1768,13 @@ DEFUN (show_ipv6_route_protocol, - struct rib *rib; - int first = 1; - -- if (strncmp (argv[0], "b", 1) == 0) -+ if (strncmp (argv[0], "bg", 2) == 0) - type = ZEBRA_ROUTE_BGP; - else if (strncmp (argv[0], "c", 1) == 0) - type = ZEBRA_ROUTE_CONNECT; - else if (strncmp (argv[0], "k", 1) ==0) - type = ZEBRA_ROUTE_KERNEL; -- else if (strncmp (argv[0], "o", 1) == 0) -+ else if (strncmp (argv[0], "os", 2) == 0) - type = ZEBRA_ROUTE_OSPF6; - else if (strncmp (argv[0], "i", 1) == 0) - type = ZEBRA_ROUTE_ISIS; -@@ -1764,7 +1782,11 @@ DEFUN (show_ipv6_route_protocol, - type = ZEBRA_ROUTE_RIPNG; - else if (strncmp (argv[0], "s", 1) == 0) - type = ZEBRA_ROUTE_STATIC; -- else -+ else if (strncmp (argv[0], "ol", 2) == 0) -+ type = ZEBRA_ROUTE_OLSR; -+ else if (strncmp (argv[0], "ba", 2) == 0) -+ type = ZEBRA_ROUTE_BATMAN; -+ else - { - vty_out (vty, "Unknown route type%s", VTY_NEWLINE); - return CMD_WARNING; diff --git a/patches-old/100-confederation.patch b/patches-old/100-confederation.patch deleted file mode 100644 index 6a98653..0000000 --- a/patches-old/100-confederation.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/bgpd/bgp_route.c -+++ b/bgpd/bgp_route.c -@@ -1815,6 +1815,7 @@ bgp_update_main (struct peer *peer, stru - if ((afi == AFI_IP || afi == AFI_IP6) - && safi == SAFI_UNICAST - && (peer_sort (peer) == BGP_PEER_IBGP -+ || peer_sort (peer) == BGP_PEER_CONFED - || (peer_sort (peer) == BGP_PEER_EBGP && peer->ttl != 1) - || CHECK_FLAG (peer->flags, PEER_FLAG_ENFORCE_MULTIHOP))) - { -@@ -1862,6 +1863,7 @@ bgp_update_main (struct peer *peer, stru - if ((afi == AFI_IP || afi == AFI_IP6) - && safi == SAFI_UNICAST - && (peer_sort (peer) == BGP_PEER_IBGP -+ || peer_sort (peer) == BGP_PEER_CONFED - || (peer_sort (peer) == BGP_PEER_EBGP && peer->ttl != 1) - || CHECK_FLAG (peer->flags, PEER_FLAG_ENFORCE_MULTIHOP))) - { diff --git a/patches-old/120-confed_errorhandle.patch b/patches-old/120-confed_errorhandle.patch deleted file mode 100644 index a3cb65c..0000000 --- a/patches-old/120-confed_errorhandle.patch +++ /dev/null @@ -1,90 +0,0 @@ ---- a/bgpd/bgp_aspath.c -+++ b/bgpd/bgp_aspath.c -@@ -614,6 +614,47 @@ aspath_private_as_check (struct aspath * - return 1; - } - -+/* AS path confed check. If aspath contains confed set or sequence then return 1. */ -+int -+aspath_confed_check (struct aspath *aspath) -+{ -+ caddr_t pnt; -+ caddr_t end; -+ struct assegment *assegment; -+ -+ if (aspath == NULL) -+ return 0; -+ -+ pnt = aspath->data; -+ end = aspath->data + aspath->length; -+ -+ while (pnt < end) -+ { -+ assegment = (struct assegment *) pnt; -+ if (assegment->type == AS_CONFED_SET || assegment->type == AS_CONFED_SEQUENCE) -+ return 1; -+ pnt += (assegment->length * AS_VALUE_SIZE) + AS_HEADER_SIZE; -+ } -+ return 0; -+} -+ -+/* Leftmost AS path segment confed check. If leftmost AS segment is of type -+ AS_CONFED_SEQUENCE or AS_CONFED_SET then return 1. */ -+int -+aspath_left_confed_check (struct aspath *aspath) -+{ -+ struct assegment *assegment; -+ -+ if (aspath == NULL) -+ return 0; -+ -+ assegment = (struct assegment *) aspath->data; -+ if (assegment->type == AS_CONFED_SEQUENCE || assegment->type == AS_CONFED_SET) -+ return 1; -+ -+ return 0; -+} -+ - /* Merge as1 to as2. as2 should be uninterned aspath. */ - struct aspath * - aspath_merge (struct aspath *as1, struct aspath *as2) -@@ -671,6 +712,10 @@ aspath_prepend (struct aspath *as1, stru - if (seg1 == NULL) - return as2; - -+ /* Delete any AS_CONFED_SEQUENCE segment from as2. */ -+ if (seg1->type == AS_SEQUENCE && seg2->type == AS_CONFED_SEQUENCE) -+ as2 = aspath_delete_confed_seq (as2); -+ - /* Compare last segment type of as1 and first segment type of as2. */ - if (seg1->type != seg2->type) - return aspath_merge (as1, as2); ---- a/bgpd/bgp_aspath.h -+++ b/bgpd/bgp_aspath.h -@@ -76,4 +76,6 @@ unsigned int aspath_key_make (struct asp - int aspath_loop_check (struct aspath *, as_t); - int aspath_private_as_check (struct aspath *); - int aspath_firstas_check (struct aspath *, as_t); -+int aspath_confed_check (struct aspath *); -+int aspath_left_confed_check (struct aspath *); - unsigned long aspath_count (); ---- a/bgpd/bgp_attr.c -+++ b/bgpd/bgp_attr.c -@@ -673,6 +673,17 @@ bgp_attr_aspath (struct peer *peer, bgp_ - return -1; - } - -+ /* Confederation sanity check. */ -+ if ((peer_sort (peer) == BGP_PEER_CONFED && ! aspath_left_confed_check (attr->aspath)) || -+ (peer_sort (peer) == BGP_PEER_EBGP && aspath_confed_check (attr->aspath))) -+ { -+ zlog (peer->log, LOG_ERR, "Malformed AS path from %s", peer->host); -+ bgp_notify_send (peer, -+ BGP_NOTIFY_UPDATE_ERR, -+ BGP_NOTIFY_UPDATE_MAL_AS_PATH); -+ return -1; -+ } -+ - bgp = peer->bgp; - - /* First AS check for EBGP. */ diff --git a/patches-old/130-netlink_ignore_wireless.patch b/patches-old/130-netlink_ignore_wireless.patch deleted file mode 100644 index 59315d6..0000000 --- a/patches-old/130-netlink_ignore_wireless.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/zebra/rt_netlink.c -+++ b/zebra/rt_netlink.c -@@ -487,6 +487,17 @@ netlink_interface (struct sockaddr_nl *s - /* Looking up interface name. */ - memset (tb, 0, sizeof tb); - netlink_parse_rtattr (tb, IFLA_MAX, IFLA_RTA (ifi), len); -+ -+#ifdef IFLA_WIRELESS -+ /* check for wireless messages to ignore */ -+ if ((tb[IFLA_WIRELESS] != NULL) && (ifi->ifi_change == 0)) -+ { -+ if (IS_ZEBRA_DEBUG_KERNEL) -+ zlog_debug ("%s: ignoring IFLA_WIRELESS message", __func__); -+ return 0; -+ } -+#endif /* IFLA_WIRELESS */ -+ - if (tb[IFLA_IFNAME] == NULL) - return -1; - name = (char *) RTA_DATA (tb[IFLA_IFNAME]); -@@ -943,6 +954,17 @@ netlink_link_change (struct sockaddr_nl - /* Looking up interface name. */ - memset (tb, 0, sizeof tb); - netlink_parse_rtattr (tb, IFLA_MAX, IFLA_RTA (ifi), len); -+ -+#ifdef IFLA_WIRELESS -+ /* check for wireless messages to ignore */ -+ if ((tb[IFLA_WIRELESS] != NULL) && (ifi->ifi_change == 0)) -+ { -+ if (IS_ZEBRA_DEBUG_KERNEL) -+ zlog_debug ("%s: ignoring IFLA_WIRELESS message", __func__); -+ return 0; -+ } -+#endif /* IFLA_WIRELESS */ -+ - if (tb[IFLA_IFNAME] == NULL) - return -1; - name = (char *) RTA_DATA (tb[IFLA_IFNAME]); diff --git a/patches-old/140-holdtimer-set.patch b/patches-old/140-holdtimer-set.patch deleted file mode 100644 index 1264f5b..0000000 --- a/patches-old/140-holdtimer-set.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/bgpd/bgp_network.c -+++ b/bgpd/bgp_network.c -@@ -109,6 +109,7 @@ bgp_accept (struct thread *thread) - peer->fd = bgp_sock; - peer->status = Active; - peer->local_id = peer1->local_id; -+ peer->v_holdtime = BGP_LARGE_HOLDTIME; - - /* Make peer's address string. */ - sockunion2str (&su, buf, SU_ADDRSTRLEN); ---- a/bgpd/bgpd.h -+++ b/bgpd/bgpd.h -@@ -656,6 +656,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 diff --git a/patches-old/150-no-cross-fs-link.patch b/patches-old/150-no-cross-fs-link.patch deleted file mode 100644 index 1988f2e..0000000 --- a/patches-old/150-no-cross-fs-link.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/lib/command.c -+++ b/lib/command.c -@@ -2567,6 +2567,13 @@ - unlink (config_file_tmp); - return CMD_WARNING; - } -+ -+#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, -@@ -2586,7 +2593,23 @@ - unlink (config_file_tmp); - return CMD_WARNING; - } -+#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); -+ return CMD_WARNING; -+ } -+ 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); diff --git a/patches-old/170-use-supported-pagers.patch b/patches-old/170-use-supported-pagers.patch deleted file mode 100644 index fca7fc4..0000000 --- a/patches-old/170-use-supported-pagers.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/vtysh/vtysh.c -+++ b/vtysh/vtysh.c -@@ -243,7 +243,7 @@ vtysh_pager_init () - 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. */ -@@ -1745,7 +1745,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') -@@ -1762,7 +1762,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); - } - From 10027eced89061b421ba1a800cd90e076c9ad4da Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 4 Apr 2012 14:13:50 +0000 Subject: [PATCH 085/117] [package] quagga: add upstream patches fixing memory leaks Signed-off-by: Oliver Smith git-svn-id: svn+ssh://svn.openwrt.org/openwrt@31190 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- patches/180-fix-lib-connect-memleak.patch | 61 +++++++++++++++++++++++ patches/181-ospf-null-ptr-fix.patch | 51 +++++++++++++++++++ patches/182-fix-bgpd-memleak.patch | 20 ++++++++ 4 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 patches/180-fix-lib-connect-memleak.patch create mode 100644 patches/181-ospf-null-ptr-fix.patch create mode 100644 patches/182-fix-bgpd-memleak.patch diff --git a/Makefile b/Makefile index 3f5255a..94d2c54 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga PKG_VERSION:=0.99.20 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MD5SUM:=64cc29394eb8a4e24649d19dac868f64 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/patches/180-fix-lib-connect-memleak.patch b/patches/180-fix-lib-connect-memleak.patch new file mode 100644 index 0000000..85b6c10 --- /dev/null +++ b/patches/180-fix-lib-connect-memleak.patch @@ -0,0 +1,61 @@ +From b24b19f719fdd9c3d61a0c93552cd64d832d964c Mon Sep 17 00:00:00 2001 +From: Stephen Hemminger +Date: Tue, 6 Dec 2011 14:09:18 +0400 +Subject: [PATCH] lib: fix memory leak on connect() failure + +Change sockunion_log() to not use strdup(). This fixes a small memory +leak that occurs on every failed connect(), and is simpler/cleaner. +--- + lib/sockunion.c | 23 +++++++++++------------ + 1 files changed, 11 insertions(+), 12 deletions(-) + +--- a/lib/sockunion.c ++++ b/lib/sockunion.c +@@ -297,27 +297,24 @@ sockunion_sizeof (union sockunion *su) + } + + /* return sockunion structure : this function should be revised. */ +-static char * +-sockunion_log (union sockunion *su) ++static const char * ++sockunion_log (union sockunion *su, char *buf, size_t len) + { +- static char buf[SU_ADDRSTRLEN]; +- + switch (su->sa.sa_family) + { + case AF_INET: +- snprintf (buf, SU_ADDRSTRLEN, "%s", inet_ntoa (su->sin.sin_addr)); +- break; ++ return inet_ntop(AF_INET, &su->sin.sin_addr, buf, len); ++ + #ifdef HAVE_IPV6 + case AF_INET6: +- snprintf (buf, SU_ADDRSTRLEN, "%s", +- inet_ntop (AF_INET6, &(su->sin6.sin6_addr), buf, SU_ADDRSTRLEN)); ++ return inet_ntop(AF_INET6, &(su->sin6.sin6_addr), buf, len); + break; + #endif /* HAVE_IPV6 */ ++ + default: +- snprintf (buf, SU_ADDRSTRLEN, "af_unknown %d ", su->sa.sa_family); +- break; ++ snprintf (buf, len, "af_unknown %d ", su->sa.sa_family); ++ return buf; + } +- return (XSTRDUP (MTYPE_TMP, buf)); + } + + /* sockunion_connect returns +@@ -379,8 +376,10 @@ sockunion_connect (int fd, union sockuni + { + if (errno != EINPROGRESS) + { ++ char str[SU_ADDRSTRLEN]; + zlog_info ("can't connect to %s fd %d : %s", +- sockunion_log (&su), fd, safe_strerror (errno)); ++ sockunion_log (&su, str, sizeof str), ++ fd, safe_strerror (errno)); + return connect_error; + } + } diff --git a/patches/181-ospf-null-ptr-fix.patch b/patches/181-ospf-null-ptr-fix.patch new file mode 100644 index 0000000..9ae47cf --- /dev/null +++ b/patches/181-ospf-null-ptr-fix.patch @@ -0,0 +1,51 @@ +From 6a2e0f36b103386e57dbe3a6ee4716e809111198 Mon Sep 17 00:00:00 2001 +From: Stephen Hemminger +Date: Tue, 6 Dec 2011 14:04:12 +0400 +Subject: [PATCH] lib: call filter delete hook before freeing access list + +The delete_hook was being run after calling access list delete function. +This would cause ospf to dereference a NULL, in ospf_filter_update +because 'access->name' was already freed. + +See also: + https://bugzilla.vyatta.com/show_bug.cgi?id=7654 +--- + lib/filter.c | 12 ++++++------ + 1 files changed, 6 insertions(+), 6 deletions(-) + +--- a/lib/filter.c ++++ b/lib/filter.c +@@ -1337,13 +1337,13 @@ DEFUN (no_access_list_all, + + master = access->master; + +- /* Delete all filter from access-list. */ +- access_list_delete (access); +- + /* Run hook function. */ + if (master->delete_hook) + (*master->delete_hook) (access); + ++ /* Delete all filter from access-list. */ ++ access_list_delete (access); ++ + return CMD_SUCCESS; + } + +@@ -1508,13 +1508,13 @@ DEFUN (no_ipv6_access_list_all, + + master = access->master; + +- /* Delete all filter from access-list. */ +- access_list_delete (access); +- + /* Run hook function. */ + if (master->delete_hook) + (*master->delete_hook) (access); + ++ /* Delete all filter from access-list. */ ++ access_list_delete (access); ++ + return CMD_SUCCESS; + } + diff --git a/patches/182-fix-bgpd-memleak.patch b/patches/182-fix-bgpd-memleak.patch new file mode 100644 index 0000000..3084585 --- /dev/null +++ b/patches/182-fix-bgpd-memleak.patch @@ -0,0 +1,20 @@ +From ce0af6ff5a4f200035ed4134da72a67f49a21dd6 Mon Sep 17 00:00:00 2001 +From: "Oleg A. Arkhangelsky" +Date: Sat, 3 Dec 2011 15:18:19 +0400 +Subject: [PATCH] bgpd: fix memory leak for extra attributes + +this fixes commit b881c7074bb698aeb1b099175b325734fc6e44d2 +--- + bgpd/bgp_attr.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +--- a/bgpd/bgp_attr.c ++++ b/bgpd/bgp_attr.c +@@ -675,6 +675,7 @@ bgp_attr_unintern (struct attr **attr) + } + + bgp_attr_unintern_sub (&tmp); ++ bgp_attr_extra_free (&tmp); + } + + void From 254d19107a8fff7cc2f0b88c7f43de7efe77c8c3 Mon Sep 17 00:00:00 2001 From: jow Date: Tue, 10 Apr 2012 13:48:55 +0000 Subject: [PATCH 086/117] [packages] quagga: explicitely disable linking against libcap git-svn-id: svn+ssh://svn.openwrt.org/openwrt@31237 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 94d2c54..4079009 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga PKG_VERSION:=0.99.20 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_MD5SUM:=64cc29394eb8a4e24649d19dac868f64 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz @@ -154,6 +154,7 @@ CONFIGURE_ARGS+= \ --enable-pie=no \ --enable-multipath=8 \ --disable-ospfclient \ + --disable-capabilities \ $(call autoconf_bool,CONFIG_PACKAGE_quagga-libzebra,zebra) \ $(call autoconf_bool,CONFIG_PACKAGE_quagga-libospf,ospfd) \ $(call autoconf_bool,CONFIG_PACKAGE_quagga-bgpd,bgpd) \ From 9a58bece62c7ad3cfc30b5bbdee7aaee351650b0 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Tue, 29 May 2012 13:01:43 +0000 Subject: [PATCH 087/117] [packages] quagga: Bump to v0.99.21 git-svn-id: svn+ssh://svn.openwrt.org/openwrt@31987 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 6 +- patches/120-quagga_manet.patch | 836 +++------------------- patches/130-fix_cpp.patch | 6 +- patches/140-holdtimer-set.patch | 2 +- patches/150-no-cross-fs-link.patch | 4 +- patches/160-pgbgp.patch | 69 +- patches/161-pgbgp-addon.patch | 16 +- patches/170-use-supported-pagers.patch | 6 +- patches/180-fix-lib-connect-memleak.patch | 61 -- patches/181-ospf-null-ptr-fix.patch | 51 -- patches/182-fix-bgpd-memleak.patch | 20 - 11 files changed, 151 insertions(+), 926 deletions(-) delete mode 100644 patches/180-fix-lib-connect-memleak.patch delete mode 100644 patches/181-ospf-null-ptr-fix.patch delete mode 100644 patches/182-fix-bgpd-memleak.patch diff --git a/Makefile b/Makefile index 4079009..d7cb21d 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga -PKG_VERSION:=0.99.20 -PKG_RELEASE:=4 -PKG_MD5SUM:=64cc29394eb8a4e24649d19dac868f64 +PKG_VERSION:=0.99.21 +PKG_RELEASE:=1 +PKG_MD5SUM:=99840adbe57047c90dfba6b6ed9aec7f PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.quagga.net/download/ \ diff --git a/patches/120-quagga_manet.patch b/patches/120-quagga_manet.patch index 105dae4..7543f1e 100644 --- a/patches/120-quagga_manet.patch +++ b/patches/120-quagga_manet.patch @@ -1,425 +1,53 @@ ---- a/bgpd/bgp_vty.c -+++ b/bgpd/bgp_vty.c -@@ -8399,8 +8399,14 @@ bgp_str2route_type (int afi, const char - return ZEBRA_ROUTE_STATIC; - else if (strncmp (str, "r", 1) == 0) - return ZEBRA_ROUTE_RIP; -- else if (strncmp (str, "o", 1) == 0) -+ else if (strncmp (str, "os", 2) == 0) - return ZEBRA_ROUTE_OSPF; -+ else if (strncmp (str, "h", 1) == 0) -+ return ZEBRA_ROUTE_HSLS; -+ else if (strncmp (str, "ol", 2) == 0) -+ return ZEBRA_ROUTE_OLSR; -+ else if (strncmp (str, "b", 1) == 0) -+ return ZEBRA_ROUTE_BATMAN; - } - if (afi == AFI_IP6) - { -@@ -8412,21 +8418,30 @@ bgp_str2route_type (int afi, const char - return ZEBRA_ROUTE_STATIC; - else if (strncmp (str, "r", 1) == 0) - return ZEBRA_ROUTE_RIPNG; -- else if (strncmp (str, "o", 1) == 0) -+ else if (strncmp (str, "os", 2) == 0) - return ZEBRA_ROUTE_OSPF6; -+ else if (strncmp (str, "h", 1) == 0) -+ return ZEBRA_ROUTE_HSLS; -+ else if (strncmp (str, "ol", 2) == 0) -+ return ZEBRA_ROUTE_OLSR; -+ else if (strncmp (str, "b", 1) == 0) -+ return ZEBRA_ROUTE_BATMAN; - } - return 0; - } - - DEFUN (bgp_redistribute_ipv4, - bgp_redistribute_ipv4_cmd, -- "redistribute (connected|kernel|ospf|rip|static)", -+ "redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman)", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" -- "Static routes\n") -+ "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n") - { - int type; - -@@ -8441,13 +8456,16 @@ DEFUN (bgp_redistribute_ipv4, - - DEFUN (bgp_redistribute_ipv4_rmap, - bgp_redistribute_ipv4_rmap_cmd, -- "redistribute (connected|kernel|ospf|rip|static) route-map WORD", -+ "redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) route-map WORD", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n") - { -@@ -8466,13 +8484,16 @@ DEFUN (bgp_redistribute_ipv4_rmap, - - DEFUN (bgp_redistribute_ipv4_metric, - bgp_redistribute_ipv4_metric_cmd, -- "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) metric <0-4294967295>", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n") - { -@@ -8493,13 +8514,16 @@ DEFUN (bgp_redistribute_ipv4_metric, - - DEFUN (bgp_redistribute_ipv4_rmap_metric, - bgp_redistribute_ipv4_rmap_metric_cmd, -- "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) route-map WORD metric <0-4294967295>", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n" - "Metric for redistributed routes\n" -@@ -8523,13 +8547,16 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric - - DEFUN (bgp_redistribute_ipv4_metric_rmap, - bgp_redistribute_ipv4_metric_rmap_cmd, -- "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", -+ "redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) metric <0-4294967295> route-map WORD", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n" - "Route map reference\n" -@@ -8553,14 +8580,17 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap - - DEFUN (no_bgp_redistribute_ipv4, - no_bgp_redistribute_ipv4_cmd, -- "no redistribute (connected|kernel|ospf|rip|static)", -+ "no redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman)", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" -- "Static routes\n") -+ "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n") - { - int type; - -@@ -8576,7 +8606,7 @@ DEFUN (no_bgp_redistribute_ipv4, - - DEFUN (no_bgp_redistribute_ipv4_rmap, - no_bgp_redistribute_ipv4_rmap_cmd, -- "no redistribute (connected|kernel|ospf|rip|static) route-map WORD", -+ "no redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8584,6 +8614,9 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n") - { -@@ -8602,7 +8635,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap, - - DEFUN (no_bgp_redistribute_ipv4_metric, - no_bgp_redistribute_ipv4_metric_cmd, -- "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8610,6 +8643,9 @@ DEFUN (no_bgp_redistribute_ipv4_metric, - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n") - { -@@ -8628,7 +8664,7 @@ DEFUN (no_bgp_redistribute_ipv4_metric, - - DEFUN (no_bgp_redistribute_ipv4_rmap_metric, - no_bgp_redistribute_ipv4_rmap_metric_cmd, -- "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) route-map WORD metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8636,6 +8672,9 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n" - "Metric for redistributed routes\n" -@@ -8657,7 +8696,7 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_met - - ALIAS (no_bgp_redistribute_ipv4_rmap_metric, - no_bgp_redistribute_ipv4_metric_rmap_cmd, -- "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", -+ "no redistribute (connected|kernel|ospf|rip|static|hsls|olsr|batman) metric <0-4294967295> route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8665,6 +8704,9 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met - "Open Shurtest Path First (OSPF)\n" - "Routing Information Protocol (RIP)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n" - "Route map reference\n" -@@ -8673,13 +8715,16 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_met - #ifdef HAVE_IPV6 - DEFUN (bgp_redistribute_ipv6, - bgp_redistribute_ipv6_cmd, -- "redistribute (connected|kernel|ospf6|ripng|static)", -+ "redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman)", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" -- "Static routes\n") -+ "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n") - { - int type; - -@@ -8695,13 +8740,16 @@ DEFUN (bgp_redistribute_ipv6, - - DEFUN (bgp_redistribute_ipv6_rmap, - bgp_redistribute_ipv6_rmap_cmd, -- "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", -+ "redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) route-map WORD", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n") - { -@@ -8720,13 +8768,16 @@ DEFUN (bgp_redistribute_ipv6_rmap, - - DEFUN (bgp_redistribute_ipv6_metric, - bgp_redistribute_ipv6_metric_cmd, -- "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) metric <0-4294967295>", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n") - { -@@ -8747,13 +8798,16 @@ DEFUN (bgp_redistribute_ipv6_metric, - - DEFUN (bgp_redistribute_ipv6_rmap_metric, - bgp_redistribute_ipv6_rmap_metric_cmd, -- "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", -+ "redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) route-map WORD metric <0-4294967295>", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n" - "Metric for redistributed routes\n" -@@ -8777,13 +8831,16 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric - - DEFUN (bgp_redistribute_ipv6_metric_rmap, - bgp_redistribute_ipv6_metric_rmap_cmd, -- "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", -+ "redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) metric <0-4294967295> route-map WORD", - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n" - "Route map reference\n" -@@ -8807,14 +8864,17 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap - - DEFUN (no_bgp_redistribute_ipv6, - no_bgp_redistribute_ipv6_cmd, -- "no redistribute (connected|kernel|ospf6|ripng|static)", -+ "no redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman)", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" - "Kernel routes\n" - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" -- "Static routes\n") -+ "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n") - { - int type; - -@@ -8830,7 +8890,7 @@ DEFUN (no_bgp_redistribute_ipv6, - - DEFUN (no_bgp_redistribute_ipv6_rmap, - no_bgp_redistribute_ipv6_rmap_cmd, -- "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", -+ "no redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8838,6 +8898,9 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n") - { -@@ -8856,7 +8919,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap, - - DEFUN (no_bgp_redistribute_ipv6_metric, - no_bgp_redistribute_ipv6_metric_cmd, -- "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8864,6 +8927,9 @@ DEFUN (no_bgp_redistribute_ipv6_metric, - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n") - { -@@ -8882,7 +8948,7 @@ DEFUN (no_bgp_redistribute_ipv6_metric, - - DEFUN (no_bgp_redistribute_ipv6_rmap_metric, - no_bgp_redistribute_ipv6_rmap_metric_cmd, -- "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", -+ "no redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) route-map WORD metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8890,6 +8956,9 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Route map reference\n" - "Pointer to route-map entries\n" - "Metric for redistributed routes\n" -@@ -8911,7 +8980,7 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_met - - ALIAS (no_bgp_redistribute_ipv6_rmap_metric, - no_bgp_redistribute_ipv6_metric_rmap_cmd, -- "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", -+ "no redistribute (connected|kernel|ospf6|ripng|static|hsls|olsr|batman) metric <0-4294967295> route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - "Connected\n" -@@ -8919,6 +8988,9 @@ ALIAS (no_bgp_redistribute_ipv6_rmap_met - "Open Shurtest Path First (OSPFv3)\n" - "Routing Information Protocol (RIPng)\n" - "Static routes\n" -+ "Hazy-Sighted Link State Protocol (HSLS)\n" -+ "Optimized Link State Routing (OLSR)\n" -+ "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" - "Metric for redistributed routes\n" - "Default metric\n" - "Route map reference\n" --- a/lib/log.c +++ b/lib/log.c -@@ -837,6 +837,8 @@ static const struct zebra_desc_table rou - DESC_ENTRY (ZEBRA_ROUTE_ISIS, "isis", 'I' ), - DESC_ENTRY (ZEBRA_ROUTE_BGP, "bgp", 'B' ), - DESC_ENTRY (ZEBRA_ROUTE_HSLS, "hsls", 'H' ), -+ DESC_ENTRY (ZEBRA_ROUTE_OLSR, "olsr", 'o' ), -+ DESC_ENTRY (ZEBRA_ROUTE_BATMAN, "batman", 'b' ), - }; - #undef DESC_ENTRY - +@@ -929,13 +929,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) +@@ -948,13 +954,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, "OSPF" + 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 @@ -428,216 +56,80 @@ -# to 'switch on' redist support (direct numeric entry remaining -# possible). -ZEBRA_ROUTE_HSLS, hsls, hslsd, 'H', 0, 0, "HSLS" --ZEBRA_ROUTE_OLSR, olsr, oslrd, 'o', 0, 0, "OLSR" +-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 - ZEBRA_ROUTE_SYSTEM, "Reserved route type, for internal use only" -@@ -71,4 +67,5 @@ ZEBRA_ROUTE_OSPF6, "Open Shortest Path +@@ -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)" ---- a/lib/zebra.h -+++ b/lib/zebra.h -@@ -437,7 +437,9 @@ struct in_pktinfo - #define ZEBRA_ROUTE_ISIS 8 - #define ZEBRA_ROUTE_BGP 9 - #define ZEBRA_ROUTE_HSLS 10 --#define ZEBRA_ROUTE_MAX 11 -+#define ZEBRA_ROUTE_OLSR 11 -+#define ZEBRA_ROUTE_BATMAN 12 -+#define ZEBRA_ROUTE_MAX 13 - - /* Note: whenever a new route-type or zserv-command is added the - * corresponding {command,route}_types[] table in lib/log.c MUST be ---- a/ospf6d/ospf6_asbr.c -+++ b/ospf6d/ospf6_asbr.c -@@ -616,13 +616,16 @@ ospf6_asbr_redistribute_remove (int type - - DEFUN (ospf6_redistribute, - ospf6_redistribute_cmd, -- "redistribute (static|kernel|connected|ripng|bgp)", -+ "redistribute (static|kernel|connected|ripng|bgp|hsls|olsr|batman)", - "Redistribute\n" - "Static route\n" - "Kernel route\n" - "Connected route\n" - "RIPng route\n" - "BGP route\n" -+ "HSLS route\n" -+ "OLSR route\n" -+ "BATMAN route\n" - ) - { - int type = 0; -@@ -637,6 +640,12 @@ DEFUN (ospf6_redistribute, - type = ZEBRA_ROUTE_RIPNG; - else if (strncmp (argv[0], "bgp", 3) == 0) - type = ZEBRA_ROUTE_BGP; -+ else if (strncmp (argv[0], "h", 1) == 0) -+ type = ZEBRA_ROUTE_HSLS; -+ else if (strncmp (argv[0], "o", 1) == 0) -+ type = ZEBRA_ROUTE_OLSR; -+ else if (strncmp (argv[0], "ba", 2) == 0) -+ type = ZEBRA_ROUTE_BATMAN; - - ospf6_asbr_redistribute_unset (type); - ospf6_asbr_routemap_unset (type); -@@ -646,13 +655,16 @@ DEFUN (ospf6_redistribute, - - DEFUN (ospf6_redistribute_routemap, - ospf6_redistribute_routemap_cmd, -- "redistribute (static|kernel|connected|ripng|bgp) route-map WORD", -+ "redistribute (static|kernel|connected|ripng|bgp|hsls|olsr|batman) route-map WORD", - "Redistribute\n" - "Static routes\n" - "Kernel route\n" - "Connected route\n" - "RIPng route\n" - "BGP route\n" -+ "HSLS route\n" -+ "OLSR route\n" -+ "BATMAN route\n" - "Route map reference\n" - "Route map name\n" - ) -@@ -669,6 +681,12 @@ DEFUN (ospf6_redistribute_routemap, - type = ZEBRA_ROUTE_RIPNG; - else if (strncmp (argv[0], "bgp", 3) == 0) - type = ZEBRA_ROUTE_BGP; -+ else if (strncmp (argv[0], "h", 1) == 0) -+ type = ZEBRA_ROUTE_HSLS; -+ else if (strncmp (argv[0], "o", 1) == 0) -+ type = ZEBRA_ROUTE_OLSR; -+ else if (strncmp (argv[0], "ba", 2) == 0) -+ type = ZEBRA_ROUTE_BATMAN; - - ospf6_asbr_redistribute_unset (type); - ospf6_asbr_routemap_set (type, argv[1]); -@@ -678,7 +696,7 @@ DEFUN (ospf6_redistribute_routemap, - - DEFUN (no_ospf6_redistribute, - no_ospf6_redistribute_cmd, -- "no redistribute (static|kernel|connected|ripng|bgp)", -+ "no redistribute (static|kernel|connected|ripng|bgp|hsls|olsr|batman)", - NO_STR - "Redistribute\n" - "Static route\n" -@@ -686,6 +704,9 @@ DEFUN (no_ospf6_redistribute, - "Connected route\n" - "RIPng route\n" - "BGP route\n" -+ "HSLS route\n" -+ "OLSR route\n" -+ "BATMAN route\n" - ) - { - int type = 0; -@@ -700,6 +721,12 @@ DEFUN (no_ospf6_redistribute, - type = ZEBRA_ROUTE_RIPNG; - else if (strncmp (argv[0], "bgp", 3) == 0) - type = ZEBRA_ROUTE_BGP; -+ else if (strncmp (argv[0], "h", 1) == 0) -+ type = ZEBRA_ROUTE_HSLS; -+ else if (strncmp (argv[0], "o", 1) == 0) -+ type = ZEBRA_ROUTE_OLSR; -+ else if (strncmp (argv[0], "ba", 2) == 0) -+ type = ZEBRA_ROUTE_BATMAN; - - ospf6_asbr_redistribute_unset (type); - ospf6_asbr_routemap_unset (type); ---- a/ospfd/ospf_vty.c -+++ b/ospfd/ospf_vty.c -@@ -107,8 +107,14 @@ str2distribute_source (const char *str, - *source = ZEBRA_ROUTE_STATIC; - else if (strncmp (str, "r", 1) == 0) - *source = ZEBRA_ROUTE_RIP; -- else if (strncmp (str, "b", 1) == 0) -+ else if (strncmp (str, "bg", 2) == 0) - *source = ZEBRA_ROUTE_BGP; -+ else if (strncmp (str, "h", 1) == 0) -+ *source = ZEBRA_ROUTE_HSLS; -+ else if (strncmp (str, "o", 1) == 0) -+ *source = ZEBRA_ROUTE_OLSR; -+ else if (strncmp (str, "ba", 2) == 0) -+ *source = ZEBRA_ROUTE_BATMAN; - else - return 0; - + ZEBRA_ROUTE_BABEL, "Babel routing protocol (Babel)" --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c -@@ -204,8 +204,11 @@ static struct { +@@ -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_BGP, 1, "bgp"}, + {ZEBRA_ROUTE_OSPF, 2, "ospf"}, -+ {ZEBRA_ROUTE_BGP, 2, "bgp"}, + {ZEBRA_ROUTE_BGP, 2, "bgp"}, +- {ZEBRA_ROUTE_BABEL, 2, "babel"}, + {ZEBRA_ROUTE_HSLS, 1, "hsls"}, + {ZEBRA_ROUTE_OLSR, 2, "olsr"}, -+ {ZEBRA_ROUTE_BATMAN, 2, "batman"}, ++ {ZEBRA_ROUTE_BATMAN, 3, "batman"}, ++ {ZEBRA_ROUTE_BABEL, 3, "babel"}, {0, 0, NULL} }; --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c -@@ -214,8 +214,11 @@ static struct { +@@ -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_BGP, 1, "bgp"}, + {ZEBRA_ROUTE_OSPF6, 2, "ospf6"}, -+ {ZEBRA_ROUTE_BGP, 2, "bgp"}, + {ZEBRA_ROUTE_BGP, 2, "bgp"}, +- {ZEBRA_ROUTE_BABEL, 2, "babel"}, + {ZEBRA_ROUTE_HSLS, 1, "hsls"}, + {ZEBRA_ROUTE_OLSR, 2, "olsr"}, -+ {ZEBRA_ROUTE_BATMAN, 2, "batman"}, ++ {ZEBRA_ROUTE_BATMAN, 3, "batman"}, ++ {ZEBRA_ROUTE_BABEL, 3, "babel"}, {0, 0, NULL} }; ---- a/zebra/redistribute.c -+++ b/zebra/redistribute.c -@@ -255,6 +255,9 @@ zebra_redistribute_add (int command, str - case ZEBRA_ROUTE_OSPF: - case ZEBRA_ROUTE_OSPF6: - case ZEBRA_ROUTE_BGP: -+ case ZEBRA_ROUTE_HSLS: -+ case ZEBRA_ROUTE_OLSR: -+ case ZEBRA_ROUTE_BATMAN: - if (! client->redist[type]) - { - client->redist[type] = 1; -@@ -283,6 +286,9 @@ zebra_redistribute_delete (int command, - case ZEBRA_ROUTE_OSPF: - case ZEBRA_ROUTE_OSPF6: - case ZEBRA_ROUTE_BGP: -+ case ZEBRA_ROUTE_HSLS: -+ case ZEBRA_ROUTE_OLSR: -+ case ZEBRA_ROUTE_BATMAN: - client->redist[type] = 0; - break; - default: +--- a/zebra/rt_netlink.c ++++ b/zebra/rt_netlink.c +@@ -1623,6 +1623,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 -@@ -66,7 +66,10 @@ static const struct - {ZEBRA_ROUTE_OSPF, 110}, - {ZEBRA_ROUTE_OSPF6, 110}, - {ZEBRA_ROUTE_ISIS, 115}, -- {ZEBRA_ROUTE_BGP, 20 /* IBGP is 200. */} -+ {ZEBRA_ROUTE_BGP, 20 /* IBGP is 200. */}, -+ {ZEBRA_ROUTE_HSLS, 0}, -+ {ZEBRA_ROUTE_OLSR, 0}, -+ {ZEBRA_ROUTE_BATMAN, 0} +@@ -67,6 +67,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 */ }; - - /* Vector for routing table. */ -@@ -374,6 +377,18 @@ nexthop_active_ipv4 (struct rib *rib, st +@@ -381,6 +384,18 @@ nexthop_active_ipv4 (struct rib *rib, st return 1; } @@ -656,7 +148,7 @@ else if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_INTERNAL)) { for (newhop = match->nexthop; newhop; newhop = newhop->next) -@@ -476,6 +491,18 @@ nexthop_active_ipv6 (struct rib *rib, st +@@ -483,6 +498,18 @@ nexthop_active_ipv6 (struct rib *rib, st return 1; } @@ -675,15 +167,15 @@ else if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_INTERNAL)) { for (newhop = match->nexthop; newhop; newhop = newhop->next) -@@ -1229,6 +1256,8 @@ static const u_char meta_queue_map[ZEBRA +@@ -1236,6 +1263,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, }; - /* Look into the RN and queue it into one or more priority queues, --- a/zebra/zebra_snmp.c +++ b/zebra/zebra_snmp.c @@ -251,6 +251,12 @@ proto_trans(int type) @@ -701,9 +193,9 @@ } --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c -@@ -557,7 +557,10 @@ vty_show_ip_route_detail (struct vty *vt - if (rib->type == ZEBRA_ROUTE_RIP +@@ -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 @@ -713,9 +205,9 @@ { time_t uptime; struct tm *tm; -@@ -775,7 +778,10 @@ vty_show_ip_route (struct vty *vty, stru - if (rib->type == ZEBRA_ROUTE_RIP +@@ -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 @@ -725,94 +217,9 @@ { time_t uptime; struct tm *tm; -@@ -803,8 +809,8 @@ vty_show_ip_route (struct vty *vty, stru - } - - #define SHOW_ROUTE_V4_HEADER "Codes: K - kernel route, C - connected, " \ -- "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, " \ -- "> - selected route, * - FIB route%s%s" -+ "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, H - HSLS, " \ -+ "o - OLSR, b - BATMAN,%s > - selected route, * - FIB route%s%s" - - DEFUN (show_ip_route, - show_ip_route_cmd, -@@ -829,7 +835,7 @@ DEFUN (show_ip_route, - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE, VTY_NEWLINE, -- VTY_NEWLINE); -+ VTY_NEWLINE, VTY_NEWLINE); - first = 0; - } - vty_show_ip_route (vty, rn, rib); -@@ -872,7 +878,7 @@ DEFUN (show_ip_route_prefix_longer, - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE, -- VTY_NEWLINE, VTY_NEWLINE); -+ VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); - first = 0; - } - vty_show_ip_route (vty, rn, rib); -@@ -911,7 +917,7 @@ DEFUN (show_ip_route_supernets, - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE, -- VTY_NEWLINE, VTY_NEWLINE); -+ VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); - first = 0; - } - vty_show_ip_route (vty, rn, rib); -@@ -922,7 +928,7 @@ DEFUN (show_ip_route_supernets, - - DEFUN (show_ip_route_protocol, - show_ip_route_protocol_cmd, -- "show ip route (bgp|connected|isis|kernel|ospf|rip|static)", -+ "show ip route (bgp|connected|isis|kernel|ospf|rip|static|hsls|olsr|batman)", - SHOW_STR - IP_STR - "IP routing table\n" -@@ -940,13 +946,13 @@ DEFUN (show_ip_route_protocol, - struct rib *rib; - int first = 1; - -- if (strncmp (argv[0], "b", 1) == 0) -+ if (strncmp (argv[0], "bg", 2) == 0) - type = ZEBRA_ROUTE_BGP; - else if (strncmp (argv[0], "c", 1) == 0) - type = ZEBRA_ROUTE_CONNECT; - else if (strncmp (argv[0], "k", 1) ==0) - type = ZEBRA_ROUTE_KERNEL; -- else if (strncmp (argv[0], "o", 1) == 0) -+ else if (strncmp (argv[0], "os", 2) == 0) - type = ZEBRA_ROUTE_OSPF; - else if (strncmp (argv[0], "i", 1) == 0) - type = ZEBRA_ROUTE_ISIS; -@@ -954,6 +960,12 @@ DEFUN (show_ip_route_protocol, - type = ZEBRA_ROUTE_RIP; - else if (strncmp (argv[0], "s", 1) == 0) - type = ZEBRA_ROUTE_STATIC; -+ else if (strncmp (argv[0], "h", 1) == 0) -+ type = ZEBRA_ROUTE_HSLS; -+ else if (strncmp (argv[0], "ol", 2) == 0) -+ type = ZEBRA_ROUTE_OLSR; -+ else if (strncmp (argv[0], "ba", 2) == 0) -+ type = ZEBRA_ROUTE_BATMAN; - else - { - vty_out (vty, "Unknown route type%s", VTY_NEWLINE); -@@ -971,7 +983,7 @@ DEFUN (show_ip_route_protocol, - { - if (first) - { -- vty_out (vty, SHOW_ROUTE_V4_HEADER, -+ vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE, - VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); - first = 0; - } -@@ -1560,7 +1572,10 @@ vty_show_ipv6_route_detail (struct vty * - if (rib->type == ZEBRA_ROUTE_RIPNG +@@ -1536,7 +1542,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 @@ -822,9 +229,9 @@ { time_t uptime; struct tm *tm; -@@ -1739,7 +1754,10 @@ vty_show_ipv6_route (struct vty *vty, st - if (rib->type == ZEBRA_ROUTE_RIPNG +@@ -1716,7 +1725,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 @@ -834,62 +241,3 @@ { time_t uptime; struct tm *tm; -@@ -1766,7 +1784,7 @@ vty_show_ipv6_route (struct vty *vty, st - } - } - --#define SHOW_ROUTE_V6_HEADER "Codes: K - kernel route, C - connected, S - static, R - RIPng, O - OSPFv3,%s I - ISIS, B - BGP, * - FIB route.%s%s" -+#define SHOW_ROUTE_V6_HEADER "Codes: K - kernel route, C - connected, S - static, R - RIPng, O - OSPFv3,%s I - ISIS, B - BGP, H - HSLS, o - OLSR, b - BATMAN, * - FIB route.%s%s" - - DEFUN (show_ipv6_route, - show_ipv6_route_cmd, -@@ -1842,7 +1860,7 @@ DEFUN (show_ipv6_route_prefix_longer, - - DEFUN (show_ipv6_route_protocol, - show_ipv6_route_protocol_cmd, -- "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|static)", -+ "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|static|hsls|olsr|batman)", - SHOW_STR - IP_STR - "IP routing table\n" -@@ -1860,13 +1878,13 @@ DEFUN (show_ipv6_route_protocol, - struct rib *rib; - int first = 1; - -- if (strncmp (argv[0], "b", 1) == 0) -+ if (strncmp (argv[0], "bg", 2) == 0) - type = ZEBRA_ROUTE_BGP; - else if (strncmp (argv[0], "c", 1) == 0) - type = ZEBRA_ROUTE_CONNECT; - else if (strncmp (argv[0], "k", 1) ==0) - type = ZEBRA_ROUTE_KERNEL; -- else if (strncmp (argv[0], "o", 1) == 0) -+ else if (strncmp (argv[0], "os", 2) == 0) - type = ZEBRA_ROUTE_OSPF6; - else if (strncmp (argv[0], "i", 1) == 0) - type = ZEBRA_ROUTE_ISIS; -@@ -1874,6 +1892,12 @@ DEFUN (show_ipv6_route_protocol, - type = ZEBRA_ROUTE_RIPNG; - else if (strncmp (argv[0], "s", 1) == 0) - type = ZEBRA_ROUTE_STATIC; -+ else if (strncmp (argv[0], "h", 1) == 0) -+ type = ZEBRA_ROUTE_HSLS; -+ else if (strncmp (argv[0], "ol", 2) == 0) -+ type = ZEBRA_ROUTE_OLSR; -+ else if (strncmp (argv[0], "ba", 2) == 0) -+ type = ZEBRA_ROUTE_BATMAN; - else - { - vty_out (vty, "Unknown route type%s", VTY_NEWLINE); ---- a/zebra/rt_netlink.c -+++ b/zebra/rt_netlink.c -@@ -1494,6 +1494,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); diff --git a/patches/130-fix_cpp.patch b/patches/130-fix_cpp.patch index 3660bf8..23991c3 100644 --- a/patches/130-fix_cpp.patch +++ b/patches/130-fix_cpp.patch @@ -1,11 +1,11 @@ --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in -@@ -62,7 +62,7 @@ $ignore{'"show history"'} = "ignore"; +@@ -63,7 +63,7 @@ $ignore{'"show history"'} = "ignore"; foreach (@ARGV) { $file = $_; -- open (FH, "cpp -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_srcdir@/isisd/topology @SNMP_INCLUDES@ $file |"); -+ open (FH, "@CPP@ @CPPFLAGS@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_srcdir@/isisd/topology @SNMP_INCLUDES@ $file |"); +- open (FH, "cpp -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_srcdir@/isisd/topology @SNMP_INCLUDES@ @CPPFLAGS@ $file |"); ++ open (FH, "@CPP@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_srcdir@/isisd/topology @SNMP_INCLUDES@ @CPPFLAGS@ $file |"); local $/; undef $/; $line = ; close (FH); diff --git a/patches/140-holdtimer-set.patch b/patches/140-holdtimer-set.patch index eb85b40..6f0d79a 100644 --- a/patches/140-holdtimer-set.patch +++ b/patches/140-holdtimer-set.patch @@ -12,7 +12,7 @@ sockunion2str (&su, buf, SU_ADDRSTRLEN); --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h -@@ -712,6 +712,7 @@ struct bgp_nlri +@@ -718,6 +718,7 @@ struct bgp_nlri /* BGP timers default value. */ #define BGP_INIT_START_TIMER 5 #define BGP_ERROR_START_TIMER 30 diff --git a/patches/150-no-cross-fs-link.patch b/patches/150-no-cross-fs-link.patch index d22311c..c3f29c3 100644 --- a/patches/150-no-cross-fs-link.patch +++ b/patches/150-no-cross-fs-link.patch @@ -1,6 +1,6 @@ --- a/lib/command.c +++ b/lib/command.c -@@ -2599,6 +2599,13 @@ DEFUN (config_write_file, +@@ -2601,6 +2601,13 @@ DEFUN (config_write_file, VTY_NEWLINE); goto finished; } @@ -14,7 +14,7 @@ if (link (config_file, config_file_sav) != 0) { vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav, -@@ -2612,7 +2619,23 @@ DEFUN (config_write_file, +@@ -2614,7 +2621,23 @@ DEFUN (config_write_file, VTY_NEWLINE); goto finished; } diff --git a/patches/160-pgbgp.patch b/patches/160-pgbgp.patch index fcdd03b..fb01ee1 100644 --- a/patches/160-pgbgp.patch +++ b/patches/160-pgbgp.patch @@ -29,16 +29,16 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c bgp_debug.c bgp_route.c bgp_zebra.c bgp_open.c bgp_routemap.c \ bgp_packet.c bgp_network.c bgp_filter.c bgp_regex.c bgp_clist.c \ bgp_dump.c bgp_snmp.c bgp_ecommunity.c bgp_mplsvpn.c bgp_nexthop.c \ -- bgp_damp.c bgp_table.c bgp_advertise.c bgp_vty.c -+ bgp_damp.c bgp_table.c bgp_advertise.c bgp_vty.c bgp_pgbgp.c +- bgp_damp.c bgp_table.c bgp_advertise.c bgp_vty.c bgp_mpath.c ++ bgp_damp.c bgp_table.c bgp_advertise.c bgp_vty.c bgp_mpath.c bgp_pgbgp.c noinst_HEADERS = \ bgp_aspath.h bgp_attr.h bgp_community.h bgp_debug.h bgp_fsm.h \ bgp_network.h bgp_open.h bgp_packet.h bgp_regex.h bgp_route.h \ bgpd.h bgp_filter.h bgp_clist.h bgp_dump.h bgp_zebra.h \ bgp_ecommunity.h bgp_mplsvpn.h bgp_nexthop.h bgp_damp.h bgp_table.h \ -- bgp_advertise.h bgp_snmp.h bgp_vty.h -+ bgp_advertise.h bgp_snmp.h bgp_vty.h bgp_pgbgp.h +- bgp_advertise.h bgp_snmp.h bgp_vty.h bgp_mpath.h ++ bgp_advertise.h bgp_snmp.h bgp_vty.h bgp_mpath.h bgp_pgbgp.h bgpd_SOURCES = bgp_main.c bgpd_LDADD = libbgp.a ../lib/libzebra.la @LIBCAP@ @LIBM@ @@ -2745,9 +2745,9 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c #include "bgpd/bgp_advertise.h" #include "bgpd/bgp_zebra.h" #include "bgpd/bgp_vty.h" -@@ -332,12 +333,19 @@ bgp_info_cmp (struct bgp *bgp, struct bg - int confed_as_route = 0; - int ret; +@@ -339,12 +340,19 @@ bgp_info_cmp (struct bgp *bgp, struct bg + + *paths_eq = 0; + /* 0. Null check. */ @@ -2765,8 +2765,8 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* 1. Weight check. */ if (new->attr->extra) new_weight = new->attr->extra->weight; -@@ -1508,6 +1516,10 @@ bgp_process_main (struct work_queue *wq, - bgp_info_unset_flag (rn, new_select, BGP_INFO_ATTR_CHANGED); +@@ -1583,6 +1591,10 @@ bgp_process_main (struct work_queue *wq, + UNSET_FLAG (new_select->flags, BGP_INFO_MULTIPATH_CHG); } + /* PGBGP needs to know about selected routes */ @@ -2776,7 +2776,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* Check each BGP peer. */ for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) -@@ -1831,6 +1843,11 @@ bgp_update_rsclient (struct peer *rsclie +@@ -1906,6 +1918,11 @@ bgp_update_rsclient (struct peer *rsclie /* If the update is implicit withdraw. */ if (ri) { @@ -2788,7 +2788,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c ri->uptime = bgp_clock (); /* Same attribute comes in. */ -@@ -2262,6 +2279,11 @@ bgp_update_main (struct peer *peer, stru +@@ -2337,6 +2354,11 @@ bgp_update_main (struct peer *peer, stru /* Increment prefix */ bgp_aggregate_increment (bgp, p, new, afi, safi); @@ -2800,7 +2800,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* Register new BGP information. */ bgp_info_add (rn, new); -@@ -5474,6 +5496,20 @@ enum bgp_display_type +@@ -5559,6 +5581,20 @@ enum bgp_display_type static void route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo) { @@ -2821,7 +2821,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* Route status display. */ if (CHECK_FLAG (binfo->flags, BGP_INFO_REMOVED)) vty_out (vty, "R"); -@@ -5974,6 +6010,7 @@ route_vty_out_detail (struct vty *vty, s +@@ -6064,6 +6100,7 @@ route_vty_out_detail (struct vty *vty, s } #define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s r RIB-failure, S Stale, R Removed%s" @@ -2829,7 +2829,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s" #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s" #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s" -@@ -6005,7 +6042,8 @@ enum bgp_show_type +@@ -6095,7 +6132,8 @@ enum bgp_show_type bgp_show_type_flap_route_map, bgp_show_type_flap_neighbor, bgp_show_type_dampend_paths, @@ -2839,7 +2839,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c }; static int -@@ -6172,11 +6210,17 @@ bgp_show_table (struct vty *vty, struct +@@ -6262,11 +6300,17 @@ bgp_show_table (struct vty *vty, struct || CHECK_FLAG (ri->flags, BGP_INFO_HISTORY)) continue; } @@ -2857,7 +2857,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); if (type == bgp_show_type_dampend_paths || type == bgp_show_type_damp_neighbor) -@@ -6254,6 +6298,7 @@ bgp_show (struct vty *vty, struct bgp *b +@@ -6344,6 +6388,7 @@ bgp_show (struct vty *vty, struct bgp *b return bgp_show_table (vty, table, &bgp->router_id, type, output_arg); } @@ -2865,7 +2865,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* Header of detailed BGP route information */ static void route_vty_out_detail_header (struct vty *vty, struct bgp *bgp, -@@ -11823,6 +11868,64 @@ DEFUN (bgp_damp_set, +@@ -11904,6 +11949,64 @@ DEFUN (bgp_damp_set, half, reuse, suppress, max); } @@ -2930,7 +2930,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c ALIAS (bgp_damp_set, bgp_damp_set2_cmd, "bgp dampening <1-45>", -@@ -11872,6 +11975,19 @@ DEFUN (show_ip_bgp_dampened_paths, +@@ -11953,6 +12056,19 @@ DEFUN (show_ip_bgp_dampened_paths, NULL); } @@ -2950,7 +2950,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c DEFUN (show_ip_bgp_flap_statistics, show_ip_bgp_flap_statistics_cmd, "show ip bgp flap-statistics", -@@ -12398,6 +12514,7 @@ bgp_route_init (void) +@@ -12479,6 +12595,7 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_ip_bgp_dampened_paths_cmd); @@ -2958,7 +2958,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c install_element (VIEW_NODE, &show_ip_bgp_flap_statistics_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_address_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_prefix_cmd); -@@ -12531,6 +12648,7 @@ bgp_route_init (void) +@@ -12612,6 +12729,7 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_dampened_paths_cmd); @@ -2966,7 +2966,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c install_element (ENABLE_NODE, &show_ip_bgp_flap_statistics_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_address_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_prefix_cmd); -@@ -12918,6 +13036,10 @@ bgp_route_init (void) +@@ -13002,6 +13120,10 @@ bgp_route_init (void) install_element (BGP_IPV4_NODE, &bgp_damp_unset_cmd); install_element (BGP_IPV4_NODE, &bgp_damp_unset2_cmd); @@ -2984,18 +2984,27 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* BGP routing information base Copyright (C) 1996, 97, 98, 2000 Kunihiro Ishiguro -@@ -76,6 +77,10 @@ struct bgp_info - #define BGP_INFO_STALE (1 << 8) - #define BGP_INFO_REMOVED (1 << 9) +@@ -68,7 +69,7 @@ struct bgp_info + int lock; + + /* BGP information status. */ +- u_int16_t flags; ++ u_int32_t flags; + #define BGP_INFO_IGP_CHANGED (1 << 0) + #define BGP_INFO_DAMPED (1 << 1) + #define BGP_INFO_HISTORY (1 << 2) +@@ -82,6 +83,10 @@ struct bgp_info #define BGP_INFO_COUNTED (1 << 10) -+#define BGP_INFO_SUSPICIOUS_O (1 << 11) -+#define BGP_INFO_SUSPICIOUS_P (1 << 12) -+#define BGP_INFO_IGNORED_P (1 << 13) -+#define BGP_INFO_SUSPICIOUS_E (1 << 14) + #define BGP_INFO_MULTIPATH (1 << 11) + #define BGP_INFO_MULTIPATH_CHG (1 << 12) ++#define BGP_INFO_SUSPICIOUS_O (1 << 13) ++#define BGP_INFO_SUSPICIOUS_P (1 << 14) ++#define BGP_INFO_IGNORED_P (1 << 15) ++#define BGP_INFO_SUSPICIOUS_E (1 << 16) /* BGP route type. This can be static, RIP, OSPF, BGP etc. */ u_char type; -@@ -120,7 +125,7 @@ struct bgp_static +@@ -126,7 +131,7 @@ struct bgp_static /* Flags which indicate a route is unuseable in some form */ #define BGP_INFO_UNUSEABLE \ @@ -3077,7 +3086,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c --- a/lib/memtypes.c +++ b/lib/memtypes.c -@@ -147,6 +147,15 @@ struct memory_list memory_list_bgp[] = +@@ -148,6 +148,15 @@ struct memory_list memory_list_bgp[] = { MTYPE_PEER_UPDATE_SOURCE, "BGP peer update interface" }, { MTYPE_BGP_DAMP_INFO, "Dampening info" }, { MTYPE_BGP_DAMP_ARRAY, "BGP Dampening array" }, diff --git a/patches/161-pgbgp-addon.patch b/patches/161-pgbgp-addon.patch index d2202b3..817cdb0 100644 --- a/patches/161-pgbgp-addon.patch +++ b/patches/161-pgbgp-addon.patch @@ -204,7 +204,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 return 0; --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c -@@ -5496,20 +5496,6 @@ enum bgp_display_type +@@ -5581,20 +5581,6 @@ enum bgp_display_type static void route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo) { @@ -225,7 +225,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 /* Route status display. */ if (CHECK_FLAG (binfo->flags, BGP_INFO_REMOVED)) vty_out (vty, "R"); -@@ -5525,6 +5511,17 @@ route_vty_short_status_out (struct vty * +@@ -5610,6 +5596,17 @@ route_vty_short_status_out (struct vty * /* Selected */ if (CHECK_FLAG (binfo->flags, BGP_INFO_HISTORY)) vty_out (vty, "h"); @@ -243,7 +243,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 else if (CHECK_FLAG (binfo->flags, BGP_INFO_DAMPED)) vty_out (vty, "d"); else if (CHECK_FLAG (binfo->flags, BGP_INFO_SELECTED)) -@@ -5998,7 +5995,22 @@ route_vty_out_detail (struct vty *vty, s +@@ -6088,7 +6085,22 @@ route_vty_out_detail (struct vty *vty, s if (binfo->extra && binfo->extra->damp_info) bgp_damp_info_vty (vty, binfo); @@ -267,7 +267,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 #ifdef HAVE_CLOCK_MONOTONIC tbuf = time(NULL) - (bgp_clock() - binfo->uptime); vty_out (vty, " Last update: %s", ctime(&tbuf)); -@@ -6009,8 +6021,9 @@ route_vty_out_detail (struct vty *vty, s +@@ -6099,8 +6111,9 @@ route_vty_out_detail (struct vty *vty, s vty_out (vty, "%s", VTY_NEWLINE); } @@ -279,7 +279,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s" #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s" #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s" -@@ -6219,8 +6232,7 @@ bgp_show_table (struct vty *vty, struct +@@ -6309,8 +6322,7 @@ bgp_show_table (struct vty *vty, struct if (header) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id), VTY_NEWLINE); @@ -289,7 +289,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); if (type == bgp_show_type_dampend_paths || type == bgp_show_type_damp_neighbor) -@@ -9761,7 +9773,7 @@ show_adj_route (struct vty *vty, struct +@@ -9842,7 +9854,7 @@ show_adj_route (struct vty *vty, struct PEER_STATUS_DEFAULT_ORIGINATE)) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); @@ -298,7 +298,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); vty_out (vty, "Originating default network 0.0.0.0%s%s", -@@ -9778,7 +9790,7 @@ show_adj_route (struct vty *vty, struct +@@ -9859,7 +9871,7 @@ show_adj_route (struct vty *vty, struct if (header1) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); @@ -307,7 +307,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); header1 = 0; } -@@ -9802,7 +9814,7 @@ show_adj_route (struct vty *vty, struct +@@ -9883,7 +9895,7 @@ show_adj_route (struct vty *vty, struct if (header1) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); diff --git a/patches/170-use-supported-pagers.patch b/patches/170-use-supported-pagers.patch index fe1a4d9..d42e145 100644 --- a/patches/170-use-supported-pagers.patch +++ b/patches/170-use-supported-pagers.patch @@ -1,6 +1,6 @@ --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c -@@ -268,7 +268,7 @@ vtysh_pager_init (void) +@@ -269,7 +269,7 @@ vtysh_pager_init (void) if (pager_defined) vtysh_pager_name = strdup (pager_defined); else @@ -9,7 +9,7 @@ } /* Command execution over the vty interface. */ -@@ -1866,7 +1866,7 @@ DEFUN (vtysh_terminal_length, +@@ -1885,7 +1885,7 @@ DEFUN (vtysh_terminal_length, { int lines; char *endptr = NULL; @@ -18,7 +18,7 @@ lines = strtol (argv[0], &endptr, 10); if (lines < 0 || lines > 512 || *endptr != '\0') -@@ -1883,7 +1883,7 @@ DEFUN (vtysh_terminal_length, +@@ -1902,7 +1902,7 @@ DEFUN (vtysh_terminal_length, if (lines != 0) { diff --git a/patches/180-fix-lib-connect-memleak.patch b/patches/180-fix-lib-connect-memleak.patch deleted file mode 100644 index 85b6c10..0000000 --- a/patches/180-fix-lib-connect-memleak.patch +++ /dev/null @@ -1,61 +0,0 @@ -From b24b19f719fdd9c3d61a0c93552cd64d832d964c Mon Sep 17 00:00:00 2001 -From: Stephen Hemminger -Date: Tue, 6 Dec 2011 14:09:18 +0400 -Subject: [PATCH] lib: fix memory leak on connect() failure - -Change sockunion_log() to not use strdup(). This fixes a small memory -leak that occurs on every failed connect(), and is simpler/cleaner. ---- - lib/sockunion.c | 23 +++++++++++------------ - 1 files changed, 11 insertions(+), 12 deletions(-) - ---- a/lib/sockunion.c -+++ b/lib/sockunion.c -@@ -297,27 +297,24 @@ sockunion_sizeof (union sockunion *su) - } - - /* return sockunion structure : this function should be revised. */ --static char * --sockunion_log (union sockunion *su) -+static const char * -+sockunion_log (union sockunion *su, char *buf, size_t len) - { -- static char buf[SU_ADDRSTRLEN]; -- - switch (su->sa.sa_family) - { - case AF_INET: -- snprintf (buf, SU_ADDRSTRLEN, "%s", inet_ntoa (su->sin.sin_addr)); -- break; -+ return inet_ntop(AF_INET, &su->sin.sin_addr, buf, len); -+ - #ifdef HAVE_IPV6 - case AF_INET6: -- snprintf (buf, SU_ADDRSTRLEN, "%s", -- inet_ntop (AF_INET6, &(su->sin6.sin6_addr), buf, SU_ADDRSTRLEN)); -+ return inet_ntop(AF_INET6, &(su->sin6.sin6_addr), buf, len); - break; - #endif /* HAVE_IPV6 */ -+ - default: -- snprintf (buf, SU_ADDRSTRLEN, "af_unknown %d ", su->sa.sa_family); -- break; -+ snprintf (buf, len, "af_unknown %d ", su->sa.sa_family); -+ return buf; - } -- return (XSTRDUP (MTYPE_TMP, buf)); - } - - /* sockunion_connect returns -@@ -379,8 +376,10 @@ sockunion_connect (int fd, union sockuni - { - if (errno != EINPROGRESS) - { -+ char str[SU_ADDRSTRLEN]; - zlog_info ("can't connect to %s fd %d : %s", -- sockunion_log (&su), fd, safe_strerror (errno)); -+ sockunion_log (&su, str, sizeof str), -+ fd, safe_strerror (errno)); - return connect_error; - } - } diff --git a/patches/181-ospf-null-ptr-fix.patch b/patches/181-ospf-null-ptr-fix.patch deleted file mode 100644 index 9ae47cf..0000000 --- a/patches/181-ospf-null-ptr-fix.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 6a2e0f36b103386e57dbe3a6ee4716e809111198 Mon Sep 17 00:00:00 2001 -From: Stephen Hemminger -Date: Tue, 6 Dec 2011 14:04:12 +0400 -Subject: [PATCH] lib: call filter delete hook before freeing access list - -The delete_hook was being run after calling access list delete function. -This would cause ospf to dereference a NULL, in ospf_filter_update -because 'access->name' was already freed. - -See also: - https://bugzilla.vyatta.com/show_bug.cgi?id=7654 ---- - lib/filter.c | 12 ++++++------ - 1 files changed, 6 insertions(+), 6 deletions(-) - ---- a/lib/filter.c -+++ b/lib/filter.c -@@ -1337,13 +1337,13 @@ DEFUN (no_access_list_all, - - master = access->master; - -- /* Delete all filter from access-list. */ -- access_list_delete (access); -- - /* Run hook function. */ - if (master->delete_hook) - (*master->delete_hook) (access); - -+ /* Delete all filter from access-list. */ -+ access_list_delete (access); -+ - return CMD_SUCCESS; - } - -@@ -1508,13 +1508,13 @@ DEFUN (no_ipv6_access_list_all, - - master = access->master; - -- /* Delete all filter from access-list. */ -- access_list_delete (access); -- - /* Run hook function. */ - if (master->delete_hook) - (*master->delete_hook) (access); - -+ /* Delete all filter from access-list. */ -+ access_list_delete (access); -+ - return CMD_SUCCESS; - } - diff --git a/patches/182-fix-bgpd-memleak.patch b/patches/182-fix-bgpd-memleak.patch deleted file mode 100644 index 3084585..0000000 --- a/patches/182-fix-bgpd-memleak.patch +++ /dev/null @@ -1,20 +0,0 @@ -From ce0af6ff5a4f200035ed4134da72a67f49a21dd6 Mon Sep 17 00:00:00 2001 -From: "Oleg A. Arkhangelsky" -Date: Sat, 3 Dec 2011 15:18:19 +0400 -Subject: [PATCH] bgpd: fix memory leak for extra attributes - -this fixes commit b881c7074bb698aeb1b099175b325734fc6e44d2 ---- - bgpd/bgp_attr.c | 1 + - 1 files changed, 1 insertions(+), 0 deletions(-) - ---- a/bgpd/bgp_attr.c -+++ b/bgpd/bgp_attr.c -@@ -675,6 +675,7 @@ bgp_attr_unintern (struct attr **attr) - } - - bgp_attr_unintern_sub (&tmp); -+ bgp_attr_extra_free (&tmp); - } - - void From 60371f85d95a60b186efc4c64dfbcea8a1c0197b Mon Sep 17 00:00:00 2001 From: acinonyx Date: Mon, 4 Jun 2012 09:59:52 +0000 Subject: [PATCH 088/117] [packages] quagga: Package babeld daemon git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32042 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d7cb21d..15f5b68 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga PKG_VERSION:=0.99.21 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MD5SUM:=99840adbe57047c90dfba6b6ed9aec7f PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz @@ -25,6 +25,7 @@ PKG_CONFIG_DEPENDS:= \ 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 @@ -99,6 +100,12 @@ define Package/quagga-ripngd TITLE:=RIPNG routing engine endef +define Package/quagga-babeld + $(call Package/quagga/Default) + DEPENDS+=+quagga-libzebra + TITLE:=Babel routing engine +endef + define Package/quagga-vtysh $(call Package/quagga/Default) DEPENDS+=quagga-libzebra +libreadline +libncurses @@ -133,6 +140,10 @@ 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 @@ -141,6 +152,7 @@ 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 @@ -162,6 +174,7 @@ CONFIGURE_ARGS+= \ $(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 += \ @@ -235,6 +248,14 @@ define Package/quagga-ripngd/install $(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/ @@ -259,4 +280,5 @@ $(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)) From e267bfbcc7900592fdff2129c5c98881b64d0dd2 Mon Sep 17 00:00:00 2001 From: jow Date: Wed, 13 Jun 2012 00:22:41 +0000 Subject: [PATCH 089/117] [packages] quagga: depends on quagga-libzebra git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32328 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 15f5b68..879c4c1 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ endef define Package/quagga $(call Package/quagga/Default) - DEPENDS:=+librt + DEPENDS:=+librt +quagga-libzebra MENU:=1 endef From 8a835daa8032ed9cded3628ca5a64e6c0973af2b Mon Sep 17 00:00:00 2001 From: jow Date: Wed, 13 Jun 2012 19:14:08 +0000 Subject: [PATCH 090/117] [packages] quagga: rework packaging - split watchquagga and zebra into quagga-watchquagga and quagga-zebra - make quagga-watchquagga and quagga-zebra default to enabled if quagga is selected - make quagga-isisd, quagga-zebra and quagga-watchquagga depend on quagga-libzebra - remove manual autoreconf invocation git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32346 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 51 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 879c4c1..192ec4e 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,8 @@ PKG_SOURCE_URL:=http://www.quagga.net/download/ \ http://www.uk.quagga.net/download/ 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 \ @@ -45,7 +47,7 @@ endef define Package/quagga $(call Package/quagga/Default) - DEPENDS:=+librt +quagga-libzebra + DEPENDS:=+librt MENU:=1 endef @@ -55,6 +57,20 @@ define Package/quagga/description 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 @@ -73,6 +89,7 @@ endef define Package/quagga-isisd $(call Package/quagga/Default) + DEPENDS+=+quagga-libzebra TITLE:=IS-IS routing engine endef @@ -108,11 +125,11 @@ endef define Package/quagga-vtysh $(call Package/quagga/Default) - DEPENDS+=quagga-libzebra +libreadline +libncurses + DEPENDS+=+quagga-libzebra +libreadline +libncurses TITLE:=integrated shell for Quagga routing software endef -define Package/quagga/conffiles +define Package/quagga-zebra/conffiles /etc/quagga/zebra.conf endef @@ -147,6 +164,8 @@ 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 @@ -180,24 +199,24 @@ CONFIGURE_ARGS+= \ MAKE_FLAGS += \ CFLAGS="$(TARGET_CFLAGS) -std=gnu99" -define Build/Configure - (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \ - autoconf \ - ); - $(call Build/Configure/Default) -endef - define Package/quagga/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(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/ - # avoid /etc being set to 0750 +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 - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/quagga $(1)/usr/sbin/quagga.init - $(INSTALL_BIN) ./files/quagga.init $(1)/etc/init.d/quagga endef define Package/quagga-bgpd/install @@ -274,6 +293,8 @@ 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)) From 5e9dd9824be3fd974a4d3d53528e70f67e100bd9 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 29 Jun 2012 15:31:27 +0000 Subject: [PATCH 091/117] [packages] quagga: Fix OLSR recursive nexthop selection git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32526 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/120-quagga_manet.patch | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/patches/120-quagga_manet.patch b/patches/120-quagga_manet.patch index 7543f1e..bf6d056 100644 --- a/patches/120-quagga_manet.patch +++ b/patches/120-quagga_manet.patch @@ -129,9 +129,9 @@ [ZEBRA_ROUTE_BABEL] = {ZEBRA_ROUTE_BABEL, 95}, /* no entry/default: 150 */ }; -@@ -381,6 +384,18 @@ nexthop_active_ipv4 (struct rib *rib, st - - return 1; +@@ -403,6 +406,18 @@ nexthop_active_ipv4 (struct rib *rib, st + } + return 0; } + else if (match->type == ZEBRA_ROUTE_OLSR) + { @@ -145,12 +145,12 @@ + } + return 0; + } - else if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_INTERNAL)) + else { - for (newhop = match->nexthop; newhop; newhop = newhop->next) -@@ -483,6 +498,18 @@ nexthop_active_ipv6 (struct rib *rib, st - - return 1; + return 0; +@@ -507,6 +522,18 @@ nexthop_active_ipv6 (struct rib *rib, st + } + return 0; } + else if (match->type == ZEBRA_ROUTE_OLSR) + { @@ -164,9 +164,9 @@ + } + return 0; + } - else if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_INTERNAL)) + else { - for (newhop = match->nexthop; newhop; newhop = newhop->next) + return 0; @@ -1236,6 +1263,8 @@ static const u_char meta_queue_map[ZEBRA [ZEBRA_ROUTE_ISIS] = 2, [ZEBRA_ROUTE_BGP] = 3, From cab879c0f3ceca49ee9c25a41c05628f6adf3533 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Thu, 12 Jul 2012 08:23:04 +0000 Subject: [PATCH 092/117] [packages] quagga: Do not try to start 'watchquagga' if it is not available git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32675 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- files/quagga | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 192ec4e..1219843 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga PKG_VERSION:=0.99.21 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MD5SUM:=99840adbe57047c90dfba6b6ed9aec7f PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/files/quagga b/files/quagga index 0ccfb1c..b172090 100644 --- a/files/quagga +++ b/files/quagga @@ -33,7 +33,7 @@ DAEMONS="zebra ripd ripngd ospfd ospf6d bgpd" DAEMON_FLAGS=-d WATCHQUAGGA_FLAGS="-d -z -T 60 -R" WATCHQUAGGA_CMD="$0 watchrestart" -if [ ${COMMAND} != "watchrestart" ] +if [ ${COMMAND} != "watchrestart" -a -x "${BINDIR}/watchquagga" ] then DAEMONS="${DAEMONS} watchquagga" fi From 1ca54cc4485d8bc4bf157dea58b56615670df3c6 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 13 Jul 2012 15:05:44 +0000 Subject: [PATCH 093/117] [packages] quagga: Disable building of documentation git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32691 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1219843..7a7ad12 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga PKG_VERSION:=0.99.21 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_MD5SUM:=99840adbe57047c90dfba6b6ed9aec7f PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz @@ -186,6 +186,7 @@ CONFIGURE_ARGS+= \ --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) \ From 6af633ef10d98be83d26721349451d1ed94f142f Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 13 Jul 2012 16:33:50 +0000 Subject: [PATCH 094/117] [packages] quagga: Fix args consolidation git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32692 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/001-bgpd-fix-args-consolidation.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 patches/001-bgpd-fix-args-consolidation.patch diff --git a/patches/001-bgpd-fix-args-consolidation.patch b/patches/001-bgpd-fix-args-consolidation.patch new file mode 100644 index 0000000..30de1b5 --- /dev/null +++ b/patches/001-bgpd-fix-args-consolidation.patch @@ -0,0 +1,11 @@ +--- a/bgpd/bgp_attr.c ++++ b/bgpd/bgp_attr.c +@@ -1646,7 +1646,7 @@ bgp_attr_ext_communities (struct bgp_att + static bgp_attr_parse_ret_t + bgp_attr_unknown (struct bgp_attr_parser_args *args) + { +- bgp_size_t total; ++ bgp_size_t total = args->total; + struct transit *transit; + struct attr_extra *attre; + struct peer *const peer = args->peer; From b7c84fab06a99cd664b59ba8b01e85f77e83a920 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 13 Jul 2012 16:34:29 +0000 Subject: [PATCH 095/117] [packages] quagga: Fix format when printing metrics git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32693 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/002-fix-metric-output.patch | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 patches/002-fix-metric-output.patch diff --git a/patches/002-fix-metric-output.patch b/patches/002-fix-metric-output.patch new file mode 100644 index 0000000..a92fc19 --- /dev/null +++ b/patches/002-fix-metric-output.patch @@ -0,0 +1,58 @@ +--- a/bgpd/bgp_debug.c ++++ b/bgpd/bgp_debug.c +@@ -194,11 +194,11 @@ bgp_dump_attr (struct peer *peer, struct + #endif /* HAVE_IPV6 */ + + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF))) +- snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %d", ++ snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %u", + attr->local_pref); + + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC))) +- snprintf (buf + strlen (buf), size - strlen (buf), ", metric %d", ++ snprintf (buf + strlen (buf), size - strlen (buf), ", metric %u", + attr->med); + + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES))) +--- a/bgpd/bgp_route.c ++++ b/bgpd/bgp_route.c +@@ -5954,7 +5954,7 @@ route_vty_out_detail (struct vty *vty, s + if (! CHECK_FLAG (binfo->flags, BGP_INFO_VALID)) + vty_out (vty, " (inaccessible)"); + else if (binfo->extra && binfo->extra->igpmetric) +- vty_out (vty, " (metric %d)", binfo->extra->igpmetric); ++ vty_out (vty, " (metric %u)", binfo->extra->igpmetric); + vty_out (vty, " from %s", sockunion2str (&binfo->peer->su, buf, SU_ADDRSTRLEN)); + if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)) + vty_out (vty, " (%s)", inet_ntoa (attr->extra->originator_id)); +--- a/bgpd/bgp_vty.c ++++ b/bgpd/bgp_vty.c +@@ -8966,7 +8966,7 @@ bgp_config_write_redistribute (struct vt + vty_out (vty, " redistribute %s", zebra_route_string(i)); + + if (bgp->redist_metric_flag[afi][i]) +- vty_out (vty, " metric %d", bgp->redist_metric[afi][i]); ++ vty_out (vty, " metric %u", bgp->redist_metric[afi][i]); + + if (bgp->rmap[afi][i].name) + vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); +--- a/zebra/zebra_vty.c ++++ b/zebra/zebra_vty.c +@@ -541,7 +541,7 @@ vty_show_ip_route_detail (struct vty *vt + inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, + VTY_NEWLINE); + vty_out (vty, " Known via \"%s\"", zebra_route_string (rib->type)); +- vty_out (vty, ", distance %d, metric %d", rib->distance, rib->metric); ++ vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric); + if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) + vty_out (vty, ", best"); + if (rib->refcnt) +@@ -1519,7 +1519,7 @@ vty_show_ipv6_route_detail (struct vty * + rn->p.prefixlen, + VTY_NEWLINE); + vty_out (vty, " Known via \"%s\"", zebra_route_string (rib->type)); +- vty_out (vty, ", distance %d, metric %d", rib->distance, rib->metric); ++ vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric); + if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) + vty_out (vty, ", best"); + if (rib->refcnt) From 6ee75f28c8208346e689fac1be3bfe6767b80f78 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 13 Jul 2012 16:35:00 +0000 Subject: [PATCH 096/117] [packages] quagga: Fix "match peer local" statements parsing git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32694 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...-bgpd-fix-route-map-match-peer-local.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 patches/003-bgpd-fix-route-map-match-peer-local.patch diff --git a/patches/003-bgpd-fix-route-map-match-peer-local.patch b/patches/003-bgpd-fix-route-map-match-peer-local.patch new file mode 100644 index 0000000..597ab73 --- /dev/null +++ b/patches/003-bgpd-fix-route-map-match-peer-local.patch @@ -0,0 +1,20 @@ +--- a/bgpd/bgp_routemap.c ++++ b/bgpd/bgp_routemap.c +@@ -172,7 +172,7 @@ route_match_peer_compile (const char *ar + + su = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (union sockunion)); + +- ret = str2sockunion ( (arg)? arg : "0.0.0.0", su); ++ ret = str2sockunion (strcmp(arg, "local") ? arg : "0.0.0.0", su); + if (ret < 0) { + XFREE (MTYPE_ROUTE_MAP_COMPILED, su); + return NULL; +@@ -2430,7 +2430,7 @@ DEFUN (match_peer_local, + "Match peer address\n" + "Static or Redistributed routes\n") + { +- return bgp_route_match_add (vty, vty->index, "peer", NULL); ++ return bgp_route_match_add (vty, vty->index, "peer", "local"); + } + + DEFUN (no_match_peer, From 3f4265ff98a20bb6e2f20d8b403c4d68626fcd77 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 13 Jul 2012 16:35:22 +0000 Subject: [PATCH 097/117] [packages] quagga: Fix various sockunion_{str2su,su2str} memleaks git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32695 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/004-fix-sockunion-memleaks.patch | 539 +++++++++++++++++++++++ 1 file changed, 539 insertions(+) create mode 100644 patches/004-fix-sockunion-memleaks.patch diff --git a/patches/004-fix-sockunion-memleaks.patch b/patches/004-fix-sockunion-memleaks.patch new file mode 100644 index 0000000..92f0dfc --- /dev/null +++ b/patches/004-fix-sockunion-memleaks.patch @@ -0,0 +1,539 @@ +--- a/bgpd/bgp_routemap.c ++++ b/bgpd/bgp_routemap.c +@@ -111,7 +111,8 @@ route_match_peer (void *rule, struct pre + void *object) + { + union sockunion *su; +- union sockunion *su2; ++ union sockunion su_def = { .sa.sa_family = AF_INET, ++ .sin.sin_addr.s_addr = INADDR_ANY }; + struct peer_group *group; + struct peer *peer; + struct listnode *node, *nnode; +@@ -127,8 +128,7 @@ route_match_peer (void *rule, struct pre + + /* If su='0.0.0.0' (command 'match peer local'), and it's a NETWORK, + REDISTRIBUTE or DEFAULT_GENERATED route => return RMAP_MATCH */ +- su2 = sockunion_str2su ("0.0.0.0"); +- if ( sockunion_same (su, su2) ) ++ if (sockunion_same (su, &su_def)) + { + int ret; + if ( CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_NETWORK) || +@@ -137,12 +137,9 @@ route_match_peer (void *rule, struct pre + ret = RMAP_MATCH; + else + ret = RMAP_NOMATCH; +- +- sockunion_free (su2); + return ret; + } +- sockunion_free (su2); +- ++ + if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) + { + if (sockunion_same (su, &peer->su)) +@@ -878,7 +875,6 @@ route_set_ip_nexthop (void *rule, struct + route_map_object_t type, void *object) + { + struct rmap_ip_nexthop_set *rins = rule; +- struct in_addr peer_address; + struct bgp_info *bgp_info; + struct peer *peer; + +@@ -894,16 +890,14 @@ route_set_ip_nexthop (void *rule, struct + && peer->su_remote + && sockunion_family (peer->su_remote) == AF_INET) + { +- inet_aton (sockunion_su2str (peer->su_remote), &peer_address); +- bgp_info->attr->nexthop = peer_address; ++ bgp_info->attr->nexthop.s_addr = sockunion2ip (peer->su_remote); + bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP); + } + else if (CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_OUT) + && peer->su_local + && sockunion_family (peer->su_local) == AF_INET) + { +- inet_aton (sockunion_su2str (peer->su_local), &peer_address); +- bgp_info->attr->nexthop = peer_address; ++ bgp_info->attr->nexthop.s_addr = sockunion2ip (peer->su_local); + bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP); + } + } +--- a/lib/sockunion.h ++++ b/lib/sockunion.h +@@ -78,23 +78,17 @@ enum connect_result + #define SET_IN6_LINKLOCAL_IFINDEX(a, i) + #endif /* KAME */ + +-/* shortcut macro to specify address field of struct sockaddr */ +-#define sock2ip(X) (((struct sockaddr_in *)(X))->sin_addr.s_addr) +-#ifdef HAVE_IPV6 +-#define sock2ip6(X) (((struct sockaddr_in6 *)(X))->sin6_addr.s6_addr) +-#endif /* HAVE_IPV6 */ +- + #define sockunion_family(X) (X)->sa.sa_family + ++#define sockunion2ip(X) (X)->sin.sin_addr.s_addr ++ + /* Prototypes. */ + extern int str2sockunion (const char *, union sockunion *); + extern const char *sockunion2str (union sockunion *, char *, size_t); + extern int sockunion_cmp (union sockunion *, union sockunion *); + extern int sockunion_same (union sockunion *, union sockunion *); + +-extern char *sockunion_su2str (union sockunion *su); + extern union sockunion *sockunion_str2su (const char *str); +-extern struct in_addr sockunion_get_in_addr (union sockunion *su); + extern int sockunion_accept (int sock, union sockunion *); + extern int sockunion_stream_socket (union sockunion *); + extern int sockopt_reuseaddr (int); +--- a/bgpd/bgp_fsm.c ++++ b/bgpd/bgp_fsm.c +@@ -597,8 +597,6 @@ bgp_stop_with_error (struct peer *peer) + static int + bgp_connect_success (struct peer *peer) + { +- char buf1[BUFSIZ]; +- + if (peer->fd < 0) + { + zlog_err ("bgp_connect_success peer's fd is negative value %d", +@@ -612,6 +610,8 @@ bgp_connect_success (struct peer *peer) + + if (BGP_DEBUG (normal, NORMAL)) + { ++ char buf1[SU_ADDRSTRLEN]; ++ + if (! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER)) + zlog_debug ("%s open active, local address %s", peer->host, + sockunion2str (peer->su_local, buf1, SU_ADDRSTRLEN)); +--- a/bgpd/bgp_mplsvpn.c ++++ b/bgpd/bgp_mplsvpn.c +@@ -581,24 +581,25 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_ro + "Neighbor to display information about\n" + "Display routes learned from neighbor\n") + { +- union sockunion *su; ++ union sockunion su; + struct peer *peer; +- +- su = sockunion_str2su (argv[0]); +- if (su == NULL) ++ int ret; ++ ++ ret = str2sockunion (argv[0], &su); ++ if (ret < 0) + { + vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); +- return CMD_WARNING; ++ return CMD_WARNING; + } + +- peer = peer_lookup (NULL, su); ++ peer = peer_lookup (NULL, &su); + if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN]) + { + vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); + return CMD_WARNING; + } + +- return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_neighbor, su, 0); ++ return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_neighbor, &su, 0); + } + + DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, +@@ -615,7 +616,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_rou + "Display routes learned from neighbor\n") + { + int ret; +- union sockunion *su; ++ union sockunion su; + struct peer *peer; + struct prefix_rd prd; + +@@ -626,21 +627,21 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_rou + return CMD_WARNING; + } + +- su = sockunion_str2su (argv[1]); +- if (su == NULL) ++ ret = str2sockunion (argv[1], &su); ++ if (ret < 0) + { + vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); +- return CMD_WARNING; ++ return CMD_WARNING; + } + +- peer = peer_lookup (NULL, su); ++ peer = peer_lookup (NULL, &su); + if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN]) + { + vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); + return CMD_WARNING; + } + +- return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_neighbor, su, 0); ++ return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_neighbor, &su, 0); + } + + DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, +--- a/bgpd/bgp_network.c ++++ b/bgpd/bgp_network.c +@@ -185,7 +185,7 @@ bgp_accept (struct thread *thread) + zlog_debug ("[Event] Make dummy peer structure until read Open packet"); + + { +- char buf[SU_ADDRSTRLEN + 1]; ++ char buf[SU_ADDRSTRLEN]; + + peer = peer_create_accept (peer1->bgp); + SET_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER); +--- a/bgpd/bgp_route.c ++++ b/bgpd/bgp_route.c +@@ -10202,15 +10202,18 @@ DEFUN (show_ip_bgp_neighbor_received_pre + "Display the prefixlist filter\n") + { + char name[BUFSIZ]; +- union sockunion *su; ++ union sockunion su; + struct peer *peer; +- int count; ++ int count, ret; + +- su = sockunion_str2su (argv[0]); +- if (su == NULL) +- return CMD_WARNING; ++ ret = str2sockunion (argv[0], &su); ++ if (ret < 0) ++ { ++ vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); ++ return CMD_WARNING; ++ } + +- peer = peer_lookup (NULL, su); ++ peer = peer_lookup (NULL, &su); + if (! peer) + return CMD_WARNING; + +@@ -10241,15 +10244,18 @@ DEFUN (show_ip_bgp_ipv4_neighbor_receive + "Display the prefixlist filter\n") + { + char name[BUFSIZ]; +- union sockunion *su; ++ union sockunion su; + struct peer *peer; +- int count; ++ int count, ret; + +- su = sockunion_str2su (argv[1]); +- if (su == NULL) +- return CMD_WARNING; ++ ret = str2sockunion (argv[1], &su); ++ if (ret < 0) ++ { ++ vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE); ++ return CMD_WARNING; ++ } + +- peer = peer_lookup (NULL, su); ++ peer = peer_lookup (NULL, &su); + if (! peer) + return CMD_WARNING; + +@@ -10312,15 +10318,18 @@ DEFUN (show_bgp_neighbor_received_prefix + "Display the prefixlist filter\n") + { + char name[BUFSIZ]; +- union sockunion *su; ++ union sockunion su; + struct peer *peer; +- int count; ++ int count, ret; + +- su = sockunion_str2su (argv[0]); +- if (su == NULL) +- return CMD_WARNING; ++ ret = str2sockunion (argv[0], &su); ++ if (ret < 0) ++ { ++ vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); ++ return CMD_WARNING; ++ } + +- peer = peer_lookup (NULL, su); ++ peer = peer_lookup (NULL, &su); + if (! peer) + return CMD_WARNING; + +@@ -10394,10 +10403,10 @@ DEFUN (show_bgp_view_neighbor_received_p + "Display the prefixlist filter\n") + { + char name[BUFSIZ]; +- union sockunion *su; ++ union sockunion su; + struct peer *peer; + struct bgp *bgp; +- int count; ++ int count, ret; + + /* BGP structure lookup. */ + bgp = bgp_lookup_by_name (argv[0]); +@@ -10407,11 +10416,14 @@ DEFUN (show_bgp_view_neighbor_received_p + return CMD_WARNING; + } + +- su = sockunion_str2su (argv[1]); +- if (su == NULL) +- return CMD_WARNING; ++ ret = str2sockunion (argv[1], &su); ++ if (ret < 0) ++ { ++ vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE); ++ return CMD_WARNING; ++ } + +- peer = peer_lookup (bgp, su); ++ peer = peer_lookup (bgp, &su); + if (! peer) + return CMD_WARNING; + +--- a/bgpd/bgp_vty.c ++++ b/bgpd/bgp_vty.c +@@ -2943,7 +2943,6 @@ peer_update_source_vty (struct vty *vty, + const char *source_str) + { + struct peer *peer; +- union sockunion *su; + + peer = peer_and_group_lookup_vty (vty, peer_str); + if (! peer) +@@ -2951,12 +2950,11 @@ peer_update_source_vty (struct vty *vty, + + if (source_str) + { +- su = sockunion_str2su (source_str); +- if (su) +- { +- peer_update_source_addr_set (peer, su); +- sockunion_free (su); +- } ++ union sockunion su; ++ int ret = str2sockunion (source_str, &su); ++ ++ if (ret == 0) ++ peer_update_source_addr_set (peer, &su); + else + peer_update_source_if_set (peer, source_str); + } +--- a/lib/sockunion.c ++++ b/lib/sockunion.c +@@ -177,55 +177,15 @@ sockunion2str (union sockunion *su, char + union sockunion * + sockunion_str2su (const char *str) + { +- int ret; +- union sockunion *su; +- +- su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion)); +- +- ret = inet_pton (AF_INET, str, &su->sin.sin_addr); +- if (ret > 0) /* Valid IPv4 address format. */ +- { +- su->sin.sin_family = AF_INET; +-#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN +- su->sin.sin_len = sizeof(struct sockaddr_in); +-#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ +- return su; +- } +-#ifdef HAVE_IPV6 +- ret = inet_pton (AF_INET6, str, &su->sin6.sin6_addr); +- if (ret > 0) /* Valid IPv6 address format. */ +- { +- su->sin6.sin6_family = AF_INET6; +-#ifdef SIN6_LEN +- su->sin6.sin6_len = sizeof(struct sockaddr_in6); +-#endif /* SIN6_LEN */ +- return su; +- } +-#endif /* HAVE_IPV6 */ +- ++ union sockunion *su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion)); ++ ++ if (!str2sockunion (str, su)) ++ return su; ++ + XFREE (MTYPE_SOCKUNION, su); + return NULL; + } + +-char * +-sockunion_su2str (union sockunion *su) +-{ +- char str[SU_ADDRSTRLEN]; +- +- switch (su->sa.sa_family) +- { +- case AF_INET: +- inet_ntop (AF_INET, &su->sin.sin_addr, str, sizeof (str)); +- break; +-#ifdef HAVE_IPV6 +- case AF_INET6: +- inet_ntop (AF_INET6, &su->sin6.sin6_addr, str, sizeof (str)); +- break; +-#endif /* HAVE_IPV6 */ +- } +- return XSTRDUP (MTYPE_TMP, str); +-} +- + /* Convert IPv4 compatible IPv6 address to IPv4 address. */ + static void + sockunion_normalise_mapped (union sockunion *su) +@@ -422,7 +382,7 @@ sockunion_bind (int sock, union sockunio + su->sin.sin_len = size; + #endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ + if (su_addr == NULL) +- su->sin.sin_addr.s_addr = htonl (INADDR_ANY); ++ sockunion2ip (su) = htonl (INADDR_ANY); + } + #ifdef HAVE_IPV6 + else if (su->sa.sa_family == AF_INET6) +@@ -779,9 +739,9 @@ sockunion_cmp (union sockunion *su1, uni + + if (su1->sa.sa_family == AF_INET) + { +- if (ntohl (su1->sin.sin_addr.s_addr) == ntohl (su2->sin.sin_addr.s_addr)) ++ if (ntohl (sockunion2ip (su1)) == ntohl (sockunion2ip (su2))) + return 0; +- if (ntohl (su1->sin.sin_addr.s_addr) > ntohl (su2->sin.sin_addr.s_addr)) ++ if (ntohl (sockunion2ip (su1)) > ntohl (sockunion2ip (su2))) + return 1; + else + return -1; +--- a/lib/vty.c ++++ b/lib/vty.c +@@ -1612,13 +1612,16 @@ vty_flush (struct thread *thread) + static struct vty * + vty_create (int vty_sock, union sockunion *su) + { ++ char buf[SU_ADDRSTRLEN]; + struct vty *vty; + ++ sockunion2str(su, buf, SU_ADDRSTRLEN); ++ + /* Allocate new vty structure and set up default values. */ + vty = vty_new (); + vty->fd = vty_sock; + vty->type = VTY_TERM; +- vty->address = sockunion_su2str (su); ++ strcpy (vty->address, buf); + if (no_password_check) + { + if (restricted_mode) +@@ -1693,7 +1696,7 @@ vty_accept (struct thread *thread) + int accept_sock; + struct prefix *p = NULL; + struct access_list *acl = NULL; +- char *bufp; ++ char buf[SU_ADDRSTRLEN]; + + accept_sock = THREAD_FD (thread); + +@@ -1719,10 +1722,8 @@ vty_accept (struct thread *thread) + if ((acl = access_list_lookup (AFI_IP, vty_accesslist_name)) && + (access_list_apply (acl, p) == FILTER_DENY)) + { +- char *buf; + zlog (NULL, LOG_INFO, "Vty connection refused from %s", +- (buf = sockunion_su2str (&su))); +- free (buf); ++ sockunion2str (&su, buf, SU_ADDRSTRLEN)); + close (vty_sock); + + /* continue accepting connections */ +@@ -1741,10 +1742,8 @@ vty_accept (struct thread *thread) + if ((acl = access_list_lookup (AFI_IP6, vty_ipv6_accesslist_name)) && + (access_list_apply (acl, p) == FILTER_DENY)) + { +- char *buf; + zlog (NULL, LOG_INFO, "Vty connection refused from %s", +- (buf = sockunion_su2str (&su))); +- free (buf); ++ sockunion2str (&su, buf, SU_ADDRSTRLEN)); + close (vty_sock); + + /* continue accepting connections */ +@@ -1767,9 +1766,7 @@ vty_accept (struct thread *thread) + safe_strerror (errno)); + + zlog (NULL, LOG_INFO, "Vty connection from %s", +- (bufp = sockunion_su2str (&su))); +- if (bufp) +- XFREE (MTYPE_TMP, bufp); ++ sockunion2str (&su, buf, SU_ADDRSTRLEN)); + + vty_create (vty_sock, &su); + +@@ -2193,8 +2190,6 @@ vty_close (struct vty *vty) + if (vty->fd > 0) + close (vty->fd); + +- if (vty->address) +- XFREE (MTYPE_TMP, vty->address); + if (vty->buf) + XFREE (MTYPE_VTY, vty->buf); + +--- a/lib/vty.h ++++ b/lib/vty.h +@@ -23,6 +23,7 @@ Software Foundation, Inc., 59 Temple Pla + + #include "thread.h" + #include "log.h" ++#include "sockunion.h" + + #define VTY_BUFSIZ 512 + #define VTY_MAXHIST 20 +@@ -39,9 +40,6 @@ struct vty + /* Node status of this vty */ + int node; + +- /* What address is this vty comming from. */ +- char *address; +- + /* Failure count */ + int fail; + +@@ -118,6 +116,9 @@ struct vty + /* Timeout seconds and thread. */ + unsigned long v_timeout; + struct thread *t_timeout; ++ ++ /* What address is this vty comming from. */ ++ char address[SU_ADDRSTRLEN]; + }; + + /* Integrated configuration file. */ +--- a/zebra/zebra_rib.c ++++ b/zebra/zebra_rib.c +@@ -678,8 +678,8 @@ rib_lookup_ipv4_route (struct prefix_ipv + if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) + { + /* We are happy with either direct or recursive hexthop */ +- if (nexthop->gate.ipv4.s_addr == qgate->sin.sin_addr.s_addr || +- nexthop->rgate.ipv4.s_addr == qgate->sin.sin_addr.s_addr) ++ if (nexthop->gate.ipv4.s_addr == sockunion2ip (qgate) || ++ nexthop->rgate.ipv4.s_addr == sockunion2ip (qgate)) + return ZEBRA_RIB_FOUND_EXACT; + else + { +@@ -688,7 +688,7 @@ rib_lookup_ipv4_route (struct prefix_ipv + char gate_buf[INET_ADDRSTRLEN], rgate_buf[INET_ADDRSTRLEN], qgate_buf[INET_ADDRSTRLEN]; + inet_ntop (AF_INET, &nexthop->gate.ipv4.s_addr, gate_buf, INET_ADDRSTRLEN); + inet_ntop (AF_INET, &nexthop->rgate.ipv4.s_addr, rgate_buf, INET_ADDRSTRLEN); +- inet_ntop (AF_INET, &qgate->sin.sin_addr.s_addr, qgate_buf, INET_ADDRSTRLEN); ++ inet_ntop (AF_INET, &sockunion2ip (qgate), qgate_buf, INET_ADDRSTRLEN); + zlog_debug ("%s: qgate == %s, gate == %s, rgate == %s", __func__, qgate_buf, gate_buf, rgate_buf); + } + return ZEBRA_RIB_FOUND_NOGATE; From f807027d29a5ad5e5cb4cfc62b874bdefed72def Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 13 Jul 2012 16:35:27 +0000 Subject: [PATCH 098/117] [packages] quagga: Add connected routes to multicast RIB git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32696 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/005-zebra-connected-in-mrib.patch | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 patches/005-zebra-connected-in-mrib.patch diff --git a/patches/005-zebra-connected-in-mrib.patch b/patches/005-zebra-connected-in-mrib.patch new file mode 100644 index 0000000..ba74317 --- /dev/null +++ b/patches/005-zebra-connected-in-mrib.patch @@ -0,0 +1,23 @@ +Index: quagga-0.99.21/zebra/connected.c +=================================================================== +--- quagga-0.99.21.orig/zebra/connected.c ++++ quagga-0.99.21/zebra/connected.c +@@ -191,6 +191,9 @@ connected_up_ipv4 (struct interface *ifp + rib_add_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, NULL, ifp->ifindex, + RT_TABLE_MAIN, ifp->metric, 0, SAFI_UNICAST); + ++ rib_add_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, NULL, ifp->ifindex, ++ RT_TABLE_MAIN, ifp->metric, 0, SAFI_MULTICAST); ++ + rib_update (); + } + +@@ -297,6 +300,8 @@ connected_down_ipv4 (struct interface *i + /* Same logic as for connected_up_ipv4(): push the changes into the head. */ + rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0, SAFI_UNICAST); + ++ rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0, SAFI_MULTICAST); ++ + rib_update (); + } + From d9f9712679a913bd60fd9dca1b0e0ecc00b5026c Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 13 Jul 2012 16:35:36 +0000 Subject: [PATCH 099/117] [packages] quagga: Fix building with no IPv6 support git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32697 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/006-fix-no-ipv6.patch | 133 ++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 patches/006-fix-no-ipv6.patch diff --git a/patches/006-fix-no-ipv6.patch b/patches/006-fix-no-ipv6.patch new file mode 100644 index 0000000..3ce2633 --- /dev/null +++ b/patches/006-fix-no-ipv6.patch @@ -0,0 +1,133 @@ +Index: quagga-0.99.21/zebra/main.c +=================================================================== +--- quagga-0.99.21.orig/zebra/main.c ++++ quagga-0.99.21/zebra/main.c +@@ -327,7 +327,9 @@ main (int argc, char **argv) + zebra_vty_init (); + access_list_init (); + prefix_list_init (); ++#ifdef RTADV + rtadv_init (); ++#endif + #ifdef HAVE_IRDP + irdp_init(); + #endif +Index: quagga-0.99.21/zebra/rtadv.h +=================================================================== +--- quagga-0.99.21.orig/zebra/rtadv.h ++++ quagga-0.99.21/zebra/rtadv.h +@@ -26,6 +26,9 @@ + #include "vty.h" + #include "zebra/interface.h" + ++/* NB: RTADV is defined in zebra/interface.h above */ ++#ifdef RTADV ++ + /* Router advertisement prefix. */ + struct rtadv_prefix + { +@@ -96,4 +99,6 @@ struct nd_opt_homeagent_info { /* Home + + extern const char *rtadv_pref_strs[]; + ++#endif /* RTADV */ ++ + #endif /* _ZEBRA_RTADV_H */ +Index: quagga-0.99.21/zebra/zebra_vty.c +=================================================================== +--- quagga-0.99.21.orig/zebra/zebra_vty.c ++++ quagga-0.99.21/zebra/zebra_vty.c +@@ -1197,6 +1197,40 @@ DEFUN (show_ip_protocol, + return CMD_SUCCESS; + } + ++/* ++ * Show IP mroute command to dump the BGP Multicast ++ * routing table ++ */ ++DEFUN (show_ip_mroute, ++ show_ip_mroute_cmd, ++ "show ip mroute", ++ SHOW_STR ++ IP_STR ++ "IP Multicast routing table\n") ++{ ++ struct route_table *table; ++ struct route_node *rn; ++ struct rib *rib; ++ int first = 1; ++ ++ table = vrf_table (AFI_IP, SAFI_MULTICAST, 0); ++ if (! table) ++ return CMD_SUCCESS; ++ ++ /* Show all IPv4 routes. */ ++ for (rn = route_top (table); rn; rn = route_next (rn)) ++ for (rib = rn->info; rib; rib = rib->next) ++ { ++ if (first) ++ { ++ vty_out (vty, SHOW_ROUTE_V4_HEADER); ++ first = 0; ++ } ++ vty_show_ip_route (vty, rn, rib); ++ } ++ return CMD_SUCCESS; ++} ++ + + #ifdef HAVE_IPV6 + /* General fucntion for IPv6 static route. */ +@@ -1952,40 +1986,6 @@ DEFUN (show_ipv6_route_summary, + } + + /* +- * Show IP mroute command to dump the BGP Multicast +- * routing table +- */ +-DEFUN (show_ip_mroute, +- show_ip_mroute_cmd, +- "show ip mroute", +- SHOW_STR +- IP_STR +- "IP Multicast routing table\n") +-{ +- struct route_table *table; +- struct route_node *rn; +- struct rib *rib; +- int first = 1; +- +- table = vrf_table (AFI_IP, SAFI_MULTICAST, 0); +- if (! table) +- return CMD_SUCCESS; +- +- /* Show all IPv4 routes. */ +- for (rn = route_top (table); rn; rn = route_next (rn)) +- for (rib = rn->info; rib; rib = rib->next) +- { +- if (first) +- { +- vty_out (vty, SHOW_ROUTE_V4_HEADER); +- first = 0; +- } +- vty_show_ip_route (vty, rn, rib); +- } +- return CMD_SUCCESS; +-} +- +-/* + * Show IPv6 mroute command.Used to dump + * the Multicast routing table. + */ +@@ -2020,11 +2020,6 @@ DEFUN (show_ipv6_mroute, + return CMD_SUCCESS; + } + +- +- +- +- +- + /* Write IPv6 static route configuration. */ + static int + static_config_ipv6 (struct vty *vty) From 0f64eae9397a48e61d91804115a59d367949ff26 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 13 Jul 2012 16:35:41 +0000 Subject: [PATCH 100/117] [packages] quagga: Drop heuristics for IPv6 address recognition git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32698 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../007-drop-heuristic-ipv6-recognition.patch | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 patches/007-drop-heuristic-ipv6-recognition.patch diff --git a/patches/007-drop-heuristic-ipv6-recognition.patch b/patches/007-drop-heuristic-ipv6-recognition.patch new file mode 100644 index 0000000..1a0e6f4 --- /dev/null +++ b/patches/007-drop-heuristic-ipv6-recognition.patch @@ -0,0 +1,92 @@ +Index: quagga-0.99.21/lib/command.c +=================================================================== +--- quagga-0.99.21.orig/lib/command.c ++++ quagga-0.99.21/lib/command.c +@@ -868,86 +868,7 @@ cmd_ipv6_match (const char *str) + if (ret == 1) + return exact_match; + +- while (*str != '\0') +- { +- switch (state) +- { +- case STATE_START: +- if (*str == ':') +- { +- if (*(str + 1) != ':' && *(str + 1) != '\0') +- return no_match; +- colons--; +- state = STATE_COLON; +- } +- else +- { +- sp = str; +- state = STATE_ADDR; +- } +- +- continue; +- case STATE_COLON: +- colons++; +- if (*(str + 1) == ':') +- state = STATE_DOUBLE; +- else +- { +- sp = str + 1; +- state = STATE_ADDR; +- } +- break; +- case STATE_DOUBLE: +- if (double_colon) +- return no_match; +- +- if (*(str + 1) == ':') +- return no_match; +- else +- { +- if (*(str + 1) != '\0') +- colons++; +- sp = str + 1; +- state = STATE_ADDR; +- } +- +- double_colon++; +- nums++; +- break; +- case STATE_ADDR: +- if (*(str + 1) == ':' || *(str + 1) == '\0') +- { +- if (str - sp > 3) +- return no_match; +- +- nums++; +- state = STATE_COLON; +- } +- if (*(str + 1) == '.') +- state = STATE_DOT; +- break; +- case STATE_DOT: +- state = STATE_ADDR; +- break; +- default: +- break; +- } +- +- if (nums > 8) +- return no_match; +- +- if (colons > 7) +- return no_match; +- +- str++; +- } +- +-#if 0 +- if (nums < 11) +- return partly_match; +-#endif /* 0 */ +- +- return exact_match; ++ return no_match; + } + + static enum match_type From adf1b0d964a6a912cece9293fafd613a292989cb Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 13 Jul 2012 16:35:46 +0000 Subject: [PATCH 101/117] [packages] quagga: Fix thread_cancel_event() git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32699 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/008-fix-thread_cancel_event.patch | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 patches/008-fix-thread_cancel_event.patch diff --git a/patches/008-fix-thread_cancel_event.patch b/patches/008-fix-thread_cancel_event.patch new file mode 100644 index 0000000..45f314d --- /dev/null +++ b/patches/008-fix-thread_cancel_event.patch @@ -0,0 +1,29 @@ +Index: quagga-0.99.21/lib/thread.c +=================================================================== +--- quagga-0.99.21.orig/lib/thread.c ++++ quagga-0.99.21/lib/thread.c +@@ -916,6 +916,24 @@ thread_cancel_event (struct thread_maste + thread_add_unuse (m, t); + } + } ++ ++ /* thread can be on the ready list too */ ++ thread = m->ready.head; ++ while (thread) ++ { ++ struct thread *t; ++ ++ t = thread; ++ thread = t->next; ++ ++ if (t->arg == arg) ++ { ++ ret++; ++ thread_list_delete (&m->ready, t); ++ t->type = THREAD_UNUSED; ++ thread_add_unuse (m, t); ++ } ++ } + return ret; + } + From 021b3def5503f3d4a5a6e22218846c0ef2542029 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 13 Jul 2012 16:35:51 +0000 Subject: [PATCH 102/117] [packages] quagga: Fix vpnv4 soft-reconfiguration crashes git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32700 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...9-bgpd-fix-vpn4-soft-reconfiguration.patch | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 patches/009-bgpd-fix-vpn4-soft-reconfiguration.patch diff --git a/patches/009-bgpd-fix-vpn4-soft-reconfiguration.patch b/patches/009-bgpd-fix-vpn4-soft-reconfiguration.patch new file mode 100644 index 0000000..4a9cac0 --- /dev/null +++ b/patches/009-bgpd-fix-vpn4-soft-reconfiguration.patch @@ -0,0 +1,91 @@ +Index: quagga-0.99.21/bgpd/bgp_route.c +=================================================================== +--- quagga-0.99.21.orig/bgpd/bgp_route.c ++++ quagga-0.99.21/bgpd/bgp_route.c +@@ -2616,7 +2616,7 @@ bgp_announce_route_all (struct peer *pee + + static void + bgp_soft_reconfig_table_rsclient (struct peer *rsclient, afi_t afi, +- safi_t safi, struct bgp_table *table) ++ safi_t safi, struct bgp_table *table, struct prefix_rd *prd) + { + struct bgp_node *rn; + struct bgp_adj_in *ain; +@@ -2627,8 +2627,11 @@ bgp_soft_reconfig_table_rsclient (struct + for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn)) + for (ain = rn->adj_in; ain; ain = ain->next) + { ++ struct bgp_info *ri = rn->info; ++ + bgp_update_rsclient (rsclient, afi, safi, ain->attr, ain->peer, +- &rn->p, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL, NULL); ++ &rn->p, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, prd, ++ (bgp_info_extra_get (ri))->tag); + } + } + +@@ -2639,18 +2642,25 @@ bgp_soft_reconfig_rsclient (struct peer + struct bgp_node *rn; + + if (safi != SAFI_MPLS_VPN) +- bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, NULL); ++ bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, NULL, NULL); + + else + for (rn = bgp_table_top (rsclient->bgp->rib[afi][safi]); rn; + rn = bgp_route_next (rn)) + if ((table = rn->info) != NULL) +- bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, table); ++ { ++ struct prefix_rd prd; ++ prd.family = AF_UNSPEC; ++ prd.prefixlen = 64; ++ memcpy(&prd.val, rn->p.u.val, 8); ++ ++ bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, table, &prd); ++ } + } + + static void + bgp_soft_reconfig_table (struct peer *peer, afi_t afi, safi_t safi, +- struct bgp_table *table) ++ struct bgp_table *table, struct prefix_rd *prd) + { + int ret; + struct bgp_node *rn; +@@ -2664,9 +2674,12 @@ bgp_soft_reconfig_table (struct peer *pe + { + if (ain->peer == peer) + { ++ struct bgp_info *ri = rn->info; ++ + ret = bgp_update (peer, &rn->p, ain->attr, afi, safi, + ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, +- NULL, NULL, 1); ++ prd, (bgp_info_extra_get (ri))->tag, 1); ++ + if (ret < 0) + { + bgp_unlock_node (rn); +@@ -2687,12 +2700,19 @@ bgp_soft_reconfig_in (struct peer *peer, + return; + + if (safi != SAFI_MPLS_VPN) +- bgp_soft_reconfig_table (peer, afi, safi, NULL); ++ bgp_soft_reconfig_table (peer, afi, safi, NULL, NULL); + else + for (rn = bgp_table_top (peer->bgp->rib[afi][safi]); rn; + rn = bgp_route_next (rn)) + if ((table = rn->info) != NULL) +- bgp_soft_reconfig_table (peer, afi, safi, table); ++ { ++ struct prefix_rd prd; ++ prd.family = AF_UNSPEC; ++ prd.prefixlen = 64; ++ memcpy(&prd.val, rn->p.u.val, 8); ++ ++ bgp_soft_reconfig_table (peer, afi, safi, table, &prd); ++ } + } + + From 8455f3db39d491843bef33e3ecfae338da9b35eb Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 13 Jul 2012 16:35:56 +0000 Subject: [PATCH 103/117] [packages] quagga: Fix memleak with struct attr_extra git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32701 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../010-bgpd-fix-struct-attr_extra-leak.patch | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 patches/010-bgpd-fix-struct-attr_extra-leak.patch diff --git a/patches/010-bgpd-fix-struct-attr_extra-leak.patch b/patches/010-bgpd-fix-struct-attr_extra-leak.patch new file mode 100644 index 0000000..5841506 --- /dev/null +++ b/patches/010-bgpd-fix-struct-attr_extra-leak.patch @@ -0,0 +1,19 @@ +Index: quagga-0.99.21/bgpd/bgp_route.c +=================================================================== +--- quagga-0.99.21.orig/bgpd/bgp_route.c ++++ quagga-0.99.21/bgpd/bgp_route.c +@@ -2485,12 +2485,8 @@ bgp_default_originate (struct peer *peer + #ifdef HAVE_IPV6 + else if (afi == AFI_IP6) + { +- struct attr_extra *ae; +- attr.extra = NULL; +- +- ae = bgp_attr_extra_get (&attr); +- attr.extra = ae; +- ++ struct attr_extra *ae = attr.extra; ++ + str2prefix ("::/0", &p); + + /* IPv6 global nexthop must be included. */ From 647ee35f193e292409bac06b62a05e8534a031ae Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 13 Jul 2012 16:36:01 +0000 Subject: [PATCH 104/117] [packages] quagga: Fix typo in isisd git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32702 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/011-isisd-fix-typo.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 patches/011-isisd-fix-typo.patch diff --git a/patches/011-isisd-fix-typo.patch b/patches/011-isisd-fix-typo.patch new file mode 100644 index 0000000..e7a1510 --- /dev/null +++ b/patches/011-isisd-fix-typo.patch @@ -0,0 +1,13 @@ +Index: quagga-0.99.21/isisd/isis_lsp.c +=================================================================== +--- quagga-0.99.21.orig/isisd/isis_lsp.c ++++ quagga-0.99.21/isisd/isis_lsp.c +@@ -2413,7 +2413,7 @@ top_lsp_refresh (struct thread *thread) + isis_dynhn_insert (lsp->lsp_header->lsp_id, lsp->tlv_data.hostname, + IS_LEVEL_1); + +- lsp->lsp_header->lsp_bits = lsp_bits_generate (level, ++ lsp->lsp_header->lsp_bits = lsp_bits_generate (lsp->level, + lsp->area->overload_bit); + rem_lifetime = lsp_rem_lifetime (lsp->area, IS_LEVEL_1); + lsp->lsp_header->rem_lifetime = htons (rem_lifetime); From 20e510acad7c1710c13acf2a916b2c51e9af4b38 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Fri, 13 Jul 2012 16:40:43 +0000 Subject: [PATCH 105/117] [packages] quagga: Refresh patches git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32703 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- patches/005-zebra-connected-in-mrib.patch | 6 ++---- patches/006-fix-no-ipv6.patch | 18 ++++++----------- .../007-drop-heuristic-ipv6-recognition.patch | 6 ++---- patches/008-fix-thread_cancel_event.patch | 6 ++---- ...9-bgpd-fix-vpn4-soft-reconfiguration.patch | 6 ++---- .../010-bgpd-fix-struct-attr_extra-leak.patch | 6 ++---- patches/011-isisd-fix-typo.patch | 6 ++---- patches/120-quagga_manet.patch | 4 ++-- patches/150-no-cross-fs-link.patch | 4 ++-- patches/160-pgbgp.patch | 20 +++++++++---------- patches/161-pgbgp-addon.patch | 16 +++++++-------- 11 files changed, 40 insertions(+), 58 deletions(-) diff --git a/patches/005-zebra-connected-in-mrib.patch b/patches/005-zebra-connected-in-mrib.patch index ba74317..6d0a868 100644 --- a/patches/005-zebra-connected-in-mrib.patch +++ b/patches/005-zebra-connected-in-mrib.patch @@ -1,7 +1,5 @@ -Index: quagga-0.99.21/zebra/connected.c -=================================================================== ---- quagga-0.99.21.orig/zebra/connected.c -+++ quagga-0.99.21/zebra/connected.c +--- a/zebra/connected.c ++++ b/zebra/connected.c @@ -191,6 +191,9 @@ connected_up_ipv4 (struct interface *ifp rib_add_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, NULL, ifp->ifindex, RT_TABLE_MAIN, ifp->metric, 0, SAFI_UNICAST); diff --git a/patches/006-fix-no-ipv6.patch b/patches/006-fix-no-ipv6.patch index 3ce2633..f39c453 100644 --- a/patches/006-fix-no-ipv6.patch +++ b/patches/006-fix-no-ipv6.patch @@ -1,7 +1,5 @@ -Index: quagga-0.99.21/zebra/main.c -=================================================================== ---- quagga-0.99.21.orig/zebra/main.c -+++ quagga-0.99.21/zebra/main.c +--- a/zebra/main.c ++++ b/zebra/main.c @@ -327,7 +327,9 @@ main (int argc, char **argv) zebra_vty_init (); access_list_init (); @@ -12,10 +10,8 @@ Index: quagga-0.99.21/zebra/main.c #ifdef HAVE_IRDP irdp_init(); #endif -Index: quagga-0.99.21/zebra/rtadv.h -=================================================================== ---- quagga-0.99.21.orig/zebra/rtadv.h -+++ quagga-0.99.21/zebra/rtadv.h +--- a/zebra/rtadv.h ++++ b/zebra/rtadv.h @@ -26,6 +26,9 @@ #include "vty.h" #include "zebra/interface.h" @@ -33,10 +29,8 @@ Index: quagga-0.99.21/zebra/rtadv.h +#endif /* RTADV */ + #endif /* _ZEBRA_RTADV_H */ -Index: quagga-0.99.21/zebra/zebra_vty.c -=================================================================== ---- quagga-0.99.21.orig/zebra/zebra_vty.c -+++ quagga-0.99.21/zebra/zebra_vty.c +--- a/zebra/zebra_vty.c ++++ b/zebra/zebra_vty.c @@ -1197,6 +1197,40 @@ DEFUN (show_ip_protocol, return CMD_SUCCESS; } diff --git a/patches/007-drop-heuristic-ipv6-recognition.patch b/patches/007-drop-heuristic-ipv6-recognition.patch index 1a0e6f4..1b49d7b 100644 --- a/patches/007-drop-heuristic-ipv6-recognition.patch +++ b/patches/007-drop-heuristic-ipv6-recognition.patch @@ -1,7 +1,5 @@ -Index: quagga-0.99.21/lib/command.c -=================================================================== ---- quagga-0.99.21.orig/lib/command.c -+++ quagga-0.99.21/lib/command.c +--- a/lib/command.c ++++ b/lib/command.c @@ -868,86 +868,7 @@ cmd_ipv6_match (const char *str) if (ret == 1) return exact_match; diff --git a/patches/008-fix-thread_cancel_event.patch b/patches/008-fix-thread_cancel_event.patch index 45f314d..3dcb9f5 100644 --- a/patches/008-fix-thread_cancel_event.patch +++ b/patches/008-fix-thread_cancel_event.patch @@ -1,7 +1,5 @@ -Index: quagga-0.99.21/lib/thread.c -=================================================================== ---- quagga-0.99.21.orig/lib/thread.c -+++ quagga-0.99.21/lib/thread.c +--- a/lib/thread.c ++++ b/lib/thread.c @@ -916,6 +916,24 @@ thread_cancel_event (struct thread_maste thread_add_unuse (m, t); } diff --git a/patches/009-bgpd-fix-vpn4-soft-reconfiguration.patch b/patches/009-bgpd-fix-vpn4-soft-reconfiguration.patch index 4a9cac0..d8efa72 100644 --- a/patches/009-bgpd-fix-vpn4-soft-reconfiguration.patch +++ b/patches/009-bgpd-fix-vpn4-soft-reconfiguration.patch @@ -1,7 +1,5 @@ -Index: quagga-0.99.21/bgpd/bgp_route.c -=================================================================== ---- quagga-0.99.21.orig/bgpd/bgp_route.c -+++ quagga-0.99.21/bgpd/bgp_route.c +--- a/bgpd/bgp_route.c ++++ b/bgpd/bgp_route.c @@ -2616,7 +2616,7 @@ bgp_announce_route_all (struct peer *pee static void diff --git a/patches/010-bgpd-fix-struct-attr_extra-leak.patch b/patches/010-bgpd-fix-struct-attr_extra-leak.patch index 5841506..8f824bf 100644 --- a/patches/010-bgpd-fix-struct-attr_extra-leak.patch +++ b/patches/010-bgpd-fix-struct-attr_extra-leak.patch @@ -1,7 +1,5 @@ -Index: quagga-0.99.21/bgpd/bgp_route.c -=================================================================== ---- quagga-0.99.21.orig/bgpd/bgp_route.c -+++ quagga-0.99.21/bgpd/bgp_route.c +--- a/bgpd/bgp_route.c ++++ b/bgpd/bgp_route.c @@ -2485,12 +2485,8 @@ bgp_default_originate (struct peer *peer #ifdef HAVE_IPV6 else if (afi == AFI_IP6) diff --git a/patches/011-isisd-fix-typo.patch b/patches/011-isisd-fix-typo.patch index e7a1510..142c8af 100644 --- a/patches/011-isisd-fix-typo.patch +++ b/patches/011-isisd-fix-typo.patch @@ -1,7 +1,5 @@ -Index: quagga-0.99.21/isisd/isis_lsp.c -=================================================================== ---- quagga-0.99.21.orig/isisd/isis_lsp.c -+++ quagga-0.99.21/isisd/isis_lsp.c +--- a/isisd/isis_lsp.c ++++ b/isisd/isis_lsp.c @@ -2413,7 +2413,7 @@ top_lsp_refresh (struct thread *thread) isis_dynhn_insert (lsp->lsp_header->lsp_id, lsp->tlv_data.hostname, IS_LEVEL_1); diff --git a/patches/120-quagga_manet.patch b/patches/120-quagga_manet.patch index bf6d056..99e3cc7 100644 --- a/patches/120-quagga_manet.patch +++ b/patches/120-quagga_manet.patch @@ -217,7 +217,7 @@ { time_t uptime; struct tm *tm; -@@ -1536,7 +1542,10 @@ vty_show_ipv6_route_detail (struct vty * +@@ -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 @@ -229,7 +229,7 @@ { time_t uptime; struct tm *tm; -@@ -1716,7 +1725,10 @@ vty_show_ipv6_route (struct vty *vty, st +@@ -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 diff --git a/patches/150-no-cross-fs-link.patch b/patches/150-no-cross-fs-link.patch index c3f29c3..2b84031 100644 --- a/patches/150-no-cross-fs-link.patch +++ b/patches/150-no-cross-fs-link.patch @@ -1,6 +1,6 @@ --- a/lib/command.c +++ b/lib/command.c -@@ -2601,6 +2601,13 @@ DEFUN (config_write_file, +@@ -2522,6 +2522,13 @@ DEFUN (config_write_file, VTY_NEWLINE); goto finished; } @@ -14,7 +14,7 @@ if (link (config_file, config_file_sav) != 0) { vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav, -@@ -2614,7 +2621,23 @@ DEFUN (config_write_file, +@@ -2535,7 +2542,23 @@ DEFUN (config_write_file, VTY_NEWLINE); goto finished; } diff --git a/patches/160-pgbgp.patch b/patches/160-pgbgp.patch index fb01ee1..a8273ab 100644 --- a/patches/160-pgbgp.patch +++ b/patches/160-pgbgp.patch @@ -2800,7 +2800,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* Register new BGP information. */ bgp_info_add (rn, new); -@@ -5559,6 +5581,20 @@ enum bgp_display_type +@@ -5575,6 +5597,20 @@ enum bgp_display_type static void route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo) { @@ -2821,7 +2821,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* Route status display. */ if (CHECK_FLAG (binfo->flags, BGP_INFO_REMOVED)) vty_out (vty, "R"); -@@ -6064,6 +6100,7 @@ route_vty_out_detail (struct vty *vty, s +@@ -6080,6 +6116,7 @@ route_vty_out_detail (struct vty *vty, s } #define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s r RIB-failure, S Stale, R Removed%s" @@ -2829,7 +2829,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s" #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s" #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s" -@@ -6095,7 +6132,8 @@ enum bgp_show_type +@@ -6111,7 +6148,8 @@ enum bgp_show_type bgp_show_type_flap_route_map, bgp_show_type_flap_neighbor, bgp_show_type_dampend_paths, @@ -2839,7 +2839,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c }; static int -@@ -6262,11 +6300,17 @@ bgp_show_table (struct vty *vty, struct +@@ -6278,11 +6316,17 @@ bgp_show_table (struct vty *vty, struct || CHECK_FLAG (ri->flags, BGP_INFO_HISTORY)) continue; } @@ -2857,7 +2857,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); if (type == bgp_show_type_dampend_paths || type == bgp_show_type_damp_neighbor) -@@ -6344,6 +6388,7 @@ bgp_show (struct vty *vty, struct bgp *b +@@ -6360,6 +6404,7 @@ bgp_show (struct vty *vty, struct bgp *b return bgp_show_table (vty, table, &bgp->router_id, type, output_arg); } @@ -2865,7 +2865,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c /* Header of detailed BGP route information */ static void route_vty_out_detail_header (struct vty *vty, struct bgp *bgp, -@@ -11904,6 +11949,64 @@ DEFUN (bgp_damp_set, +@@ -11932,6 +11977,64 @@ DEFUN (bgp_damp_set, half, reuse, suppress, max); } @@ -2930,7 +2930,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c ALIAS (bgp_damp_set, bgp_damp_set2_cmd, "bgp dampening <1-45>", -@@ -11953,6 +12056,19 @@ DEFUN (show_ip_bgp_dampened_paths, +@@ -11981,6 +12084,19 @@ DEFUN (show_ip_bgp_dampened_paths, NULL); } @@ -2950,7 +2950,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c DEFUN (show_ip_bgp_flap_statistics, show_ip_bgp_flap_statistics_cmd, "show ip bgp flap-statistics", -@@ -12479,6 +12595,7 @@ bgp_route_init (void) +@@ -12507,6 +12623,7 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_ip_bgp_dampened_paths_cmd); @@ -2958,7 +2958,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c install_element (VIEW_NODE, &show_ip_bgp_flap_statistics_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_address_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_prefix_cmd); -@@ -12612,6 +12729,7 @@ bgp_route_init (void) +@@ -12640,6 +12757,7 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_dampened_paths_cmd); @@ -2966,7 +2966,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705c install_element (ENABLE_NODE, &show_ip_bgp_flap_statistics_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_address_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_prefix_cmd); -@@ -13002,6 +13120,10 @@ bgp_route_init (void) +@@ -13030,6 +13148,10 @@ bgp_route_init (void) install_element (BGP_IPV4_NODE, &bgp_damp_unset_cmd); install_element (BGP_IPV4_NODE, &bgp_damp_unset2_cmd); diff --git a/patches/161-pgbgp-addon.patch b/patches/161-pgbgp-addon.patch index 817cdb0..5bcd907 100644 --- a/patches/161-pgbgp-addon.patch +++ b/patches/161-pgbgp-addon.patch @@ -204,7 +204,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 return 0; --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c -@@ -5581,20 +5581,6 @@ enum bgp_display_type +@@ -5597,20 +5597,6 @@ enum bgp_display_type static void route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo) { @@ -225,7 +225,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 /* Route status display. */ if (CHECK_FLAG (binfo->flags, BGP_INFO_REMOVED)) vty_out (vty, "R"); -@@ -5610,6 +5596,17 @@ route_vty_short_status_out (struct vty * +@@ -5626,6 +5612,17 @@ route_vty_short_status_out (struct vty * /* Selected */ if (CHECK_FLAG (binfo->flags, BGP_INFO_HISTORY)) vty_out (vty, "h"); @@ -243,7 +243,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 else if (CHECK_FLAG (binfo->flags, BGP_INFO_DAMPED)) vty_out (vty, "d"); else if (CHECK_FLAG (binfo->flags, BGP_INFO_SELECTED)) -@@ -6088,7 +6085,22 @@ route_vty_out_detail (struct vty *vty, s +@@ -6104,7 +6101,22 @@ route_vty_out_detail (struct vty *vty, s if (binfo->extra && binfo->extra->damp_info) bgp_damp_info_vty (vty, binfo); @@ -267,7 +267,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 #ifdef HAVE_CLOCK_MONOTONIC tbuf = time(NULL) - (bgp_clock() - binfo->uptime); vty_out (vty, " Last update: %s", ctime(&tbuf)); -@@ -6099,8 +6111,9 @@ route_vty_out_detail (struct vty *vty, s +@@ -6115,8 +6127,9 @@ route_vty_out_detail (struct vty *vty, s vty_out (vty, "%s", VTY_NEWLINE); } @@ -279,7 +279,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s" #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s" #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s" -@@ -6309,8 +6322,7 @@ bgp_show_table (struct vty *vty, struct +@@ -6325,8 +6338,7 @@ bgp_show_table (struct vty *vty, struct if (header) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id), VTY_NEWLINE); @@ -289,7 +289,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); if (type == bgp_show_type_dampend_paths || type == bgp_show_type_damp_neighbor) -@@ -9842,7 +9854,7 @@ show_adj_route (struct vty *vty, struct +@@ -9858,7 +9870,7 @@ show_adj_route (struct vty *vty, struct PEER_STATUS_DEFAULT_ORIGINATE)) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); @@ -298,7 +298,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); vty_out (vty, "Originating default network 0.0.0.0%s%s", -@@ -9859,7 +9871,7 @@ show_adj_route (struct vty *vty, struct +@@ -9875,7 +9887,7 @@ show_adj_route (struct vty *vty, struct if (header1) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); @@ -307,7 +307,7 @@ X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6 vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); header1 = 0; } -@@ -9883,7 +9895,7 @@ show_adj_route (struct vty *vty, struct +@@ -9899,7 +9911,7 @@ show_adj_route (struct vty *vty, struct if (header1) { vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); From 6096ee74b2a80bf4409a0c86e358b4664dc8908d Mon Sep 17 00:00:00 2001 From: acinonyx Date: Sat, 14 Jul 2012 12:59:27 +0000 Subject: [PATCH 106/117] [packages] quagga: babeld depends on IPv6 support git-svn-id: svn+ssh://svn.openwrt.org/openwrt@32707 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7a7ad12..9474a9e 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga PKG_VERSION:=0.99.21 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_MD5SUM:=99840adbe57047c90dfba6b6ed9aec7f PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz @@ -119,7 +119,7 @@ endef define Package/quagga-babeld $(call Package/quagga/Default) - DEPENDS+=+quagga-libzebra + DEPENDS+=+quagga-libzebra @IPV6 TITLE:=Babel routing engine endef From 15e66113f87f3fb0927f9418828dd54958100dd1 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 4 Aug 2012 17:02:17 +0000 Subject: [PATCH 107/117] [packages] ndppd libc++ fix git-svn-id: svn://svn.openwrt.org/openwrt/packages/ipv6/ndppd@32985 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 7d37384..8ffcacb 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ndppd PKG_VERSION:=0.2.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz @@ -22,6 +22,7 @@ PKG_MD5SUM:=d90c4b65777a62274c1837dba341e5a8 #PKG_SOURCE_VERSION=master #PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION) +include $(INCLUDE_DIR)/uclibc++.mk include $(INCLUDE_DIR)/package.mk define Package/ndppd @@ -30,7 +31,7 @@ define Package/ndppd TITLE:=NDP Proxy Daemon URL:=http://www.priv.nu/projects/ndppd/ MAINTAINER:=Gabriel Kerneis - DEPENDS:=+kmod-ipv6 +uclibcxx + DEPENDS:=+kmod-ipv6 $(CXX_DEPENDS) endef define Package/ndppd/description @@ -51,11 +52,9 @@ endef define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR) \ CXX="$(TARGET_CXX)" \ - CXXFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CXXFLAGS) $(TARGET_CFLAGS) \ - -std=c++0x -fno-builtin -fno-rtti -nostdinc++ \ - -I$(STAGING_DIR)/usr/include/uClibc++" \ + CXXFLAGS="$(TARGET_CXXFLAGS) -std=c++0x -fno-rtti" \ LDFLAGS="$(TARGET_LDFLAGS)" \ - LIBS="-nodefaultlibs -lc -luClibc++ $(LIBGCC_S)" \ + LIBS="-lc" \ ndppd endef From 4d4f6b899cb3314c99f3c16f1426efd1dc2f7004 Mon Sep 17 00:00:00 2001 From: acinonyx Date: Sun, 18 Nov 2012 12:14:32 +0000 Subject: [PATCH 108/117] [packages] quagga: Fix package download URL (#12425) git-svn-id: svn+ssh://svn.openwrt.org/openwrt@34241 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9474a9e..4256ca1 100644 --- a/Makefile +++ b/Makefile @@ -9,13 +9,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga PKG_VERSION:=0.99.21 -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_MD5SUM:=99840adbe57047c90dfba6b6ed9aec7f PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://www.quagga.net/download/ \ - http://www.de.quagga.net/download/ \ - http://www.uk.quagga.net/download/ +PKG_SOURCE_URL:=http://download.savannah.gnu.org/releases/quagga/ PKG_CONFIG_DEPENDS:= \ CONFIG_IPV6 \ CONFIG_PACKAGE_quagga-watchquagga \ From 95b7ebc00a188cd0177df351dbbde78668c85f52 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 14 May 2013 15:02:57 +0000 Subject: [PATCH 109/117] packages: fold the IPv6 menu into Network Signed-off-by: Felix Fietkau git-svn-id: svn://svn.openwrt.org/openwrt/packages/ipv6/ndppd@36635 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8ffcacb..b7c3282 100644 --- a/Makefile +++ b/Makefile @@ -26,8 +26,8 @@ include $(INCLUDE_DIR)/uclibc++.mk include $(INCLUDE_DIR)/package.mk define Package/ndppd - SECTION:=ipv6 - CATEGORY:=IPv6 + SECTION:=net + CATEGORY:=Network TITLE:=NDP Proxy Daemon URL:=http://www.priv.nu/projects/ndppd/ MAINTAINER:=Gabriel Kerneis From 4b340f797466be6c3930864e80e312799ccbc37f Mon Sep 17 00:00:00 2001 From: acinonyx Date: Sat, 25 May 2013 17:05:33 +0000 Subject: [PATCH 110/117] [quagga] Update to v0.99.22 git-svn-id: svn+ssh://svn.openwrt.org/openwrt@36717 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 6 +- patches/001-bgpd-fix-args-consolidation.patch | 11 - patches/002-fix-metric-output.patch | 58 - ...-bgpd-fix-route-map-match-peer-local.patch | 20 - patches/004-fix-sockunion-memleaks.patch | 539 --- patches/005-zebra-connected-in-mrib.patch | 21 - patches/006-fix-no-ipv6.patch | 127 - .../007-drop-heuristic-ipv6-recognition.patch | 90 - patches/008-fix-thread_cancel_event.patch | 27 - ...9-bgpd-fix-vpn4-soft-reconfiguration.patch | 89 - .../010-bgpd-fix-struct-attr_extra-leak.patch | 17 - patches/011-isisd-fix-typo.patch | 11 - patches/110-fix_ipctl_forwarding.patch | 25 - patches/120-quagga_manet.patch | 16 +- patches/130-fix_cpp.patch | 11 - patches/140-holdtimer-set.patch | 2 +- patches/150-no-cross-fs-link.patch | 4 +- patches/160-pgbgp.patch | 3104 ----------------- patches/161-pgbgp-addon.patch | 318 -- patches/170-use-supported-pagers.patch | 6 +- 20 files changed, 17 insertions(+), 4485 deletions(-) delete mode 100644 patches/001-bgpd-fix-args-consolidation.patch delete mode 100644 patches/002-fix-metric-output.patch delete mode 100644 patches/003-bgpd-fix-route-map-match-peer-local.patch delete mode 100644 patches/004-fix-sockunion-memleaks.patch delete mode 100644 patches/005-zebra-connected-in-mrib.patch delete mode 100644 patches/006-fix-no-ipv6.patch delete mode 100644 patches/007-drop-heuristic-ipv6-recognition.patch delete mode 100644 patches/008-fix-thread_cancel_event.patch delete mode 100644 patches/009-bgpd-fix-vpn4-soft-reconfiguration.patch delete mode 100644 patches/010-bgpd-fix-struct-attr_extra-leak.patch delete mode 100644 patches/011-isisd-fix-typo.patch delete mode 100644 patches/110-fix_ipctl_forwarding.patch delete mode 100644 patches/130-fix_cpp.patch delete mode 100644 patches/160-pgbgp.patch delete mode 100644 patches/161-pgbgp-addon.patch diff --git a/Makefile b/Makefile index 4256ca1..fac45c2 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2012 OpenWrt.org +# Copyright (C) 2006-2013 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quagga -PKG_VERSION:=0.99.21 +PKG_VERSION:=0.99.22 PKG_RELEASE:=6 -PKG_MD5SUM:=99840adbe57047c90dfba6b6ed9aec7f +PKG_MD5SUM:=3057bf3a91116a1017dd0df7e5e8ef93 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://download.savannah.gnu.org/releases/quagga/ diff --git a/patches/001-bgpd-fix-args-consolidation.patch b/patches/001-bgpd-fix-args-consolidation.patch deleted file mode 100644 index 30de1b5..0000000 --- a/patches/001-bgpd-fix-args-consolidation.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/bgpd/bgp_attr.c -+++ b/bgpd/bgp_attr.c -@@ -1646,7 +1646,7 @@ bgp_attr_ext_communities (struct bgp_att - static bgp_attr_parse_ret_t - bgp_attr_unknown (struct bgp_attr_parser_args *args) - { -- bgp_size_t total; -+ bgp_size_t total = args->total; - struct transit *transit; - struct attr_extra *attre; - struct peer *const peer = args->peer; diff --git a/patches/002-fix-metric-output.patch b/patches/002-fix-metric-output.patch deleted file mode 100644 index a92fc19..0000000 --- a/patches/002-fix-metric-output.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/bgpd/bgp_debug.c -+++ b/bgpd/bgp_debug.c -@@ -194,11 +194,11 @@ bgp_dump_attr (struct peer *peer, struct - #endif /* HAVE_IPV6 */ - - if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF))) -- snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %d", -+ snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %u", - attr->local_pref); - - if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC))) -- snprintf (buf + strlen (buf), size - strlen (buf), ", metric %d", -+ snprintf (buf + strlen (buf), size - strlen (buf), ", metric %u", - attr->med); - - if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES))) ---- a/bgpd/bgp_route.c -+++ b/bgpd/bgp_route.c -@@ -5954,7 +5954,7 @@ route_vty_out_detail (struct vty *vty, s - if (! CHECK_FLAG (binfo->flags, BGP_INFO_VALID)) - vty_out (vty, " (inaccessible)"); - else if (binfo->extra && binfo->extra->igpmetric) -- vty_out (vty, " (metric %d)", binfo->extra->igpmetric); -+ vty_out (vty, " (metric %u)", binfo->extra->igpmetric); - vty_out (vty, " from %s", sockunion2str (&binfo->peer->su, buf, SU_ADDRSTRLEN)); - if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)) - vty_out (vty, " (%s)", inet_ntoa (attr->extra->originator_id)); ---- a/bgpd/bgp_vty.c -+++ b/bgpd/bgp_vty.c -@@ -8966,7 +8966,7 @@ bgp_config_write_redistribute (struct vt - vty_out (vty, " redistribute %s", zebra_route_string(i)); - - if (bgp->redist_metric_flag[afi][i]) -- vty_out (vty, " metric %d", bgp->redist_metric[afi][i]); -+ vty_out (vty, " metric %u", bgp->redist_metric[afi][i]); - - if (bgp->rmap[afi][i].name) - vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); ---- a/zebra/zebra_vty.c -+++ b/zebra/zebra_vty.c -@@ -541,7 +541,7 @@ vty_show_ip_route_detail (struct vty *vt - inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, - VTY_NEWLINE); - vty_out (vty, " Known via \"%s\"", zebra_route_string (rib->type)); -- vty_out (vty, ", distance %d, metric %d", rib->distance, rib->metric); -+ vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric); - if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) - vty_out (vty, ", best"); - if (rib->refcnt) -@@ -1519,7 +1519,7 @@ vty_show_ipv6_route_detail (struct vty * - rn->p.prefixlen, - VTY_NEWLINE); - vty_out (vty, " Known via \"%s\"", zebra_route_string (rib->type)); -- vty_out (vty, ", distance %d, metric %d", rib->distance, rib->metric); -+ vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric); - if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) - vty_out (vty, ", best"); - if (rib->refcnt) diff --git a/patches/003-bgpd-fix-route-map-match-peer-local.patch b/patches/003-bgpd-fix-route-map-match-peer-local.patch deleted file mode 100644 index 597ab73..0000000 --- a/patches/003-bgpd-fix-route-map-match-peer-local.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/bgpd/bgp_routemap.c -+++ b/bgpd/bgp_routemap.c -@@ -172,7 +172,7 @@ route_match_peer_compile (const char *ar - - su = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (union sockunion)); - -- ret = str2sockunion ( (arg)? arg : "0.0.0.0", su); -+ ret = str2sockunion (strcmp(arg, "local") ? arg : "0.0.0.0", su); - if (ret < 0) { - XFREE (MTYPE_ROUTE_MAP_COMPILED, su); - return NULL; -@@ -2430,7 +2430,7 @@ DEFUN (match_peer_local, - "Match peer address\n" - "Static or Redistributed routes\n") - { -- return bgp_route_match_add (vty, vty->index, "peer", NULL); -+ return bgp_route_match_add (vty, vty->index, "peer", "local"); - } - - DEFUN (no_match_peer, diff --git a/patches/004-fix-sockunion-memleaks.patch b/patches/004-fix-sockunion-memleaks.patch deleted file mode 100644 index 92f0dfc..0000000 --- a/patches/004-fix-sockunion-memleaks.patch +++ /dev/null @@ -1,539 +0,0 @@ ---- a/bgpd/bgp_routemap.c -+++ b/bgpd/bgp_routemap.c -@@ -111,7 +111,8 @@ route_match_peer (void *rule, struct pre - void *object) - { - union sockunion *su; -- union sockunion *su2; -+ union sockunion su_def = { .sa.sa_family = AF_INET, -+ .sin.sin_addr.s_addr = INADDR_ANY }; - struct peer_group *group; - struct peer *peer; - struct listnode *node, *nnode; -@@ -127,8 +128,7 @@ route_match_peer (void *rule, struct pre - - /* If su='0.0.0.0' (command 'match peer local'), and it's a NETWORK, - REDISTRIBUTE or DEFAULT_GENERATED route => return RMAP_MATCH */ -- su2 = sockunion_str2su ("0.0.0.0"); -- if ( sockunion_same (su, su2) ) -+ if (sockunion_same (su, &su_def)) - { - int ret; - if ( CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_NETWORK) || -@@ -137,12 +137,9 @@ route_match_peer (void *rule, struct pre - ret = RMAP_MATCH; - else - ret = RMAP_NOMATCH; -- -- sockunion_free (su2); - return ret; - } -- sockunion_free (su2); -- -+ - if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) - { - if (sockunion_same (su, &peer->su)) -@@ -878,7 +875,6 @@ route_set_ip_nexthop (void *rule, struct - route_map_object_t type, void *object) - { - struct rmap_ip_nexthop_set *rins = rule; -- struct in_addr peer_address; - struct bgp_info *bgp_info; - struct peer *peer; - -@@ -894,16 +890,14 @@ route_set_ip_nexthop (void *rule, struct - && peer->su_remote - && sockunion_family (peer->su_remote) == AF_INET) - { -- inet_aton (sockunion_su2str (peer->su_remote), &peer_address); -- bgp_info->attr->nexthop = peer_address; -+ bgp_info->attr->nexthop.s_addr = sockunion2ip (peer->su_remote); - bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP); - } - else if (CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_OUT) - && peer->su_local - && sockunion_family (peer->su_local) == AF_INET) - { -- inet_aton (sockunion_su2str (peer->su_local), &peer_address); -- bgp_info->attr->nexthop = peer_address; -+ bgp_info->attr->nexthop.s_addr = sockunion2ip (peer->su_local); - bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP); - } - } ---- a/lib/sockunion.h -+++ b/lib/sockunion.h -@@ -78,23 +78,17 @@ enum connect_result - #define SET_IN6_LINKLOCAL_IFINDEX(a, i) - #endif /* KAME */ - --/* shortcut macro to specify address field of struct sockaddr */ --#define sock2ip(X) (((struct sockaddr_in *)(X))->sin_addr.s_addr) --#ifdef HAVE_IPV6 --#define sock2ip6(X) (((struct sockaddr_in6 *)(X))->sin6_addr.s6_addr) --#endif /* HAVE_IPV6 */ -- - #define sockunion_family(X) (X)->sa.sa_family - -+#define sockunion2ip(X) (X)->sin.sin_addr.s_addr -+ - /* Prototypes. */ - extern int str2sockunion (const char *, union sockunion *); - extern const char *sockunion2str (union sockunion *, char *, size_t); - extern int sockunion_cmp (union sockunion *, union sockunion *); - extern int sockunion_same (union sockunion *, union sockunion *); - --extern char *sockunion_su2str (union sockunion *su); - extern union sockunion *sockunion_str2su (const char *str); --extern struct in_addr sockunion_get_in_addr (union sockunion *su); - extern int sockunion_accept (int sock, union sockunion *); - extern int sockunion_stream_socket (union sockunion *); - extern int sockopt_reuseaddr (int); ---- a/bgpd/bgp_fsm.c -+++ b/bgpd/bgp_fsm.c -@@ -597,8 +597,6 @@ bgp_stop_with_error (struct peer *peer) - static int - bgp_connect_success (struct peer *peer) - { -- char buf1[BUFSIZ]; -- - if (peer->fd < 0) - { - zlog_err ("bgp_connect_success peer's fd is negative value %d", -@@ -612,6 +610,8 @@ bgp_connect_success (struct peer *peer) - - if (BGP_DEBUG (normal, NORMAL)) - { -+ char buf1[SU_ADDRSTRLEN]; -+ - if (! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER)) - zlog_debug ("%s open active, local address %s", peer->host, - sockunion2str (peer->su_local, buf1, SU_ADDRSTRLEN)); ---- a/bgpd/bgp_mplsvpn.c -+++ b/bgpd/bgp_mplsvpn.c -@@ -581,24 +581,25 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_ro - "Neighbor to display information about\n" - "Display routes learned from neighbor\n") - { -- union sockunion *su; -+ union sockunion su; - struct peer *peer; -- -- su = sockunion_str2su (argv[0]); -- if (su == NULL) -+ int ret; -+ -+ ret = str2sockunion (argv[0], &su); -+ if (ret < 0) - { - vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); -- return CMD_WARNING; -+ return CMD_WARNING; - } - -- peer = peer_lookup (NULL, su); -+ peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - -- return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_neighbor, su, 0); -+ return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_neighbor, &su, 0); - } - - DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, -@@ -615,7 +616,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_rou - "Display routes learned from neighbor\n") - { - int ret; -- union sockunion *su; -+ union sockunion su; - struct peer *peer; - struct prefix_rd prd; - -@@ -626,21 +627,21 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_rou - return CMD_WARNING; - } - -- su = sockunion_str2su (argv[1]); -- if (su == NULL) -+ ret = str2sockunion (argv[1], &su); -+ if (ret < 0) - { - vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); -- return CMD_WARNING; -+ return CMD_WARNING; - } - -- peer = peer_lookup (NULL, su); -+ peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - -- return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_neighbor, su, 0); -+ return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_neighbor, &su, 0); - } - - DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, ---- a/bgpd/bgp_network.c -+++ b/bgpd/bgp_network.c -@@ -185,7 +185,7 @@ bgp_accept (struct thread *thread) - zlog_debug ("[Event] Make dummy peer structure until read Open packet"); - - { -- char buf[SU_ADDRSTRLEN + 1]; -+ char buf[SU_ADDRSTRLEN]; - - peer = peer_create_accept (peer1->bgp); - SET_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER); ---- a/bgpd/bgp_route.c -+++ b/bgpd/bgp_route.c -@@ -10202,15 +10202,18 @@ DEFUN (show_ip_bgp_neighbor_received_pre - "Display the prefixlist filter\n") - { - char name[BUFSIZ]; -- union sockunion *su; -+ union sockunion su; - struct peer *peer; -- int count; -+ int count, ret; - -- su = sockunion_str2su (argv[0]); -- if (su == NULL) -- return CMD_WARNING; -+ ret = str2sockunion (argv[0], &su); -+ if (ret < 0) -+ { -+ vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); -+ return CMD_WARNING; -+ } - -- peer = peer_lookup (NULL, su); -+ peer = peer_lookup (NULL, &su); - if (! peer) - return CMD_WARNING; - -@@ -10241,15 +10244,18 @@ DEFUN (show_ip_bgp_ipv4_neighbor_receive - "Display the prefixlist filter\n") - { - char name[BUFSIZ]; -- union sockunion *su; -+ union sockunion su; - struct peer *peer; -- int count; -+ int count, ret; - -- su = sockunion_str2su (argv[1]); -- if (su == NULL) -- return CMD_WARNING; -+ ret = str2sockunion (argv[1], &su); -+ if (ret < 0) -+ { -+ vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE); -+ return CMD_WARNING; -+ } - -- peer = peer_lookup (NULL, su); -+ peer = peer_lookup (NULL, &su); - if (! peer) - return CMD_WARNING; - -@@ -10312,15 +10318,18 @@ DEFUN (show_bgp_neighbor_received_prefix - "Display the prefixlist filter\n") - { - char name[BUFSIZ]; -- union sockunion *su; -+ union sockunion su; - struct peer *peer; -- int count; -+ int count, ret; - -- su = sockunion_str2su (argv[0]); -- if (su == NULL) -- return CMD_WARNING; -+ ret = str2sockunion (argv[0], &su); -+ if (ret < 0) -+ { -+ vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); -+ return CMD_WARNING; -+ } - -- peer = peer_lookup (NULL, su); -+ peer = peer_lookup (NULL, &su); - if (! peer) - return CMD_WARNING; - -@@ -10394,10 +10403,10 @@ DEFUN (show_bgp_view_neighbor_received_p - "Display the prefixlist filter\n") - { - char name[BUFSIZ]; -- union sockunion *su; -+ union sockunion su; - struct peer *peer; - struct bgp *bgp; -- int count; -+ int count, ret; - - /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[0]); -@@ -10407,11 +10416,14 @@ DEFUN (show_bgp_view_neighbor_received_p - return CMD_WARNING; - } - -- su = sockunion_str2su (argv[1]); -- if (su == NULL) -- return CMD_WARNING; -+ ret = str2sockunion (argv[1], &su); -+ if (ret < 0) -+ { -+ vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE); -+ return CMD_WARNING; -+ } - -- peer = peer_lookup (bgp, su); -+ peer = peer_lookup (bgp, &su); - if (! peer) - return CMD_WARNING; - ---- a/bgpd/bgp_vty.c -+++ b/bgpd/bgp_vty.c -@@ -2943,7 +2943,6 @@ peer_update_source_vty (struct vty *vty, - const char *source_str) - { - struct peer *peer; -- union sockunion *su; - - peer = peer_and_group_lookup_vty (vty, peer_str); - if (! peer) -@@ -2951,12 +2950,11 @@ peer_update_source_vty (struct vty *vty, - - if (source_str) - { -- su = sockunion_str2su (source_str); -- if (su) -- { -- peer_update_source_addr_set (peer, su); -- sockunion_free (su); -- } -+ union sockunion su; -+ int ret = str2sockunion (source_str, &su); -+ -+ if (ret == 0) -+ peer_update_source_addr_set (peer, &su); - else - peer_update_source_if_set (peer, source_str); - } ---- a/lib/sockunion.c -+++ b/lib/sockunion.c -@@ -177,55 +177,15 @@ sockunion2str (union sockunion *su, char - union sockunion * - sockunion_str2su (const char *str) - { -- int ret; -- union sockunion *su; -- -- su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion)); -- -- ret = inet_pton (AF_INET, str, &su->sin.sin_addr); -- if (ret > 0) /* Valid IPv4 address format. */ -- { -- su->sin.sin_family = AF_INET; --#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN -- su->sin.sin_len = sizeof(struct sockaddr_in); --#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ -- return su; -- } --#ifdef HAVE_IPV6 -- ret = inet_pton (AF_INET6, str, &su->sin6.sin6_addr); -- if (ret > 0) /* Valid IPv6 address format. */ -- { -- su->sin6.sin6_family = AF_INET6; --#ifdef SIN6_LEN -- su->sin6.sin6_len = sizeof(struct sockaddr_in6); --#endif /* SIN6_LEN */ -- return su; -- } --#endif /* HAVE_IPV6 */ -- -+ union sockunion *su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion)); -+ -+ if (!str2sockunion (str, su)) -+ return su; -+ - XFREE (MTYPE_SOCKUNION, su); - return NULL; - } - --char * --sockunion_su2str (union sockunion *su) --{ -- char str[SU_ADDRSTRLEN]; -- -- switch (su->sa.sa_family) -- { -- case AF_INET: -- inet_ntop (AF_INET, &su->sin.sin_addr, str, sizeof (str)); -- break; --#ifdef HAVE_IPV6 -- case AF_INET6: -- inet_ntop (AF_INET6, &su->sin6.sin6_addr, str, sizeof (str)); -- break; --#endif /* HAVE_IPV6 */ -- } -- return XSTRDUP (MTYPE_TMP, str); --} -- - /* Convert IPv4 compatible IPv6 address to IPv4 address. */ - static void - sockunion_normalise_mapped (union sockunion *su) -@@ -422,7 +382,7 @@ sockunion_bind (int sock, union sockunio - su->sin.sin_len = size; - #endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ - if (su_addr == NULL) -- su->sin.sin_addr.s_addr = htonl (INADDR_ANY); -+ sockunion2ip (su) = htonl (INADDR_ANY); - } - #ifdef HAVE_IPV6 - else if (su->sa.sa_family == AF_INET6) -@@ -779,9 +739,9 @@ sockunion_cmp (union sockunion *su1, uni - - if (su1->sa.sa_family == AF_INET) - { -- if (ntohl (su1->sin.sin_addr.s_addr) == ntohl (su2->sin.sin_addr.s_addr)) -+ if (ntohl (sockunion2ip (su1)) == ntohl (sockunion2ip (su2))) - return 0; -- if (ntohl (su1->sin.sin_addr.s_addr) > ntohl (su2->sin.sin_addr.s_addr)) -+ if (ntohl (sockunion2ip (su1)) > ntohl (sockunion2ip (su2))) - return 1; - else - return -1; ---- a/lib/vty.c -+++ b/lib/vty.c -@@ -1612,13 +1612,16 @@ vty_flush (struct thread *thread) - static struct vty * - vty_create (int vty_sock, union sockunion *su) - { -+ char buf[SU_ADDRSTRLEN]; - struct vty *vty; - -+ sockunion2str(su, buf, SU_ADDRSTRLEN); -+ - /* Allocate new vty structure and set up default values. */ - vty = vty_new (); - vty->fd = vty_sock; - vty->type = VTY_TERM; -- vty->address = sockunion_su2str (su); -+ strcpy (vty->address, buf); - if (no_password_check) - { - if (restricted_mode) -@@ -1693,7 +1696,7 @@ vty_accept (struct thread *thread) - int accept_sock; - struct prefix *p = NULL; - struct access_list *acl = NULL; -- char *bufp; -+ char buf[SU_ADDRSTRLEN]; - - accept_sock = THREAD_FD (thread); - -@@ -1719,10 +1722,8 @@ vty_accept (struct thread *thread) - if ((acl = access_list_lookup (AFI_IP, vty_accesslist_name)) && - (access_list_apply (acl, p) == FILTER_DENY)) - { -- char *buf; - zlog (NULL, LOG_INFO, "Vty connection refused from %s", -- (buf = sockunion_su2str (&su))); -- free (buf); -+ sockunion2str (&su, buf, SU_ADDRSTRLEN)); - close (vty_sock); - - /* continue accepting connections */ -@@ -1741,10 +1742,8 @@ vty_accept (struct thread *thread) - if ((acl = access_list_lookup (AFI_IP6, vty_ipv6_accesslist_name)) && - (access_list_apply (acl, p) == FILTER_DENY)) - { -- char *buf; - zlog (NULL, LOG_INFO, "Vty connection refused from %s", -- (buf = sockunion_su2str (&su))); -- free (buf); -+ sockunion2str (&su, buf, SU_ADDRSTRLEN)); - close (vty_sock); - - /* continue accepting connections */ -@@ -1767,9 +1766,7 @@ vty_accept (struct thread *thread) - safe_strerror (errno)); - - zlog (NULL, LOG_INFO, "Vty connection from %s", -- (bufp = sockunion_su2str (&su))); -- if (bufp) -- XFREE (MTYPE_TMP, bufp); -+ sockunion2str (&su, buf, SU_ADDRSTRLEN)); - - vty_create (vty_sock, &su); - -@@ -2193,8 +2190,6 @@ vty_close (struct vty *vty) - if (vty->fd > 0) - close (vty->fd); - -- if (vty->address) -- XFREE (MTYPE_TMP, vty->address); - if (vty->buf) - XFREE (MTYPE_VTY, vty->buf); - ---- a/lib/vty.h -+++ b/lib/vty.h -@@ -23,6 +23,7 @@ Software Foundation, Inc., 59 Temple Pla - - #include "thread.h" - #include "log.h" -+#include "sockunion.h" - - #define VTY_BUFSIZ 512 - #define VTY_MAXHIST 20 -@@ -39,9 +40,6 @@ struct vty - /* Node status of this vty */ - int node; - -- /* What address is this vty comming from. */ -- char *address; -- - /* Failure count */ - int fail; - -@@ -118,6 +116,9 @@ struct vty - /* Timeout seconds and thread. */ - unsigned long v_timeout; - struct thread *t_timeout; -+ -+ /* What address is this vty comming from. */ -+ char address[SU_ADDRSTRLEN]; - }; - - /* Integrated configuration file. */ ---- a/zebra/zebra_rib.c -+++ b/zebra/zebra_rib.c -@@ -678,8 +678,8 @@ rib_lookup_ipv4_route (struct prefix_ipv - if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) - { - /* We are happy with either direct or recursive hexthop */ -- if (nexthop->gate.ipv4.s_addr == qgate->sin.sin_addr.s_addr || -- nexthop->rgate.ipv4.s_addr == qgate->sin.sin_addr.s_addr) -+ if (nexthop->gate.ipv4.s_addr == sockunion2ip (qgate) || -+ nexthop->rgate.ipv4.s_addr == sockunion2ip (qgate)) - return ZEBRA_RIB_FOUND_EXACT; - else - { -@@ -688,7 +688,7 @@ rib_lookup_ipv4_route (struct prefix_ipv - char gate_buf[INET_ADDRSTRLEN], rgate_buf[INET_ADDRSTRLEN], qgate_buf[INET_ADDRSTRLEN]; - inet_ntop (AF_INET, &nexthop->gate.ipv4.s_addr, gate_buf, INET_ADDRSTRLEN); - inet_ntop (AF_INET, &nexthop->rgate.ipv4.s_addr, rgate_buf, INET_ADDRSTRLEN); -- inet_ntop (AF_INET, &qgate->sin.sin_addr.s_addr, qgate_buf, INET_ADDRSTRLEN); -+ inet_ntop (AF_INET, &sockunion2ip (qgate), qgate_buf, INET_ADDRSTRLEN); - zlog_debug ("%s: qgate == %s, gate == %s, rgate == %s", __func__, qgate_buf, gate_buf, rgate_buf); - } - return ZEBRA_RIB_FOUND_NOGATE; diff --git a/patches/005-zebra-connected-in-mrib.patch b/patches/005-zebra-connected-in-mrib.patch deleted file mode 100644 index 6d0a868..0000000 --- a/patches/005-zebra-connected-in-mrib.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/zebra/connected.c -+++ b/zebra/connected.c -@@ -191,6 +191,9 @@ connected_up_ipv4 (struct interface *ifp - rib_add_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, NULL, ifp->ifindex, - RT_TABLE_MAIN, ifp->metric, 0, SAFI_UNICAST); - -+ rib_add_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, NULL, ifp->ifindex, -+ RT_TABLE_MAIN, ifp->metric, 0, SAFI_MULTICAST); -+ - rib_update (); - } - -@@ -297,6 +300,8 @@ connected_down_ipv4 (struct interface *i - /* Same logic as for connected_up_ipv4(): push the changes into the head. */ - rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0, SAFI_UNICAST); - -+ rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0, SAFI_MULTICAST); -+ - rib_update (); - } - diff --git a/patches/006-fix-no-ipv6.patch b/patches/006-fix-no-ipv6.patch deleted file mode 100644 index f39c453..0000000 --- a/patches/006-fix-no-ipv6.patch +++ /dev/null @@ -1,127 +0,0 @@ ---- a/zebra/main.c -+++ b/zebra/main.c -@@ -327,7 +327,9 @@ main (int argc, char **argv) - zebra_vty_init (); - access_list_init (); - prefix_list_init (); -+#ifdef RTADV - rtadv_init (); -+#endif - #ifdef HAVE_IRDP - irdp_init(); - #endif ---- a/zebra/rtadv.h -+++ b/zebra/rtadv.h -@@ -26,6 +26,9 @@ - #include "vty.h" - #include "zebra/interface.h" - -+/* NB: RTADV is defined in zebra/interface.h above */ -+#ifdef RTADV -+ - /* Router advertisement prefix. */ - struct rtadv_prefix - { -@@ -96,4 +99,6 @@ struct nd_opt_homeagent_info { /* Home - - extern const char *rtadv_pref_strs[]; - -+#endif /* RTADV */ -+ - #endif /* _ZEBRA_RTADV_H */ ---- a/zebra/zebra_vty.c -+++ b/zebra/zebra_vty.c -@@ -1197,6 +1197,40 @@ DEFUN (show_ip_protocol, - return CMD_SUCCESS; - } - -+/* -+ * Show IP mroute command to dump the BGP Multicast -+ * routing table -+ */ -+DEFUN (show_ip_mroute, -+ show_ip_mroute_cmd, -+ "show ip mroute", -+ SHOW_STR -+ IP_STR -+ "IP Multicast routing table\n") -+{ -+ struct route_table *table; -+ struct route_node *rn; -+ struct rib *rib; -+ int first = 1; -+ -+ table = vrf_table (AFI_IP, SAFI_MULTICAST, 0); -+ if (! table) -+ return CMD_SUCCESS; -+ -+ /* Show all IPv4 routes. */ -+ for (rn = route_top (table); rn; rn = route_next (rn)) -+ for (rib = rn->info; rib; rib = rib->next) -+ { -+ if (first) -+ { -+ vty_out (vty, SHOW_ROUTE_V4_HEADER); -+ first = 0; -+ } -+ vty_show_ip_route (vty, rn, rib); -+ } -+ return CMD_SUCCESS; -+} -+ - - #ifdef HAVE_IPV6 - /* General fucntion for IPv6 static route. */ -@@ -1952,40 +1986,6 @@ DEFUN (show_ipv6_route_summary, - } - - /* -- * Show IP mroute command to dump the BGP Multicast -- * routing table -- */ --DEFUN (show_ip_mroute, -- show_ip_mroute_cmd, -- "show ip mroute", -- SHOW_STR -- IP_STR -- "IP Multicast routing table\n") --{ -- struct route_table *table; -- struct route_node *rn; -- struct rib *rib; -- int first = 1; -- -- table = vrf_table (AFI_IP, SAFI_MULTICAST, 0); -- if (! table) -- return CMD_SUCCESS; -- -- /* Show all IPv4 routes. */ -- for (rn = route_top (table); rn; rn = route_next (rn)) -- for (rib = rn->info; rib; rib = rib->next) -- { -- if (first) -- { -- vty_out (vty, SHOW_ROUTE_V4_HEADER); -- first = 0; -- } -- vty_show_ip_route (vty, rn, rib); -- } -- return CMD_SUCCESS; --} -- --/* - * Show IPv6 mroute command.Used to dump - * the Multicast routing table. - */ -@@ -2020,11 +2020,6 @@ DEFUN (show_ipv6_mroute, - return CMD_SUCCESS; - } - -- -- -- -- -- - /* Write IPv6 static route configuration. */ - static int - static_config_ipv6 (struct vty *vty) diff --git a/patches/007-drop-heuristic-ipv6-recognition.patch b/patches/007-drop-heuristic-ipv6-recognition.patch deleted file mode 100644 index 1b49d7b..0000000 --- a/patches/007-drop-heuristic-ipv6-recognition.patch +++ /dev/null @@ -1,90 +0,0 @@ ---- a/lib/command.c -+++ b/lib/command.c -@@ -868,86 +868,7 @@ cmd_ipv6_match (const char *str) - if (ret == 1) - return exact_match; - -- while (*str != '\0') -- { -- switch (state) -- { -- case STATE_START: -- if (*str == ':') -- { -- if (*(str + 1) != ':' && *(str + 1) != '\0') -- return no_match; -- colons--; -- state = STATE_COLON; -- } -- else -- { -- sp = str; -- state = STATE_ADDR; -- } -- -- continue; -- case STATE_COLON: -- colons++; -- if (*(str + 1) == ':') -- state = STATE_DOUBLE; -- else -- { -- sp = str + 1; -- state = STATE_ADDR; -- } -- break; -- case STATE_DOUBLE: -- if (double_colon) -- return no_match; -- -- if (*(str + 1) == ':') -- return no_match; -- else -- { -- if (*(str + 1) != '\0') -- colons++; -- sp = str + 1; -- state = STATE_ADDR; -- } -- -- double_colon++; -- nums++; -- break; -- case STATE_ADDR: -- if (*(str + 1) == ':' || *(str + 1) == '\0') -- { -- if (str - sp > 3) -- return no_match; -- -- nums++; -- state = STATE_COLON; -- } -- if (*(str + 1) == '.') -- state = STATE_DOT; -- break; -- case STATE_DOT: -- state = STATE_ADDR; -- break; -- default: -- break; -- } -- -- if (nums > 8) -- return no_match; -- -- if (colons > 7) -- return no_match; -- -- str++; -- } -- --#if 0 -- if (nums < 11) -- return partly_match; --#endif /* 0 */ -- -- return exact_match; -+ return no_match; - } - - static enum match_type diff --git a/patches/008-fix-thread_cancel_event.patch b/patches/008-fix-thread_cancel_event.patch deleted file mode 100644 index 3dcb9f5..0000000 --- a/patches/008-fix-thread_cancel_event.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/lib/thread.c -+++ b/lib/thread.c -@@ -916,6 +916,24 @@ thread_cancel_event (struct thread_maste - thread_add_unuse (m, t); - } - } -+ -+ /* thread can be on the ready list too */ -+ thread = m->ready.head; -+ while (thread) -+ { -+ struct thread *t; -+ -+ t = thread; -+ thread = t->next; -+ -+ if (t->arg == arg) -+ { -+ ret++; -+ thread_list_delete (&m->ready, t); -+ t->type = THREAD_UNUSED; -+ thread_add_unuse (m, t); -+ } -+ } - return ret; - } - diff --git a/patches/009-bgpd-fix-vpn4-soft-reconfiguration.patch b/patches/009-bgpd-fix-vpn4-soft-reconfiguration.patch deleted file mode 100644 index d8efa72..0000000 --- a/patches/009-bgpd-fix-vpn4-soft-reconfiguration.patch +++ /dev/null @@ -1,89 +0,0 @@ ---- a/bgpd/bgp_route.c -+++ b/bgpd/bgp_route.c -@@ -2616,7 +2616,7 @@ bgp_announce_route_all (struct peer *pee - - static void - bgp_soft_reconfig_table_rsclient (struct peer *rsclient, afi_t afi, -- safi_t safi, struct bgp_table *table) -+ safi_t safi, struct bgp_table *table, struct prefix_rd *prd) - { - struct bgp_node *rn; - struct bgp_adj_in *ain; -@@ -2627,8 +2627,11 @@ bgp_soft_reconfig_table_rsclient (struct - for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn)) - for (ain = rn->adj_in; ain; ain = ain->next) - { -+ struct bgp_info *ri = rn->info; -+ - bgp_update_rsclient (rsclient, afi, safi, ain->attr, ain->peer, -- &rn->p, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL, NULL); -+ &rn->p, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, prd, -+ (bgp_info_extra_get (ri))->tag); - } - } - -@@ -2639,18 +2642,25 @@ bgp_soft_reconfig_rsclient (struct peer - struct bgp_node *rn; - - if (safi != SAFI_MPLS_VPN) -- bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, NULL); -+ bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, NULL, NULL); - - else - for (rn = bgp_table_top (rsclient->bgp->rib[afi][safi]); rn; - rn = bgp_route_next (rn)) - if ((table = rn->info) != NULL) -- bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, table); -+ { -+ struct prefix_rd prd; -+ prd.family = AF_UNSPEC; -+ prd.prefixlen = 64; -+ memcpy(&prd.val, rn->p.u.val, 8); -+ -+ bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, table, &prd); -+ } - } - - static void - bgp_soft_reconfig_table (struct peer *peer, afi_t afi, safi_t safi, -- struct bgp_table *table) -+ struct bgp_table *table, struct prefix_rd *prd) - { - int ret; - struct bgp_node *rn; -@@ -2664,9 +2674,12 @@ bgp_soft_reconfig_table (struct peer *pe - { - if (ain->peer == peer) - { -+ struct bgp_info *ri = rn->info; -+ - ret = bgp_update (peer, &rn->p, ain->attr, afi, safi, - ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, -- NULL, NULL, 1); -+ prd, (bgp_info_extra_get (ri))->tag, 1); -+ - if (ret < 0) - { - bgp_unlock_node (rn); -@@ -2687,12 +2700,19 @@ bgp_soft_reconfig_in (struct peer *peer, - return; - - if (safi != SAFI_MPLS_VPN) -- bgp_soft_reconfig_table (peer, afi, safi, NULL); -+ bgp_soft_reconfig_table (peer, afi, safi, NULL, NULL); - else - for (rn = bgp_table_top (peer->bgp->rib[afi][safi]); rn; - rn = bgp_route_next (rn)) - if ((table = rn->info) != NULL) -- bgp_soft_reconfig_table (peer, afi, safi, table); -+ { -+ struct prefix_rd prd; -+ prd.family = AF_UNSPEC; -+ prd.prefixlen = 64; -+ memcpy(&prd.val, rn->p.u.val, 8); -+ -+ bgp_soft_reconfig_table (peer, afi, safi, table, &prd); -+ } - } - - diff --git a/patches/010-bgpd-fix-struct-attr_extra-leak.patch b/patches/010-bgpd-fix-struct-attr_extra-leak.patch deleted file mode 100644 index 8f824bf..0000000 --- a/patches/010-bgpd-fix-struct-attr_extra-leak.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/bgpd/bgp_route.c -+++ b/bgpd/bgp_route.c -@@ -2485,12 +2485,8 @@ bgp_default_originate (struct peer *peer - #ifdef HAVE_IPV6 - else if (afi == AFI_IP6) - { -- struct attr_extra *ae; -- attr.extra = NULL; -- -- ae = bgp_attr_extra_get (&attr); -- attr.extra = ae; -- -+ struct attr_extra *ae = attr.extra; -+ - str2prefix ("::/0", &p); - - /* IPv6 global nexthop must be included. */ diff --git a/patches/011-isisd-fix-typo.patch b/patches/011-isisd-fix-typo.patch deleted file mode 100644 index 142c8af..0000000 --- a/patches/011-isisd-fix-typo.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/isisd/isis_lsp.c -+++ b/isisd/isis_lsp.c -@@ -2413,7 +2413,7 @@ top_lsp_refresh (struct thread *thread) - isis_dynhn_insert (lsp->lsp_header->lsp_id, lsp->tlv_data.hostname, - IS_LEVEL_1); - -- lsp->lsp_header->lsp_bits = lsp_bits_generate (level, -+ lsp->lsp_header->lsp_bits = lsp_bits_generate (lsp->level, - lsp->area->overload_bit); - rem_lifetime = lsp_rem_lifetime (lsp->area, IS_LEVEL_1); - lsp->lsp_header->rem_lifetime = htons (rem_lifetime); diff --git a/patches/110-fix_ipctl_forwarding.patch b/patches/110-fix_ipctl_forwarding.patch deleted file mode 100644 index d757312..0000000 --- a/patches/110-fix_ipctl_forwarding.patch +++ /dev/null @@ -1,25 +0,0 @@ -Add definitions for IPCTL_FORWARDING and IP6CTL_FORWARDING. - -Inspired from -http://svn.gnumonks.org/trunk/grouter/build/src/quagga/quagga/quagga-0.99.1-forward_sysctl-2.6.14.patch - -Signed-off-by: Thomas Petazzoni - ---- a/zebra/ipforward_sysctl.c -+++ b/zebra/ipforward_sysctl.c -@@ -31,6 +31,15 @@ - - #define MIB_SIZ 4 - -+/* Fix for recent (2.6.14) kernel headers */ -+#ifndef IPCTL_FORWARDING -+#define IPCTL_FORWARDING NET_IPV4_FORWARD -+#endif -+ -+#ifndef IP6CTL_FORWARDING -+#define IP6CTL_FORWARDING NET_IPV6_FORWARDING -+#endif -+ - extern struct zebra_privs_t zserv_privs; - - /* IPv4 forwarding control MIB. */ diff --git a/patches/120-quagga_manet.patch b/patches/120-quagga_manet.patch index 99e3cc7..684a27d 100644 --- a/patches/120-quagga_manet.patch +++ b/patches/120-quagga_manet.patch @@ -1,6 +1,6 @@ --- a/lib/log.c +++ b/lib/log.c -@@ -929,13 +929,19 @@ proto_redistnum(int afi, const char *s) +@@ -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; @@ -22,7 +22,7 @@ return ZEBRA_ROUTE_BABEL; } if (afi == AFI_IP6) -@@ -948,13 +954,19 @@ proto_redistnum(int afi, const char *s) +@@ -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; @@ -107,7 +107,7 @@ --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c -@@ -1623,6 +1623,9 @@ netlink_route_multipath (int cmd, struct +@@ -1609,6 +1609,9 @@ netlink_route_multipath (int cmd, struct addattr_l (&req.n, sizeof req, RTA_PREFSRC, &nexthop->src.ipv4, bytelen); @@ -119,7 +119,7 @@ "nexthop via if %u", nexthop->ifindex); --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c -@@ -67,6 +67,9 @@ static const struct +@@ -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. */}, @@ -129,7 +129,7 @@ [ZEBRA_ROUTE_BABEL] = {ZEBRA_ROUTE_BABEL, 95}, /* no entry/default: 150 */ }; -@@ -403,6 +406,18 @@ nexthop_active_ipv4 (struct rib *rib, st +@@ -456,6 +459,18 @@ nexthop_active_ipv4 (struct rib *rib, st } return 0; } @@ -148,7 +148,7 @@ else { return 0; -@@ -507,6 +522,18 @@ nexthop_active_ipv6 (struct rib *rib, st +@@ -560,6 +575,18 @@ nexthop_active_ipv6 (struct rib *rib, st } return 0; } @@ -167,7 +167,7 @@ else { return 0; -@@ -1236,6 +1263,8 @@ static const u_char meta_queue_map[ZEBRA +@@ -1376,6 +1403,8 @@ static const u_char meta_queue_map[ZEBRA [ZEBRA_ROUTE_ISIS] = 2, [ZEBRA_ROUTE_BGP] = 3, [ZEBRA_ROUTE_HSLS] = 4, @@ -178,7 +178,7 @@ --- a/zebra/zebra_snmp.c +++ b/zebra/zebra_snmp.c -@@ -251,6 +251,12 @@ proto_trans(int type) +@@ -245,6 +245,12 @@ proto_trans(int type) return 1; /* shouldn't happen */ case ZEBRA_ROUTE_BGP: return 14; /* bgp */ diff --git a/patches/130-fix_cpp.patch b/patches/130-fix_cpp.patch deleted file mode 100644 index 23991c3..0000000 --- a/patches/130-fix_cpp.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/vtysh/extract.pl.in -+++ b/vtysh/extract.pl.in -@@ -63,7 +63,7 @@ $ignore{'"show history"'} = "ignore"; - foreach (@ARGV) { - $file = $_; - -- open (FH, "cpp -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_srcdir@/isisd/topology @SNMP_INCLUDES@ @CPPFLAGS@ $file |"); -+ open (FH, "@CPP@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_srcdir@/isisd/topology @SNMP_INCLUDES@ @CPPFLAGS@ $file |"); - local $/; undef $/; - $line = ; - close (FH); diff --git a/patches/140-holdtimer-set.patch b/patches/140-holdtimer-set.patch index 6f0d79a..b699775 100644 --- a/patches/140-holdtimer-set.patch +++ b/patches/140-holdtimer-set.patch @@ -12,7 +12,7 @@ sockunion2str (&su, buf, SU_ADDRSTRLEN); --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h -@@ -718,6 +718,7 @@ struct bgp_nlri +@@ -732,6 +732,7 @@ struct bgp_nlri /* BGP timers default value. */ #define BGP_INIT_START_TIMER 5 #define BGP_ERROR_START_TIMER 30 diff --git a/patches/150-no-cross-fs-link.patch b/patches/150-no-cross-fs-link.patch index 2b84031..32c1208 100644 --- a/patches/150-no-cross-fs-link.patch +++ b/patches/150-no-cross-fs-link.patch @@ -1,6 +1,6 @@ --- a/lib/command.c +++ b/lib/command.c -@@ -2522,6 +2522,13 @@ DEFUN (config_write_file, +@@ -2527,6 +2527,13 @@ DEFUN (config_write_file, VTY_NEWLINE); goto finished; } @@ -14,7 +14,7 @@ if (link (config_file, config_file_sav) != 0) { vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav, -@@ -2535,7 +2542,23 @@ DEFUN (config_write_file, +@@ -2540,7 +2547,23 @@ DEFUN (config_write_file, VTY_NEWLINE); goto finished; } diff --git a/patches/160-pgbgp.patch b/patches/160-pgbgp.patch deleted file mode 100644 index a8273ab..0000000 --- a/patches/160-pgbgp.patch +++ /dev/null @@ -1,3104 +0,0 @@ -From: Josh Karlin -Date: Mon, 18 Aug 2008 13:17:21 +0000 (+0100) -Subject: [bgp] Add support for Pretty-Good BGP -X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=c2ee55705cad607f4b86ff143f7af92d538dc946 - -[bgp] Add support for Pretty-Good BGP - -2008-7-7 Josh Karlin - - * bgpd/bgp_pgbgp.c: Added file - * bgpd/bgp_pgbgp.h: Added file - * bgpd/Makefile.am: Added bgp_pgbgp.h and bgp_pgbgp.c - * bgpd/bgp_aspath.h: Externed the hash of as paths (ashash) - * bgpd/bgp_route.c: . Added PGBGP depref check to decision process. - . Informs PGBGP of new updates and selected routes - . Added anomaly status for show ip bgp - . Added PGBGP commands - * bgpd/bgp_route.h: Added suspicious route flags - * bgpd/bgp_table.h: Added PGBGP history pointer to struct bgp_node - * bgpd/bgpd.h: Defined BGP_CONFIG_PGBGP - * lib/hash.c: Added "hash_iterate_until" to be able to break out - * lib/hash.h: Definition for "hash_iterate_until" - * lib/memtypes.c: Added PGBGP memory types ---- - ---- a/bgpd/Makefile.am -+++ b/bgpd/Makefile.am -@@ -15,14 +15,14 @@ libbgp_a_SOURCES = \ - bgp_debug.c bgp_route.c bgp_zebra.c bgp_open.c bgp_routemap.c \ - bgp_packet.c bgp_network.c bgp_filter.c bgp_regex.c bgp_clist.c \ - bgp_dump.c bgp_snmp.c bgp_ecommunity.c bgp_mplsvpn.c bgp_nexthop.c \ -- bgp_damp.c bgp_table.c bgp_advertise.c bgp_vty.c bgp_mpath.c -+ bgp_damp.c bgp_table.c bgp_advertise.c bgp_vty.c bgp_mpath.c bgp_pgbgp.c - - noinst_HEADERS = \ - bgp_aspath.h bgp_attr.h bgp_community.h bgp_debug.h bgp_fsm.h \ - bgp_network.h bgp_open.h bgp_packet.h bgp_regex.h bgp_route.h \ - bgpd.h bgp_filter.h bgp_clist.h bgp_dump.h bgp_zebra.h \ - bgp_ecommunity.h bgp_mplsvpn.h bgp_nexthop.h bgp_damp.h bgp_table.h \ -- bgp_advertise.h bgp_snmp.h bgp_vty.h bgp_mpath.h -+ bgp_advertise.h bgp_snmp.h bgp_vty.h bgp_mpath.h bgp_pgbgp.h - - bgpd_SOURCES = bgp_main.c - bgpd_LDADD = libbgp.a ../lib/libzebra.la @LIBCAP@ @LIBM@ ---- /dev/null -+++ b/bgpd/bgp_pgbgp.c -@@ -0,0 +1,2401 @@ -+/* -+ BGP Pretty Good BGP -+ Copyright (C) 2008 University of New Mexico (Josh Karlin) -+ -+This file is part of GNU Zebra. -+ -+GNU Zebra is free software; you can redistribute it and/or modify it -+under the terms of the GNU General Public License as published by the -+Free Software Foundation; either version 2, or (at your option) any -+later version. -+ -+GNU Zebra is distributed in the hope that it will be useful, but -+WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+General Public License for more details. -+ -+You should have received a copy of the GNU General Public License -+along with GNU Zebra; see the file COPYING. If not, write to the Free -+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -+02111-1307, USA. -+*/ -+ -+/* -+ Quagga based Pretty Good BGP: -+ -+ Summary -+ ------- -+ Pretty Good BGP (PGBGP) is a soft security enhancement to BGP. -+ It uses independently collected (therefore completely distributed) -+ historical routing information to determine network topology and -+ prefix ownership. Abberations to the historical database are considered -+ anomalous and avoided when possible. -+ -+ What PGBGP can protect against: prefix hijacks, sub-prefix hijacks, and -+ spoofed edges. -+ -+ Further reading is available at http://cs.unm.edu/~karlinjf/pgbgp/ -+ -+ Route updates are forwarded to PGBGP, which determines if the route -+ is anomalous. Anomalous routes are flagged as suspicious and -+ avoided where feasible for 24 hours. If the anomalous -+ characteristic is still in the RIB after 24 hours, consider it valid -+ and enter it into the normal database. -+ -+ Cases for anomalous routes -+ -------------------------- -+ case 1) New origin AS - prefix pair (one not recently seen in the RIB): -+ response) label the route with BGP_INFO_SUSPICIOUS_O and avoid for 24 hours if possible -+ -+ case 2) New edge in path (one not recently seen in the RIB): -+ response) label the route with BGP_INFO_SUSPICIOUS_E and avoid for 24 hours -+ if possible -+ -+ case 3) New prefix that is a sub-prefix of a prefix in recent history -+ and that path differs from the current less-specific's path -+ response) label the sub-prefix routes with BGP_INFO_IGNORED_P and -+ prevent it from entering FIB for 24 hours -+ response) label the super-net routes from the same next-hop as BGP_INFO_SUSPICIOUS_P -+ and try to avoid it for 24 hours if possible -+ response) while no super-net route is selected, remove the BGP_INFO_IGNORED_P flags -+ -+ -+ Normal Database (history) -+ ------------------------- -+ Recently Seen) A route characteristic (edge, prefix/origin pair, prefix) -+ that has resided within the RIB within the last X hours -+ where X is user defined for each characteristic. -+ Storage) Prefix and Origin history are stored in bgp_node structs with the -+ "hist" pointer. -+ Edge information is stored in a separate hash table, where the edge -+ is the key to the hash. -+ Updates) The history's primary function is the keep track of when each route -+ characteristic was last seen. For each route announcement, update -+ the history's 'last seen' time. Periodically run the garbage collector -+ which updates 'last seen' times for objects currently in the RIB. -+ -+ Garbage Collection -+ ------------------ -+ Periodically the garbage collector (gc) is called to remove stale history -+ information and update the lastSeen time of objects that reside in the RIB -+ at the time of collection. This is relatively expensive as it walks -+ the RIB as well as the list of AS paths. -+ -+ What is removed) Objects that have not been seen in the RIB within a user-defined -+ time. -+ Suspicious objcets that are 24 hours old that have not been in the RIB -+ since the last collection. -+ -+ Reuse Priority Queue -+ -------------------- -+ After 24 hours, routes that are flagged as suspicious have the flags removed. -+ This is not run on a timer. Instead, for each update that PGBGP is informed of, -+ it checks the reuse queue to determine if any routes need to be updated. -+ -+*/ -+ -+ -+/* -+ Things that must be ensured: -+ . GC updates lastSeen so it must be called at least twice as often as the lowest BUFFER_TIME -+ . GC should be called at least twice per day -+ . Delay times must be shorter than history window lengths -+*/ -+ -+ -+/* -+ Changes made to original PGBGP thinking -+ . Don't check for things in the RIB all of the time, periodically -+ update the lastSeen values and just use lastSeen -+*/ -+ -+/* -+ Changes made to original protocol -+ . sub-prefixes are only ignored while the super-net has a selected -+ route and it's non-anomalous (not to a neighbor that announced -+ the sub-prefix) -+ -+ . At point of reuse, don't delete the item if it's not in the RIB. -+ delete it if it hasn't been in the RIB since the last storage. -+ This saves a lot of processing time for new edges -+ -+ . Changed heuristic from "if new sub-prefix and trusted AS on path -+ then it's okay" to "if new sub-prefix and same path is used to reach -+ super-prefix, then it's okay". Might be better to change to "if old -+ path is prefix of new path, then okay" -+*/ -+ -+#include -+#include -+ -+#include "prefix.h" -+#include "memory.h" -+#include "command.h" -+#include "log.h" -+#include "pqueue.h" -+#include "table.h" -+#include "hash.h" -+#include "str.h" -+ -+#include "bgpd/bgpd.h" -+#include "bgpd/bgp_aspath.h" -+#include "bgpd/bgp_pgbgp.h" -+#include "bgpd/bgp_table.h" -+#include "bgpd/bgp_route.h" -+#include "bgpd/bgp_attr.h" -+#include "bgpd/bgp_advertise.h" -+ -+ -+#define true 1 -+#define false 0 -+ -+struct hash * ashash; -+ -+static void *edge_hash_alloc (void *arg); -+static unsigned int edge_key_make (void *p); -+static int edge_cmp (const void *arg1, const void *args); -+ -+// Helper Functions -+static struct bgp_pgbgp_pathSet bgp_pgbgp_pathOrigin (struct aspath *); -+static int bgp_pgbgp_pathLength (struct aspath *asp); -+static int bgp_pgbgp_gc (struct bgp_table *); -+static int bgp_pgbgp_clean (struct bgp_table *); -+static int bgp_pgbgp_reuse (time_t); -+static struct bgp_node *findSuper (struct bgp_table *table, struct prefix *p, -+ time_t t_now); -+static int bgp_pgbgp_store (struct bgp_table *table); -+static int bgp_pgbgp_restore (void); -+static struct bgp_info *bgp_pgbgp_selected (struct bgp_node *node); -+static int originInRIB (struct bgp_node *node, struct bgp_pgbgp_origin *origin); -+static int prefixInRIB (struct bgp_node *node, struct bgp_pgbgp_prefix *prefix); -+static int edgeInRIB (struct bgp_pgbgp_edge *e); -+ -+// MOAS Functions -+static void bgp_pgbgp_logOriginAnomaly (as_t asn, struct bgp_node *rn, -+ struct attr *); -+static int bgp_pgbgp_reuseOrigin (struct bgp_pgbgp_r_origin); -+static void bgp_pgbgp_cleanHistTable (struct bgp_table *); -+static int bgp_pgbgp_garbageCollectHistTable (struct bgp_table *); -+static void bgp_pgbgp_storeHistTable (struct bgp_table *table, FILE * file); -+static int bgp_pgbgp_updateOrigin (struct bgp_pgbgp_hist *, struct bgp_info *, -+ struct attr *, struct bgp_node *, time_t, int); -+ -+ -+// Sub-Prefix Hijack Detector Functions -+static int bgp_pgbgp_shouldIgnore (struct bgp_node *super, struct bgp_info *selected); -+static void bgp_pgbgp_logSubprefixAnomaly (as_t asn, struct bgp_node *rn, -+ struct attr *, struct bgp_node *super); -+static int bgp_pgbgp_reusePrefix (struct bgp_pgbgp_r_prefix); -+static int bgp_pgbgp_updatePrefix (struct bgp_pgbgp_hist *hist, struct bgp_node *, -+ struct bgp_info *, struct attr *, -+ struct bgp_node *, time_t, int); -+ -+ -+// Spoofed Edge Detector Functions -+static void bgp_pgbgp_cleanEdges (void); -+static void bgp_pgbgp_logEdgeAnomaly (struct bgp_node *rn, struct attr *, -+ struct edge *edge); -+static int bgp_pgbgp_reuseEdge (struct bgp_pgbgp_r_edge); -+static void bgp_pgbgp_storeEdges (struct bgp_table *, FILE *); -+static int bgp_pgbgp_garbageCollectEdges (struct bgp_table *); -+static int bgp_pgbgp_updateEdge (struct bgp_pgbgp_hist *hist, struct bgp_info *, -+ struct attr *, struct bgp_node *, time_t, int); -+static int bgp_pgbgp_restoreEdge (FILE * file); -+static void bgp_pgbgp_storeEdges (struct bgp_table *table, FILE * file); -+ -+ -+ -+// New Peer Detector Functions -+static int bgp_pgbgp_updatePeer (struct bgp_info *binfo, time_t now); -+ -+ -+/* --------------- Global Variables ------------------ */ -+struct bgp_pgbgp_config bgp_pgbgp_cfg; -+struct bgp_pgbgp_config *pgbgp = &bgp_pgbgp_cfg; -+/*! --------------- Global Variables ------------------ !*/ -+ -+/* --------------- VTY (others exist in bgp_route.c) ------------------ */ -+ -+struct nsearch -+{ -+ struct vty *pvty; -+ time_t time; -+ as_t asn; -+}; -+ -+static void -+edge_neighbor_iterator (struct hash_backet *backet, struct nsearch *pns) -+{ -+ struct bgp_pgbgp_edge *hedge = backet->data; -+ if ((hedge->e.a == pns->asn || hedge->e.b == pns->asn) -+ && hedge->e.a != hedge->e.b) -+ { -+ struct vty *vty = pns->pvty; -+ if (hedge->deprefUntil > pns->time) -+ vty_out (pns->pvty, "Untrusted: %d -- %d%s", hedge->e.a, hedge->e.b, -+ VTY_NEWLINE); -+ else -+ vty_out (pns->pvty, "Trusted: %d -- %d%s", hedge->e.a, hedge->e.b, -+ VTY_NEWLINE); -+ } -+} -+ -+static int -+bgp_pgbgp_stats_neighbors (struct vty *vty, afi_t afi, safi_t safi, as_t asn) -+{ -+ struct nsearch ns; -+ ns.pvty = vty; -+ ns.time = time (NULL); -+ ns.asn = asn; -+ -+ hash_iterate (pgbgp->edgeT, -+ (void (*)(struct hash_backet *, void *)) -+ edge_neighbor_iterator, &ns); -+ return CMD_SUCCESS; -+} -+ -+static int -+bgp_pgbgp_stats_origins (struct vty *vty, afi_t afi, safi_t safi, -+ const char *prefix) -+{ -+ struct bgp *bgp; -+ struct bgp_table *table; -+ time_t t_now = time (NULL); -+ bgp = bgp_get_default (); -+ if (bgp == NULL) -+ return CMD_WARNING; -+ if (bgp->rib == NULL) -+ return CMD_WARNING; -+ table = bgp->rib[afi][safi]; -+ if (table == NULL) -+ return CMD_WARNING; -+ -+ struct prefix p; -+ str2prefix (prefix, &p); -+ struct bgp_node *rn = bgp_node_match (table, &p); -+ vty_out (vty, "%s%s", prefix, VTY_NEWLINE); -+ if (rn) -+ { -+ if (rn->hist) -+ { -+ for (struct bgp_pgbgp_origin * cur = rn->hist->o; cur != NULL; -+ cur = cur->next) -+ { -+ if (cur->deprefUntil > t_now) -+ vty_out (vty, "Untrusted Origin AS: %d%s", cur->originAS, -+ VTY_NEWLINE); -+ else -+ vty_out (vty, "Trusted Origin AS: %d%s", cur->originAS, -+ VTY_NEWLINE); -+ } -+ } -+ bgp_unlock_node (rn); -+ } -+ return CMD_SUCCESS; -+} -+ -+static int -+bgp_pgbgp_stats (struct vty *vty, afi_t afi, safi_t safi) -+{ -+ struct bgp *bgp; -+ struct bgp_table *table; -+ -+ -+ bgp = bgp_get_default (); -+ if (bgp == NULL) -+ return CMD_WARNING; -+ if (bgp->rib == NULL) -+ return CMD_WARNING; -+ table = bgp->rib[afi][safi]; -+ if (table == NULL) -+ return CMD_WARNING; -+ -+ // bgp_pgbgp_store(table); -+ -+ // Print out the number of anomalous routes -+ int anomalous = 0; -+ int routes = 0; -+ int num_selected = 0; -+ int num_origin = 0; -+ int num_super = 0; -+ int num_ignored = 0; -+ int num_edge = 0; -+ -+ for (struct bgp_node * rn = bgp_table_top (table); rn; -+ rn = bgp_route_next (rn)) -+ { -+ for (struct bgp_info * ri = rn->info; ri; ri = ri->next) -+ { -+ routes += 1; -+ if (ANOMALOUS (ri->flags)) -+ { -+ anomalous += 1; -+ if (CHECK_FLAG (ri->flags, BGP_INFO_SELECTED)) -+ num_selected += 1; -+ -+ if (CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_O)) -+ num_origin += 1; -+ if (CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_E)) -+ num_edge += 1; -+ if (CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_P)) -+ num_super += 1; -+ if (CHECK_FLAG (ri->flags, BGP_INFO_IGNORED_P)) -+ num_ignored += 1; -+ } -+ } -+ } -+ -+ vty_out (vty, "%-30s: %10d%s", "Routes in the RIB", routes, VTY_NEWLINE); -+ vty_out (vty, "%-30s: %10d%s", "Anomalous routes in RIB", anomalous, -+ VTY_NEWLINE); -+ vty_out (vty, "%-30s: %10d%s", "Selected anomalous routes", num_selected, -+ VTY_NEWLINE); -+ vty_out (vty, "-----------------------------%s", VTY_NEWLINE); -+ vty_out (vty, "%-30s: %10d%s", "Routes with anomalous origins", num_origin, -+ VTY_NEWLINE); -+ vty_out (vty, "%-30s: %10d%s", "Routes with anomalous edges", num_edge, -+ VTY_NEWLINE); -+ vty_out (vty, "%-30s: %10d%s", "Routes ignored for sub-prefix", num_ignored, -+ VTY_NEWLINE); -+ vty_out (vty, "%-30s: %10d%s", "Less specific routes to avoid", num_super, -+ VTY_NEWLINE); -+ /* -+ vty_out (vty, "There are %d routes in the RIB.%s", routes, VTY_NEWLINE); -+ vty_out (vty, "%d are anomalous.%s", anomalous, VTY_NEWLINE); -+ vty_out (vty, "%d anomalous routes are selected.%s", num_selected, VTY_NEWLINE); -+ vty_out (vty, "%s", VTY_NEWLINE); -+ vty_out (vty, "Anomaly breakdown:%s", VTY_NEWLINE); -+ vty_out (vty, "%d contain anomalous origins%s", num_origin, VTY_NEWLINE); -+ vty_out (vty, "%d contain anomalous edges.%s", num_edge, VTY_NEWLINE); -+ vty_out (vty, "%d are for ignored sub-prefixes.%s", num_ignored, VTY_NEWLINE); -+ vty_out (vty, "%d are super-net routes through peers that announced anomalous sub-prefixes.%s", num_super, VTY_NEWLINE); -+ */ -+ return CMD_SUCCESS; -+} -+ -+ -+DEFUN (show_ip_bgp_pgbgp, -+ show_ip_bgp_pgbgp_cmd, -+ "show ip bgp pgbgp", -+ SHOW_STR IP_STR BGP_STR "Display PGBGP statistics\n") -+{ -+ return bgp_pgbgp_stats (vty, AFI_IP, SAFI_UNICAST); -+} -+ -+DEFUN (show_ip_bgp_pgbgp_neighbors, -+ show_ip_bgp_pgbgp_neighbors_cmd, -+ "show ip bgp pgbgp neighbors WORD", -+ SHOW_STR -+ IP_STR -+ BGP_STR -+ "BGP pgbgp\n" -+ "BGP pgbgp neighbors\n" "ASN whos neighbors should be displayed\n") -+{ -+ return bgp_pgbgp_stats_neighbors (vty, AFI_IP, SAFI_UNICAST, -+ atoi (argv[0])); -+} -+ -+DEFUN (show_ip_bgp_pgbgp_origins, -+ show_ip_bgp_pgbgp_origins_cmd, -+ "show ip bgp pgbgp origins A.B.C.D/M", -+ SHOW_STR -+ IP_STR -+ BGP_STR -+ "BGP pgbgp\n" -+ "BGP pgbgp neighbors\n" "Prefix to look up origin ASes of\n") -+{ -+ return bgp_pgbgp_stats_origins (vty, AFI_IP, SAFI_UNICAST, argv[0]); -+} -+ -+ -+ -+ -+/*! --------------- VTY (others exist in bgp_route.c) ------------------ !*/ -+ -+ -+ -+ -+ -+ -+ -+/* --------------- Helper Functions ------------------ */ -+/* -+ If the origin hasn't been seen/verified lately, look for it in the RIB -+*/ -+int -+originInRIB (struct bgp_node *node, struct bgp_pgbgp_origin *origin) -+{ -+ for (struct bgp_info * ri = node->info; ri; ri = ri->next) -+ { -+ struct bgp_pgbgp_pathSet pathOrigins; -+ pathOrigins = bgp_pgbgp_pathOrigin (ri->attr->aspath); -+ for (int i = 0; i < pathOrigins.length; ++i) -+ { -+ if (pathOrigins.ases[i] == origin->originAS) -+ { -+ return true; -+ } -+ } -+ } -+ return false; -+} -+ -+ -+/* -+ If the prefix hasn't been seen/verified lately, look for it in the RIB -+*/ -+int -+prefixInRIB (struct bgp_node *node, struct bgp_pgbgp_prefix *prefix) -+{ -+ if (node->info) -+ return true; -+ return false; -+} -+ -+static int -+edge_inRIB_iterator (struct hash_backet *backet, struct bgp_pgbgp_edge *hedge) -+{ -+ struct aspath *p = backet->data; -+ char first = true; -+ struct edge curEdge; -+ curEdge.a = 0; -+ curEdge.b = 0; -+ -+ struct assegment *seg; -+ -+ for (seg = p->segments; seg; seg = seg->next) -+ { -+ for (int i = 0; i < seg->length; i++) -+ { -+ curEdge.a = curEdge.b; -+ curEdge.b = seg->as[i]; -+ if (first) -+ { -+ first = false; -+ continue; -+ } -+ // Is this the edge we're looking for? -+ if (curEdge.a == hedge->e.a && curEdge.b == hedge->e.b) -+ { -+ hedge->lastSeen = time (NULL); -+ return false; -+ } -+ } -+ } -+ -+ return true; -+} -+ -+/* -+ If the edge hasn't been seen/verified lately, look for it in the AS path list -+ This function is expensive, use sparingly -+*/ -+int -+edgeInRIB (struct bgp_pgbgp_edge *e) -+{ -+ int completed; -+ completed = hash_iterate_until (ashash, -+ (int (*)(struct hash_backet *, void *)) -+ edge_inRIB_iterator, e); -+ if (completed) -+ return false; -+ -+ return true; -+} -+ -+ -+ -+/* -+ Return the selected route for the given route node -+ */ -+ -+struct bgp_info * -+bgp_pgbgp_selected (struct bgp_node *node) -+{ -+ for (struct bgp_info * ri = node->info; ri; ri = ri->next) -+ { -+ if (CHECK_FLAG (ri->flags, BGP_INFO_SELECTED)) -+ return ri; -+ } -+ return NULL; -+} -+ -+static int -+reuse_cmp (void *node1, void *node2) -+{ -+ struct bgp_pgbgp_reuse *a; -+ struct bgp_pgbgp_reuse *b; -+ a = (struct bgp_pgbgp_reuse *) node1; -+ b = (struct bgp_pgbgp_reuse *) node2; -+ return a->deprefUntil - b->deprefUntil; -+} -+ -+int -+bgp_pgbgp_pathLength (struct aspath *asp) -+{ -+ struct assegment *seg; -+ if ((asp == NULL) || (asp->segments == NULL)) -+ return 0; -+ int count = 0; -+ seg = asp->segments; -+ while (seg->next != NULL) -+ { -+ count += seg->length; -+ seg = seg->next; -+ } -+ return count; -+} -+ -+ -+ -+/* Find the origin(s) of the path -+ All ASes in the final set are considered origins */ -+static struct bgp_pgbgp_pathSet -+bgp_pgbgp_pathOrigin (struct aspath *asp) -+{ -+ struct assegment *seg, *last; -+ struct bgp_pgbgp_pathSet tmp; -+ tmp.length = 0; -+ tmp.ases = NULL; -+ -+ assert (asp != NULL && asp->segments != NULL); -+ -+ /* if ( (asp == NULL) || (asp->segments == NULL) ) -+ return tmp; -+ */ -+ seg = asp->segments; -+ last = NULL; -+ while (seg->next != NULL) -+ { -+ if (seg->type != AS_SET && seg->type != AS_CONFED_SET) -+ last = seg; -+ seg = seg->next; -+ } -+ -+ if (seg->type == AS_SET || seg->type == AS_CONFED_SET) -+ seg = last; -+ -+ assert (seg); -+ tmp.length = 1; -+ tmp.ases = &seg->as[seg->length - 1]; -+ -+ /* -+ if (seg->type == AS_SET || seg->type == AS_CONFED_SET) -+ { -+ tmp.length = seg->length; -+ tmp.ases = seg->as; -+ } -+ else -+ { -+ tmp.length = 1; -+ tmp.ases = &seg->as[seg->length - 1]; -+ } -+ */ -+ assert (tmp.length >= 1); -+ return tmp; -+ // return seg->as[seg->length-1]; -+} -+ -+int -+bgp_pgbgp_reuse (time_t t_now) -+{ -+ -+ struct bgp_pgbgp_reuse *cur = NULL; -+ -+ while (pgbgp->rq_size > 0) -+ { -+ cur = pqueue_dequeue (pgbgp->reuse_q); -+ pgbgp->rq_size -= 1; -+ -+ // Is the next item ready to be reused? -+ if (t_now < cur->deprefUntil) -+ { -+ pqueue_enqueue (cur, pgbgp->reuse_q); -+ pgbgp->rq_size += 1; -+ break; -+ } -+ -+ // Okay, it needs to be reused now -+ if (cur->type == PGBGP_REUSE_ORIGIN) -+ bgp_pgbgp_reuseOrigin (cur->data.origin); -+ -+ else if (cur->type == PGBGP_REUSE_PREFIX) -+ bgp_pgbgp_reusePrefix (cur->data.prefix); -+ -+ else if (cur->type == PGBGP_REUSE_EDGE) -+ bgp_pgbgp_reuseEdge (cur->data.edge); -+ -+ -+ XFREE (MTYPE_BGP_PGBGP_REUSE, cur); -+ } -+ return 0; -+} -+ -+/* Check bit of the prefix. */ -+static int -+check_bit (u_char * prefix, u_char prefixlen) -+{ -+ int offset; -+ int shift; -+ u_char *p = (u_char *) prefix; -+ -+ assert (prefixlen <= 128); -+ -+ offset = prefixlen / 8; -+ shift = 7 - (prefixlen % 8); -+ -+ return (p[offset] >> shift & 1); -+} -+ -+/* -+ Find a super-net in the tree that's not currently anomalous if one exists -+*/ -+struct bgp_node * -+findSuper (struct bgp_table *table, struct prefix *p, time_t t_now) -+{ -+ struct bgp_node *node; -+ struct bgp_node *matched; -+ -+ matched = NULL; -+ node = table->top; -+ -+ while (node && node->p.prefixlen < p->prefixlen && -+ prefix_match (&node->p, p)) -+ { -+ // Node may not yet have its info set when reading in from pgbgp log files -+ if (node->hist && node->p.prefixlen >= 8) -+ { -+ if (node->hist->p != NULL && node->hist->p->ignoreUntil < t_now) -+ //if (node->hist->p != NULL && prefixInRIB (node, NULL)) -+ //if (node->hist->p != NULL) -+ matched = node; -+ } -+ node = node->link[check_bit (&p->u.prefix, node->p.prefixlen)]; -+ } -+ if (matched) -+ return bgp_lock_node (matched); -+ return NULL; -+} -+ -+ -+ -+ -+ -+/*! --------------- Helper Functions ------------------ !*/ -+ -+ -+ -+ -+ -+ -+ -+/* --------------- Public PGBGP Interface ------------------ */ -+int -+bgp_pgbgp_enable (struct bgp *bgp, afi_t afi, safi_t safi, -+ int ost, int est, int sst, int oht, int pht, int eht, -+ const char *file, const char *anoms) -+{ -+ -+ if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP)) -+ { -+ if (pgbgp->storage && pgbgp->anomalies) -+ { -+ if (pgbgp->origin_sus_time == ost -+ && pgbgp->edge_sus_time == est -+ && pgbgp->sub_sus_time == sst -+ && pgbgp->origin_hist_time == oht -+ && pgbgp->prefix_hist_time == pht -+ && pgbgp->edge_hist_time == eht -+ && strcmp (pgbgp->storage, file) == 0 -+ && strcmp (pgbgp->anomalies, anoms) == 0) -+ -+ return 0; -+ } -+ } -+ -+ SET_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP); -+ -+#ifndef PGBGP_DEBUG -+ time_t hour = 3600; -+ time_t day = 86400; -+#endif -+#ifdef PGBGP_DEBUG -+ time_t hour = 2; -+ time_t day = 5; -+#endif -+ -+ pgbgp->origin_sus_time = ost * hour; -+ pgbgp->edge_sus_time = est * hour; -+ pgbgp->sub_sus_time = sst * hour; -+ pgbgp->origin_hist_time = oht * day; -+ pgbgp->prefix_hist_time = pht * day; -+ pgbgp->edge_hist_time = eht * day; -+ pgbgp->peer_hist_time = DEFAULT_ORIGIN_HIST; -+ -+ if (file != NULL) -+ pgbgp->storage = strdup (file); -+ else -+ pgbgp->storage = NULL; -+ -+ if (anoms != NULL) -+ pgbgp->anomalies = strdup (anoms); -+ else -+ pgbgp->anomalies = NULL; -+ -+ -+ pgbgp->reuse_q = pqueue_create (); -+ pgbgp->reuse_q->cmp = reuse_cmp; -+ pgbgp->rq_size = 0; -+ pgbgp->lastgc = time (NULL); -+ pgbgp->lastStore = time (NULL); -+ pgbgp->startTime = time (NULL); -+ install_element (VIEW_NODE, &show_ip_bgp_pgbgp_cmd); -+ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_cmd); -+ install_element (VIEW_NODE, &show_ip_bgp_pgbgp_neighbors_cmd); -+ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_neighbors_cmd); -+ install_element (VIEW_NODE, &show_ip_bgp_pgbgp_origins_cmd); -+ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_origins_cmd); -+ pgbgp->edgeT = hash_create_size (131072, edge_key_make, edge_cmp); -+ bgp_pgbgp_restore (); -+ return 0; -+} -+ -+int -+bgp_pgbgp_disable (struct bgp *bgp, afi_t afi, safi_t safi) -+{ -+ UNSET_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP); -+ -+ // Clean the tables -+ if (bgp->rib[afi][safi] != NULL) -+ bgp_pgbgp_clean (bgp->rib[afi][safi]); -+ -+ bgp_pgbgp_cleanEdges (); -+ -+ if (pgbgp->storage != NULL) -+ free (pgbgp->storage); -+ -+ if (pgbgp->anomalies != NULL) -+ free (pgbgp->anomalies); -+ -+ struct bgp_pgbgp_peerTime *pr = pgbgp->peerLast; -+ while (pr) -+ { -+ struct bgp_pgbgp_peerTime *cur = pr; -+ pr = pr->next; -+ XFREE (MTYPE_BGP_PGBGP_PEER, cur); -+ } -+ -+ return 0; -+} -+ -+int -+bgp_pgbgp_clean (struct bgp_table *table) -+{ -+ struct bgp_pgbgp_reuse *rnode = NULL; -+ -+ while (pgbgp->rq_size > 0) -+ { -+ rnode = (struct bgp_pgbgp_reuse *) pqueue_dequeue (pgbgp->reuse_q); -+ pgbgp->rq_size -= 1; -+ XFREE (MTYPE_BGP_PGBGP_REUSE, rnode); -+ } -+ pqueue_delete (pgbgp->reuse_q); -+ -+ if (table == NULL) -+ return 0; -+ -+ // Clean the detectors -+ bgp_pgbgp_cleanHistTable (table); -+ -+ bgp_pgbgp_cleanEdges (); -+ -+ -+ // Clean up the RIB nodes -+ for (struct bgp_node * rn = bgp_table_top (table); rn; -+ rn = bgp_route_next (rn)) -+ { -+ int changed = 0; -+ for (struct bgp_info * ri = rn->info; ri; ri = ri->next) -+ { -+ if (CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_O -+ | BGP_INFO_SUSPICIOUS_P | BGP_INFO_SUSPICIOUS_E -+ | BGP_INFO_IGNORED_P)) -+ { -+ changed = 1; -+ UNSET_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_O -+ | BGP_INFO_SUSPICIOUS_P | BGP_INFO_SUSPICIOUS_E -+ | BGP_INFO_IGNORED_P); -+ } -+ } -+ if (changed && rn->info) -+ { -+ struct bgp_info *ri = rn->info; -+ bgp_process (ri->peer->bgp, rn, rn->table->afi, rn->table->safi); -+ } -+ } -+ -+ hash_free (pgbgp->edgeT); -+ return 0; -+} -+ -+ -+int -+bgp_pgbgp_gc (struct bgp_table *table) -+{ -+ struct bgp *bgp = bgp_get_default (); -+ if (!bgp) -+ return 0; -+ -+ // Collect each AFI/SAFI RIB -+ for (afi_t afi = AFI_IP; afi < AFI_MAX; afi++) -+ for (safi_t safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) -+ { -+ if (!CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP)) -+ continue; -+ struct bgp_table *curTable = bgp->rib[afi][safi]; -+ if (!curTable) -+ continue; -+ bgp_pgbgp_garbageCollectHistTable (curTable); -+ } -+ -+ bgp_pgbgp_garbageCollectEdges (table); -+ -+ return 0; -+} -+ -+int -+bgp_pgbgp_restore (void) -+{ -+ -+ if (pgbgp->storage == NULL) -+ return 0; -+ FILE *file = fopen (pgbgp->storage, "r"); -+ if (!file) -+ return 0; -+ -+ int type = 0; -+ struct prefix p; -+ struct bgp *bgp = bgp_get_default (); -+ struct bgp_node *curNode = NULL; -+ -+ // Get the log store time -+ long long int writetime; -+ fscanf (file, "%lld", &writetime); -+ time_t swtime = writetime; -+ -+ // If it's too old (more than 1 week old), start fresh -+ if (time (NULL) - swtime > 86400 * 7) -+ { -+ fclose (file); -+ return 0; -+ } -+ -+ -+ // Get the PGBGP init time -+ long long int stime; -+ fscanf (file, "%lld", &stime); -+ pgbgp->startTime = stime; -+ -+ while (fscanf (file, "%d", &type) != EOF) -+ { -+ -+ if (type == PREFIX_ID) -+ { -+ char pre[128]; -+ unsigned int afi; -+ unsigned int safi; -+ long long int time; -+ fscanf (file, "%s %u %u %lld", pre, &afi, &safi, &time); -+ str2prefix (pre, &p); -+ struct bgp_table *curTable = bgp->rib[afi][safi]; -+ assert (curTable != NULL); -+ -+ // Create and lock the node -+ curNode = bgp_node_get (curTable, &p); -+ assert (curNode->hist == NULL); -+ -+ // bgp_lock_node(curNode); -+ -+ curNode->hist = -+ XCALLOC (MTYPE_BGP_PGBGP_HIST, sizeof (struct bgp_pgbgp_hist)); -+ assert (curNode->hist != NULL); -+ -+ curNode->hist->p = -+ XCALLOC (MTYPE_BGP_PGBGP_PREFIX, -+ sizeof (struct bgp_pgbgp_prefix)); -+ assert (curNode->hist->p != NULL); -+ -+ curNode->hist->p->lastSeen = time; -+ } -+ else if (type == ORIGIN_ID) -+ { -+ unsigned int ASN; -+ long long int time; -+ fscanf (file, "%u %lld", &ASN, &time); -+ struct bgp_pgbgp_origin *or = XCALLOC (MTYPE_BGP_PGBGP_ORIGIN, -+ sizeof (struct -+ bgp_pgbgp_origin)); -+ or->lastSeen = time; -+ or->originAS = ASN; -+ or->next = curNode->hist->o; -+ curNode->hist->o = or; -+ } -+ else if (type == EDGE_ID) -+ { -+ bgp_pgbgp_restoreEdge (file); -+ } -+ else if (type == PEER_ID) -+ { -+ struct bgp_pgbgp_peerTime *pr; -+ long long int time; -+ union sockunion su; -+ char szsu[128]; -+ fscanf (file, "%s %lld", szsu, &time); -+ str2sockunion (szsu, &su); -+ pr = -+ XCALLOC (MTYPE_BGP_PGBGP_PEER, -+ sizeof (struct bgp_pgbgp_peerTime)); -+ pr->su = su; -+ pr->lastSeen = time; -+ pr->next = pgbgp->peerLast; -+ pgbgp->peerLast = pr; -+ } -+ } -+ -+ fclose (file); -+ return 0; -+} -+ -+int -+bgp_pgbgp_store (struct bgp_table *table) -+{ -+ if (pgbgp->storage == NULL) -+ return 0; -+ char *tmpname = malloc (sizeof (char) * (1 + 4 + strlen (pgbgp->storage))); -+ strcpy (tmpname, pgbgp->storage); -+ strcat (tmpname, ".tmp"); -+ FILE *file = fopen (tmpname, "w"); -+ -+ if (!file) -+ { -+ free (tmpname); -+ return 0; -+ } -+ -+ // Store the current time -+ fprintf (file, "%lld\n", (long long int) time (NULL)); -+ -+ // Store the init time -+ fprintf (file, "%lld\n", (long long int) pgbgp->startTime); -+ -+ // Store the peer times -+ for (struct bgp_pgbgp_peerTime * pr = pgbgp->peerLast; pr; pr = pr->next) -+ { -+ char strSock[128]; -+ sockunion2str (&pr->su, strSock, sizeof (strSock)); -+ -+ if (pr->deprefUntil < time (NULL)) -+ { -+ fprintf (file, "%d %s %lld\n", PEER_ID, strSock, -+ (long long int) pr->lastSeen); -+ } -+ } -+ -+ // Store the tables -+ bgp_pgbgp_storeHistTable (table, file); -+ bgp_pgbgp_storeEdges (table, file); -+ -+ fclose (file); -+ -+ rename (tmpname, pgbgp->storage); -+ -+ free (tmpname); -+ return 0; -+} -+ -+/* -+ Check to see if we've seen the peer recently -+ If not, then we need to return true and not delay routes -+ for awhile -+*/ -+int -+bgp_pgbgp_updatePeer (struct bgp_info *binfo, time_t now) -+{ -+ int status = false; -+ // Find the peer -+ struct bgp_pgbgp_peerTime *pr = pgbgp->peerLast; -+ for (; pr; pr = pr->next) -+ if (sockunion_same (&pr->su, &binfo->peer->su)) -+ break; -+ -+ // If this is a new peer, create it -+ if (pr == NULL) -+ { -+ pr = XCALLOC (MTYPE_BGP_PGBGP_PEER, sizeof (struct bgp_pgbgp_peerTime)); -+ pr->su = binfo->peer->su; -+ pr->next = pgbgp->peerLast; -+ pgbgp->peerLast = pr; -+ -+ } -+ // Is it currently marked as new? -+ if (pr->deprefUntil > now) -+ goto UPPEER_DEPREF; -+ -+ // Have we seen the peer recently? -+ if (pr->lastSeen + pgbgp->peer_hist_time > now) -+ goto UPPEER_CLEAN; -+ -+ // It must not have been seen lately, depref it -+ pr->deprefUntil = now + PGBGP_PEER_GRACE; -+ -+ -+UPPEER_DEPREF: -+ status = true; -+ -+UPPEER_CLEAN: -+ pr->lastSeen = now; -+ -+ return status; -+} -+ -+ -+/* -+ Returns whether or not the sub-prefix should be ignored -+*/ -+int -+bgp_pgbgp_shouldIgnore (struct bgp_node *super, struct bgp_info *selected) -+{ -+ if (!selected || CHECK_FLAG (selected->flags, BGP_INFO_SUSPICIOUS_P)) -+ return false; -+ return true; -+} -+ -+/* -+ This is a special case function for smoothly handling sub-prefix hijacks. -+ -+ It handles the following 2 events: -+ -+ Event 1: The super-prefix of an anomalous prefix has a route through a non-anomalous -+ -+ Event 1: An anomalous sub-prefix is ignored, but no best route for the super-prefix exists -+ Response: Announce the sub-prefix until the super-prefix comes back -+ -+ Event 2: A super-prefix comes back to the RIB and its anomalous sub-prefix is in use -+ Response: Ignore the sub-prefix again -+ */ -+ -+ -+int -+bgp_pgbgp_rib_updated (struct bgp_node *rn, struct bgp_info *old_best, -+ struct bgp_info *new_best) -+{ -+ // return 0; -+ struct bgp_pgbgp_hist *hist = rn->hist; -+ if (!hist) -+ return 0; -+ if (!hist->p) -+ return 0; -+ time_t t_now = time (NULL); -+ -+ /* -+ If we can't avoid the sub-prefix by routing to the super-prefix, -+ then route as normal to the sub-prefix -+ */ -+ if (!bgp_pgbgp_shouldIgnore (rn, new_best)) -+ { -+ for (struct bgp_pgbgp_avoid * cur = hist->p->avoid; cur; -+ cur = cur->next) -+ { -+ if (cur->avoidUntil > t_now) -+ { -+ int changed = false; -+ for (struct bgp_info * ri = cur->sub->info; ri; ri = ri->next) -+ { -+ if (CHECK_FLAG (ri->flags, BGP_INFO_IGNORED_P)) -+ { -+ changed = true; -+ UNSET_FLAG (ri->flags, BGP_INFO_IGNORED_P); -+ } -+ } -+ if (changed) -+ { -+ struct bgp_info *ri = cur->sub->info; -+ if (ri && ri->peer && ri->peer->bgp) -+ bgp_process (ri->peer->bgp, cur->sub, -+ cur->sub->table->afi, cur->sub->table->safi); -+ -+ } -+ -+ } -+ } -+ } -+ -+ /* -+ If we can avoid the sub-prefix by routing to the super-prefix, -+ then do so -+ */ -+ -+ else -+ { -+ for (struct bgp_pgbgp_avoid * cur = hist->p->avoid; cur; -+ cur = cur->next) -+ { -+ if (cur->avoidUntil > t_now) -+ { -+ int changed = false; -+ for (struct bgp_info * ri = cur->sub->info; ri; ri = ri->next) -+ { -+ if (!CHECK_FLAG (ri->flags, BGP_INFO_IGNORED_P)) -+ { -+ changed = true; -+ SET_FLAG (ri->flags, BGP_INFO_IGNORED_P); -+ } -+ } -+ if (changed) -+ { -+ struct bgp_info *ri = cur->sub->info; -+ if (ri && ri->peer && ri->peer->bgp) -+ bgp_process (ri->peer->bgp, cur->sub, -+ cur->sub->table->afi, cur->sub->table->safi); -+ } -+ } -+ } -+ } -+ -+ /* -+ if (old_best && !new_best) -+ { -+ time_t t_now = time(NULL); -+ for (struct bgp_pgbgp_avoid * cur = hist->p->avoid; cur; -+ cur = cur->next) -+ { -+ if (cur->avoidUntil > t_now) -+ { -+ for (struct bgp_info * ri = cur->sub->info; ri; ri = ri->next) -+ UNSET_FLAG (ri->flags, BGP_INFO_IGNORED_P); -+ -+ struct bgp_info *ri = cur->sub->info; -+ if (ri && ri->peer && ri->peer->bgp) -+ bgp_process (ri->peer->bgp, cur->sub, cur->sub->table->afi, -+ cur->sub->table->safi); -+ } -+ } -+ } -+ -+ -+ else if (!old_best && new_best) -+ { -+ time_t t_now = time(NULL); -+ for (struct bgp_pgbgp_avoid * av = hist->p->avoid; av; av = av->next) -+ { -+ struct bgp_info * ri = av->sub->info; -+ if (av->avoidUntil > t_now && ri && !CHECK_FLAG(ri->flags, BGP_INFO_IGNORED_P)) -+ { -+ for (; ri; ri = ri->next) -+ SET_FLAG (ri->flags, BGP_INFO_IGNORED_P); -+ ri = av->sub->info; -+ if (ri && ri->peer && ri->peer->bgp) -+ bgp_process (ri->peer->bgp, av->sub, -+ av->sub->table->afi, av->sub->table->safi); -+ -+ } -+ } -+ } -+ */ -+ return 0; -+} -+ -+int -+bgp_pgbgp_update (struct bgp_info *binfo, struct attr *at, -+ struct bgp_node *rn) -+{ -+ time_t t_now = time (NULL); -+ -+ // Clean up the reuse list -+ bgp_pgbgp_reuse (t_now); -+ -+ -+ if (!rn->hist) -+ { -+ rn->hist = -+ XCALLOC (MTYPE_BGP_PGBGP_HIST, sizeof (struct bgp_pgbgp_hist)); -+ // Get the PGBGP history lock on rn -+ bgp_lock_node (rn); -+ } -+ -+ struct bgp_node *superhn = NULL; -+ -+ // implicit lock from node_get -+ superhn = findSuper (rn->table, &rn->p, t_now); -+ -+ int newPeer = bgp_pgbgp_updatePeer (binfo, t_now); -+ bgp_pgbgp_updateOrigin (rn->hist, binfo, at, rn, t_now, newPeer); -+ bgp_pgbgp_updatePrefix (rn->hist, superhn, binfo, at, rn, t_now, newPeer); -+ bgp_pgbgp_updateEdge (rn->hist, binfo, at, rn, t_now, newPeer); -+ -+ if (superhn != NULL) -+ bgp_unlock_node (superhn); -+ -+ -+ -+ // GC and storage must be last, as they update lastSeen values of objects -+ // which would cause new routes to be recently seen, which is undesired behavior -+ // Make sure you don't collect anything that might be in use! -+ if (t_now >= pgbgp->lastgc + PGBGP_GC_DELTA) -+ { -+ bgp_pgbgp_gc (rn->table); -+ pgbgp->lastgc = t_now; -+ } -+ -+ if (t_now >= pgbgp->lastStore + PGBGP_STORE_DELTA) -+ { -+ bgp_pgbgp_store (rn->table); -+ pgbgp->lastStore = t_now; -+ } -+ -+ -+ -+ return 0; -+} -+ -+ -+ -+ -+/*! --------------- Public PGBGP Interface ------------------ !*/ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+/* --------------- MOAS Detection ------------------ */ -+void -+bgp_pgbgp_storeHistTable (struct bgp_table *table, FILE * file) -+{ -+ time_t t_now; -+ t_now = time (NULL); -+ -+ struct bgp *bgp = bgp_get_default (); -+ if (!bgp) -+ return; -+ -+ // Store each AFI/SAFI RIB -+ for (afi_t afi = AFI_IP; afi < AFI_MAX; afi++) -+ for (safi_t safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) -+ { -+ if (!CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP)) -+ continue; -+ struct bgp_table *curTable = bgp->rib[afi][safi]; -+ if (!curTable) -+ continue; -+ -+ for (struct bgp_node * rn = bgp_table_top (curTable); rn; -+ rn = bgp_route_next (rn)) -+ { -+ struct bgp_pgbgp_hist *hist = rn->hist; -+ if (hist == NULL) -+ continue; -+ char szPrefix[128]; -+ prefix2str (&rn->p, szPrefix, sizeof (szPrefix)); -+ -+ -+ struct bgp_pgbgp_prefix *pre = hist->p; -+ if (pre && pre->ignoreUntil <= t_now) -+ { -+ if (pre->lastSeen + pgbgp->prefix_hist_time > t_now) -+ fprintf (file, "%d %s %u %u %lld\n", PREFIX_ID, szPrefix, -+ (unsigned int) afi, (unsigned int) safi, -+ (long long int) pre->lastSeen); -+ else -+ continue; -+ } -+ /* Need a prefix in the file before the origins, -+ if no prefix.. skip origins */ -+ else -+ continue; -+ -+ for (struct bgp_pgbgp_origin * cur = hist->o; cur; -+ cur = cur->next) -+ { -+ if (cur->deprefUntil > t_now) -+ continue; -+ -+ if (cur->lastSeen + pgbgp->origin_hist_time > t_now) -+ fprintf (file, "%d %u %lld\n", ORIGIN_ID, cur->originAS, -+ (long long int) cur->lastSeen); -+ } -+ -+ } -+ } -+} -+ -+ -+int -+bgp_pgbgp_garbageCollectHistTable (struct bgp_table *table) -+{ -+ time_t t_now; -+ t_now = time (NULL); -+ -+ -+ for (struct bgp_node * rn = bgp_table_top (table); rn; -+ rn = bgp_route_next (rn)) -+ { -+ int collect = false; -+ struct bgp_pgbgp_hist *hist = rn->hist; -+ if (hist == NULL) -+ continue; -+ -+ struct bgp_pgbgp_origin *cur = hist->o; -+ struct bgp_pgbgp_prefix *pre = hist->p; -+ struct bgp_pgbgp_origin *parent = NULL; -+ -+ int used = false; -+ if (cur != NULL || pre != NULL) -+ used = true; -+ -+ while (cur != NULL) -+ { -+ // Update the lastSeen time w/ originInRIB -+ if (originInRIB (rn, cur)) -+ cur->lastSeen = t_now; -+ -+ collect = false; -+ -+ // Collect if old -+ if (cur->lastSeen + pgbgp->origin_hist_time <= t_now) -+ collect = true; -+ -+ // Collect if anomaly just became okay but not seen since last collection -+ if (cur->deprefUntil != 0 && cur->deprefUntil < t_now) -+ { -+ if (cur->lastSeen < pgbgp->lastgc) -+ collect = true; -+ cur->deprefUntil = 0; -+ } -+ -+ if (collect) -+ { -+ if (parent == NULL) -+ hist->o = cur->next; -+ else -+ parent->next = cur->next; -+ -+ // Delete cur, parent doesn't change -+ struct bgp_pgbgp_origin *del = cur; -+ cur = cur->next; -+ XFREE (MTYPE_BGP_PGBGP_ORIGIN, del); -+ } -+ else -+ { -+ parent = cur; -+ cur = cur->next; -+ } -+ } -+ -+ // Update the lastSeen time w/ prefixInRIB -+ if (pre && prefixInRIB (rn, pre)) -+ pre->lastSeen = t_now; -+ -+ collect = false; -+ -+ // Collect if old -+ if (pre && pre->lastSeen + pgbgp->prefix_hist_time <= t_now) -+ collect = true; -+ -+ // Collect if anomaly just became okay but not seen since last collection -+ if (pre && pre->ignoreUntil != 0 && pre->ignoreUntil < t_now) -+ { -+ if (pre->lastSeen < pgbgp->lastgc) -+ collect = true; -+ pre->ignoreUntil = 0; -+ } -+ -+ if (collect) -+ { -+ for (struct bgp_pgbgp_avoid * av = pre->avoid; av;) -+ { -+ struct bgp_pgbgp_avoid *del = av; -+ av = av->next; -+ bgp_unlock_node (del->sub); -+ XFREE (MTYPE_BGP_PGBGP_AVOID, del); -+ } -+ -+ XFREE (MTYPE_BGP_PGBGP_PREFIX, pre); -+ hist->p = NULL; -+ } -+ -+ // If the node isn't in use, remove it -+ if (used && hist->o == NULL && hist->p == NULL) -+ { -+ XFREE (MTYPE_BGP_PGBGP_HIST, hist); -+ rn->hist = NULL; -+ bgp_unlock_node (rn); -+ } -+ } -+ -+ return 0; -+} -+ -+void -+bgp_pgbgp_cleanHistTable (struct bgp_table *table) -+{ -+ // Clean up the RIB nodes -+ for (struct bgp_node * rn = bgp_table_top (table); rn; -+ rn = bgp_route_next (rn)) -+ { -+ struct bgp_pgbgp_hist *hist = rn->hist; -+ if (hist == NULL) -+ continue; -+ -+ if (hist->p) -+ { -+ for (struct bgp_pgbgp_avoid * av = hist->p->avoid; av;) -+ { -+ struct bgp_pgbgp_avoid *del = av; -+ av = av->next; -+ bgp_unlock_node (del->sub); -+ XFREE (MTYPE_BGP_PGBGP_AVOID, del); -+ } -+ hist->p->avoid = NULL; -+ XFREE (MTYPE_BGP_PGBGP_PREFIX, hist->p); -+ hist->p = NULL; -+ } -+ -+ for (struct bgp_pgbgp_origin * cur = hist->o; cur;) -+ { -+ struct bgp_pgbgp_origin *next = cur->next; -+ XFREE (MTYPE_BGP_PGBGP_ORIGIN, cur); -+ cur = next; -+ } -+ hist->o = NULL; -+ XFREE (MTYPE_BGP_PGBGP_HIST, hist); -+ rn->hist = NULL; -+ bgp_unlock_node (rn); -+ } -+} -+ -+void -+bgp_pgbgp_logOriginAnomaly (as_t asn, struct bgp_node *rn, struct attr *at) -+{ -+ assert (pgbgp); -+ if (!pgbgp->anomalies) -+ return; -+ FILE *file = fopen (pgbgp->anomalies, "a"); -+ if (!file) -+ return; -+ -+ char pre[256]; -+ prefix2str (&rn->p, pre, sizeof (pre)); -+ -+ // MOAS | TIME | NEXTHOP | PREFIX | SUSPICIOUS_ORIGIN | TRUSTED_ORIGINS | PATH -+ fprintf (file, "%d|%lld|%s|%s|%d|", MOAS, (long long int) time (NULL), -+ inet_ntoa (at->nexthop), pre, asn); -+ -+ -+ // Print the trusted origins -+ assert (rn->hist); -+ assert (rn->hist->o); -+ -+ struct bgp_pgbgp_hist *hist = rn->hist; -+ -+ for (struct bgp_pgbgp_origin * cur = hist->o; cur != NULL; cur = cur->next) -+ { -+ if (cur->deprefUntil > time (NULL)) -+ continue; -+ fprintf (file, "%d", cur->originAS); -+ if (cur->next != NULL) -+ fprintf (file, " "); -+ } -+ -+ fprintf (file, " |%s\n", aspath_print (at->aspath)); -+ fclose (file); -+} -+ -+int -+bgp_pgbgp_updateOrigin (struct bgp_pgbgp_hist *hist, struct bgp_info *binfo, -+ struct attr *at, struct bgp_node *rn, time_t t_now, -+ int newPeer) -+{ -+ struct bgp_pgbgp_pathSet pathOrigins; -+ struct bgp_pgbgp_origin *pi = NULL; -+ int status = 0; -+ struct bgp_pgbgp_reuse *r; -+ pathOrigins = bgp_pgbgp_pathOrigin (at->aspath); -+ -+ -+ for (int i = 0; i < pathOrigins.length; i++) -+ { -+ as_t pathOrigin = pathOrigins.ases[i]; -+ -+ /* Is the Origin AS in the history? */ -+ for (pi = hist->o; pi; pi = pi->next) -+ if (pi->originAS == pathOrigin) -+ break; -+ -+ if (pi == NULL) -+ { -+ pi = -+ XCALLOC (MTYPE_BGP_PGBGP_ORIGIN, -+ sizeof (struct bgp_pgbgp_origin)); -+ pi->next = hist->o; -+ pi->originAS = pathOrigin; -+ hist->o = pi; -+ } -+ -+ // If this is our first origin for the prefix, let the sub-prefix -+ // check take care of it -+ if (pi->next == NULL) -+ goto UPO_CLEAN; -+ -+ /* Is the origin currently marked as suspicious? */ -+ if (pi->deprefUntil > t_now) -+ goto UPO_DEPREF; -+ -+ /* Have we seen the origin recently? */ -+ if (pi->lastSeen + pgbgp->origin_hist_time > t_now) -+ goto UPO_CLEAN; -+ -+#ifndef PGBGP_DEBUG -+ /* Are we within the initial grace period? */ -+ if (newPeer) -+ goto UPO_CLEAN; -+#endif -+ -+ /* It must not be in recent history, depref origin for first time */ -+ pi->deprefUntil = t_now + pgbgp->origin_sus_time; -+ bgp_pgbgp_logOriginAnomaly (pathOrigin, rn, at); -+ -+ r = XCALLOC (MTYPE_BGP_PGBGP_REUSE, sizeof (struct bgp_pgbgp_reuse)); -+ r->type = PGBGP_REUSE_ORIGIN; -+ r->deprefUntil = pi->deprefUntil; -+ r->data.origin.originAS = pathOrigin; -+ r->data.origin.rn = rn; -+ bgp_lock_node (rn); -+ pqueue_enqueue (r, pgbgp->reuse_q); -+ pgbgp->rq_size += 1; -+ -+ -+ UPO_DEPREF: -+ SET_FLAG (binfo->flags, BGP_INFO_SUSPICIOUS_O); -+ status = BGP_INFO_SUSPICIOUS_O; -+ -+ UPO_CLEAN: -+ pi->lastSeen = t_now; -+ } -+ return status; -+} -+ -+int -+bgp_pgbgp_reuseOrigin (struct bgp_pgbgp_r_origin data) -+{ -+ struct bgp_info *ri; -+ int numChanged = 0; -+ time_t t_now = time (NULL); -+ assert (data.rn->hist != NULL); -+ -+ // Repreference paths for this prefix that are now okay -+ for (ri = data.rn->info; ri; ri = ri->next) -+ { -+ if (CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_O)) -+ { -+ struct bgp_pgbgp_pathSet pathOrigins; -+ pathOrigins = bgp_pgbgp_pathOrigin (ri->attr->aspath); -+ int numOkay = 0; -+ for (int i = 0; i < pathOrigins.length; i++) -+ { -+ as_t pathOrigin = pathOrigins.ases[i]; -+ // Find the origin -+ struct bgp_pgbgp_origin *o = NULL; -+ for (o = data.rn->hist->o; o != NULL; o = o->next) -+ if (o->originAS == pathOrigin) -+ break; -+ /* -+ if (o == NULL) { -+ for(struct bgp_pgbgp_origin * z = data.rn->hist->o; z != NULL; z = z->next) -+ printf("Known origin: %d\n", z->originAS); -+ char pre[128]; -+ prefix2str(&data.rn->p, pre, 128); -+ printf("%s : %s : %d\n", pre, ri->attr->aspath->str, pathOrigin); -+ } -+ */ -+ assert (o != NULL); -+ -+ if (o->deprefUntil <= t_now) -+ numOkay += 1; -+ } -+ if (numOkay == pathOrigins.length) -+ { -+ UNSET_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_O); -+ numChanged += 1; -+ } -+ } -+ } -+ -+ ri = data.rn->info; -+ -+ // Rerun the decision process? -+ if (numChanged > 0) -+ bgp_process (ri->peer->bgp, data.rn, data.rn->table->afi, -+ data.rn->table->safi); -+ -+ -+ /* -+ // Remove this (origin,prefix) pair from the normal database -+ // if it's not still in the RIB -+ struct bgp_pgbgp_hist *hist = rn->hist; -+ struct bgp_pgbgp_origin * cur = hist->o; -+ struct bgp_pgbgp_origin * parent = NULL; -+ -+ // Find the origin AS node -+ while(cur != NULL) -+ { -+ if (cur->originAS == data.originAS) -+ { -+ // Delete the node if it hasn't been seen -+ // since the last storage run -+ if (cur->lastSeen < pgbgp->lastStore) { -+ // Delete this node -+ if (parent == NULL) -+ hist->o = cur->next; -+ else -+ parent->next = cur->next; -+ -+ XFREE(MTYPE_BGP_PGBGP_ORIGIN, cur); -+ } -+ break; -+ } -+ parent = cur; -+ cur = cur->next; -+ } -+ */ -+ -+ bgp_unlock_node (data.rn); -+ return 0; -+} -+ -+/*! --------------- MOAS Detection ------------------ !*/ -+ -+ -+/* --------------- Sub-Prefix Detection ------------------ */ -+ -+ -+ -+ -+ -+void -+bgp_pgbgp_logSubprefixAnomaly (as_t asn, struct bgp_node *rn, struct attr *at, -+ struct bgp_node *super) -+{ -+ assert (pgbgp); -+ if (!pgbgp->anomalies) -+ return; -+ FILE *file = fopen (pgbgp->anomalies, "a"); -+ if (!file) -+ return; -+ -+ char pre[256]; -+ prefix2str (&rn->p, pre, sizeof (pre)); -+ -+ char superpre[256]; -+ prefix2str (&super->p, superpre, sizeof (superpre)); -+ -+ // SUBPREFIX | TIME | NEXTHOP | PREFIX | SUPER-PREFIX | SUSPICIOUS_ORIGIN | TRUSTED_ORIGINS | PATH -+ fprintf (file, "%d|%lld|%s|%s|%s|%d|", SUBPREFIX, -+ (long long int) time (NULL), inet_ntoa (at->nexthop), pre, -+ superpre, asn); -+ -+ // Print the trusted origins -+ assert (super->hist); -+ assert (super->hist->o); -+ -+ struct bgp_pgbgp_hist *hist = super->hist; -+ -+ for (struct bgp_pgbgp_origin * cur = hist->o; cur != NULL; cur = cur->next) -+ { -+ if (cur->deprefUntil > time (NULL)) -+ continue; -+ fprintf (file, "%d", cur->originAS); -+ if (cur->next != NULL) -+ fprintf (file, " "); -+ } -+ -+ fprintf (file, " |%s\n", aspath_print (at->aspath)); -+ fclose (file); -+} -+ -+/* -+ If the first path is a prefix of the second, then return true -+ */ -+ -+static int -+bgp_pgbgp_pathIsPrefix(struct aspath *trusted, struct aspath * new) -+{ -+ if (trusted == new) -+ return true; -+ -+ struct assegment *seg1 = trusted->segments; -+ struct assegment *seg2 = new->segments; -+ -+ while (seg1 || seg2) -+ { -+ if ((!seg1 && seg2) || (seg1 && !seg2)) -+ return false; -+ if (seg1->type != seg2->type) -+ return false; -+ -+ if (seg1->length > seg2->length) -+ return false; -+ -+ for(int i = 0; i < seg1->length; i++) -+ if (seg1->as[i] != seg2->as[i]) -+ return false; -+ -+ seg1 = seg1->next; -+ seg2 = seg2->next; -+ } -+ -+ return true; -+} -+ -+int -+bgp_pgbgp_updatePrefix (struct bgp_pgbgp_hist *hist, -+ struct bgp_node *supernode, struct bgp_info *binfo, -+ struct attr *at, struct bgp_node *rn, time_t t_now, -+ int newPeer) -+{ -+ struct bgp_pgbgp_prefix *pre = NULL; -+ struct bgp_pgbgp_reuse *r = NULL; -+ int status = 0; -+ int changed = false; -+ -+ pre = hist->p; -+ -+ -+ /* Do we have this prefix? */ -+ if (pre == NULL) -+ { -+ pre = -+ XCALLOC (MTYPE_BGP_PGBGP_PREFIX, sizeof (struct bgp_pgbgp_prefix)); -+ hist->p = pre; -+ } -+ -+ /* Is the prefix currently marked as suspicious? */ -+ if (pre->ignoreUntil > t_now) -+ { -+ goto UPP_IGNORE; -+ } -+ -+ /* Should this neighbor be avoided for this prefix because it -+ sent us info. about a suspicious sub-prefix? */ -+ for (struct bgp_pgbgp_avoid * av = hist->p->avoid; av; av = av->next) -+ { -+ if (binfo->peer->as == av->peerASN && av->avoidUntil > t_now) -+ { -+ SET_FLAG (binfo->flags, BGP_INFO_SUSPICIOUS_P); -+ status = BGP_INFO_SUSPICIOUS_P; -+ goto UPP_DONE; -+ } -+ } -+ -+ /* Have we seen the prefix recently? */ -+ if (pre->lastSeen + pgbgp->prefix_hist_time > t_now) -+ goto UPP_DONE; -+ -+#ifndef PGBGP_DEBUG -+ /* Are we within the initial grace period? */ -+ if (newPeer) -+ goto UPP_DONE; -+#endif -+ -+ /* Is there a less specific *in recent history* that this could be hijacking? */ -+ if (supernode == NULL) -+ goto UPP_DONE; -+ -+ /* Does this path the super-net's non-anomalous path from this peer? If so it's okay */ -+ int found = false; -+ for (struct bgp_info * ri = supernode->info; ri; ri = ri->next) -+ { -+ if (ri->peer->as == binfo->peer->as) -+ { -+ if (!ANOMALOUS(ri->flags) && bgp_pgbgp_pathIsPrefix(ri->attr->aspath, at->aspath)) -+ found = true; -+ break; -+ } -+ } -+ -+ if (found) -+ goto UPP_DONE; -+ -+ /* -+ It's not in recent history, and there is a less specific currently in use -+ Response: -+ . Ignore this prefix -+ . Make the less specific's route for this neighbor suspicious -+ */ -+ -+ -+ pre->ignoreUntil = t_now + pgbgp->sub_sus_time; -+ -+ struct bgp_pgbgp_pathSet pathOrigins; -+ pathOrigins = bgp_pgbgp_pathOrigin (at->aspath); -+ for (int i = 0; i < pathOrigins.length; i++) -+ bgp_pgbgp_logSubprefixAnomaly (pathOrigins.ases[i], rn, at, supernode); -+ -+ -+ -+ r = XCALLOC (MTYPE_BGP_PGBGP_REUSE, sizeof (struct bgp_pgbgp_reuse)); -+ r->type = PGBGP_REUSE_PREFIX; -+ r->deprefUntil = pre->ignoreUntil; -+ r->data.prefix.rn = rn; -+ r->data.prefix.rnsuper = supernode; -+ bgp_lock_node (rn); -+ bgp_lock_node (supernode); -+ pqueue_enqueue (r, pgbgp->reuse_q); -+ pgbgp->rq_size += 1; -+ -+UPP_IGNORE: -+ // Sanity check -+ if (supernode == NULL) -+ goto UPP_DONE; -+ -+ /* Set the less specific's route from this peer to suspicious */ -+ changed = false; -+ -+ for (struct bgp_info * ri = supernode->info; ri; ri = ri->next) -+ { -+ if (ri->peer->as == binfo->peer->as) -+ { -+ if (!CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_P)) -+ { -+ SET_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_P); -+ changed = true; -+ } -+ break; -+ } -+ } -+ -+ // Make note of it in the less specific's history information -+ found = false; -+ struct bgp_pgbgp_hist *superhist = supernode->hist; -+ -+ if (superhist && superhist->p) -+ { -+ for (struct bgp_pgbgp_avoid * av = superhist->p->avoid; av; -+ av = av->next) -+ { -+ if (av->peerASN == binfo->peer->as) -+ { -+ if (av->avoidUntil < pre->ignoreUntil) -+ av->avoidUntil = pre->ignoreUntil; -+ found = true; -+ break; -+ } -+ } -+ if (!found) -+ { -+ struct bgp_pgbgp_avoid *newavoid = -+ XCALLOC (MTYPE_BGP_PGBGP_AVOID, sizeof (struct bgp_pgbgp_avoid)); -+ newavoid->peerASN = binfo->peer->as; -+ newavoid->avoidUntil = pre->ignoreUntil; -+ newavoid->next = superhist->p->avoid; -+ newavoid->sub = rn; -+ bgp_lock_node (rn); -+ superhist->p->avoid = newavoid; -+ } -+ } -+ /* -+ ignore this route unless the supernet's node -+ is only a placeholder from loaded pgbgp data -+ */ -+ if (bgp_pgbgp_shouldIgnore (supernode, bgp_pgbgp_selected (supernode))) -+ { -+ SET_FLAG (binfo->flags, BGP_INFO_IGNORED_P); -+ status = BGP_INFO_IGNORED_P; -+ } -+ if (changed) -+ { -+ struct bgp_info *ri = supernode->info; -+ bgp_process (ri->peer->bgp, supernode, supernode->table->afi, -+ supernode->table->safi); -+ } -+ -+UPP_DONE: -+ pre->lastSeen = t_now; -+ -+ return status; -+} -+ -+int -+bgp_pgbgp_reusePrefix (struct bgp_pgbgp_r_prefix data) -+{ -+ struct bgp_info *ri = NULL; -+ -+ time_t t_now = time (NULL); -+ -+ // Repreference all routes for this node -+ for (ri = data.rn->info; ri; ri = ri->next) -+ UNSET_FLAG (ri->flags, BGP_INFO_IGNORED_P); -+ ri = data.rn->info; -+ -+ // Rerun the decision process -+ if (ri != NULL) -+ bgp_process (ri->peer->bgp, data.rn, data.rn->table->afi, -+ data.rn->table->safi); -+ -+ -+ // Remove the avoid nodes from the super -+ struct bgp_pgbgp_hist *superhist = data.rnsuper->hist; -+ if (superhist != NULL && superhist->p != NULL) -+ { -+ struct bgp_pgbgp_avoid *parent = NULL; -+ for (struct bgp_pgbgp_avoid * av = superhist->p->avoid; av;) -+ { -+ int numChanged = 0; -+ if (av->avoidUntil <= t_now) -+ { -+ struct bgp_pgbgp_avoid *del = av; -+ av = av->next; -+ if (parent == NULL) -+ superhist->p->avoid = av; -+ else -+ parent->next = av; -+ -+ // Repreference any routes -+ for (ri = data.rnsuper->info; ri; ri = ri->next) -+ { -+ if (ri->peer->as == del->peerASN) -+ { -+ UNSET_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_P); -+ numChanged += 1; -+ break; -+ } -+ } -+ ri = data.rnsuper->info; -+ -+ if (numChanged > 0 && ri != NULL) -+ bgp_process (ri->peer->bgp, data.rnsuper, -+ data.rnsuper->table->afi, -+ data.rnsuper->table->safi); -+ bgp_unlock_node (del->sub); -+ XFREE (MTYPE_BGP_PGBGP_AVOID, del); -+ } -+ else -+ { -+ parent = av; -+ av = av->next; -+ } -+ } -+ } -+ -+ // Remove this prefix from the normal database -+ // if it hasn't been seen in the RIB since the last -+ // storage run -+ /* -+ struct bgp_pgbgp_hist *hist = rn->hist; -+ struct bgp_pgbgp_prefix * pre = hist->p; -+ -+ if (pre && pre->lastSeen < pgbgp->lastStore) -+ { -+ // Delete this node -+ for(struct bgp_pgbgp_avoid * av = hist->p->avoid; av;) -+ { -+ struct bgp_pgbgp_avoid *del = av; -+ av = av->next; -+ bgp_unlock_node(del->sub); -+ XFREE (MTYPE_BGP_PGBGP_AVOID, del); -+ } -+ XFREE(MTYPE_BGP_PGBGP_PREFIX, pre); -+ hist->p = NULL; -+ } -+ */ -+ bgp_unlock_node (data.rn); -+ bgp_unlock_node (data.rnsuper); -+ return 0; -+} -+ -+/*! --------------- Sub-Prefix Detection ------------------ !*/ -+ -+ -+ -+ -+ -+/* --------------- Edge Detection ------------------ */ -+ -+static void -+edge_store_clear_iterator (struct hash_backet *backet, void *file) -+{ -+ struct bgp_pgbgp_edge *hedge = backet->data; -+} -+ -+static void -+edge_store_iterator (struct hash_backet *backet, FILE * file) -+{ -+ struct bgp_pgbgp_edge *hedge = backet->data; -+ time_t t_now = time (NULL); -+ if (hedge->deprefUntil > t_now) -+ return; -+ if (hedge->lastSeen + pgbgp->edge_hist_time > t_now) -+ { -+ fprintf (file, "%d %u %u %lld\n", EDGE_ID, hedge->e.a, hedge->e.b, -+ (long long int) hedge->lastSeen); -+ } -+} -+ -+ -+void -+bgp_pgbgp_storeEdges (struct bgp_table *table, FILE * file) -+{ -+ hash_iterate (pgbgp->edgeT, -+ (void (*)(struct hash_backet *, void *)) -+ edge_store_iterator, file); -+ return; -+} -+ -+ -+int -+bgp_pgbgp_restoreEdge (FILE * file) -+{ -+ unsigned int a, b; -+ long long int lastSeen; -+ fscanf (file, "%u %u %lld", &a, &b, &lastSeen); -+ struct bgp_pgbgp_edge finder; -+ finder.e.a = a; -+ finder.e.b = b; -+ finder.lastSeen = lastSeen; -+ struct bgp_pgbgp_edge *hedge = -+ hash_get (pgbgp->edgeT, &finder, edge_hash_alloc); -+ hedge->lastSeen = finder.lastSeen; -+ return 0; -+} -+ -+unsigned int -+edge_key_make (void *p) -+{ -+ struct bgp_pgbgp_edge *pe = p; -+ struct edge *e = &pe->e; -+ return (e->a << 16) + e->b; -+} -+ -+static int -+edge_cmp (const void *arg1, const void *arg2) -+{ -+ -+ const struct edge *e1 = &((const struct bgp_pgbgp_edge *) arg1)->e; -+ const struct edge *e2 = &((const struct bgp_pgbgp_edge *) arg2)->e; -+ if (e1->a == e2->a && e1->b == e2->b) -+ return 1; -+ return 0; -+} -+ -+static void * -+edge_hash_alloc (void *arg) -+{ -+ struct bgp_pgbgp_edge *hedge = -+ XCALLOC (MTYPE_BGP_PGBGP_EDGE, sizeof (struct bgp_pgbgp_edge)); -+ struct bgp_pgbgp_edge *lookup = arg; -+ if (hedge == NULL) -+ return NULL; -+ hedge->e = lookup->e; -+ return hedge; -+} -+ -+ -+static void -+edge_gc_iterator (struct hash_backet *backet, time_t * time) -+{ -+ time_t t_now = *time; -+ struct bgp_pgbgp_edge *hedge = backet->data; -+ -+ int collect = false; -+ -+ // Collect if we haven't seen it in awhile -+ if (hedge->lastSeen + pgbgp->edge_hist_time <= t_now) -+ collect = true; -+ -+ // Collect if it has just gotten out of anomaly stage -+ // but hasn't been in the RIB since the last GC -+ if (hedge->deprefUntil != 0 && hedge->deprefUntil < t_now) -+ { -+ if (hedge->lastSeen < pgbgp->lastgc) -+ collect = true; -+ hedge->deprefUntil = 0; -+ } -+ -+ if (collect) -+ { -+ struct bgp_pgbgp_edge *ret = hash_release (pgbgp->edgeT, hedge); -+ assert (ret != NULL); -+ XFREE (MTYPE_BGP_PGBGP_EDGE, hedge); -+ } -+} -+ -+ -+ -+static void -+edge_update_iterator (struct hash_backet *backet, void *v) -+{ -+ struct aspath *p = backet->data; -+ time_t t_now = time (NULL); -+ int first = true; -+ -+ struct edge cur; -+ cur.a = 0; -+ cur.b = 0; -+ struct assegment *seg; -+ struct bgp_pgbgp_edge *hedge = NULL; -+ for (seg = p->segments; seg; seg = seg->next) -+ { -+ for (int i = 0; i < seg->length; i++) -+ { -+ cur.a = cur.b; -+ cur.b = seg->as[i]; -+ if (first) -+ { -+ first = false; -+ continue; -+ } -+ if (cur.a == cur.b) -+ continue; -+ // printf("%d -- %d\n", cur.a, cur.b); -+ struct bgp_pgbgp_edge finder; -+ finder.e = cur; -+ hedge = hash_lookup (pgbgp->edgeT, &finder); -+ -+ if (!hedge) -+ continue; -+ hedge->lastSeen = t_now; -+ } -+ } -+} -+ -+int -+bgp_pgbgp_garbageCollectEdges (struct bgp_table *table) -+{ -+ // Update the timings -+ hash_iterate (ashash, -+ (void (*)(struct hash_backet *, void *)) -+ edge_update_iterator, NULL); -+ -+ // Perform the collection -+ time_t t_now = time (NULL); -+ hash_iterate (pgbgp->edgeT, -+ (void (*)(struct hash_backet *, void *)) -+ edge_gc_iterator, &t_now); -+ return 0; -+} -+ -+static void -+edge_clean_iterator (struct hash_backet *backet, void *a1) -+{ -+ struct bgp_pgbgp_edge *hedge = backet->data; -+ struct bgp_pgbgp_edge *ret = hash_release (pgbgp->edgeT, hedge); -+ assert (ret != NULL); -+ XFREE (MTYPE_BGP_PGBGP_EDGE, hedge); -+} -+ -+static void -+bgp_pgbgp_cleanEdges (void) -+{ -+ if (pgbgp->edgeT != NULL) -+ { -+ hash_iterate (pgbgp->edgeT, -+ (void (*)(struct hash_backet *, void *)) -+ edge_clean_iterator, NULL); -+ hash_free (pgbgp->edgeT); -+ } -+ return; -+} -+ -+void -+bgp_pgbgp_logEdgeAnomaly (struct bgp_node *rn, struct attr *at, -+ struct edge *edge) -+{ -+ assert (pgbgp); -+ if (!pgbgp->anomalies) -+ return; -+ FILE *file = fopen (pgbgp->anomalies, "a"); -+ if (!file) -+ return; -+ -+ char pre[256]; -+ prefix2str (&rn->p, pre, sizeof (pre)); -+ -+ // EDGE | TIME | NEXTHOP | PREFIX | PATH | Edge.a | Edge.b -+ -+ fprintf (file, "%d|%lld|%s|%s|%s|%d|%d\n", EDGE, -+ (long long int) time (NULL), inet_ntoa (at->nexthop), pre, -+ aspath_print (at->aspath), edge->a, edge->b); -+ -+ fclose (file); -+} -+ -+ -+int -+bgp_pgbgp_updateEdge (struct bgp_pgbgp_hist *hist, struct bgp_info *binfo, -+ struct attr *at, struct bgp_node *rn, time_t t_now, -+ int newPeer) -+{ -+ -+ char first = true; -+ struct edge curEdge; -+ curEdge.a = 0; -+ curEdge.b = 0; -+ -+ -+ if (at->aspath == NULL) -+ return 0; -+ struct assegment *seg = at->aspath->segments; -+ if (seg == NULL) -+ return 0; -+ time_t max_depref = 0; -+ for (seg = at->aspath->segments; seg; seg = seg->next) -+ { -+ for (int i = 0; i < seg->length; i++) -+ { -+ curEdge.a = curEdge.b; -+ curEdge.b = seg->as[i]; -+ if (first) -+ { -+ first = false; -+ continue; -+ } -+ if (curEdge.a == curEdge.b) -+ continue; -+ -+ // We have an edge to consider -+ struct bgp_pgbgp_edge finder; -+ finder.e = curEdge; -+ struct bgp_pgbgp_edge *hedge = -+ hash_get (pgbgp->edgeT, &finder, edge_hash_alloc); -+ -+ // Is this edge marked as suspicious? -+ if (hedge->deprefUntil > t_now) -+ goto UPE_DEPREF; -+ -+ // Have we seen the edge recently? -+ if (hedge->lastSeen + pgbgp->edge_hist_time > t_now) -+ goto UPE_CLEAN; -+#ifndef PGBGP_DEBUG -+ /* Are we within the initial grace period? */ -+ if (newPeer) -+ goto UPE_CLEAN; -+#endif -+ // It must not be in recent history, depref edge for first time -+ hedge->deprefUntil = t_now + pgbgp->edge_sus_time; -+ bgp_pgbgp_logEdgeAnomaly (rn, at, &curEdge); -+ -+ -+ UPE_DEPREF: -+ if (hedge->deprefUntil > max_depref) -+ max_depref = hedge->deprefUntil; -+ UPE_CLEAN: -+ hedge->lastSeen = t_now; -+ } -+ } -+ if (max_depref) -+ { -+ SET_FLAG (binfo->flags, BGP_INFO_SUSPICIOUS_E); -+ if (!hist->pEdgeReuse) -+ { -+ struct bgp_pgbgp_reuse *r; -+ r = -+ XCALLOC (MTYPE_BGP_PGBGP_REUSE, sizeof (struct bgp_pgbgp_reuse)); -+ r->type = PGBGP_REUSE_EDGE; -+ r->deprefUntil = max_depref; -+ r->data.edge.rn = rn; -+ bgp_lock_node (rn); -+ pqueue_enqueue (r, pgbgp->reuse_q); -+ pgbgp->rq_size += 1; -+ hist->pEdgeReuse = r; -+ } -+ return BGP_INFO_SUSPICIOUS_E; -+ } -+ -+ return 0; -+} -+ -+int -+bgp_pgbgp_reuseEdge (struct bgp_pgbgp_r_edge data) -+{ -+ -+ // Okay, go through all of the paths for the prefix -+ // and find the path that needs to be updated next and -+ // enqueue it -+ time_t minMax = 0; -+ int numChanged = 0; -+ time_t t_now = time (NULL); -+ -+ for (struct bgp_info * ri = data.rn->info; ri; ri = ri->next) -+ { -+ char first = true; -+ struct edge curEdge = { 0, 0 }; -+ struct assegment *seg; -+ time_t max_depref = 0; -+ -+ for (seg = ri->attr->aspath->segments; seg; seg = seg->next) -+ { -+ for (int i = 0; i < seg->length; i++) -+ { -+ curEdge.a = curEdge.b; -+ curEdge.b = seg->as[i]; -+ if (first) -+ { -+ first = false; -+ continue; -+ } -+ struct bgp_pgbgp_edge finder; -+ finder.e = curEdge; -+ struct bgp_pgbgp_edge *hedge = -+ hash_lookup (pgbgp->edgeT, &finder); -+ if (!hedge) -+ continue; -+ // Is this edge suspicious? -+ if (hedge->deprefUntil > t_now -+ && hedge->deprefUntil > max_depref) -+ max_depref = hedge->deprefUntil; -+ } -+ } -+ -+ if (max_depref) -+ { -+ if (!minMax || max_depref < minMax) -+ minMax = max_depref; -+ } -+ else -+ { -+ if (CHECK_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_E)) -+ { -+ UNSET_FLAG (ri->flags, BGP_INFO_SUSPICIOUS_E); -+ numChanged += 1; -+ } -+ } -+ } -+ struct bgp_info *ri = data.rn->info; -+ if (numChanged > 0 && ri) -+ bgp_process (ri->peer->bgp, data.rn, data.rn->table->afi, -+ data.rn->table->safi); -+ -+ struct bgp_pgbgp_hist *hist = data.rn->hist; -+ hist->pEdgeReuse = NULL; -+ -+ if (minMax) -+ { -+ struct bgp_pgbgp_reuse *r; -+ r = XCALLOC (MTYPE_BGP_PGBGP_REUSE, sizeof (struct bgp_pgbgp_reuse)); -+ r->type = PGBGP_REUSE_EDGE; -+ r->deprefUntil = minMax; -+ r->data.edge.rn = data.rn; -+ pqueue_enqueue (r, pgbgp->reuse_q); -+ pgbgp->rq_size += 1; -+ hist->pEdgeReuse = r; -+ } -+ else -+ { -+ bgp_unlock_node (data.rn); -+ } -+ -+ return 0; -+} ---- /dev/null -+++ b/bgpd/bgp_pgbgp.h -@@ -0,0 +1,286 @@ -+/* BGP Pretty Good BGP -+ Copyright (C) 2008 University of New Mexico (Josh Karlin) -+ -+This file is part of GNU Zebra. -+ -+GNU Zebra is free software; you can redistribute it and/or modify it -+under the terms of the GNU General Public License as published by the -+Free Software Foundation; either version 2, or (at your option) any -+later version. -+ -+GNU Zebra is distributed in the hope that it will be useful, but -+WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+General Public License for more details. -+ -+You should have received a copy of the GNU General Public License -+along with GNU Zebra; see the file COPYING. If not, write to the Free -+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -+02111-1307, USA. */ -+ -+#ifndef _QUAGGA_BGP_PGBGP_H -+#define _QUAGGA_BGP_PGBGP_H -+ -+#include "bgpd.h" -+#include "bgp_route.h" -+#include "table.h" -+ -+#define MOAS 0 -+#define SUBPREFIX 1 -+#define EDGE 2 -+ -+/* Global PGBGP data */ -+struct bgp_pgbgp_config -+{ -+ /* Depref time for a new origin AS */ -+ time_t origin_sus_time; -+ -+ /* Depref time for a new edge */ -+ time_t edge_sus_time; -+ -+ /* Depref time for a new sub-prefix */ -+ time_t sub_sus_time; -+ -+ /* Origin AS Mapping History Length */ -+ time_t origin_hist_time; -+ -+ /* Prefix Mapping History Length */ -+ time_t prefix_hist_time; -+ -+ /* Edge Mapping History Length */ -+ time_t edge_hist_time; -+ -+ /* Peer Mapping History Length */ -+ time_t peer_hist_time; -+ -+ /* The list of depreferenced routes */ -+ struct pqueue *reuse_q; -+ int rq_size; -+ -+ /* Time that the last garbage collection (gc) took place */ -+ time_t lastgc; -+ -+ /* History table */ -+ // struct route_table *histT; -+ -+ /* Edge Hash Table */ -+ struct hash *edgeT; -+ -+ /* File path for history storage */ -+ char *storage; -+ -+ /* File path for dump of anomalous routes */ -+ char *anomalies; -+ -+ /* The time that we last stored to disk */ -+ time_t lastStore; -+ -+ /* The time that PGBGP started counting */ -+ time_t startTime; -+ -+ /* Last time each peer was seen */ -+ struct bgp_pgbgp_peerTime *peerLast; -+ -+}; -+ -+ -+struct bgp_pgbgp_peerTime -+{ -+ struct bgp_pgbgp_peerTime *next; -+ time_t lastSeen; -+ union sockunion su; -+ time_t deprefUntil; -+}; -+ -+struct edge -+{ -+ as_t a; -+ as_t b; -+}; -+ -+/* -+ Avoid the neighbors for the less specific that told you about -+ the more specific -+ */ -+struct bgp_pgbgp_avoid -+{ -+ struct bgp_pgbgp_avoid *next; -+ time_t avoidUntil; -+ as_t peerASN; -+ struct bgp_node *sub; -+}; -+ -+/* A list of origin ASes for a path -+ Usually it's only one but if the last AS -+ in the path is an AS set, then the whole -+ set must be returned -+*/ -+struct bgp_pgbgp_pathSet -+{ -+ int length; -+ as_t *ases; -+}; -+ -+/* -+ Avoid paths with suspicious origins -+ */ -+struct bgp_pgbgp_origin -+{ -+ struct bgp_pgbgp_origin *next; -+ time_t lastSeen; -+ time_t deprefUntil; -+ as_t originAS; -+}; -+ -+/* -+ Ignore routes for this prefix -+ */ -+struct bgp_pgbgp_prefix -+{ -+ time_t lastSeen; -+ time_t ignoreUntil; -+ struct bgp_pgbgp_avoid *avoid; -+}; -+ -+struct bgp_pgbgp_edge -+{ -+ time_t lastSeen; -+ time_t deprefUntil; -+ struct edge e; -+}; -+ -+struct bgp_pgbgp_hist -+{ -+ struct bgp_pgbgp_origin *o; -+ struct bgp_pgbgp_prefix *p; -+ struct bgp_pgbgp_reuse *pEdgeReuse; -+}; -+ -+struct bgp_pgbgp_r_origin -+{ -+ as_t originAS; -+ struct bgp_node *rn; -+}; -+ -+struct bgp_pgbgp_r_prefix -+{ -+ struct bgp_node *rn; -+ struct bgp_node *rnsuper; -+}; -+ -+/* -+ This node contained a route with a bad edge, check -+ it again for bad edges in 24 hours -+*/ -+struct bgp_pgbgp_r_edge -+{ -+ struct bgp_node *rn; -+}; -+ -+ -+union reuseTypes -+{ -+ struct bgp_pgbgp_r_origin origin; -+ struct bgp_pgbgp_r_prefix prefix; -+ struct bgp_pgbgp_r_edge edge; -+}; -+ -+struct bgp_pgbgp_reuse -+{ -+ union reuseTypes data; -+ short type; -+ time_t deprefUntil; -+}; -+ -+#define ANOMALOUS(V) \ -+(CHECK_FLAG(V, BGP_INFO_SUSPICIOUS_O | BGP_INFO_SUSPICIOUS_P \ -+ | BGP_INFO_SUSPICIOUS_E | BGP_INFO_IGNORED_P)) -+ -+#define PGBGP_REUSE_ORIGIN 0 -+#define PGBGP_REUSE_PREFIX 1 -+#define PGBGP_REUSE_EDGE 2 -+ -+#define BGP_PGBGP_NONE 0 -+#define BGP_PGBGP_DEPREFFED 1 -+ -+// For storage -+#define ORIGIN_ID 0 -+#define PREFIX_ID 1 -+#define EDGE_ID 2 -+#define PEER_ID 3 -+ -+/* Default timing values */ -+#define DEFAULT_ORIGIN_SUS (86400 * 1) -+#define DEFAULT_EDGE_SUS (86400 * 1) -+#define DEFAULT_SUB_SUS (86400 * 1) -+#define DEFAULT_ORIGIN_HIST (86400 * 30) -+#define DEFAULT_PREFIX_HIST (86400 * 10) -+#define DEFAULT_EDGE_HIST (86400 * 60) -+// Time between garbage collections -+#define PGBGP_GC_DELTA (3600) -+// Time between file stores -+#define PGBGP_STORE_DELTA (28800) -+// Time that a new peer's routes are not considered suspicious -+#define PGBGP_PEER_GRACE (86400 * 1) -+ -+ -+ -+///////// PUBLIC PGBGP FUNCTIONS ///////// -+ -+/* -+ bgp_pgbgp_enable: -+ Enable PGBGP depreferencing / history tracking for this afi/safi -+ -+ Arguments: -+ . ost: Depref. time of new prefix origins (in hours) -+ . est: Depref. time of new edges (in hours) -+ . sst: Depref. time of new sub-prefixes (in hours) -+ . oht: Storage time of known origins for prefixes (in days) -+ . pht: Storage time of known prefixes (in days) -+ . eht: Storage time of known edges (in days) -+ . storage: File to periodically store history in (can be /dev/null) -+ . anoms: File to store history of depreferenced routes (can be /dev/null) -+ -+ Caution: -+ It is important that the storage times are longer than the depreference times -+*/ -+extern int bgp_pgbgp_enable (struct bgp *, afi_t afi, safi_t safi, int ost, -+ int est, int sst, int oht, int pht, int eht, -+ const char *storage, const char *anoms); -+extern int bgp_pgbgp_disable (struct bgp *, afi_t afi, safi_t safi); -+ -+/* -+ bgp_pgbgp_update: -+ Call on the event of an announcement update -+ -+ Arguments: -+ bgp_info: The route -+ at: The new route's attributes -+*/ -+extern int bgp_pgbgp_update (struct bgp_info *, struct attr *at, -+ struct bgp_node *); -+ -+/* -+ bgp_pgbgp_rib_updated: -+ Call upon discovery of a new best path (or lack thereof) -+ -+ This is a special case function for smoothly handling sub-prefix hijacks. -+ -+ It handles the following 2 events: -+ -+ Event 1: An anomalous sub-prefix is ignored, but no best route for the super-prefix exists -+ Response: Announce the sub-prefix until the super-prefix comes back -+ -+ Event 2: A super-prefix comes back to the RIB and its anomalous sub-prefix is in use -+ Response: Ignore the sub-prefix again -+ -+ Arguments: -+ rn: The route node that a new best path was found for -+ old_best: The old best route (NULL if one did not exist) -+ new_best: The current best route (NULL if one does not exist) -+ */ -+extern int -+bgp_pgbgp_rib_updated (struct bgp_node *rn, struct bgp_info *old_best, -+ struct bgp_info *new_best); -+ -+#endif ---- a/bgpd/bgp_route.c -+++ b/bgpd/bgp_route.c -@@ -51,6 +51,7 @@ Software Foundation, Inc., 59 Temple Pla - #include "bgpd/bgp_mplsvpn.h" - #include "bgpd/bgp_nexthop.h" - #include "bgpd/bgp_damp.h" -+#include "bgpd/bgp_pgbgp.h" - #include "bgpd/bgp_advertise.h" - #include "bgpd/bgp_zebra.h" - #include "bgpd/bgp_vty.h" -@@ -339,12 +340,19 @@ bgp_info_cmp (struct bgp *bgp, struct bg - - *paths_eq = 0; - -+ - /* 0. Null check. */ - if (new == NULL) - return 0; - if (exist == NULL) - return 1; - -+ /* 0.5 PGBGP Depref. Check */ -+ if (ANOMALOUS(exist->flags) && !ANOMALOUS(new->flags)) -+ return 1; -+ if (!ANOMALOUS(exist->flags) && ANOMALOUS(new->flags)) -+ return 0; -+ - /* 1. Weight check. */ - if (new->attr->extra) - new_weight = new->attr->extra->weight; -@@ -1583,6 +1591,10 @@ bgp_process_main (struct work_queue *wq, - UNSET_FLAG (new_select->flags, BGP_INFO_MULTIPATH_CHG); - } - -+ /* PGBGP needs to know about selected routes */ -+ if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP)) -+ bgp_pgbgp_rib_updated(rn, old_select, new_select); -+ - - /* Check each BGP peer. */ - for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) -@@ -1906,6 +1918,11 @@ bgp_update_rsclient (struct peer *rsclie - /* If the update is implicit withdraw. */ - if (ri) - { -+ /* Update PGBGP state, and mark the route as anomalous if necessary */ -+ if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP) -+ && peer_sort(peer) == BGP_PEER_EBGP) -+ bgp_pgbgp_update(ri, attr_new, rn); -+ - ri->uptime = bgp_clock (); - - /* Same attribute comes in. */ -@@ -2337,6 +2354,11 @@ bgp_update_main (struct peer *peer, stru - /* Increment prefix */ - bgp_aggregate_increment (bgp, p, new, afi, safi); - -+ /* Update PGBGP state, and mark the route as anomalous if necessary */ -+ if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_PGBGP) -+ && peer_sort(peer) == BGP_PEER_EBGP) -+ bgp_pgbgp_update(new, attr_new, rn); -+ - /* Register new BGP information. */ - bgp_info_add (rn, new); - -@@ -5575,6 +5597,20 @@ enum bgp_display_type - static void - route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo) - { -+ if (ANOMALOUS(binfo->flags)) -+ { -+ vty_out(vty, "a["); -+ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_P)) -+ vty_out(vty, "i"); -+ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_O)) -+ vty_out(vty, "p"); -+ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_E)) -+ vty_out(vty, "e"); -+ if (CHECK_FLAG(binfo->flags, BGP_INFO_IGNORED_P)) -+ vty_out(vty, "s"); -+ vty_out(vty, "] "); -+ } -+ - /* Route status display. */ - if (CHECK_FLAG (binfo->flags, BGP_INFO_REMOVED)) - vty_out (vty, "R"); -@@ -6080,6 +6116,7 @@ route_vty_out_detail (struct vty *vty, s - } - - #define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s r RIB-failure, S Stale, R Removed%s" -+#define BGP_SHOW_PCODE_HEADER "Status code: a (anomalous) of: [p] prefix hijack, [s] sub-prefix hijack,%s [i] informant of sub-prefix [e] new edge%s" - #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s" - #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s" - #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s" -@@ -6111,7 +6148,8 @@ enum bgp_show_type - bgp_show_type_flap_route_map, - bgp_show_type_flap_neighbor, - bgp_show_type_dampend_paths, -- bgp_show_type_damp_neighbor -+ bgp_show_type_damp_neighbor, -+ bgp_show_type_anomalous_paths - }; - - static int -@@ -6278,11 +6316,17 @@ bgp_show_table (struct vty *vty, struct - || CHECK_FLAG (ri->flags, BGP_INFO_HISTORY)) - continue; - } -+ if (type == bgp_show_type_anomalous_paths) -+ { -+ if (! ANOMALOUS(ri->flags)) -+ continue; -+ } - - if (header) - { - vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id), VTY_NEWLINE); - vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); -+ vty_out (vty, BGP_SHOW_PCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); - vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); - if (type == bgp_show_type_dampend_paths - || type == bgp_show_type_damp_neighbor) -@@ -6360,6 +6404,7 @@ bgp_show (struct vty *vty, struct bgp *b - return bgp_show_table (vty, table, &bgp->router_id, type, output_arg); - } - -+ - /* Header of detailed BGP route information */ - static void - route_vty_out_detail_header (struct vty *vty, struct bgp *bgp, -@@ -11932,6 +11977,64 @@ DEFUN (bgp_damp_set, - half, reuse, suppress, max); - } - -+DEFUN (bgp_pgbgp_arg, -+ bgp_pgbgp_arg_cmd, -+ "bgp pgbgp <1-100> <1-100> <1-100> <1-365> <1-365> <1-365> WORD WORD", -+ "BGP Specific commands\n" -+ "Enable Pretty Good BGP\n" -+ "New origin depref time (in hours)\n" -+ "New edge depref time (in hours)\n" -+ "New sub-prefix depref time (in hours)\n" -+ "Origin history time (in days)\n" -+ "Prefix history time (in days)\n" -+ "Edge history time (in days)\n" -+ "Log file for history data\n" -+ "Log file of anomalies\n") -+{ -+ struct bgp *bgp; -+ -+ int ost = DEFAULT_ORIGIN_SUS; -+ int est = DEFAULT_EDGE_SUS; -+ int sst = DEFAULT_SUB_SUS; -+ int oht = DEFAULT_ORIGIN_HIST; -+ int pht = DEFAULT_PREFIX_HIST; -+ int eht = DEFAULT_EDGE_HIST; -+ const char* path = "/var/log/quagga/pgbgp_hist"; -+ const char* anoms = "/var/log/quagga/pgbgp_anomalies"; -+ -+ if (argc == 8) -+ { -+ VTY_GET_INTEGER("origin depref time", ost, argv[0]); -+ VTY_GET_INTEGER("edge depref time", est, argv[1]); -+ VTY_GET_INTEGER("sub-prefix depref time", sst, argv[2]); -+ VTY_GET_INTEGER("origin history time", oht, argv[3]); -+ VTY_GET_INTEGER("prefix history time", pht, argv[4]); -+ VTY_GET_INTEGER("edge history time", eht, argv[5]); -+ path = argv[6]; -+ anoms = argv[7]; -+ } -+ -+ bgp = vty->index; -+ return bgp_pgbgp_enable(bgp, bgp_node_afi (vty), bgp_node_safi (vty), -+ ost, est, sst, oht, pht, eht, path, anoms); -+} -+ -+ALIAS (bgp_pgbgp_arg, -+ bgp_pgbgp_cmd, -+ "bgp pgbgp", -+ "BGP specific commands\n" -+ "Enable Pretty Good BGP\n") -+ -+DEFUN (bgp_pgbgp_unset, -+ bgp_pgbgp_unset_cmd, -+ "no bgp pgbgp\n", -+ "BGP specific commands\n") -+{ -+ struct bgp *bgp; -+ bgp = vty->index; -+ return bgp_pgbgp_disable (bgp, bgp_node_afi (vty), bgp_node_safi (vty)); -+} -+ - ALIAS (bgp_damp_set, - bgp_damp_set2_cmd, - "bgp dampening <1-45>", -@@ -11981,6 +12084,19 @@ DEFUN (show_ip_bgp_dampened_paths, - NULL); - } - -+DEFUN (show_ip_bgp_anomalous_paths, -+ show_ip_bgp_anomalous_paths_cmd, -+ "show ip bgp anomalous-paths", -+ SHOW_STR -+ IP_STR -+ BGP_STR -+ "Display anomalous paths (less likely to be used)\n") -+{ -+ return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_anomalous_paths, -+ NULL); -+} -+ -+ - DEFUN (show_ip_bgp_flap_statistics, - show_ip_bgp_flap_statistics_cmd, - "show ip bgp flap-statistics", -@@ -12507,6 +12623,7 @@ bgp_route_init (void) - install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); - install_element (VIEW_NODE, &show_ip_bgp_dampened_paths_cmd); -+ install_element (VIEW_NODE, &show_ip_bgp_anomalous_paths_cmd); - install_element (VIEW_NODE, &show_ip_bgp_flap_statistics_cmd); - install_element (VIEW_NODE, &show_ip_bgp_flap_address_cmd); - install_element (VIEW_NODE, &show_ip_bgp_flap_prefix_cmd); -@@ -12640,6 +12757,7 @@ bgp_route_init (void) - install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_dampened_paths_cmd); -+ install_element (ENABLE_NODE, &show_ip_bgp_anomalous_paths_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_flap_statistics_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_flap_address_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_flap_prefix_cmd); -@@ -13030,6 +13148,10 @@ bgp_route_init (void) - install_element (BGP_IPV4_NODE, &bgp_damp_unset_cmd); - install_element (BGP_IPV4_NODE, &bgp_damp_unset2_cmd); - -+ install_element (BGP_NODE, &bgp_pgbgp_cmd); -+ install_element (BGP_NODE, &bgp_pgbgp_arg_cmd); -+ install_element (BGP_NODE, &bgp_pgbgp_unset_cmd); -+ - /* Deprecated AS-Pathlimit commands */ - install_element (BGP_NODE, &bgp_network_ttl_cmd); - install_element (BGP_NODE, &bgp_network_mask_ttl_cmd); ---- a/bgpd/bgp_route.h -+++ b/bgpd/bgp_route.h -@@ -1,3 +1,4 @@ -+ - /* BGP routing information base - Copyright (C) 1996, 97, 98, 2000 Kunihiro Ishiguro - -@@ -68,7 +69,7 @@ struct bgp_info - int lock; - - /* BGP information status. */ -- u_int16_t flags; -+ u_int32_t flags; - #define BGP_INFO_IGP_CHANGED (1 << 0) - #define BGP_INFO_DAMPED (1 << 1) - #define BGP_INFO_HISTORY (1 << 2) -@@ -82,6 +83,10 @@ struct bgp_info - #define BGP_INFO_COUNTED (1 << 10) - #define BGP_INFO_MULTIPATH (1 << 11) - #define BGP_INFO_MULTIPATH_CHG (1 << 12) -+#define BGP_INFO_SUSPICIOUS_O (1 << 13) -+#define BGP_INFO_SUSPICIOUS_P (1 << 14) -+#define BGP_INFO_IGNORED_P (1 << 15) -+#define BGP_INFO_SUSPICIOUS_E (1 << 16) - - /* BGP route type. This can be static, RIP, OSPF, BGP etc. */ - u_char type; -@@ -126,7 +131,7 @@ struct bgp_static - - /* Flags which indicate a route is unuseable in some form */ - #define BGP_INFO_UNUSEABLE \ -- (BGP_INFO_HISTORY|BGP_INFO_DAMPED|BGP_INFO_REMOVED) -+ (BGP_INFO_HISTORY|BGP_INFO_DAMPED|BGP_INFO_REMOVED|BGP_INFO_IGNORED_P) - /* Macro to check BGP information is alive or not. Sadly, - * not equivalent to just checking previous, because of the - * sense of the additional VALID flag. ---- a/bgpd/bgp_table.h -+++ b/bgpd/bgp_table.h -@@ -65,6 +65,8 @@ struct bgp_node - - int lock; - -+ struct bgp_pgbgp_hist *hist; -+ - u_char flags; - #define BGP_NODE_PROCESS_SCHEDULED (1 << 0) - }; ---- a/bgpd/bgpd.h -+++ b/bgpd/bgpd.h -@@ -123,6 +123,7 @@ struct bgp - /* BGP Per AF flags */ - u_int16_t af_flags[AFI_MAX][SAFI_MAX]; - #define BGP_CONFIG_DAMPENING (1 << 0) -+#define BGP_CONFIG_PGBGP (1 << 1) - - /* Static route configuration. */ - struct bgp_table *route[AFI_MAX][SAFI_MAX]; ---- a/lib/hash.c -+++ b/lib/hash.c -@@ -166,6 +166,35 @@ hash_iterate (struct hash *hash, - } - } - -+/* -+ Iterates until 0 is returned or until completion -+ Return: 1 if iteration completed -+ Return: 0 if iteration was interrupted -+*/ -+ -+int -+hash_iterate_until(struct hash *hash, -+ int (*func) (struct hash_backet *, void *), void *arg) -+{ -+ unsigned int i; -+ struct hash_backet *hb; -+ struct hash_backet *hbnext; -+ int ret; -+ -+ for (i = 0; i < hash->size; i++) -+ for (hb = hash->index[i]; hb; hb = hbnext) -+ { -+ /* get pointer to next hash backet here, in case (*func) -+ * decides to delete hb by calling hash_release -+ */ -+ hbnext = hb->next; -+ ret = (*func) (hb, arg); -+ if (!ret) -+ return 0; -+ } -+ return 1; -+} -+ - /* Clean up hash. */ - void - hash_clean (struct hash *hash, void (*free_func) (void *)) ---- a/lib/hash.h -+++ b/lib/hash.h -@@ -66,7 +66,8 @@ extern void *hash_release (struct hash * - - extern void hash_iterate (struct hash *, - void (*) (struct hash_backet *, void *), void *); -- -+extern int hash_iterate_until(struct hash *, -+ int (*) (struct hash_backet *, void *), void *); - extern void hash_clean (struct hash *, void (*) (void *)); - extern void hash_free (struct hash *); - ---- a/lib/memtypes.c -+++ b/lib/memtypes.c -@@ -148,6 +148,15 @@ struct memory_list memory_list_bgp[] = - { MTYPE_PEER_UPDATE_SOURCE, "BGP peer update interface" }, - { MTYPE_BGP_DAMP_INFO, "Dampening info" }, - { MTYPE_BGP_DAMP_ARRAY, "BGP Dampening array" }, -+ { 0, NULL }, -+ { MTYPE_BGP_PGBGP_ORIGIN, "BGP PGBGP Origin AS Node" }, -+ { MTYPE_BGP_PGBGP_PREFIX, "BGP PGBGP Prefix AS Node" }, -+ { MTYPE_BGP_PGBGP_EDGE, "BGP PGBGP Edge Node" }, -+ { MTYPE_BGP_PGBGP_REUSE, "BGP PGBGP Reuse Node" }, -+ { MTYPE_BGP_PGBGP_HIST, "BGP PGBGP History Node" }, -+ { MTYPE_BGP_PGBGP_AVOID, "BGP PGBGP Avoid Peer Node" }, -+ { MTYPE_BGP_PGBGP_PEER, "BGP PGBGP Peer Timing" }, -+ { 0, NULL }, - { MTYPE_BGP_REGEXP, "BGP regexp" }, - { MTYPE_BGP_AGGREGATE, "BGP aggregate" }, - { -1, NULL } diff --git a/patches/161-pgbgp-addon.patch b/patches/161-pgbgp-addon.patch deleted file mode 100644 index 5bcd907..0000000 --- a/patches/161-pgbgp-addon.patch +++ /dev/null @@ -1,318 +0,0 @@ -From: Paul Jakma -Date: Thu, 4 Sep 2008 22:27:13 +0000 (+0100) -Subject: [bgp/pgbgp] Add some pgbgp commands to restricted-mode and other command tweaks -X-Git-Url: http://git.ozo.com/?p=quagga-pgbg.git;a=commitdiff_plain;h=06ac72f9f6021635e9e1e5105c3e22bf7eb0d6c3 - -[bgp/pgbgp] Add some pgbgp commands to restricted-mode and other command tweaks - -* bgp_pgbgp.c: - (edge_neighbor_iterator) make ASN==0 mean 'iterate over all ASNs' - (bgp_pgbgp_stats_origin_one) new function, to display one origin AS status. - (bgp_pgbgp_stats_origins) adapt to use previous. - Adapt to iterate over all stats if no prefix was giving. - (show_ip_bgp_pgbgp_neighbors_cmd) recognise no ASN argument case - (show_ip_bgp_pgbgp_neighbors_all_cmd) Iterate over all - (show_ip_bgp_pgbgp_origins_cmd) similar - (show_ip_bgp_pgbgp_origins_all_cmd) - (bgp_pgbgp_enable) install the lookup commands to ther new RESTRICTED_NODE -* bgp_route.c: - (route_vty_short_status_out) only allowed to print one char for anomalous - status. - (route_vty_out_detail) Add support for printing out more detail on - PG-BGP status ---- - ---- a/bgpd/bgp_pgbgp.c -+++ b/bgpd/bgp_pgbgp.c -@@ -227,7 +227,7 @@ static void - edge_neighbor_iterator (struct hash_backet *backet, struct nsearch *pns) - { - struct bgp_pgbgp_edge *hedge = backet->data; -- if ((hedge->e.a == pns->asn || hedge->e.b == pns->asn) -+ if ((!pns->asn || hedge->e.a == pns->asn || hedge->e.b == pns->asn) - && hedge->e.a != hedge->e.b) - { - struct vty *vty = pns->pvty; -@@ -254,13 +254,39 @@ bgp_pgbgp_stats_neighbors (struct vty *v - return CMD_SUCCESS; - } - -+static void -+bgp_pgbgp_stats_origin_one (struct vty *vty, struct bgp_node *rn, -+ time_t t_now) -+{ -+ char str[INET6_BUFSIZ]; -+ -+ if (!rn->hist) -+ return; -+ -+ prefix2str (&rn->p, str, sizeof(str)); -+ vty_out (vty, "%s%s", str, VTY_NEWLINE); -+ -+ for (struct bgp_pgbgp_origin * cur = rn->hist->o; cur != NULL; -+ cur = cur->next) -+ { -+ if (cur->deprefUntil > t_now) -+ vty_out (vty, "Untrusted Origin AS: %d%s", cur->originAS, -+ VTY_NEWLINE); -+ else -+ vty_out (vty, "Trusted Origin AS: %d%s", cur->originAS, -+ VTY_NEWLINE); -+ } -+} -+ - static int - bgp_pgbgp_stats_origins (struct vty *vty, afi_t afi, safi_t safi, - const char *prefix) - { - struct bgp *bgp; - struct bgp_table *table; -+ struct bgp_node *rn; - time_t t_now = time (NULL); -+ - bgp = bgp_get_default (); - if (bgp == NULL) - return CMD_WARNING; -@@ -269,28 +295,22 @@ bgp_pgbgp_stats_origins (struct vty *vty - table = bgp->rib[afi][safi]; - if (table == NULL) - return CMD_WARNING; -- -- struct prefix p; -- str2prefix (prefix, &p); -- struct bgp_node *rn = bgp_node_match (table, &p); -- vty_out (vty, "%s%s", prefix, VTY_NEWLINE); -- if (rn) -+ -+ if (prefix) - { -+ struct prefix p; -+ str2prefix (prefix, &p); -+ rn = bgp_node_match (table, &p); - if (rn->hist) -- { -- for (struct bgp_pgbgp_origin * cur = rn->hist->o; cur != NULL; -- cur = cur->next) -- { -- if (cur->deprefUntil > t_now) -- vty_out (vty, "Untrusted Origin AS: %d%s", cur->originAS, -- VTY_NEWLINE); -- else -- vty_out (vty, "Trusted Origin AS: %d%s", cur->originAS, -- VTY_NEWLINE); -- } -- } -+ bgp_pgbgp_stats_origin_one (vty, rn, t_now); - bgp_unlock_node (rn); -+ return CMD_SUCCESS; - } -+ -+ for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn)) -+ if (rn->hist) -+ bgp_pgbgp_stats_origin_one (vty, rn, t_now); -+ - return CMD_SUCCESS; - } - -@@ -377,7 +397,7 @@ bgp_pgbgp_stats (struct vty *vty, afi_t - DEFUN (show_ip_bgp_pgbgp, - show_ip_bgp_pgbgp_cmd, - "show ip bgp pgbgp", -- SHOW_STR IP_STR BGP_STR "Display PGBGP statistics\n") -+ SHOW_STR IP_STR BGP_STR "Pretty-Good BGP statistics\n") - { - return bgp_pgbgp_stats (vty, AFI_IP, SAFI_UNICAST); - } -@@ -385,29 +405,46 @@ DEFUN (show_ip_bgp_pgbgp, - DEFUN (show_ip_bgp_pgbgp_neighbors, - show_ip_bgp_pgbgp_neighbors_cmd, - "show ip bgp pgbgp neighbors WORD", -- SHOW_STR -- IP_STR -- BGP_STR -- "BGP pgbgp\n" -- "BGP pgbgp neighbors\n" "ASN whos neighbors should be displayed\n") -+ SHOW_STR IP_STR BGP_STR -+ "Pretty-Good BGP statistics\n" -+ "PG-BGP neighbor information\n" -+ "AS to show neighbors of\n") - { - return bgp_pgbgp_stats_neighbors (vty, AFI_IP, SAFI_UNICAST, -- atoi (argv[0])); -+ argc == 1 ? atoi (argv[0]) : 0); - } - -+ALIAS (show_ip_bgp_pgbgp_neighbors, -+ show_ip_bgp_pgbgp_neighbors_all_cmd, -+ "show ip bgp pgbgp neighbors", -+ SHOW_STR -+ IP_STR -+ BGP_STR -+ "Pretty-Good BGP statistics\n" -+ "PG-BGP neighbors information\n") -+ - DEFUN (show_ip_bgp_pgbgp_origins, - show_ip_bgp_pgbgp_origins_cmd, - "show ip bgp pgbgp origins A.B.C.D/M", - SHOW_STR - IP_STR - BGP_STR -- "BGP pgbgp\n" -- "BGP pgbgp neighbors\n" "Prefix to look up origin ASes of\n") -+ "Pretty-Good BGP statistics\n" -+ "PG-BGP prefix origin information\n" -+ "Prefix to look up origin ASes of\n") - { -- return bgp_pgbgp_stats_origins (vty, AFI_IP, SAFI_UNICAST, argv[0]); -+ return bgp_pgbgp_stats_origins (vty, AFI_IP, SAFI_UNICAST, -+ argc == 1 ? argv[0] : NULL); - } - -- -+ALIAS (show_ip_bgp_pgbgp_origins, -+ show_ip_bgp_pgbgp_origins_all_cmd, -+ "show ip bgp pgbgp origins", -+ SHOW_STR -+ IP_STR -+ BGP_STR -+ "Pretty-Good BGP statistics\n" -+ "PG-BGP prefixes origin information") - - - /*! --------------- VTY (others exist in bgp_route.c) ------------------ !*/ -@@ -749,12 +786,19 @@ bgp_pgbgp_enable (struct bgp *bgp, afi_t - pgbgp->lastgc = time (NULL); - pgbgp->lastStore = time (NULL); - pgbgp->startTime = time (NULL); -+ install_element (RESTRICTED_NODE, &show_ip_bgp_pgbgp_cmd); -+ install_element (RESTRICTED_NODE, &show_ip_bgp_pgbgp_neighbors_cmd); -+ install_element (RESTRICTED_NODE, &show_ip_bgp_pgbgp_origins_cmd); - install_element (VIEW_NODE, &show_ip_bgp_pgbgp_cmd); -- install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_cmd); - install_element (VIEW_NODE, &show_ip_bgp_pgbgp_neighbors_cmd); -- install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_neighbors_cmd); - install_element (VIEW_NODE, &show_ip_bgp_pgbgp_origins_cmd); -+ install_element (VIEW_NODE, &show_ip_bgp_pgbgp_neighbors_all_cmd); -+ install_element (VIEW_NODE, &show_ip_bgp_pgbgp_origins_all_cmd); -+ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_cmd); -+ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_neighbors_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_origins_cmd); -+ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_neighbors_all_cmd); -+ install_element (ENABLE_NODE, &show_ip_bgp_pgbgp_origins_all_cmd); - pgbgp->edgeT = hash_create_size (131072, edge_key_make, edge_cmp); - bgp_pgbgp_restore (); - return 0; ---- a/bgpd/bgp_route.c -+++ b/bgpd/bgp_route.c -@@ -5597,20 +5597,6 @@ enum bgp_display_type - static void - route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo) - { -- if (ANOMALOUS(binfo->flags)) -- { -- vty_out(vty, "a["); -- if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_P)) -- vty_out(vty, "i"); -- if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_O)) -- vty_out(vty, "p"); -- if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_E)) -- vty_out(vty, "e"); -- if (CHECK_FLAG(binfo->flags, BGP_INFO_IGNORED_P)) -- vty_out(vty, "s"); -- vty_out(vty, "] "); -- } -- - /* Route status display. */ - if (CHECK_FLAG (binfo->flags, BGP_INFO_REMOVED)) - vty_out (vty, "R"); -@@ -5626,6 +5612,17 @@ route_vty_short_status_out (struct vty * - /* Selected */ - if (CHECK_FLAG (binfo->flags, BGP_INFO_HISTORY)) - vty_out (vty, "h"); -+ else if (ANOMALOUS(binfo->flags)) -+ { -+ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_O)) -+ vty_out(vty, "p"); -+ else if (CHECK_FLAG(binfo->flags, BGP_INFO_IGNORED_P)) -+ vty_out(vty, "P"); -+ else if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_P)) -+ vty_out(vty, "a"); -+ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_E)) -+ vty_out(vty, "a"); -+ } - else if (CHECK_FLAG (binfo->flags, BGP_INFO_DAMPED)) - vty_out (vty, "d"); - else if (CHECK_FLAG (binfo->flags, BGP_INFO_SELECTED)) -@@ -6104,7 +6101,22 @@ route_vty_out_detail (struct vty *vty, s - if (binfo->extra && binfo->extra->damp_info) - bgp_damp_info_vty (vty, binfo); - -- /* Line 7 display Uptime */ -+ /* 8: PGBGP status */ -+ if (ANOMALOUS(binfo->flags)) -+ { -+ vty_out (vty, " Anomalous:"); -+ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_P)) -+ vty_out (vty, " divergent sub-prefixes,"); -+ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_O)) -+ vty_out (vty, " origin AS (prefix hijack?),"); -+ if (CHECK_FLAG(binfo->flags, BGP_INFO_SUSPICIOUS_E)) -+ vty_out (vty, " new edge in path,"); -+ if (CHECK_FLAG(binfo->flags, BGP_INFO_IGNORED_P)) -+ vty_out (vty, " origin AS (sub-prefix hijack?),"); -+ vty_out (vty, "%s", VTY_NEWLINE); -+ } -+ -+ /* Line 9 display Uptime */ - #ifdef HAVE_CLOCK_MONOTONIC - tbuf = time(NULL) - (bgp_clock() - binfo->uptime); - vty_out (vty, " Last update: %s", ctime(&tbuf)); -@@ -6115,8 +6127,9 @@ route_vty_out_detail (struct vty *vty, s - vty_out (vty, "%s", VTY_NEWLINE); - } - --#define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s r RIB-failure, S Stale, R Removed%s" --#define BGP_SHOW_PCODE_HEADER "Status code: a (anomalous) of: [p] prefix hijack, [s] sub-prefix hijack,%s [i] informant of sub-prefix [e] new edge%s" -+#define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,%s" \ -+ " r RIB-failure, S Stale, R Removed, %s" \ -+ " p prefix hijack, P sub-prefix hijack, a other anomaly%s" - #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s" - #define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s" - #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s" -@@ -6325,8 +6338,7 @@ bgp_show_table (struct vty *vty, struct - if (header) - { - vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (*router_id), VTY_NEWLINE); -- vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); -- vty_out (vty, BGP_SHOW_PCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); -+ vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); - vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); - if (type == bgp_show_type_dampend_paths - || type == bgp_show_type_damp_neighbor) -@@ -9858,7 +9870,7 @@ show_adj_route (struct vty *vty, struct - PEER_STATUS_DEFAULT_ORIGINATE)) - { - vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); -- vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); -+ vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); - vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); - - vty_out (vty, "Originating default network 0.0.0.0%s%s", -@@ -9875,7 +9887,7 @@ show_adj_route (struct vty *vty, struct - if (header1) - { - vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); -- vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); -+ vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); - vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); - header1 = 0; - } -@@ -9899,7 +9911,7 @@ show_adj_route (struct vty *vty, struct - if (header1) - { - vty_out (vty, "BGP table version is 0, local router ID is %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); -- vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); -+ vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); - vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); - header1 = 0; - } diff --git a/patches/170-use-supported-pagers.patch b/patches/170-use-supported-pagers.patch index d42e145..15595a7 100644 --- a/patches/170-use-supported-pagers.patch +++ b/patches/170-use-supported-pagers.patch @@ -1,6 +1,6 @@ --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c -@@ -269,7 +269,7 @@ vtysh_pager_init (void) +@@ -268,7 +268,7 @@ vtysh_pager_init (void) if (pager_defined) vtysh_pager_name = strdup (pager_defined); else @@ -9,7 +9,7 @@ } /* Command execution over the vty interface. */ -@@ -1885,7 +1885,7 @@ DEFUN (vtysh_terminal_length, +@@ -1884,7 +1884,7 @@ DEFUN (vtysh_terminal_length, { int lines; char *endptr = NULL; @@ -18,7 +18,7 @@ lines = strtol (argv[0], &endptr, 10); if (lines < 0 || lines > 512 || *endptr != '\0') -@@ -1902,7 +1902,7 @@ DEFUN (vtysh_terminal_length, +@@ -1901,7 +1901,7 @@ DEFUN (vtysh_terminal_length, if (lines != 0) { From c377d13b861319dcf63fb60ca2f6a9eab7bde181 Mon Sep 17 00:00:00 2001 From: p4u Date: Tue, 4 Jun 2013 23:39:49 +0200 Subject: [PATCH 111/117] Change dependence name to libjson-c (changed in openwrt-trunk --- bmx6/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bmx6/Makefile b/bmx6/Makefile index 689fa6f..dea2c5d 100644 --- a/bmx6/Makefile +++ b/bmx6/Makefile @@ -82,7 +82,7 @@ endef define Package/bmx6-json $(call Package/bmx6/Default) - DEPENDS:=bmx6 +libjson + DEPENDS:=bmx6 +libjson-c TITLE:=json plugin based on jsonc endef From d0e2f73104fa96281518b85dbd27955f861147d3 Mon Sep 17 00:00:00 2001 From: p4u Date: Tue, 4 Jun 2013 23:41:01 +0200 Subject: [PATCH 112/117] Remove obsolete package bmxd not maintained anymore --- bmxd/Makefile | 75 -------------------------------------- bmxd/files/etc/config/bmxd | 9 ----- bmxd/files/etc/init.d/bmxd | 51 -------------------------- 3 files changed, 135 deletions(-) delete mode 100644 bmxd/Makefile delete mode 100644 bmxd/files/etc/config/bmxd delete mode 100644 bmxd/files/etc/init.d/bmxd diff --git a/bmxd/Makefile b/bmxd/Makefile deleted file mode 100644 index 5dfd7f9..0000000 --- a/bmxd/Makefile +++ /dev/null @@ -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 -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)) diff --git a/bmxd/files/etc/config/bmxd b/bmxd/files/etc/config/bmxd deleted file mode 100644 index c8619e9..0000000 --- a/bmxd/files/etc/config/bmxd +++ /dev/null @@ -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' diff --git a/bmxd/files/etc/init.d/bmxd b/bmxd/files/etc/init.d/bmxd deleted file mode 100644 index d23b4c8..0000000 --- a/bmxd/files/etc/init.d/bmxd +++ /dev/null @@ -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 -} From 40d5775826476ee61de41fe8bbbe55238fe6de06 Mon Sep 17 00:00:00 2001 From: Vasilis Tsiligiannis Date: Fri, 28 Jun 2013 13:44:42 +0300 Subject: [PATCH 113/117] quagga: Move files in package directory --- Makefile => quagga/Makefile | 0 {files => quagga/files}/quagga | 0 {files => quagga/files}/quagga.conf | 0 {files => quagga/files}/quagga.init | 0 {patches => quagga/patches}/120-quagga_manet.patch | 0 {patches => quagga/patches}/140-holdtimer-set.patch | 0 {patches => quagga/patches}/150-no-cross-fs-link.patch | 0 {patches => quagga/patches}/170-use-supported-pagers.patch | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename Makefile => quagga/Makefile (100%) rename {files => quagga/files}/quagga (100%) rename {files => quagga/files}/quagga.conf (100%) rename {files => quagga/files}/quagga.init (100%) rename {patches => quagga/patches}/120-quagga_manet.patch (100%) rename {patches => quagga/patches}/140-holdtimer-set.patch (100%) rename {patches => quagga/patches}/150-no-cross-fs-link.patch (100%) rename {patches => quagga/patches}/170-use-supported-pagers.patch (100%) diff --git a/Makefile b/quagga/Makefile similarity index 100% rename from Makefile rename to quagga/Makefile diff --git a/files/quagga b/quagga/files/quagga similarity index 100% rename from files/quagga rename to quagga/files/quagga diff --git a/files/quagga.conf b/quagga/files/quagga.conf similarity index 100% rename from files/quagga.conf rename to quagga/files/quagga.conf diff --git a/files/quagga.init b/quagga/files/quagga.init similarity index 100% rename from files/quagga.init rename to quagga/files/quagga.init diff --git a/patches/120-quagga_manet.patch b/quagga/patches/120-quagga_manet.patch similarity index 100% rename from patches/120-quagga_manet.patch rename to quagga/patches/120-quagga_manet.patch diff --git a/patches/140-holdtimer-set.patch b/quagga/patches/140-holdtimer-set.patch similarity index 100% rename from patches/140-holdtimer-set.patch rename to quagga/patches/140-holdtimer-set.patch diff --git a/patches/150-no-cross-fs-link.patch b/quagga/patches/150-no-cross-fs-link.patch similarity index 100% rename from patches/150-no-cross-fs-link.patch rename to quagga/patches/150-no-cross-fs-link.patch diff --git a/patches/170-use-supported-pagers.patch b/quagga/patches/170-use-supported-pagers.patch similarity index 100% rename from patches/170-use-supported-pagers.patch rename to quagga/patches/170-use-supported-pagers.patch From 1fb0f3bcfeaafbd1631e769837fb26e3c86669cf Mon Sep 17 00:00:00 2001 From: Saverio Proto Date: Mon, 1 Jul 2013 15:35:57 +0200 Subject: [PATCH 114/117] Move files to ndppd folder for import in openwrt-routing feed --- Makefile => ndppd/Makefile | 0 {files => ndppd/files}/ndppd.init | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename Makefile => ndppd/Makefile (100%) rename {files => ndppd/files}/ndppd.init (100%) diff --git a/Makefile b/ndppd/Makefile similarity index 100% rename from Makefile rename to ndppd/Makefile diff --git a/files/ndppd.init b/ndppd/files/ndppd.init similarity index 100% rename from files/ndppd.init rename to ndppd/files/ndppd.init From adbb4cb247daa18d63cb54b8bf977caf7744abdf Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Wed, 24 Jul 2013 16:48:40 +0800 Subject: [PATCH 115/117] batman-adv: upgrade package to latest release 2013.3.0 Signed-off-by: Marek Lindner --- batman-adv/Makefile | 35 ++- ...he-proper-header-len-when-checking-t.patch | 74 ------ ...tocol-argument-to-packet-tagging-fun.patch | 69 ------ ...-proto-length-before-accessing-proto.patch | 33 --- ...heck-return-value-of-pskb_trim_rcsum.patch | 44 ---- ...DAT-drop-ARP-requests-targeting-loca.patch | 48 ---- ...er-clean-up-routine-in-order-to-avoi.patch | 57 ----- ...Avoid-double-freeing-of-bat_counters.patch | 47 ---- ...for-rtnl-in-batadv_store_mesh_iface-.patch | 42 ---- ...-handle-address-updates-when-bla-is-.patch | 35 --- ...forward-late-OGMs-from-best-next-hop.patch | 226 ------------------ 11 files changed, 24 insertions(+), 686 deletions(-) delete mode 100644 batman-adv/patches/0001-batman-adv-use-the-proper-header-len-when-checking-t.patch delete mode 100644 batman-adv/patches/0002-batman-adv-vlan-add-protocol-argument-to-packet-tagging-fun.patch delete mode 100644 batman-adv/patches/0003-batman-adv-check-proto-length-before-accessing-proto.patch delete mode 100644 batman-adv/patches/0004-batman-adv-check-return-value-of-pskb_trim_rcsum.patch delete mode 100644 batman-adv/patches/0005-batman-adv-make-DAT-drop-ARP-requests-targeting-loca.patch delete mode 100644 batman-adv/patches/0006-batman-adv-reorder-clean-up-routine-in-order-to-avoi.patch delete mode 100644 batman-adv/patches/0007-batman-adv-Avoid-double-freeing-of-bat_counters.patch delete mode 100644 batman-adv/patches/0008-batman-adv-wait-for-rtnl-in-batadv_store_mesh_iface-.patch delete mode 100644 batman-adv/patches/0009-batman-adv-Don-t-handle-address-updates-when-bla-is-.patch delete mode 100644 batman-adv/patches/0010-batman-adv-forward-late-OGMs-from-best-next-hop.patch diff --git a/batman-adv/Makefile b/batman-adv/Makefile index 1e77051..977d180 100644 --- a/batman-adv/Makefile +++ b/batman-adv/Makefile @@ -10,11 +10,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2013.2.0 -BATCTL_VERSION:=2013.2.0 +PKG_VERSION:=2013.3.0 +BATCTL_VERSION:=2013.3.0 PKG_RELEASE:=3 -PKG_MD5SUM:=9ec18300b96df22f0ed21c9f51e4ccef -BATCTL_MD5SUM:=712f86cdd0f9076503fc48acf37e109e +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 diff --git a/batman-adv/patches/0001-batman-adv-use-the-proper-header-len-when-checking-t.patch b/batman-adv/patches/0001-batman-adv-use-the-proper-header-len-when-checking-t.patch deleted file mode 100644 index 525dbac..0000000 --- a/batman-adv/patches/0001-batman-adv-use-the-proper-header-len-when-checking-t.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 9b96ecbae7295269aaa0320667f646870de65661 Mon Sep 17 00:00:00 2001 -From: Antonio Quartulli -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 -Signed-off-by: Marek Lindner ---- - 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 - diff --git a/batman-adv/patches/0002-batman-adv-vlan-add-protocol-argument-to-packet-tagging-fun.patch b/batman-adv/patches/0002-batman-adv-vlan-add-protocol-argument-to-packet-tagging-fun.patch deleted file mode 100644 index 608bd43..0000000 --- a/batman-adv/patches/0002-batman-adv-vlan-add-protocol-argument-to-packet-tagging-fun.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 82d1a8ebf19a1b9841ee44ce7b2448114be3e772 Mon Sep 17 00:00:00 2001 -From: Patrick McHardy -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 -Signed-off-by: David S. Miller -[siwu@hrz.tu-chemnitz.de: added compat code] -Signed-off-by: Simon Wunderlich -Signed-off-by: Marek Lindner ---- - 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 -+#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 - diff --git a/batman-adv/patches/0003-batman-adv-check-proto-length-before-accessing-proto.patch b/batman-adv/patches/0003-batman-adv-check-proto-length-before-accessing-proto.patch deleted file mode 100644 index f6270fa..0000000 --- a/batman-adv/patches/0003-batman-adv-check-proto-length-before-accessing-proto.patch +++ /dev/null @@ -1,33 +0,0 @@ -From aa7d19a5b97fe48657e075e8e4d130bd6916551e Mon Sep 17 00:00:00 2001 -From: Marek Lindner -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 -Signed-off-by: Marek Lindner ---- - 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 - diff --git a/batman-adv/patches/0004-batman-adv-check-return-value-of-pskb_trim_rcsum.patch b/batman-adv/patches/0004-batman-adv-check-return-value-of-pskb_trim_rcsum.patch deleted file mode 100644 index e38596b..0000000 --- a/batman-adv/patches/0004-batman-adv-check-return-value-of-pskb_trim_rcsum.patch +++ /dev/null @@ -1,44 +0,0 @@ -From d22ebef1431aab13099370b89afa4ba55eb95c35 Mon Sep 17 00:00:00 2001 -From: Marek Lindner -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 -Signed-off-by: Marek Lindner -Acked-by: Martin Hundebøll ---- - 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 - diff --git a/batman-adv/patches/0005-batman-adv-make-DAT-drop-ARP-requests-targeting-loca.patch b/batman-adv/patches/0005-batman-adv-make-DAT-drop-ARP-requests-targeting-loca.patch deleted file mode 100644 index e617ad3..0000000 --- a/batman-adv/patches/0005-batman-adv-make-DAT-drop-ARP-requests-targeting-loca.patch +++ /dev/null @@ -1,48 +0,0 @@ -From d6bd8b36fa1f3d72a6fd5942a6e9bde6ddafcd0d Mon Sep 17 00:00:00 2001 -From: Antonio Quartulli -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 -Signed-off-by: Antonio Quartulli -Tested-by: Carlos Quijano -Signed-off-by: Marek Lindner ---- - 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 - diff --git a/batman-adv/patches/0006-batman-adv-reorder-clean-up-routine-in-order-to-avoi.patch b/batman-adv/patches/0006-batman-adv-reorder-clean-up-routine-in-order-to-avoi.patch deleted file mode 100644 index 967fb31..0000000 --- a/batman-adv/patches/0006-batman-adv-reorder-clean-up-routine-in-order-to-avoi.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 763f413b9c74ccb25cb066408f49f07e5dd78f9b Mon Sep 17 00:00:00 2001 -From: Antonio Quartulli -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 -Signed-off-by: Marek Lindner ---- - 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 - diff --git a/batman-adv/patches/0007-batman-adv-Avoid-double-freeing-of-bat_counters.patch b/batman-adv/patches/0007-batman-adv-Avoid-double-freeing-of-bat_counters.patch deleted file mode 100644 index d4f3806..0000000 --- a/batman-adv/patches/0007-batman-adv-Avoid-double-freeing-of-bat_counters.patch +++ /dev/null @@ -1,47 +0,0 @@ -From a5d79639a76d7a71116abbc369a246bd1fcbf947 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= -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 -Signed-off-by: Marek Lindner ---- - 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 - diff --git a/batman-adv/patches/0008-batman-adv-wait-for-rtnl-in-batadv_store_mesh_iface-.patch b/batman-adv/patches/0008-batman-adv-wait-for-rtnl-in-batadv_store_mesh_iface-.patch deleted file mode 100644 index 87a2940..0000000 --- a/batman-adv/patches/0008-batman-adv-wait-for-rtnl-in-batadv_store_mesh_iface-.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 96cd7725540f4dccdd6fbb4fde59243e1cc1ad80 Mon Sep 17 00:00:00 2001 -From: Matthias Schiffer -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 -Reviewed-by: Simon Wunderlich -Signed-off-by: Marek Lindner ---- - 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 - diff --git a/batman-adv/patches/0009-batman-adv-Don-t-handle-address-updates-when-bla-is-.patch b/batman-adv/patches/0009-batman-adv-Don-t-handle-address-updates-when-bla-is-.patch deleted file mode 100644 index 52e1acd..0000000 --- a/batman-adv/patches/0009-batman-adv-Don-t-handle-address-updates-when-bla-is-.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 518fba156ed911c6183cf5cb34955a6fdf1b4637 Mon Sep 17 00:00:00 2001 -From: Simon Wunderlich -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 -Signed-off-by: Marek Lindner ---- - 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 - diff --git a/batman-adv/patches/0010-batman-adv-forward-late-OGMs-from-best-next-hop.patch b/batman-adv/patches/0010-batman-adv-forward-late-OGMs-from-best-next-hop.patch deleted file mode 100644 index 843ee89..0000000 --- a/batman-adv/patches/0010-batman-adv-forward-late-OGMs-from-best-next-hop.patch +++ /dev/null @@ -1,226 +0,0 @@ -From 3d999e5116f44b47c742aa16d6382721c360a6d0 Mon Sep 17 00:00:00 2001 -From: Simon Wunderlich -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 -Signed-off-by: Marek Lindner ---- - 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 - From 555c89d48d3a00895990a00da0edb20ef460f4ca Mon Sep 17 00:00:00 2001 From: Axel Neumann Date: Tue, 30 Jul 2013 08:17:40 +0200 Subject: [PATCH 116/117] bmx6: fix libjson dependency --- bmx6/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bmx6/Makefile b/bmx6/Makefile index 212c971..90f4123 100644 --- a/bmx6/Makefile +++ b/bmx6/Makefile @@ -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) @@ -82,7 +82,7 @@ endef define Package/bmx6-json $(call Package/bmx6/Default) - DEPENDS:=bmx6 +libjson-c + DEPENDS:=bmx6 +libjson TITLE:=json plugin based on jsonc endef From a96287cedca943643448a288ac30325cc261706e Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Wed, 31 Jul 2013 11:50:08 +0800 Subject: [PATCH 117/117] batman-adv: fix batctl compiler problems on mips Signed-off-by: Marek Lindner --- batman-adv/Makefile | 2 +- ...batctl-Add-CFLAGS-to-the-linker-step.patch | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 batman-adv/patches/0001-batctl-Add-CFLAGS-to-the-linker-step.patch diff --git a/batman-adv/Makefile b/batman-adv/Makefile index 977d180..6db66a6 100644 --- a/batman-adv/Makefile +++ b/batman-adv/Makefile @@ -12,7 +12,7 @@ PKG_NAME:=batman-adv PKG_VERSION:=2013.3.0 BATCTL_VERSION:=2013.3.0 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_MD5SUM:=d070c0879cd8fe8125315a4566fabd2d BATCTL_MD5SUM:=747535b0296f0013a6f99373a51d41fc diff --git a/batman-adv/patches/0001-batctl-Add-CFLAGS-to-the-linker-step.patch b/batman-adv/patches/0001-batctl-Add-CFLAGS-to-the-linker-step.patch new file mode 100644 index 0000000..492ae35 --- /dev/null +++ b/batman-adv/patches/0001-batctl-Add-CFLAGS-to-the-linker-step.patch @@ -0,0 +1,33 @@ +From 2c7bfe1299efa97438814bf6826a8f7ab3bc0b16 Mon Sep 17 00:00:00 2001 +From: Sven Eckelmann +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 +Signed-off-by: Marek Lindner +--- + 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 +