summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.in174
-rw-r--r--lib/routemap.c117
-rw-r--r--lib/zebra.h46
3 files changed, 165 insertions, 172 deletions
diff --git a/lib/Makefile.in b/lib/Makefile.in
index d821f238..3ea28bf5 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.7 from Makefile.am.
+# Makefile.in generated by automake 1.6.3 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
@@ -13,128 +13,94 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
+SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
+transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
+host_alias = @host_alias@
host_triplet = @host@
-ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
+
+EXEEXT = @EXEEXT@
+OBJEXT = @OBJEXT@
+PATH_SEPARATOR = @PATH_SEPARATOR@
AMTAR = @AMTAR@
AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BGPD = @BGPD@
CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
CURSES = @CURSES@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
DEPDIR = @DEPDIR@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
IF_METHOD = @IF_METHOD@
IF_PROC = @IF_PROC@
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
IPFORWARD = @IPFORWARD@
KERNEL_METHOD = @KERNEL_METHOD@
-LDFLAGS = @LDFLAGS@
LIBPAM = @LIBPAM@
-LIBS = @LIBS@
LIB_IPV6 = @LIB_IPV6@
LIB_REGEX = @LIB_REGEX@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
MULTIPATH_NUM = @MULTIPATH_NUM@
-OBJEXT = @OBJEXT@
OSPF6D = @OSPF6D@
OSPFD = @OSPFD@
OTHER_METHOD = @OTHER_METHOD@
PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
RIPD = @RIPD@
RIPNGD = @RIPNGD@
RTREAD_METHOD = @RTREAD_METHOD@
RT_METHOD = @RT_METHOD@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
VTYSH = @VTYSH@
ZEBRA = @ZEBRA@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-datadir = @datadir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-includedir = @includedir@
-infodir = @infodir@
install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-oldincludedir = @oldincludedir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
+DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
noinst_LIBRARIES = libzebra.a
@@ -177,8 +143,10 @@ am_libzebra_a_OBJECTS = version.$(OBJEXT) network.$(OBJEXT) \
sockopt.$(OBJEXT) smux.$(OBJEXT) md5.$(OBJEXT) \
if_rmap.$(OBJEXT) keychain.$(OBJEXT)
libzebra_a_OBJECTS = $(am_libzebra_a_OBJECTS)
-
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/buffer.Po ./$(DEPDIR)/checksum.Po \
@@ -202,6 +170,7 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
DIST_SOURCES = $(libzebra_a_SOURCES)
HEADERS = $(noinst_HEADERS)
@@ -212,7 +181,7 @@ all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -269,34 +238,22 @@ distclean-depend:
-rm -rf ./$(DEPDIR)
.c.o:
-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
-@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@ fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \
-@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@ fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
-CTAGS = ctags
-CTAGSFLAGS =
-
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -322,39 +279,20 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
-
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
- list='$(DISTFILES)'; for file in $$list; do \
- case $$file in \
- $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
- esac; \
+ @list='$(DISTFILES)'; for file in $$list; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@@ -439,26 +377,18 @@ mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
uninstall-am: uninstall-info-am
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-noinstLIBRARIES ctags distclean distclean-compile \
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
- uninstall-am uninstall-info-am
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
version.c: Makefile
diff --git a/lib/routemap.c b/lib/routemap.c
index b000f2fc..4e65fa2b 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -634,72 +634,85 @@ route_map_delete_set (struct route_map_index *index, char *set_name,
return 1;
}
-/* Apply route map's each index to the object. */
-/*
-** The matrix for a route-map looks like this:
-** (note, this includes the description for the "NEXT"
-** and "GOTO" frobs now
-**
-** Match | No Match
-** |
-** permit a | c
-** |
-** ------------------+---------------
-** |
-** deny b | d
-** |
-**
-** a) Apply Set statements, accept route
-** If NEXT is specified, goto NEXT statement
-** If GOTO is specified, goto the first clause where pref > nextpref
-** If nothing is specified, do as Cisco and finish
-** b) Finish route-map processing, and deny route
-** c) & d) Goto Next index
-**
-** If we get no matches after we've processed all updates, then the route
-** is dropped too.
-**
-** Some notes on the new "NEXT" and "GOTO"
-** on-match next - If this clause is matched, then the set statements
-** are executed and then we drop through to the next clause
-** on-match goto n - If this clause is matched, then the set statments
-** are executed and then we goto the nth clause, or the
-** first clause greater than this. In order to ensure
-** route-maps *always* exit, you cannot jump backwards.
-** Sorry ;)
-**
-** We need to make sure our route-map processing matches the above
+/* Apply route map's each index to the object.
+
+ The matrix for a route-map looks like this:
+ (note, this includes the description for the "NEXT"
+ and "GOTO" frobs now
+
+ Match | No Match
+ |
+ permit a | c
+ |
+ ------------------+---------------
+ |
+ deny b | d
+ |
+
+ a) Apply Set statements, accept route
+ If NEXT is specified, goto NEXT statement
+ If GOTO is specified, goto the first clause where pref > nextpref
+ If nothing is specified, do as Cisco and finish
+ b) If NEXT is specified, goto NEXT statement
+ If nothing is specified, finally will be denied by route-map.
+ c) & d) Goto Next index
+
+ If we get no matches after we've processed all updates, then the route
+ is dropped too.
+
+ Some notes on the new "NEXT" and "GOTO"
+ on-match next - If this clause is matched, then the set statements
+ are executed and then we drop through to the next clause
+ on-match goto n - If this clause is matched, then the set statments
+ are executed and then we goto the nth clause, or the
+ first clause greater than this. In order to ensure
+ route-maps *always* exit, you cannot jump backwards.
+ Sorry ;)
+
+ We need to make sure our route-map processing matches the above
*/
route_map_result_t
route_map_apply_index (struct route_map_index *index, struct prefix *prefix,
route_map_object_t type, void *object)
{
- int ret;
+ int ret = 0;
struct route_map_rule *match;
struct route_map_rule *set;
-
- /* Check all match rule and if there is no match rule return 0. */
- for (match = index->match_list.head; match; match = match->next)
+
+ /* Check all match rule and if there is no match rule, go to the
+ set statement. */
+ if (! index->match_list.head)
+ ret = RMAP_MATCH;
+ else
{
- /* Try each match statement in turn. If any return something
- other than RM_MATCH then we don't need to check anymore and can
- return */
- ret = (*match->cmd->func_apply)(match->value, prefix, type, object);
- if (ret != RMAP_MATCH)
- return ret;
+ for (match = index->match_list.head; match; match = match->next)
+ {
+ /* Try each match statement in turn, If any return
+ RMAP_MATCH, go direct to set statement, otherwise, walk
+ to next match statement. */
+ ret = (*match->cmd->func_apply)(match->value, prefix, type, object);
+
+ if (ret == RMAP_MATCH)
+ break;
+ }
}
+ /* If end of match statement, still can't get any RMAP_MATCH return,
+ just return to next rout-map statement. */
+
+ if (ret != RMAP_MATCH)
+ return ret;
+
/* We get here if all match statements matched From the matrix
- above, if this is PERMIT we go on and apply the SET functions. If
- we're deny, we return indicating we matched a deny */
+ above, if this is PERMIT we go on and apply the SET functions.
+ If we're deny, we return indicating we matched a deny */
/* Apply set statement to the object. */
if (index->type == RMAP_PERMIT)
{
for (set = index->set_list.head; set; set = set->next)
- {
- ret = (*set->cmd->func_apply)(set->value, prefix, type, object);
- }
+ ret = (*set->cmd->func_apply)(set->value, prefix, type, object);
+
return RMAP_MATCH;
}
else
@@ -726,11 +739,15 @@ route_map_apply (struct route_map *map, struct prefix *prefix,
/* Apply this index. End here if we get a RM_NOMATCH */
ret = route_map_apply_index (index, prefix, type, object);
+ if (ret == RMAP_MATCH || ret == RMAP_DENYMATCH)
+ return ret;
+
if (ret != RMAP_NOMATCH)
{
/* We now have to handle the NEXT and GOTO clauses */
if(index->exitpolicy == RMAP_EXIT)
return ret;
+
if(index->exitpolicy == RMAP_GOTO)
{
/* Find the next clause to jump to */
diff --git a/lib/zebra.h b/lib/zebra.h
index 06302b3d..a34f5d4a 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -28,8 +28,15 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifdef SUNOS_5
#define _XPG4_2
#define __EXTENSIONS__
+typedef unsigned int u_int32_t;
+typedef unsigned short u_int16_t;
+typedef unsigned short u_int8_t;
#endif /* SUNOS_5 */
+#ifndef HAVE_SOCKLEN_T
+typedef int socklen_t;
+#endif /* HAVE_SOCKLEN_T */
+
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -309,4 +316,43 @@ typedef u_char safi_t;
typedef u_int16_t zebra_size_t;
typedef u_int8_t zebra_command_t;
+/* FIFO -- first in first out structure and macros. */
+struct fifo
+{
+ struct fifo *next;
+ struct fifo *prev;
+};
+
+#define FIFO_INIT(F) \
+ do { \
+ struct fifo *Xfifo = (struct fifo *)(F); \
+ Xfifo->next = Xfifo->prev = Xfifo; \
+ } while (0)
+
+#define FIFO_ADD(F,N) \
+ do { \
+ struct fifo *Xfifo = (struct fifo *)(F); \
+ struct fifo *Xnode = (struct fifo *)(N); \
+ Xnode->next = Xfifo; \
+ Xnode->prev = Xfifo->prev; \
+ Xfifo->prev = Xfifo->prev->next = Xnode; \
+ } while (0)
+
+#define FIFO_DEL(N) \
+ do { \
+ struct fifo *Xnode = (struct fifo *)(N); \
+ Xnode->prev->next = Xnode->next; \
+ Xnode->next->prev = Xnode->prev; \
+ } while (0)
+
+#define FIFO_HEAD(F) \
+ ((((struct fifo *)(F))->next == (struct fifo *)(F)) \
+ ? NULL : (F)->next)
+
+#define FIFO_EMPTY(F) \
+ (((struct fifo *)(F))->next == (struct fifo *)(F))
+
+#define FIFO_TOP(F) \
+ (FIFO_EMPTY(F) ? NULL : ((struct fifo *)(F))->next)
+
#endif /* _ZEBRA_H */