diff options
author | jardin <jardin> | 2003-12-23 08:56:18 +0000 |
---|---|---|
committer | jardin <jardin> | 2003-12-23 08:56:18 +0000 |
commit | 9e867fe663c4eb43c36f35067c0dd092e8c83c14 (patch) | |
tree | f29461b6a2dc8c38037dc0cf91e70392f9ed4ab2 /isisd | |
parent | eb5d44eb8dcf25a1b328e57d1eabb1f89e3bc59b (diff) |
Merge isisd into the Quagga's framework:
- add privs support
- use misc quagga's definitions
- make it compile"able"
- fix segfault cases related to hostname()
- add debug isis xxx command
This patch has been approved by Paul Jakma.
Diffstat (limited to 'isisd')
-rw-r--r-- | isisd/Makefile.am | 10 | ||||
-rw-r--r-- | isisd/Makefile.in | 242 | ||||
-rw-r--r-- | isisd/isis_dynhn.c | 2 | ||||
-rw-r--r-- | isisd/isis_lsp.c | 21 | ||||
-rw-r--r-- | isisd/isis_main.c | 54 | ||||
-rw-r--r-- | isisd/isis_misc.c | 24 | ||||
-rw-r--r-- | isisd/isis_misc.h | 2 | ||||
-rw-r--r-- | isisd/isis_network.c | 45 | ||||
-rw-r--r-- | isisd/isisd.c | 98 | ||||
-rw-r--r-- | isisd/isisd.h | 1 |
10 files changed, 363 insertions, 136 deletions
diff --git a/isisd/Makefile.am b/isisd/Makefile.am index b9a0c7cb..fd4c199d 100644 --- a/isisd/Makefile.am +++ b/isisd/Makefile.am @@ -43,13 +43,3 @@ install-sysconfDATA: $(sysconf_DATA) fi; fi; \ done -depend: - @$(CPP) -MM $(INCLUDES) $(LDFLAGS) *.c - -## File dependency. -isis_adjacency.o : isis_adjacency.c ../lib/version.h ../lib/log.h \ - ../isisd/isis_adjacency.h -isis_pdu.o : isis_pdu.c ../lib/log.h ../isisd/isisd.h \ - ../isisd/isis_constants.h ../isisd/isis_adjacency.h \ - ../isisd/isis_pdu.h -isis_circuit.o : isis_circuit.c ../isisd/isis_circuit.h diff --git a/isisd/Makefile.in b/isisd/Makefile.in index 46aae735..7cb2e594 100644 --- a/isisd/Makefile.in +++ b/isisd/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.6.2 from Makefile.am. +# Makefile.in generated by automake 1.7.9 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -13,98 +13,138 @@ # 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@ - -EXEEXT = @EXEEXT@ -OBJEXT = @OBJEXT@ -PATH_SEPARATOR = @PATH_SEPARATOR@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BGPD = @BGPD@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFDATE = @CONFDATE@ 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 -Itopology 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@ ISISD = @ISISD@ KERNEL_METHOD = @KERNEL_METHOD@ +LDFLAGS = @LDFLAGS@ +LIBCAP = @LIBCAP@ +LIBOBJS = @LIBOBJS@ LIBPAM = @LIBPAM@ +LIBS = @LIBS@ LIB_IPV6 = @LIB_IPV6@ LIB_REGEX = @LIB_REGEX@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ MULTIPATH_NUM = @MULTIPATH_NUM@ +OBJEXT = @OBJEXT@ OSPF6D = @OSPF6D@ +OSPFAPI = @OSPFAPI@ +OSPFCLIENT = @OSPFCLIENT@ 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__leading_dot = @am__leading_dot@ 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@ +exampledir = @exampledir@ +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@ -DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" +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@ INSTALL_SDATA = @INSTALL@ -m 600 -LIBS = @LIBS@ noinst_LIBRARIES = libisis.a sbin_PROGRAMS = isisd @@ -132,6 +172,7 @@ sysconf_DATA = isisd.conf.sample EXTRA_DIST = $(sysconf_DATA) subdir = isisd +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @@ -161,9 +202,8 @@ am_isisd_OBJECTS = isis_main.$(OBJEXT) $(am__objects_1) isisd_OBJECTS = $(am_isisd_OBJECTS) isisd_DEPENDENCIES = ../lib/libzebra.a isisd_LDFLAGS = + DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/dict.Po \ @@ -183,23 +223,22 @@ 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 = $(libisis_a_SOURCES) $(isisd_SOURCES) DATA = $(sysconf_DATA) HEADERS = $(noinst_HEADERS) -DIST_COMMON = README $(noinst_HEADERS) AUTHORS COPYING ChangeLog \ - Makefile.am Makefile.in TODO +DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.in AUTHORS \ + COPYING ChangeLog Makefile.am TODO SOURCES = $(libisis_a_SOURCES) $(isisd_SOURCES) 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) --gnu isisd/Makefile + $(AUTOMAKE) --foreign isisd/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) @@ -217,18 +256,16 @@ install-sbinPROGRAMS: $(sbin_PROGRAMS) p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ - p1=`echo "$$p1" | sed -e 's,^.*/,,'`; \ - f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f; \ + $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f || exit 1; \ else :; fi; \ done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - f=`echo "$$f" | sed -e 's,^.*/,,'`; \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \ rm -f $(DESTDIR)$(sbindir)/$$f; \ done @@ -266,21 +303,27 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isisd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso_checksum.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)/'`$< +@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 -f "$(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)/'`$< .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@ +@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)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(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)/$<'; fi` uninstall-info-am: sysconfDATA_INSTALL = $(INSTALL_DATA) @@ -295,6 +338,9 @@ uninstall-sysconfDATA: ETAGS = etags ETAGSFLAGS = +CTAGS = ctags +CTAGSFLAGS = + tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -320,20 +366,41 @@ 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 + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @list='$(DISTFILES)'; for file in $$list; do \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ 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 \ @@ -359,7 +426,6 @@ all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS) installdirs: $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(sysconfdir) - install: install-am install-exec: install-exec-am install-data: install-data-am @@ -371,7 +437,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -379,7 +445,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -390,9 +456,10 @@ clean-am: clean-generic clean-noinstLIBRARIES clean-sbinPROGRAMS \ mostlyclean-am distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-tags + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags dvi: dvi-am @@ -413,27 +480,36 @@ install-man: installcheck-am: maintainer-clean: maintainer-clean-am - + -rm -rf ./$(DEPDIR) + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS \ uninstall-sysconfDATA -.PHONY: GTAGS all all-am check check-am clean clean-generic \ - clean-noinstLIBRARIES clean-sbinPROGRAMS 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-sbinPROGRAMS install-strip install-sysconfDATA \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic tags uninstall uninstall-am \ - uninstall-info-am uninstall-sbinPROGRAMS uninstall-sysconfDATA +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES clean-sbinPROGRAMS ctags distclean \ + distclean-compile 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-sbinPROGRAMS install-strip \ + install-sysconfDATA 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 \ + uninstall-sbinPROGRAMS uninstall-sysconfDATA install-sysconfDATA: $(sysconf_DATA) @@ -448,16 +524,6 @@ install-sysconfDATA: $(sysconf_DATA) $(INSTALL_SDATA) $$p $(DESTDIR)$(sysconfdir)/$$p; \ fi; fi; \ done - -depend: - @$(CPP) -MM $(INCLUDES) $(LDFLAGS) *.c - -isis_adjacency.o : isis_adjacency.c ../lib/version.h ../lib/log.h \ - ../isisd/isis_adjacency.h -isis_pdu.o : isis_pdu.c ../lib/log.h ../isisd/isisd.h \ - ../isisd/isis_constants.h ../isisd/isis_adjacency.h \ - ../isisd/isis_pdu.h -isis_circuit.o : isis_circuit.c ../isisd/isis_circuit.h # 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/isisd/isis_dynhn.c b/isisd/isis_dynhn.c index 9e151d0a..0ba18428 100644 --- a/isisd/isis_dynhn.c +++ b/isisd/isis_dynhn.c @@ -117,7 +117,7 @@ void dynhn_print_all (struct vty *vty) VTY_NEWLINE); } - vty_out (vty, " * %s %s%s", sysid_print (isis->sysid), host.name, + vty_out (vty, " * %s %s%s", sysid_print (isis->sysid), unix_hostname(), VTY_NEWLINE); return; } diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 6bfb0fd4..f797b9e6 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -60,7 +60,6 @@ extern struct isis *isis; extern struct thread_master *master; -extern struct host host; int lsp_id_cmp (u_char *id1, u_char *id2) @@ -638,7 +637,7 @@ lspid_print (u_char *lsp_id, u_char *trg, char dynhost, char frag) if (dyn) sprintf (id, "%.14s", dyn->name.name); else if (!memcmp (isis->sysid, lsp_id, ISIS_SYS_ID_LEN) & dynhost) - sprintf (id, "%.14s", host.name); + sprintf (id, "%.14s", unix_hostname()); else { memcpy(id, sysid_print (lsp_id), 15); } @@ -1053,8 +1052,9 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area) if (area->dynhostname) { lsp->tlv_data.hostname = XMALLOC (MTYPE_ISIS_TLV, sizeof (struct hostname)); - memcpy (&lsp->tlv_data.hostname->name, host.name, strlen(host.name)); - lsp->tlv_data.hostname->namelen = strlen (host.name); + memcpy (&lsp->tlv_data.hostname->name, unix_hostname(), + strlen(unix_hostname())); + lsp->tlv_data.hostname->namelen = strlen (unix_hostname()); } #ifdef TOPOLOGY_GENERATE /* @@ -1337,8 +1337,10 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area) if (area->dynhostname) { lsp->tlv_data.hostname = XMALLOC (MTYPE_ISIS_TLV, sizeof (struct hostname)); - memcpy (lsp->tlv_data.hostname->name, host.name, strlen (host.name)); - lsp->tlv_data.hostname->namelen = strlen (host.name); + + memcpy (lsp->tlv_data.hostname->name, unix_hostname(), + strlen (unix_hostname())); + lsp->tlv_data.hostname->namelen = strlen (unix_hostname()); } /* @@ -1553,13 +1555,14 @@ build_lsp_data (struct isis_lsp *lsp, struct isis_area *area) if (area->dynhostname) { tlv_ptr = lsppdu_realloc (lsp,MTYPE_ISIS_TLV, 2); /* the 2 is for the TL */ *tlv_ptr = DYNAMIC_HOSTNAME; /* Type */ - *(tlv_ptr+1) = strlen (host.name); /* Length */ + *(tlv_ptr+1) = strlen (unix_hostname()); /* Length */ lsp->tlv_data.hostname = (struct hostname *) (lsppdu_realloc(lsp, MTYPE_ISIS_TLV, /* the -1 is to fit the length in the struct */ - strlen (host.name)) - 1); - memcpy (lsp->tlv_data.hostname->name, host.name, strlen(host.name)); + strlen (unix_hostname())) - 1); + memcpy (lsp->tlv_data.hostname->name, unix_hostname(), + strlen(unix_hostname())); } } diff --git a/isisd/isis_main.c b/isisd/isis_main.c index baf5f38d..8106492f 100644 --- a/isisd/isis_main.c +++ b/isisd/isis_main.c @@ -33,6 +33,7 @@ #include "memory.h" #include "stream.h" #include "if.h" +#include "privs.h" #include "isisd/dict.h" #include "include-netbsd/iso.h" @@ -48,12 +49,36 @@ /* Default vty port */ #define ISISD_VTY_PORT 2607 +/* isisd privileges */ +zebra_capabilities_t _caps_p [] = +{ + ZCAP_RAW, + ZCAP_BIND +}; + +struct zebra_privs_t isisd_privs = +{ +#if defined(QUAGGA_USER) + .user = QUAGGA_USER, +#endif +#if defined QUAGGA_GROUP + .group = QUAGGA_GROUP, +#endif +#ifdef VTY_GROUP + .vty_group = VTY_GROUP, +#endif + .caps_p = _caps_p, + .cap_num_p = 2, + .cap_num_i = 0 +}; + /* isisd options */ struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, { "config_file", required_argument, NULL, 'f'}, { "vty_port", required_argument, NULL, 'P'}, + { "user", required_argument, NULL, 'u'}, { "version", no_argument, NULL, 'v'}, { "help", no_argument, NULL, 'h'}, { 0 } @@ -94,6 +119,7 @@ Daemon which manages IS-IS routing\n\n\ -d, --daemon Runs in daemon mode\n\ -f, --config_file Set configuration file name\n\ -P, --vty_port Set vty's port number\n\ +-u, --user User and group to run as\n\ -v, --version Print program version\n\ -h, --help Display this help and exit\n\ \n\ @@ -230,7 +256,7 @@ main (int argc, char **argv, char **envp) /* Command line argument treatment. */ while (1) { - opt = getopt_long (argc, argv, "df:hAp:P:v", longopts, 0); + opt = getopt_long (argc, argv, "df:hAp:P:u:v", longopts, 0); if (opt == EOF) break; @@ -249,7 +275,19 @@ main (int argc, char **argv, char **envp) vty_addr = optarg; break; case 'P': + /* Deal with atoi() returning 0 on failure, and isisd not + listening on isisd port... */ + if (strcmp(optarg, "0") == 0) + { + vty_port = 0; + break; + } vty_port = atoi (optarg); + vty_port = (vty_port ? vty_port : ISISD_VTY_PORT); + break; + case 'u': + isisd_privs.user = isisd_privs.group = optarg; + break; break; case 'v': printf("ISISd version %s\n", ISISD_VERSION); @@ -276,9 +314,10 @@ main (int argc, char **argv, char **envp) /* * initializations */ + zprivs_init (&isisd_privs); signal_init (); cmd_init (1); - vty_init (); + vty_init (master); memory_init (); isis_init (); dyn_cache_init (); @@ -295,19 +334,18 @@ main (int argc, char **argv, char **envp) if (daemon_mode) daemon (0, 0); - /* Problems with the build env ?*/ -#ifndef PATH_ISISD_PID -#define PATH_ISISD_PID "/var/run/isisd.pid" -#endif /* Process ID file creation. */ pid_output (PATH_ISISD_PID); /* Make isis vty socket. */ - vty_serv_sock (vty_addr, vty_port ? vty_port : ISISD_VTY_PORT, - ISIS_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, ISIS_VTYSH_PATH); /* Print banner. */ +#if defined(ZEBRA_VERSION) zlog_info ("ISISd %s starting: vty@%d", ZEBRA_VERSION, vty_port); +#elif defined(QUAGGA_VERSION) + zlog_info ("Quagga-ISISd %s starting: vty@%d", QUAGGA_VERSION, vty_port); +#endif #ifdef HAVE_IPV6 zlog_info ("IPv6 enabled"); #endif diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c index 763ae243..cf558e83 100644 --- a/isisd/isis_misc.c +++ b/isisd/isis_misc.c @@ -28,12 +28,13 @@ #include <ctype.h> #include <zebra.h> #include <net/ethernet.h> - +#include <sys/utsname.h> #include "stream.h" #include "vty.h" #include "hash.h" #include "if.h" +#include "command.h" #include "isisd/dict.h" #include "isisd/isis_constants.h" @@ -432,7 +433,22 @@ newprefix2inaddr (u_char *prefix_start, u_char prefix_masklen) return new_prefix; } +/* + * Returns host.name if any, otherwise + * it returns the system hostname. + */ +const char * +unix_hostname(void) +{ + static struct utsname names; + const char *hostname; + extern struct host host; + + hostname = host.name; + if (!hostname) { + uname(&names); + hostname = names.nodename; + } - - - + return hostname; +} diff --git a/isisd/isis_misc.h b/isisd/isis_misc.h index 0e219c65..ca0c0ae3 100644 --- a/isisd/isis_misc.h +++ b/isisd/isis_misc.h @@ -53,6 +53,8 @@ char *nlpid2string (struct nlpids *); */ int speaks (struct nlpids *nlpids, int family); unsigned long isis_jitter (unsigned long timer, unsigned long jitter); +const char * unix_hostname(void); + /* * macros diff --git a/isisd/isis_network.c b/isisd/isis_network.c index d22f3dd8..c10aeebf 100644 --- a/isisd/isis_network.c +++ b/isisd/isis_network.c @@ -42,6 +42,10 @@ #include "isisd/isis_circuit.h" #include "isisd/isis_network.h" +#include "privs.h" + +extern struct zebra_privs_t isisd_privs; + /* * On linux we can use the packet(7) sockets, in other OSs we have to do with * Berkley Packet Filter (BPF). Please tell me if you can think of a better @@ -297,28 +301,39 @@ isis_sock_init (struct isis_circuit *circuit) { int retval = ISIS_OK; + if ( isisd_privs.change (ZPRIVS_RAISE) ) + zlog_err ("%s: could not raise privs, %s", __func__, + strerror (errno) ); #ifdef GNU_LINUX retval = open_packet_socket (circuit); #else retval = open_bpf_dev (circuit); #endif - - if (retval == ISIS_OK) { - if (circuit->circ_type == CIRCUIT_T_BROADCAST) { - circuit->tx = isis_send_pdu_bcast; - circuit->rx = isis_recv_pdu_bcast; - } - else if (circuit->circ_type == CIRCUIT_T_P2P) { - circuit->tx = isis_send_pdu_p2p; - circuit->rx = isis_recv_pdu_p2p; - } - else { - zlog_warn ("isis_sock_init(): unknown circuit type"); - retval = ISIS_WARNING; - } + + if (retval != ISIS_OK) { + zlog_warn("%s: could not initialize the socket", + __func__); + goto end; } - + + if (circuit->circ_type == CIRCUIT_T_BROADCAST) { + circuit->tx = isis_send_pdu_bcast; + circuit->rx = isis_recv_pdu_bcast; + } else if (circuit->circ_type == CIRCUIT_T_P2P) { + circuit->tx = isis_send_pdu_p2p; + circuit->rx = isis_recv_pdu_p2p; + } else { + zlog_warn ("isis_sock_init(): unknown circuit type"); + retval = ISIS_WARNING; + goto end; + } + +end: + if ( isisd_privs.change (ZPRIVS_LOWER) ) + zlog_err ("%s: could not lower privs, %s", __func__, + strerror (errno) ); + return retval; } diff --git a/isisd/isisd.c b/isisd/isisd.c index 8794a12c..3b8a0a62 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -506,6 +506,79 @@ DEFUN (show_debugging, return CMD_SUCCESS; } +/* Debug node. */ +static struct cmd_node debug_node = +{ + DEBUG_NODE, + "", + 1 +}; + +static int +config_write_debug (struct vty *vty) +{ + int write = 0; + int flags = isis->debugs; + + if (flags & DEBUG_ADJ_PACKETS) { + vty_out (vty, "debug isis adj-packets%s", + VTY_NEWLINE); + write++; + } + if (flags & DEBUG_CHECKSUM_ERRORS) { + vty_out (vty, "debug isis checksum-errors%s", + VTY_NEWLINE); + write++; + } + if (flags & DEBUG_LOCAL_UPDATES) { + vty_out (vty, "debug isis local-updates%s", + VTY_NEWLINE); + write++; + } + if (flags & DEBUG_PROTOCOL_ERRORS) { + vty_out (vty, "debug isis protocol-errors%s", + VTY_NEWLINE); + write++; + } + if (flags & DEBUG_SNP_PACKETS) { + vty_out (vty, "debug isis snp-packets%s", + VTY_NEWLINE); + write++; + } + if (flags & DEBUG_SPF_EVENTS) { + vty_out (vty, "debug isis spf-events%s", + VTY_NEWLINE); + write++; + } + if (flags & DEBUG_SPF_STATS) { + vty_out (vty, "debug isis spf-statistics%s", + VTY_NEWLINE); + write++; + } + if (flags & DEBUG_SPF_TRIGGERS) { + vty_out (vty, "debug isis spf-triggers%s", + VTY_NEWLINE); + write++; + } + if (flags & DEBUG_UPDATE_PACKETS) { + vty_out (vty, "debug isis update-packets%s", + VTY_NEWLINE); + write++; + } + if (flags & DEBUG_RTE_EVENTS) { + vty_out (vty, "debug isis route-events%s", + VTY_NEWLINE); + write++; + } + if (flags & DEBUG_EVENTS) { + vty_out (vty, "debug isis events%s", + VTY_NEWLINE); + write++; + } + + return write; +} + DEFUN (debug_isis_adj, debug_isis_adj_cmd, "debug isis adj-packets", @@ -1893,6 +1966,8 @@ isis_init () install_element (ENABLE_NODE, &show_database_detail_cmd); install_element (ENABLE_NODE, &show_debugging_cmd); + install_node(&debug_node, config_write_debug); + install_element (ENABLE_NODE, &debug_isis_adj_cmd); install_element (ENABLE_NODE, &no_debug_isis_adj_cmd); install_element (ENABLE_NODE, &debug_isis_csum_cmd); @@ -1916,6 +1991,29 @@ isis_init () install_element (ENABLE_NODE, &debug_isis_events_cmd); install_element (ENABLE_NODE, &no_debug_isis_events_cmd); + install_element (CONFIG_NODE, &debug_isis_adj_cmd); + install_element (CONFIG_NODE, &no_debug_isis_adj_cmd); + install_element (CONFIG_NODE, &debug_isis_csum_cmd); + install_element (CONFIG_NODE, &no_debug_isis_csum_cmd); + install_element (CONFIG_NODE, &debug_isis_lupd_cmd); + install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd); + install_element (CONFIG_NODE, &debug_isis_err_cmd); + install_element (CONFIG_NODE, &no_debug_isis_err_cmd); + install_element (CONFIG_NODE, &debug_isis_snp_cmd); + install_element (CONFIG_NODE, &no_debug_isis_snp_cmd); + install_element (CONFIG_NODE, &debug_isis_upd_cmd); + install_element (CONFIG_NODE, &no_debug_isis_upd_cmd); + install_element (CONFIG_NODE, &debug_isis_spfevents_cmd); + install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd); + install_element (CONFIG_NODE, &debug_isis_spfstats_cmd); + install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd); + install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd); + install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd); + install_element (CONFIG_NODE, &debug_isis_rtevents_cmd); + install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd); + install_element (CONFIG_NODE, &debug_isis_events_cmd); + install_element (CONFIG_NODE, &no_debug_isis_events_cmd); + install_element (CONFIG_NODE, &router_isis_cmd); install_element (CONFIG_NODE, &no_router_isis_cmd); diff --git a/isisd/isisd.h b/isisd/isisd.h index 67bf8d63..3ca421ad 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -24,7 +24,6 @@ #define ISISD_H #define ISISD_VERSION "0.0.7" -#define ISIS_VTYSH_PATH "/tmp/.isisd" /* uncomment if you are a developer in bug hunt */ /* #define EXTREME_DEBUG */ |