summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/.cvsignore1
-rw-r--r--lib/ChangeLog13
-rw-r--r--lib/Makefile.am7
-rw-r--r--lib/Makefile.in399
-rw-r--r--lib/distribute.c103
-rw-r--r--lib/if.c139
-rw-r--r--lib/if.h5
-rw-r--r--lib/linklist.c5
-rw-r--r--lib/memory.h2
-rw-r--r--lib/privs.c106
-rw-r--r--lib/privs.h14
-rw-r--r--lib/routemap.c117
-rw-r--r--lib/smux.c4
-rw-r--r--lib/smux.h2
-rw-r--r--lib/thread.c230
-rw-r--r--lib/thread.h39
-rw-r--r--lib/version.h2
-rw-r--r--lib/vty.c16
-rw-r--r--lib/zebra.h6
19 files changed, 573 insertions, 637 deletions
diff --git a/lib/.cvsignore b/lib/.cvsignore
index 051b8e4f..b8e258be 100644
--- a/lib/.cvsignore
+++ b/lib/.cvsignore
@@ -1,4 +1,5 @@
Makefile
+Makefile.in
*.o
version.c
.deps
diff --git a/lib/ChangeLog b/lib/ChangeLog
index b4d0ae12..71fb42c3 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,16 @@
+2003-05-24 Anil Madhavapeddy
+
+ * (sockunion.c): Incorrect bounds specified in sockunion_log()
+
+2003-05-08 Sergiy Vyshnevetskiy <serg @ vostok.net>
+
+ * vty.c: -A option
+
+2003-04-19 Hasso Tepper <hasso@estpak.ee>
+
+ * rip_routemap.c: sync daemon's route-map commands to have same
+ syntax
+
2002-09-28 Yasuhiro Ohara <yasu@sfc.wide.ad.jp>
* vty.c (vty_flush): One line more on vty.
diff --git a/lib/Makefile.am b/lib/Makefile.am
index d041770d..02680603 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -10,9 +10,9 @@ libzebra_a_SOURCES = \
print_version.c checksum.c vector.c linklist.c vty.c command.c \
sockunion.c prefix.c thread.c if.c memory.c buffer.c table.c hash.c \
filter.c routemap.c distribute.c stream.c str.c log.c plist.c \
- zclient.c sockopt.c smux.c md5.c if_rmap.c keychain.c privs.c debug.c
+ zclient.c sockopt.c smux.c md5.c if_rmap.c keychain.c
-libzebra_a_DEPENDENCIES = @LIB_REGEX@ @LIBCAP@
+libzebra_a_DEPENDENCIES = @LIB_REGEX@
libzebra_a_LIBADD = @LIB_REGEX@
@@ -20,8 +20,7 @@ noinst_HEADERS = \
buffer.h command.h filter.h getopt.h hash.h if.h linklist.h log.h \
memory.h network.h prefix.h routemap.h distribute.h sockunion.h \
str.h stream.h table.h thread.h vector.h version.h vty.h zebra.h \
- plist.h zclient.h sockopt.h smux.h md5-gnu.h if_rmap.h keychain.h \
- privs.h debug.h
+ plist.h zclient.h sockopt.h smux.h md5-gnu.h if_rmap.h keychain.h
EXTRA_DIST = regex.c regex-gnu.h
diff --git a/lib/Makefile.in b/lib/Makefile.in
deleted file mode 100644
index 3ea28bf5..00000000
--- a/lib/Makefile.in
+++ /dev/null
@@ -1,399 +0,0 @@
-# Makefile.in generated by automake 1.6.3 from Makefile.am.
-# @configure_input@
-
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# 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@
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-host_alias = @host_alias@
-host_triplet = @host@
-
-EXEEXT = @EXEEXT@
-OBJEXT = @OBJEXT@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-AMTAR = @AMTAR@
-AR = @AR@
-AWK = @AWK@
-BGPD = @BGPD@
-CC = @CC@
-CPP = @CPP@
-CURSES = @CURSES@
-DEPDIR = @DEPDIR@
-IF_METHOD = @IF_METHOD@
-IF_PROC = @IF_PROC@
-
-INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-IPFORWARD = @IPFORWARD@
-KERNEL_METHOD = @KERNEL_METHOD@
-LIBPAM = @LIBPAM@
-LIB_IPV6 = @LIB_IPV6@
-LIB_REGEX = @LIB_REGEX@
-MULTIPATH_NUM = @MULTIPATH_NUM@
-OSPF6D = @OSPF6D@
-OSPFD = @OSPFD@
-OTHER_METHOD = @OTHER_METHOD@
-PACKAGE = @PACKAGE@
-RANLIB = @RANLIB@
-RIPD = @RIPD@
-RIPNGD = @RIPNGD@
-RTREAD_METHOD = @RTREAD_METHOD@
-RT_METHOD = @RT_METHOD@
-STRIP = @STRIP@
-VERSION = @VERSION@
-VTYSH = @VTYSH@
-ZEBRA = @ZEBRA@
-am__include = @am__include@
-am__quote = @am__quote@
-install_sh = @install_sh@
-DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
-
-noinst_LIBRARIES = libzebra.a
-
-libzebra_a_SOURCES = \
- version.c network.c pid_output.c getopt.c getopt1.c daemon.c \
- print_version.c checksum.c vector.c linklist.c vty.c command.c \
- sockunion.c prefix.c thread.c if.c memory.c buffer.c table.c hash.c \
- filter.c routemap.c distribute.c stream.c str.c log.c plist.c \
- zclient.c sockopt.c smux.c md5.c if_rmap.c keychain.c
-
-
-libzebra_a_DEPENDENCIES = @LIB_REGEX@
-
-libzebra_a_LIBADD = @LIB_REGEX@
-
-noinst_HEADERS = \
- buffer.h command.h filter.h getopt.h hash.h if.h linklist.h log.h \
- memory.h network.h prefix.h routemap.h distribute.h sockunion.h \
- str.h stream.h table.h thread.h vector.h version.h vty.h zebra.h \
- plist.h zclient.h sockopt.h smux.h md5-gnu.h if_rmap.h keychain.h
-
-
-EXTRA_DIST = regex.c regex-gnu.h
-subdir = lib
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-
-libzebra_a_AR = $(AR) cru
-am_libzebra_a_OBJECTS = version.$(OBJEXT) network.$(OBJEXT) \
- pid_output.$(OBJEXT) getopt.$(OBJEXT) getopt1.$(OBJEXT) \
- daemon.$(OBJEXT) print_version.$(OBJEXT) checksum.$(OBJEXT) \
- vector.$(OBJEXT) linklist.$(OBJEXT) vty.$(OBJEXT) \
- command.$(OBJEXT) sockunion.$(OBJEXT) prefix.$(OBJEXT) \
- thread.$(OBJEXT) if.$(OBJEXT) memory.$(OBJEXT) buffer.$(OBJEXT) \
- table.$(OBJEXT) hash.$(OBJEXT) filter.$(OBJEXT) \
- routemap.$(OBJEXT) distribute.$(OBJEXT) stream.$(OBJEXT) \
- str.$(OBJEXT) log.$(OBJEXT) plist.$(OBJEXT) zclient.$(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 \
-@AMDEP_TRUE@ ./$(DEPDIR)/command.Po ./$(DEPDIR)/daemon.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/distribute.Po ./$(DEPDIR)/filter.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/getopt.Po ./$(DEPDIR)/getopt1.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/hash.Po ./$(DEPDIR)/if.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/if_rmap.Po ./$(DEPDIR)/keychain.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/linklist.Po ./$(DEPDIR)/log.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/md5.Po ./$(DEPDIR)/memory.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/network.Po ./$(DEPDIR)/pid_output.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/plist.Po ./$(DEPDIR)/prefix.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/print_version.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/routemap.Po ./$(DEPDIR)/smux.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/sockopt.Po ./$(DEPDIR)/sockunion.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/str.Po ./$(DEPDIR)/stream.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/table.Po ./$(DEPDIR)/thread.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/vector.Po ./$(DEPDIR)/version.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/vty.Po ./$(DEPDIR)/zclient.Po
-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)
-
-DIST_COMMON = $(noinst_HEADERS) ChangeLog Makefile.am Makefile.in
-SOURCES = $(libzebra_a_SOURCES)
-
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .o .obj
-$(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
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
-
-clean-noinstLIBRARIES:
- -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libzebra.a: $(libzebra_a_OBJECTS) $(libzebra_a_DEPENDENCIES)
- -rm -f libzebra.a
- $(libzebra_a_AR) libzebra.a $(libzebra_a_OBJECTS) $(libzebra_a_LIBADD)
- $(RANLIB) libzebra.a
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT) core *.core
-
-distclean-compile:
- -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/checksum.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/daemon.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/distribute.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/if.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/if_rmap.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keychain.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linklist.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/network.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pid_output.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plist.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prefix.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print_version.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/routemap.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smux.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockopt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockunion.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/table.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vty.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zclient.Po@am__quote@
-
-distclean-depend:
- -rm -rf ./$(DEPDIR)
-
-.c.o:
-@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:
-@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 =
-
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- 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; }'`; \
- mkid -fID $$unique
-
-TAGS: $(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 "$(ETAGS_ARGS)$$tags$$unique" \
- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_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
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
-
-distdir: $(DISTFILES)
- @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 \
- dir="/$$dir"; \
- $(mkinstalldirs) "$(distdir)$$dir"; \
- else \
- dir=''; \
- fi; \
- if test -d $$d/$$file; then \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LIBRARIES) $(HEADERS)
-
-installdirs:
-
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
-
-distclean: distclean-am
-
-distclean-am: clean-am distclean-compile distclean-depend \
- distclean-generic distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-exec-am:
-
-install-info: install-info-am
-
-install-man:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic
-
-uninstall-am: uninstall-info-am
-
-.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 tags uninstall uninstall-am \
- uninstall-info-am
-
-
-version.c: Makefile
- echo '' >version.c
- echo 'char *host_name = "$(host_alias)";' >>version.c
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/lib/distribute.c b/lib/distribute.c
index d5893a5b..59dbc5a4 100644
--- a/lib/distribute.c
+++ b/lib/distribute.c
@@ -327,6 +327,14 @@ DEFUN (distribute_list_all,
return CMD_SUCCESS;
}
+ALIAS (distribute_list_all,
+ ipv6_distribute_list_all_cmd,
+ "distribute-list WORD (in|out)",
+ "Filter networks in routing updates\n"
+ "Access-list name\n"
+ "Filter incoming routing updates\n"
+ "Filter outgoing routing updates\n")
+
DEFUN (no_distribute_list_all,
no_distribute_list_all_cmd,
"no distribute-list WORD (in|out)",
@@ -360,6 +368,15 @@ DEFUN (no_distribute_list_all,
return CMD_SUCCESS;
}
+ALIAS (no_distribute_list_all,
+ no_ipv6_distribute_list_all_cmd,
+ "no distribute-list WORD (in|out)",
+ NO_STR
+ "Filter networks in routing updates\n"
+ "Access-list name\n"
+ "Filter incoming routing updates\n"
+ "Filter outgoing routing updates\n")
+
DEFUN (distribute_list,
distribute_list_cmd,
"distribute-list WORD (in|out) WORD",
@@ -389,6 +406,15 @@ DEFUN (distribute_list,
return CMD_SUCCESS;
}
+ALIAS (distribute_list,
+ ipv6_distribute_list_cmd,
+ "distribute-list WORD (in|out) WORD",
+ "Filter networks in routing updates\n"
+ "Access-list name\n"
+ "Filter incoming routing updates\n"
+ "Filter outgoing routing updates\n"
+ "Interface name\n")
+
DEFUN (no_districute_list, no_distribute_list_cmd,
"no distribute-list WORD (in|out) WORD",
NO_STR
@@ -421,6 +447,15 @@ DEFUN (no_districute_list, no_distribute_list_cmd,
return CMD_SUCCESS;
}
+ALIAS (no_districute_list, no_ipv6_distribute_list_cmd,
+ "no distribute-list WORD (in|out) WORD",
+ NO_STR
+ "Filter networks in routing updates\n"
+ "Access-list name\n"
+ "Filter incoming routing updates\n"
+ "Filter outgoing routing updates\n"
+ "Interface name\n")
+
DEFUN (districute_list_prefix_all,
distribute_list_prefix_all_cmd,
"distribute-list prefix WORD (in|out)",
@@ -451,6 +486,15 @@ DEFUN (districute_list_prefix_all,
return CMD_SUCCESS;
}
+ALIAS (districute_list_prefix_all,
+ ipv6_distribute_list_prefix_all_cmd,
+ "distribute-list prefix WORD (in|out)",
+ "Filter networks in routing updates\n"
+ "Filter prefixes in routing updates\n"
+ "Name of an IP prefix-list\n"
+ "Filter incoming routing updates\n"
+ "Filter outgoing routing updates\n")
+
DEFUN (no_districute_list_prefix_all,
no_distribute_list_prefix_all_cmd,
"no distribute-list prefix WORD (in|out)",
@@ -485,6 +529,16 @@ DEFUN (no_districute_list_prefix_all,
return CMD_SUCCESS;
}
+ALIAS (no_districute_list_prefix_all,
+ no_ipv6_distribute_list_prefix_all_cmd,
+ "no distribute-list prefix WORD (in|out)",
+ NO_STR
+ "Filter networks in routing updates\n"
+ "Filter prefixes in routing updates\n"
+ "Name of an IP prefix-list\n"
+ "Filter incoming routing updates\n"
+ "Filter outgoing routing updates\n")
+
DEFUN (districute_list_prefix, distribute_list_prefix_cmd,
"distribute-list prefix WORD (in|out) WORD",
"Filter networks in routing updates\n"
@@ -515,6 +569,15 @@ DEFUN (districute_list_prefix, distribute_list_prefix_cmd,
return CMD_SUCCESS;
}
+ALIAS (districute_list_prefix, ipv6_distribute_list_prefix_cmd,
+ "distribute-list prefix WORD (in|out) WORD",
+ "Filter networks in routing updates\n"
+ "Filter prefixes in routing updates\n"
+ "Name of an IP prefix-list\n"
+ "Filter incoming routing updates\n"
+ "Filter outgoing routing updates\n"
+ "Interface name\n")
+
DEFUN (no_districute_list_prefix, no_distribute_list_prefix_cmd,
"no distribute-list prefix WORD (in|out) WORD",
NO_STR
@@ -549,6 +612,16 @@ DEFUN (no_districute_list_prefix, no_distribute_list_prefix_cmd,
return CMD_SUCCESS;
}
+ALIAS (no_districute_list_prefix, no_ipv6_distribute_list_prefix_cmd,
+ "no distribute-list prefix WORD (in|out) WORD",
+ NO_STR
+ "Filter networks in routing updates\n"
+ "Filter prefixes in routing updates\n"
+ "Name of an IP prefix-list\n"
+ "Filter incoming routing updates\n"
+ "Filter outgoing routing updates\n"
+ "Interface name\n")
+
int
config_show_distribute (struct vty *vty)
{
@@ -695,15 +768,23 @@ distribute_list_init (int node)
{
disthash = hash_create (distribute_hash_make, distribute_cmp);
- install_element (node, &distribute_list_all_cmd);
- install_element (node, &no_distribute_list_all_cmd);
-
- install_element (node, &distribute_list_cmd);
- install_element (node, &no_distribute_list_cmd);
-
- install_element (node, &distribute_list_prefix_all_cmd);
- install_element (node, &no_distribute_list_prefix_all_cmd);
-
- install_element (node, &distribute_list_prefix_cmd);
- install_element (node, &no_distribute_list_prefix_cmd);
+ if(node==RIP_NODE) {
+ install_element (RIP_NODE, &distribute_list_all_cmd);
+ install_element (RIP_NODE, &no_distribute_list_all_cmd);
+ install_element (RIP_NODE, &distribute_list_cmd);
+ install_element (RIP_NODE, &no_distribute_list_cmd);
+ install_element (RIP_NODE, &distribute_list_prefix_all_cmd);
+ install_element (RIP_NODE, &no_distribute_list_prefix_all_cmd);
+ install_element (RIP_NODE, &distribute_list_prefix_cmd);
+ install_element (RIP_NODE, &no_distribute_list_prefix_cmd);
+ } else {
+ install_element (RIPNG_NODE, &ipv6_distribute_list_all_cmd);
+ install_element (RIPNG_NODE, &no_ipv6_distribute_list_all_cmd);
+ install_element (RIPNG_NODE, &ipv6_distribute_list_cmd);
+ install_element (RIPNG_NODE, &no_ipv6_distribute_list_cmd);
+ install_element (RIPNG_NODE, &ipv6_distribute_list_prefix_all_cmd);
+ install_element (RIPNG_NODE, &no_ipv6_distribute_list_prefix_all_cmd);
+ install_element (RIPNG_NODE, &ipv6_distribute_list_prefix_cmd);
+ install_element (RIPNG_NODE, &no_ipv6_distribute_list_prefix_cmd);
+ }
}
diff --git a/lib/if.c b/lib/if.c
index bbf22ab1..f003754a 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -189,11 +189,13 @@ if_lookup_address (struct in_addr src)
listnode node;
struct prefix addr;
struct prefix best;
+ struct prefix peer;
listnode cnode;
struct interface *ifp;
struct prefix *p;
struct connected *c;
struct interface *match;
+ int prefixlen;
/* Zero structures - get rid of rubbish from stack */
memset(&addr, 0, sizeof(addr));
@@ -212,34 +214,24 @@ if_lookup_address (struct in_addr src)
for (cnode = listhead (ifp->connected); cnode; nextnode (cnode))
{
c = getdata (cnode);
+ p = c->address;
- if (if_is_pointopoint (ifp))
+ if (p->family == AF_INET)
{
- p = c->address;
+ prefixlen = p->prefixlen;
- if (p && p->family == AF_INET)
+ if (if_is_pointopoint (ifp) ||
+ prefixlen >= IPV4_MAX_PREFIXLEN - 1)
{
-#ifdef OLD_RIB /* PTP links are conventionally identified
- by the address of the far end - MAG */
- if (IPV4_ADDR_SAME (&p->u.prefix4, &src))
- return ifp;
-#endif
- p = c->destination;
- if (p && IPV4_ADDR_SAME (&p->u.prefix4, &src))
- return ifp;
+ peer = *c->destination;
+ peer.prefixlen = prefixlen;
+ p = &peer;
}
- }
- else
- {
- p = c->address;
- if (p->family == AF_INET)
+ if (prefix_match (p, &addr) && prefixlen > best.prefixlen)
{
- if (prefix_match (p, &addr) && p->prefixlen > best.prefixlen)
- {
- best = *p;
- match = ifp;
- }
+ best = *p;
+ match = ifp;
}
}
}
@@ -270,6 +262,22 @@ if_is_up (struct interface *ifp)
return ifp->flags & IFF_UP;
}
+/* Is interface running? */
+int
+if_is_running (struct interface *ifp)
+{
+ return ifp->flags & IFF_RUNNING;
+}
+
+/* Is the interface operative, eg. either UP & RUNNING
+ or UP & !ZEBRA_INTERFACE_LINK_DETECTION */
+int
+if_is_operative (struct interface *ifp)
+{
+ return ((ifp->flags & IFF_UP) &&
+ (ifp->flags & IFF_RUNNING || !CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION)));
+}
+
/* Is this loopback interface ? */
int
if_is_loopback (struct interface *ifp)
@@ -432,6 +440,36 @@ DEFUN (interface,
return CMD_SUCCESS;
}
+DEFUN_NOSH (no_interface,
+ no_interface_cmd,
+ "no interface IFNAME",
+ NO_STR
+ "Delete a pseudo interface's configuration\n"
+ "Interface's name\n")
+{
+ // deleting interface
+ struct interface *ifp;
+
+ ifp = if_lookup_by_name (argv[0]);
+
+ if (ifp == NULL)
+ {
+ vty_out (vty, "%% Inteface %s does not exist%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
+ {
+ vty_out (vty, "%% Only inactive interfaces can be deleted%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if_delete(ifp);
+
+ return CMD_SUCCESS;
+}
+
/* For debug purpose. */
DEFUN (show_address,
show_address_cmd,
@@ -553,6 +591,65 @@ connected_delete_by_prefix (struct interface *ifp, struct prefix *p)
return NULL;
}
+/* Find the IPv4 address on our side that will be used when packets
+ are sent to dst. */
+struct connected *
+connected_lookup_address (struct interface *ifp, struct in_addr dst)
+{
+ struct prefix addr;
+ struct prefix best;
+ listnode cnode;
+ struct prefix *p;
+ struct connected *c;
+ struct connected *match;
+
+ /* Zero structures - get rid of rubbish from stack */
+ memset(&addr, 0, sizeof(addr));
+ memset(&best, 0, sizeof(best));
+
+ addr.family = AF_INET;
+ addr.u.prefix4 = dst;
+ addr.prefixlen = IPV4_MAX_BITLEN;
+
+ match = NULL;
+
+ for (cnode = listhead (ifp->connected); cnode; nextnode (cnode))
+ {
+ c = getdata (cnode);
+
+ if (if_is_pointopoint (ifp))
+ {
+ p = c->address;
+
+ if (p && p->family == AF_INET)
+ {
+#ifdef OLD_RIB /* PTP links are conventionally identified
+ by the address of the far end - MAG */
+ if (IPV4_ADDR_SAME (&p->u.prefix4, &dst))
+ return c;
+#endif
+ p = c->destination;
+ if (p && IPV4_ADDR_SAME (&p->u.prefix4, &dst))
+ return c;
+ }
+ }
+ else
+ {
+ p = c->address;
+
+ if (p->family == AF_INET)
+ {
+ if (prefix_match (p, &addr) && p->prefixlen > best.prefixlen)
+ {
+ best = *p;
+ match = c;
+ }
+ }
+ }
+ }
+ return match;
+}
+
/* Check the connected information is PtP style or not. */
int
ifc_pointopoint (struct connected *ifc)
diff --git a/lib/if.h b/lib/if.h
index 3896d187..9ffe74cf 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -85,6 +85,7 @@ struct interface
u_char status;
#define ZEBRA_INTERFACE_ACTIVE (1 << 0)
#define ZEBRA_INTERFACE_SUB (1 << 1)
+#define ZEBRA_INTERFACE_LINKDETECTION (1 << 2)
/* Interface flags. */
unsigned long flags;
@@ -188,6 +189,8 @@ struct interface *if_lookup_address (struct in_addr);
struct interface *if_get_by_name (char *);
void if_delete (struct interface *);
int if_is_up (struct interface *);
+int if_is_running (struct interface *);
+int if_is_operative (struct interface *);
int if_is_loopback (struct interface *);
int if_is_broadcast (struct interface *);
int if_is_pointopoint (struct interface *);
@@ -202,6 +205,7 @@ struct connected *connected_new ();
void connected_free (struct connected *);
void connected_add (struct interface *, struct connected *);
struct connected *connected_delete_by_prefix (struct interface *, struct prefix *);
+struct connected *connected_lookup_address (struct interface *, struct in_addr);
int ifc_pointopoint (struct connected *);
#ifndef HAVE_IF_NAMETOINDEX
@@ -216,6 +220,7 @@ extern list iflist;
extern struct cmd_element interface_desc_cmd;
extern struct cmd_element no_interface_desc_cmd;
extern struct cmd_element interface_cmd;
+extern struct cmd_element no_interface_cmd;
extern struct cmd_element interface_pseudo_cmd;
extern struct cmd_element no_interface_pseudo_cmd;
diff --git a/lib/linklist.c b/lib/linklist.c
index 5a2b6969..3cb10caf 100644
--- a/lib/linklist.c
+++ b/lib/linklist.c
@@ -162,6 +162,7 @@ listnode_delete (struct list *list, void *val)
{
struct listnode *node;
+ assert(list);
for (node = list->head; node; node = node->next)
{
if (node->data == val)
@@ -189,6 +190,7 @@ listnode_head (struct list *list)
{
struct listnode *node;
+ assert(list);
node = list->head;
if (node)
@@ -203,6 +205,7 @@ list_delete_all_node (struct list *list)
struct listnode *node;
struct listnode *next;
+ assert(list);
for (node = list->head; node; node = next)
{
next = node->next;
@@ -221,6 +224,7 @@ list_delete (struct list *list)
struct listnode *node;
struct listnode *next;
+ assert(list);
for (node = list->head; node; node = next)
{
next = node->next;
@@ -237,6 +241,7 @@ listnode_lookup (struct list *list, void *data)
{
listnode node;
+ assert(list);
for (node = list->head; node; nextnode (node))
if (data == getdata (node))
return node;
diff --git a/lib/memory.h b/lib/memory.h
index 925f6b65..a38cda3f 100644
--- a/lib/memory.h
+++ b/lib/memory.h
@@ -189,8 +189,6 @@ enum
MTYPE_VRF,
MTYPE_VRF_NAME,
-
- MTYPE_PRIVS,
MTYPE_MAX
};
diff --git a/lib/privs.c b/lib/privs.c
index 9139823e..35e5a76b 100644
--- a/lib/privs.c
+++ b/lib/privs.c
@@ -40,7 +40,6 @@ static struct _zprivs_t
uid_t zuid, /* uid to run as */
zsuid; /* saved uid */
gid_t zgid; /* gid to run as */
- gid_t vtygrp; /* gid for vty sockets */
} zprivs_state;
/* externally exported but not directly accessed functions */
@@ -70,9 +69,11 @@ cap_map [ZCAP_MAX] =
[ZCAP_DAC_OVERRIDE] = CAP_DAC_OVERRIDE,
[ZCAP_READ_SEARCH] = CAP_DAC_READ_SEARCH,
[ZCAP_SYS_ADMIN] = CAP_SYS_ADMIN,
- [ZCAP_FOWNER] = CAP_FOWNER
+ [ZCAP_FOWNER] = ZCAP_FOWNER
};
+static cap_value_t cap_setuid_value [] = { CAP_SETUID };
+
/* convert zebras privileges to system capabilities */
static cap_value_t *
zcaps2sys (zebra_capabilities_t *zcaps, int num)
@@ -175,12 +176,6 @@ zprivs_init(struct zebra_privs_t *zprivs)
struct passwd *pwentry = NULL;
struct group *grentry = NULL;
- if (!zprivs)
- {
- zlog_err ("zprivs_init: called with NULL arg!");
- exit (1);
- }
-
/* NULL privs */
if (! (zprivs->user || zprivs->group
|| zprivs->cap_num_p || zprivs->cap_num_i) )
@@ -193,31 +188,7 @@ zprivs_init(struct zebra_privs_t *zprivs)
if (zprivs->user)
{
if ( (pwentry = getpwnam (zprivs->user)) )
- {
- zprivs_state.zuid = pwentry->pw_uid;
- }
- else
- {
- zlog_err ("privs_init: could not lookup supplied user");
- exit (1);
- }
- }
-
- grentry = NULL;
-
- if (zprivs->vty_group)
- /* Add the vty_group to the supplementary groups so it can be chowned to */
- {
- if ( (grentry = getgrnam (zprivs->vty_group)) )
- {
- zprivs_state.vtygrp = grentry->gr_gid;
- if ( setgroups (1, &zprivs_state.vtygrp) )
- {
- zlog_err ("privs_init: could not setgroups, %s",
- strerror (errno) );
- exit (1);
- }
- }
+ zprivs_state.zuid = pwentry->pw_uid;
else
{
zlog_err ("privs_init: could not lookup supplied user");
@@ -227,20 +198,18 @@ zprivs_init(struct zebra_privs_t *zprivs)
if (zprivs->group)
{
- if ( (grentry = getgrnam (zprivs->group)) )
- {
- zprivs_state.zgid = grentry->gr_gid;
- }
+ if ( (grentry = getgrnam (zprivs->user)) )
+ zprivs_state.zgid = grentry->gr_gid;
else
{
zlog_err ("privs_init: could not lookup supplied user");
exit (1);
}
+
/* change group now, forever. uid we do later */
if ( setregid (zprivs_state.zgid, zprivs_state.zgid) )
{
- zlog_err ("zprivs_init: could not setregid, %s",
- strerror (errno) );
+ zlog_err ("privs_init: could not setregid");
exit (1);
}
}
@@ -269,17 +238,6 @@ zprivs_init(struct zebra_privs_t *zprivs)
zlog_err ("privs_init: failed to cap_init, %s", strerror (errno) );
exit (1);
}
-
- /* we have caps, we have no need to ever change back the original user */
- if (zprivs_state.zuid)
- {
- if ( setreuid (zprivs_state.zuid, zprivs_state.zuid) )
- {
- zlog_err ("zprivs_init (cap): could not setreuid, %s",
- strerror (errno) );
- exit (1);
- }
- }
if ( cap_clear (zprivs_state.caps) )
{
@@ -293,6 +251,12 @@ zprivs_init(struct zebra_privs_t *zprivs)
cap_set_flag(zprivs_state.caps, CAP_EFFECTIVE,
zprivs_state.sys_num_p, zprivs_state.syscaps_p, CAP_SET);
+ /* still need CAP_SETUID for the moment */
+ cap_set_flag(zprivs_state.caps, CAP_PERMITTED,
+ 1, cap_setuid_value, CAP_SET);
+ cap_set_flag(zprivs_state.caps, CAP_EFFECTIVE,
+ 1, cap_setuid_value, CAP_SET);
+
/* set inheritable caps, if any */
if (zprivs_state.sys_num_i)
{
@@ -300,8 +264,8 @@ zprivs_init(struct zebra_privs_t *zprivs)
zprivs_state.sys_num_i, zprivs_state.syscaps_i, CAP_SET);
}
- /* apply caps. CAP_EFFECTIVE is cleared. we'll raise the caps as
- * and when, and only when, they are needed.
+ /* apply caps. CAP_EFFECTIVE is clear bar cap_setuid_value.
+ * we'll raise the caps as and when, and only when, they are needed.
*/
if ( cap_set_proc (zprivs_state.caps) )
{
@@ -309,7 +273,28 @@ zprivs_init(struct zebra_privs_t *zprivs)
exit (1);
}
- /* set methods for the caller to use */
+ /* we have caps, we have no need to ever change back the original user */
+ if (zprivs_state.zuid)
+ {
+ if ( setreuid (zprivs_state.zuid, zprivs_state.zuid) )
+ {
+ zlog_err ("privs_init (cap): could not setreuid, %s", strerror (errno) );
+ exit (1);
+ }
+ }
+
+ /* No more need for cap_setuid_value */
+ cap_set_flag(zprivs_state.caps, CAP_PERMITTED,
+ 1, cap_setuid_value, CAP_CLEAR);
+ cap_set_flag(zprivs_state.caps, CAP_EFFECTIVE,
+ 1, cap_setuid_value, CAP_CLEAR);
+ if ( cap_set_proc (zprivs_state.caps) )
+ {
+ zlog_err ("privs_init: cap_set_proc failed to clear cap_setuid, %s",
+ strerror (errno) );
+ exit (1);
+ }
+
zprivs->change = zprivs_change_caps;
zprivs->current_state = zprivs_state_caps;
@@ -369,18 +354,3 @@ zprivs_terminate (void)
#endif /* HAVE_LCAPS */
return;
}
-
-void
-zprivs_get_ids(struct zprivs_ids_t *ids)
-{
-
- ids->uid_priv = getuid();
- (zprivs_state.zuid) ? (ids->uid_normal = zprivs_state.zuid)
- : (ids->uid_normal = -1);
- (zprivs_state.zgid) ? (ids->gid_normal = zprivs_state.zgid)
- : (ids->gid_normal = -1);
- (zprivs_state.vtygrp) ? (ids->gid_vty = zprivs_state.vtygrp)
- : (ids->gid_vty = -1);
-
- return;
-}
diff --git a/lib/privs.h b/lib/privs.h
index 65c9f358..3cdd20da 100644
--- a/lib/privs.h
+++ b/lib/privs.h
@@ -63,7 +63,7 @@ struct zebra_privs_t
int cap_num_i;
char *user; /* user and group to run as */
char *group;
- char *vty_group; /* group to chown vty socket to */
+
/* methods */
int
(*change) (zebra_privs_ops_t); /* change privileges, 0 on success */
@@ -71,21 +71,9 @@ struct zebra_privs_t
(*current_state) (void); /* current privilege state */
};
-struct zprivs_ids_t
-{
- /* -1 is undefined */
- uid_t uid_priv; /* privileged uid */
- uid_t uid_normal; /* normal uid */
- gid_t gid_priv; /* privileged uid */
- gid_t gid_normal; /* normal uid */
- gid_t gid_vty; /* vty gid */
-};
-
/* initialise zebra privileges */
void zprivs_init (struct zebra_privs_t *zprivs);
/* drop all and terminate privileges */
void zprivs_terminate (void);
- /* query for runtime uid's and gid's, eg vty needs this */
-void zprivs_get_ids(struct zprivs_ids_t *);
#endif /* _ZEBRA_PRIVS_H */
diff --git a/lib/routemap.c b/lib/routemap.c
index 4e65fa2b..b000f2fc 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -634,85 +634,72 @@ 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) 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
+/* 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
*/
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 = 0;
+ int ret;
struct route_map_rule *match;
struct route_map_rule *set;
-
- /* 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
+
+ /* Check all match rule and if there is no match rule return 0. */
+ for (match = index->match_list.head; match; match = match->next)
{
- 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;
- }
+ /* 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;
}
- /* 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
@@ -739,15 +726,11 @@ 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/smux.c b/lib/smux.c
index 3d30a261..952c5a81 100644
--- a/lib/smux.c
+++ b/lib/smux.c
@@ -22,7 +22,9 @@
#include <zebra.h>
#ifdef HAVE_SNMP
-
+#ifdef HAVE_NETSNMP
+#include <net-snmp/net-snmp-config.h>
+#endif
#include <asn1.h>
#include <snmp.h>
#include <snmp_impl.h>
diff --git a/lib/smux.h b/lib/smux.h
index 27f36447..91c3d46f 100644
--- a/lib/smux.h
+++ b/lib/smux.h
@@ -149,7 +149,7 @@ void smux_start (void);
void smux_register_mib(char *, struct variable *, size_t, int, oid [], size_t);
int smux_header_generic (struct variable *, oid [], size_t *, int, size_t *,
WriteMethod **);
-int smux_trap (oid *, size_t, oid *, size_t, struct trap_object *, size_t, unsigned int, u_char);
+int smux_trap (oid *, size_t, oid *, size_t, struct trap_object *, size_t, unsigned int);
int oid_compare (oid *, int, oid *, int);
void oid2in_addr (oid [], int, struct in_addr *);
diff --git a/lib/thread.c b/lib/thread.c
index 31bbcd77..402167cf 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -26,6 +26,10 @@
#include "thread.h"
#include "memory.h"
#include "log.h"
+#include "hash.h"
+#include "command.h"
+
+static struct hash *cpu_record = NULL;
/* Struct timeval's tv_usec one second value. */
#define TIMER_SECOND_MICRO 1000000L
@@ -82,6 +86,141 @@ timeval_elapsed (struct timeval a, struct timeval b)
+ (a.tv_usec - b.tv_usec));
}
+static unsigned int
+cpu_record_hash_key (struct cpu_thread_history *a)
+{
+ return (unsigned int) a->func;
+}
+
+static int
+cpu_record_hash_cmp (struct cpu_thread_history *a,
+ struct cpu_thread_history *b)
+{
+ return a->func == b->func;
+}
+
+static void*
+cpu_record_hash_alloc (struct cpu_thread_history *a)
+{
+ struct cpu_thread_history *new;
+ new = XMALLOC( MTYPE_TMP/*XXX*/, sizeof *new);
+ memset(new, 0, sizeof *new);
+ new->func = a->func;
+ new->funcname = XSTRDUP(MTYPE_TMP/*XXX*/,a->funcname);
+ return new;
+}
+
+static inline void
+vty_out_cpu_thread_history(struct vty* vty,
+ struct cpu_thread_history *a)
+{
+ vty_out(vty, " %7ld.%03ld %9d %8ld %10ld %c%c%c%c%c %s%s",
+ a->total/1000, a->total%1000, a->total_calls,
+ a->total/a->total_calls, a->max,
+ a->types & (1 << THREAD_READ) ? 'R':' ',
+ a->types & (1 << THREAD_WRITE) ? 'W':' ',
+ a->types & (1 << THREAD_TIMER) ? 'T':' ',
+ a->types & (1 << THREAD_EVENT) ? 'E':' ',
+ a->types & (1 << THREAD_EXECUTE) ? 'X':' ',
+ a->funcname, VTY_NEWLINE);
+}
+
+static void
+cpu_record_hash_print(struct hash_backet *bucket,
+ void *args[])
+{
+ struct cpu_thread_history *totals = args[0];
+ struct vty *vty = args[1];
+ unsigned char *filter = args[2];
+ struct cpu_thread_history *a = bucket->data;
+
+
+ a = bucket->data;
+ if ( !(a->types & *filter) )
+ return;
+ vty_out_cpu_thread_history(vty,a);
+ totals->total += a->total;
+ totals->total_calls += a->total_calls;
+ if (totals->max < a->max)
+ totals->max = a->max;
+}
+
+static void
+cpu_record_print(struct vty *vty, unsigned char filter)
+{
+ struct cpu_thread_history tmp;
+ void *args[3] = {&tmp, vty, &filter};
+
+ memset(&tmp, 0, sizeof tmp);
+ tmp.funcname = "TOTAL";
+ tmp.types = filter;
+
+ vty_out(vty,
+ " Runtime(ms) Invoked Avg uSecs Max uSecs Type Thread%s",
+ VTY_NEWLINE);
+ hash_iterate(cpu_record,
+ (void(*)(struct hash_backet*,void*))cpu_record_hash_print,
+ args);
+
+ if (tmp.total_calls > 0)
+ vty_out_cpu_thread_history(vty, &tmp);
+}
+
+DEFUN(show_thread_cpu,
+ show_thread_cpu_cmd,
+ "show thread cpu [FILTER]",
+ SHOW_STR
+ "Thread information\n"
+ "Thread CPU usage\n"
+ "Display filter (rwtex)\n")
+{
+ int i = 0;
+ unsigned char filter = 0xff;
+
+ if (argc > 0)
+ {
+ filter = 0;
+ while (argv[0][i] != '\0')
+ {
+ switch ( argv[0][i] )
+ {
+ case 'r':
+ case 'R':
+ filter |= (1 << THREAD_READ);
+ break;
+ case 'w':
+ case 'W':
+ filter |= (1 << THREAD_WRITE);
+ break;
+ case 't':
+ case 'T':
+ filter |= (1 << THREAD_TIMER);
+ break;
+ case 'e':
+ case 'E':
+ filter |= (1 << THREAD_EVENT);
+ break;
+ case 'x':
+ case 'X':
+ filter |= (1 << THREAD_EXECUTE);
+ break;
+ default:
+ break;
+ }
+ ++i;
+ }
+ if (filter == 0)
+ {
+ vty_out(vty, "Invalid filter \"%s\" specified, must contain at least one of 'RWTEX'%s",
+ argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ }
+
+ cpu_record_print(vty, filter);
+ return CMD_SUCCESS;
+}
+
/* List allocation and head/tail print out. */
static void
thread_list_debug (struct thread_list *list)
@@ -113,6 +252,10 @@ thread_master_debug (struct thread_master *m)
struct thread_master *
thread_master_create ()
{
+ if (cpu_record == NULL)
+ {
+ cpu_record = hash_create_size( 1011, cpu_record_hash_key, cpu_record_hash_cmp);
+ }
return (struct thread_master *) XCALLOC (MTYPE_THREAD_MASTER,
sizeof (struct thread_master));
}
@@ -185,6 +328,7 @@ thread_list_free (struct thread_master *m, struct thread_list *list)
for (t = list->head; t; t = next)
{
next = t->next;
+ XFREE (MTYPE_STRVEC, t->funcname);
XFREE (MTYPE_THREAD, t);
list->count--;
m->alloc--;
@@ -235,32 +379,66 @@ thread_timer_remain_second (struct thread *thread)
return 0;
}
+/* Trim blankspace and "()"s */
+static char *
+strip_funcname (char *funcname)
+{
+ char buff[100];
+ char tmp, *ret, *e, *b = buff;
+
+ strncpy(buff, funcname, sizeof(buff));
+ buff[ sizeof(buff) -1] = '\0';
+ e = buff +strlen(buff) -1;
+
+ /* Wont work for funcname == "Word (explanation)" */
+
+ while (*b == ' ' || *b == '(')
+ ++b;
+ while (*e == ' ' || *e == ')')
+ --e;
+ e++;
+
+ tmp = *e;
+ *e = '\0';
+ ret = XSTRDUP (MTYPE_STRVEC, b);
+ *e = tmp;
+
+ return ret;
+}
+
/* Get new thread. */
static struct thread *
thread_get (struct thread_master *m, u_char type,
- int (*func) (struct thread *), void *arg)
+ int (*func) (struct thread *), void *arg, char* funcname)
{
struct thread *thread;
if (m->unuse.head)
- thread = thread_trim_head (&m->unuse);
+ {
+ thread = thread_trim_head (&m->unuse);
+ if (thread->funcname)
+ XFREE(MTYPE_STRVEC, thread->funcname);
+ }
else
{
thread = XCALLOC (MTYPE_THREAD, sizeof (struct thread));
m->alloc++;
}
thread->type = type;
+ thread->add_type = type;
thread->master = m;
thread->func = func;
thread->arg = arg;
+ thread->funcname = strip_funcname(funcname);
+
return thread;
}
/* Add new read thread. */
struct thread *
-thread_add_read (struct thread_master *m,
- int (*func) (struct thread *), void *arg, int fd)
+funcname_thread_add_read (struct thread_master *m,
+ int (*func) (struct thread *), void *arg, int fd, char* funcname)
{
struct thread *thread;
@@ -272,7 +450,7 @@ thread_add_read (struct thread_master *m,
return NULL;
}
- thread = thread_get (m, THREAD_READ, func, arg);
+ thread = thread_get (m, THREAD_READ, func, arg, funcname);
FD_SET (fd, &m->readfd);
thread->u.fd = fd;
thread_list_add (&m->read, thread);
@@ -282,8 +460,8 @@ thread_add_read (struct thread_master *m,
/* Add new write thread. */
struct thread *
-thread_add_write (struct thread_master *m,
- int (*func) (struct thread *), void *arg, int fd)
+funcname_thread_add_write (struct thread_master *m,
+ int (*func) (struct thread *), void *arg, int fd, char* funcname)
{
struct thread *thread;
@@ -295,7 +473,7 @@ thread_add_write (struct thread_master *m,
return NULL;
}
- thread = thread_get (m, THREAD_WRITE, func, arg);
+ thread = thread_get (m, THREAD_WRITE, func, arg, funcname);
FD_SET (fd, &m->writefd);
thread->u.fd = fd;
thread_list_add (&m->write, thread);
@@ -305,8 +483,8 @@ thread_add_write (struct thread_master *m,
/* Add timer event thread. */
struct thread *
-thread_add_timer (struct thread_master *m,
- int (*func) (struct thread *), void *arg, long timer)
+funcname_thread_add_timer (struct thread_master *m,
+ int (*func) (struct thread *), void *arg, long timer, char* funcname)
{
struct timeval timer_now;
struct thread *thread;
@@ -316,7 +494,7 @@ thread_add_timer (struct thread_master *m,
assert (m != NULL);
- thread = thread_get (m, THREAD_TIMER, func, arg);
+ thread = thread_get (m, THREAD_TIMER, func, arg, funcname);
/* Do we need jitter here? */
gettimeofday (&timer_now, NULL);
@@ -342,14 +520,14 @@ thread_add_timer (struct thread_master *m,
/* Add simple event thread. */
struct thread *
-thread_add_event (struct thread_master *m,
- int (*func) (struct thread *), void *arg, int val)
+funcname_thread_add_event (struct thread_master *m,
+ int (*func) (struct thread *), void *arg, int val, char* funcname)
{
struct thread *thread;
assert (m != NULL);
- thread = thread_get (m, THREAD_EVENT, func, arg);
+ thread = thread_get (m, THREAD_EVENT, func, arg, funcname);
thread->u.val = val;
thread_list_add (&m->event, thread);
@@ -621,6 +799,11 @@ thread_call (struct thread *thread)
{
unsigned long thread_time;
RUSAGE_T ru;
+ struct cpu_thread_history tmp, *cpu;
+
+ tmp.func = thread->func;
+ tmp.funcname = thread->funcname;
+ cpu = hash_get(cpu_record, &tmp, cpu_record_hash_alloc);
GETRUSAGE (&thread->ru);
@@ -629,6 +812,12 @@ thread_call (struct thread *thread)
GETRUSAGE (&ru);
thread_time = thread_consumed_time (&ru, &thread->ru);
+ cpu->total += thread_time;
+ if (cpu->max < thread_time)
+ cpu->max = thread_time;
+
+ ++cpu->total_calls;
+ cpu->types |= (1 << thread->add_type);
#ifdef THREAD_CONSUMED_TIME_CHECK
if (thread_time > 200000L)
@@ -638,8 +827,8 @@ thread_call (struct thread *thread)
* Whinge about it now, so we're aware this is yet another task
* to fix.
*/
- zlog_err ("CPU HOG task %lx ran for %ldms",
- /* FIXME: report the name of the function somehow */
+ zlog_err ("CPU HOG task %s (%lx) ran for %ldms",
+ thread->funcname,
(unsigned long) thread->func,
thread_time / 1000L);
}
@@ -648,21 +837,26 @@ thread_call (struct thread *thread)
/* Execute thread */
struct thread *
-thread_execute (struct thread_master *m,
+funcname_thread_execute (struct thread_master *m,
int (*func)(struct thread *),
void *arg,
- int val)
+ int val,
+ char* funcname)
{
struct thread dummy;
memset (&dummy, 0, sizeof (struct thread));
dummy.type = THREAD_EVENT;
+ dummy.add_type = THREAD_EXECUTE;
dummy.master = NULL;
dummy.func = func;
dummy.arg = arg;
dummy.u.val = val;
+ dummy.funcname = strip_funcname (funcname);
thread_call (&dummy);
+ XFREE (MTYPE_STRVEC, dummy.funcname);
+
return NULL;
}
diff --git a/lib/thread.h b/lib/thread.h
index 9de62cdd..0a45d8f3 100644
--- a/lib/thread.h
+++ b/lib/thread.h
@@ -57,6 +57,7 @@ struct thread_master
struct thread
{
unsigned char type; /* thread type */
+ unsigned char add_type; /* thread type */
struct thread *next; /* next pointer of the thread */
struct thread *prev; /* previous pointer of the thread */
struct thread_master *master; /* pointer to the struct thread_master. */
@@ -68,6 +69,15 @@ struct thread
struct timeval sands; /* rest of time sands value. */
} u;
RUSAGE_T ru; /* Indepth usage info. */
+ char* funcname;
+};
+
+struct cpu_thread_history {
+ int (*func)(struct thread *);
+ char *funcname;
+ unsigned int total_calls;
+ unsigned long total, max;
+ unsigned char types;
};
/* Thread types. */
@@ -77,6 +87,7 @@ struct thread
#define THREAD_EVENT 3
#define THREAD_READY 4
#define THREAD_UNUSED 5
+#define THREAD_EXECUTE 6
/* Thread yield time. */
#define THREAD_YIELD_TIME_SLOT 100 * 1000L /* 100ms */
@@ -117,23 +128,31 @@ struct thread
#define THREAD_WRITE_OFF(thread) THREAD_OFF(thread)
#define THREAD_TIMER_OFF(thread) THREAD_OFF(thread)
+#define thread_add_read(m,f,a,v) funcname_thread_add_read(m,f,a,v,#f)
+#define thread_add_write(m,f,a,v) funcname_thread_add_write(m,f,a,v,#f)
+#define thread_add_timer(m,f,a,v) funcname_thread_add_timer(m,f,a,v,#f)
+#define thread_add_event(m,f,a,v) funcname_thread_add_event(m,f,a,v,#f)
+#define thread_execute(m,f,a,v) funcname_thread_execute(m,f,a,v,#f)
+
/* Prototypes. */
struct thread_master *thread_master_create ();
-struct thread *thread_add_read (struct thread_master *,
- int (*)(struct thread *), void *, int);
-struct thread *thread_add_write (struct thread_master *,
- int (*)(struct thread *), void *, int);
-struct thread *thread_add_timer (struct thread_master *,
- int (*)(struct thread *), void *, long);
-struct thread *thread_add_event (struct thread_master *,
- int (*)(struct thread *), void *, int );
+struct thread *funcname_thread_add_read (struct thread_master *,
+ int (*)(struct thread *), void *, int, char*);
+struct thread *funcname_thread_add_write (struct thread_master *,
+ int (*)(struct thread *), void *, int, char*);
+struct thread *funcname_thread_add_timer (struct thread_master *,
+ int (*)(struct thread *), void *, long, char*);
+struct thread *funcname_thread_add_event (struct thread_master *,
+ int (*)(struct thread *), void *, int, char*);
void thread_cancel (struct thread *);
void thread_cancel_event (struct thread_master *, void *);
struct thread *thread_fetch (struct thread_master *, struct thread *);
-struct thread *thread_execute (struct thread_master *,
- int (*)(struct thread *), void *, int);
+struct thread *funcname_thread_execute (struct thread_master *,
+ int (*)(struct thread *), void *, int, char *);
void thread_call (struct thread *);
unsigned long thread_timer_remain_second (struct thread *);
+extern struct cmd_element show_thread_cpu_cmd;
+
#endif /* _ZEBRA_THREAD_H */
diff --git a/lib/version.h b/lib/version.h
index ecb6b0a3..9a90bf4e 100644
--- a/lib/version.h
+++ b/lib/version.h
@@ -22,7 +22,7 @@
#ifndef _ZEBRA_VERSION_H
#define _ZEBRA_VERSION_H
-#define ZEBRA_VERSION "0.94"
+#define ZEBRA_VERSION "0.93b"
#define ZEBRA_BUG_ADDRESS "bug-zebra@gnu.org"
diff --git a/lib/vty.c b/lib/vty.c
index 4d6eb304..5ef364a0 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -33,7 +33,6 @@
#include "log.h"
#include "prefix.h"
#include "filter.h"
-#include "privs.h"
/* Vty events */
enum event
@@ -1852,8 +1851,7 @@ vty_serv_un (char *path)
int sock, len;
struct sockaddr_un serv;
mode_t old_mask;
- struct zprivs_ids_t ids;
-
+
/* First of all, unlink existing socket */
unlink (path);
@@ -1896,18 +1894,6 @@ vty_serv_un (char *path)
umask (old_mask);
- zprivs_get_ids(&ids);
-
- if (ids.gid_vty > 0)
- {
- /* set group of socket */
- if ( chown (path, -1, ids.gid_vty) )
- {
- zlog_err ("vty_serv_un: could chown socket, %s",
- strerror (errno) );
- }
- }
-
vty_event (VTYSH_SERV, sock, NULL);
}
diff --git a/lib/zebra.h b/lib/zebra.h
index 15608dbc..62566cf8 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -42,8 +42,6 @@ typedef int socklen_t;
#include <fcntl.h>
#include <signal.h>
#include <string.h>
-#include <pwd.h>
-#include <grp.h>
#ifdef HAVE_STROPTS_H
#include <stropts.h>
#endif /* HAVE_STROPTS_H */
@@ -72,10 +70,6 @@ typedef int socklen_t;
#ifdef HAVE_RUSAGE
#include <sys/resource.h>
#endif /* HAVE_RUSAGE */
-#ifdef HAVE_LCAPS
-#include <sys/capability.h>
-#include <sys/prctl.h>
-#endif /* HAVE_LCAPS */
/* machine dependent includes */
#ifdef SUNOS_5