diff --git a/.gitignore b/.gitignore index 0b95d3a1..3b734f49 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ /config.status /configure /sysdep/autoconf.h.in +/sysdep/autoconf.h.in~ +/cscope.* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..ff11dda0 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,309 @@ +variables: + DEBIAN_FRONTEND: noninteractive + LC_ALL: C + GIT_STRATEGY: fetch + DOCKER_CMD: docker --config="$HOME/.docker/$CI_JOB_ID/" + IMG_BASE: registry.labs.nic.cz/labs/bird + +stages: + - image + - build + +.docker: &docker_build + stage: image + allow_failure: true + script: + - $DOCKER_CMD login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.labs.nic.cz + # Make sure we refresh the base image if it updates (eg. security updates, etc) + # If we do just the build, cache is always reused and the freshness of the + # base image is never checked. However, pull always asks and updates the + # image only if it changed ‒ therefore, the cache is used unless there's a + # change. + - $DOCKER_CMD pull `sed -ne 's/^FROM //p' "misc/docker/$IMG_NAME/Dockerfile"` + - $DOCKER_CMD build -t "bird:$IMG_NAME" "misc/docker/$IMG_NAME" + - $DOCKER_CMD tag "bird:$IMG_NAME" "$IMG_BASE:$IMG_NAME" + - $DOCKER_CMD push "$IMG_BASE:$IMG_NAME" + after_script: + - rm -f "$HOME/.docker/$CI_JOB_ID/" # cleanup the credentials + tags: + # That's Docker in Docker + - dind + +docker_debian-7-amd64: + variables: + IMG_NAME: "debian-7-amd64" + <<: *docker_build + +docker_debian-8-amd64: + variables: + IMG_NAME: "debian-8-amd64" + <<: *docker_build + +docker_debian-9-amd64: + variables: + IMG_NAME: "debian-9-amd64" + <<: *docker_build + +docker_debian-testing-amd64: + variables: + IMG_NAME: "debian-testing-amd64" + <<: *docker_build + +docker_debian-7-i386: + variables: + IMG_NAME: "debian-7-i386" + <<: *docker_build + +docker_debian-8-i386: + variables: + IMG_NAME: "debian-8-i386" + <<: *docker_build + +docker_debian-9-i386: + variables: + IMG_NAME: "debian-9-i386" + <<: *docker_build + +docker_debian-testing-i386: + variables: + IMG_NAME: "debian-testing-i386" + <<: *docker_build + +docker_fedora-25-amd64: + variables: + IMG_NAME: "fedora-25-amd64" + <<: *docker_build + +docker_fedora-26-amd64: + variables: + IMG_NAME: "fedora-26-amd64" + <<: *docker_build + +docker_centos-6-amd64: + variables: + IMG_NAME: "centos-6-amd64" + <<: *docker_build + +docker_centos-7-amd64: + variables: + IMG_NAME: "centos-7-amd64" + <<: *docker_build + +docker_opensuse-42_3-amd64: + variables: + IMG_NAME: "opensuse-42.3-amd64" + <<: *docker_build + +docker_ubuntu-14_04-amd64: + variables: + IMG_NAME: "ubuntu-14.04-amd64" + <<: *docker_build + +docker_ubuntu-16_04-amd64: + variables: + IMG_NAME: "ubuntu-16.04-amd64" + <<: *docker_build + +.debian-7-i386: &debian-7-i386_env + image: registry.labs.nic.cz/labs/bird:debian-7-i386 + tags: + - docker + - linux + - amd64 + +.debian-8-i386: &debian-8-i386_env + image: registry.labs.nic.cz/labs/bird:debian-8-i386 + tags: + - docker + - linux + - amd64 + +.debian-9-i386: &debian-9-i386_env + image: registry.labs.nic.cz/labs/bird:debian-9-i386 + tags: + - docker + - linux + - amd64 + +.debian-testing-i386: &debian-testing-i386_env + image: registry.labs.nic.cz/labs/bird:debian-testing-i386 + tags: + - docker + - linux + - amd64 + +.debian-7-amd64: &debian-7-amd64_env + image: registry.labs.nic.cz/labs/bird:debian-7-amd64 + tags: + - docker + - linux + - amd64 + +.debian-8-amd64: &debian-8-amd64_env + image: registry.labs.nic.cz/labs/bird:debian-8-amd64 + tags: + - docker + - linux + - amd64 + +.debian-9-amd64: &debian-9-amd64_env + image: registry.labs.nic.cz/labs/bird:debian-9-amd64 + tags: + - docker + - linux + - amd64 + +.debian-testing-amd64: &debian-testing-amd64_env + image: registry.labs.nic.cz/labs/bird:debian-testing-amd64 + tags: + - docker + - linux + - amd64 + +.fedora-25-amd64: &fedora-25-amd64_env + image: registry.labs.nic.cz/labs/bird:fedora-25-amd64 + tags: + - docker + - linux + - amd64 + +.fedora-26-amd64: &fedora-26-amd64_env + image: registry.labs.nic.cz/labs/bird:fedora-26-amd64 + tags: + - docker + - linux + - amd64 + +.centos-6-amd64: ¢os-6-amd64_env + image: registry.labs.nic.cz/labs/bird:centos-6-amd64 + tags: + - docker + - linux + - amd64 + +.centos-7-amd64: ¢os-7-amd64_env + image: registry.labs.nic.cz/labs/bird:centos-7-amd64 + tags: + - docker + - linux + - amd64 + +.opensuse-42_3-amd64: &opensuse-42_3-amd64_env + image: registry.labs.nic.cz/labs/bird:opensuse-42.3-amd64 + tags: + - docker + - linux + - amd64 + +.ubuntu-14_04-amd64: &ubuntu-14_04-amd64_env + image: registry.labs.nic.cz/labs/bird:ubuntu-14.04-amd64 + tags: + - docker + - linux + - amd64 + +.ubuntu-16_04-amd64: &ubuntu-16_04-amd64_env + image: registry.labs.nic.cz/labs/bird:ubuntu-16.04-amd64 + tags: + - docker + - linux + - amd64 + +# TODO We want to copy these BSDs to our own virtual machines, to make sure someone doesn't update them by accident. +.freebsd-11-i386: &freebsd-11-i386_env + tags: + - freebsd + - i386 + #only: + #- master + #- triggers + #- tags + +.freebsd-11-amd64: &freebsd-11-amd64_env + tags: + - freebsd + - amd64 + #only: + #- master + #- triggers + #- tags + +.build: &build_job + stage: build + script: + - autoreconf + - ./configure CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" + # Detect which make is available + - MAKE=make + - which gmake 2>/dev/null >/dev/null && MAKE=gmake + - $MAKE + # Run tests if they are available + - $MAKE check + +build-debian-7-amd64: + <<: *debian-7-amd64_env + <<: *build_job + +build-debian-8-amd64: + <<: *debian-8-amd64_env + <<: *build_job + +build-debian-9-amd64: + <<: *debian-9-amd64_env + <<: *build_job + +build-debian-testing-amd64: + <<: *debian-testing-amd64_env + <<: *build_job + +build-fedora-25-amd64: + <<: *fedora-25-amd64_env + <<: *build_job + +build-fedora-26-amd64: + <<: *fedora-26-amd64_env + <<: *build_job + +build-centos-6-amd64: + <<: *centos-6-amd64_env + <<: *build_job + +build-centos-7-amd64: + <<: *centos-7-amd64_env + <<: *build_job + +build-opensuse-42_3-amd64: + <<: *opensuse-42_3-amd64_env + <<: *build_job + +build-ubuntu-14_04-amd64: + <<: *ubuntu-14_04-amd64_env + <<: *build_job + +build-ubuntu-16_04-amd64: + <<: *ubuntu-16_04-amd64_env + <<: *build_job + +build-debian-7-i386: + <<: *debian-7-i386_env + <<: *build_job + +build-debian-8-i386: + <<: *debian-8-i386_env + <<: *build_job + +build-debian-9-i386: + <<: *debian-9-i386_env + <<: *build_job + +build-debian-testing-i386: + <<: *debian-testing-i386_env + <<: *build_job + +build-freebsd-11-amd64: + <<: *freebsd-11-amd64_env + <<: *build_job + +build-freebsd-11-i386: + <<: *freebsd-11-i386_env + <<: *build_job diff --git a/Makefile.in b/Makefile.in index e1f8d9c2..b755df44 100644 --- a/Makefile.in +++ b/Makefile.in @@ -9,6 +9,8 @@ MAKEFLAGS += -r CPPFLAGS=-I$(objdir) -I$(srcdir) @CPPFLAGS@ CFLAGS=$(CPPFLAGS) @CFLAGS@ LDFLAGS=@LDFLAGS@ +M4FLAGS=@M4FLAGS@ +BISONFLAGS=@BISONFLAGS@ LIBS=@LIBS@ DAEMON_LIBS=@DAEMON_LIBS@ CLIENT_LIBS=@CLIENT_LIBS@ @@ -37,6 +39,11 @@ srcdir := @srcdir@ objdir := @objdir@ exedir := @exedir@ +git-label:=$(strip $(shell cd $(srcdir) && [ "$$(git rev-parse --show-toplevel)" = "$$(readlink -f .)" ] && git describe --always --dirty=-x 2>/dev/null)) +ifneq ($(git-label),) + CFLAGS += -DGIT_LABEL="$(git-label)" +endif + ifeq ($(objdir),.) objdir := $(realpath .) endif @@ -49,11 +56,15 @@ else Q:= endif +ifneq ($(COLOR),) + CFLAGS += -fdiagnostics-color=always +endif + # Meta rules docgoals := docs userdocs progdocs testgoals := check test tests tests_run cleangoals := clean distclean testsclean -.PHONY: all daemon cli $(docgoals) $(testgoals) $(cleangoals) tags +.PHONY: all daemon cli $(docgoals) $(testgoals) $(cleangoals) tags cscope all: daemon cli daemon: $(daemon) @@ -90,7 +101,7 @@ clean = $(eval $(call clean_in,$(1))) include $(addsuffix /Makefile,$(addprefix $(srcdir)/,$(dirs))) # Generic rules - +# Object file rules $(objdir)/%.o: $(srcdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h $(E)echo CC -o $@ -c $< $(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $< @@ -99,7 +110,16 @@ $(objdir)/%.o: $(objdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h $(E)echo CC -o $@ -c $< $(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $< +# Debug: Preprocessed source rules +$(objdir)/%.E: $(srcdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h + $(E)echo CC -o $@ -E $< + $(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -E $< +$(objdir)/%.E: $(objdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h + $(E)echo CC -o $@ -E $< + $(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -E $< + +# Debug: Assembler object rules $(objdir)/%.S: $(srcdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h $(E)echo CC -o $@ -S $< $(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -S $< @@ -157,6 +177,9 @@ endif tags: cd $(srcdir) ; etags -lc `find $(dirs) -name *.[chY]` +cscope: + cd $(srcdir) ; find $(dirs) -name *.[chY] > cscope.files ; cscope -b + # Install install: all diff --git a/NEWS b/NEWS index 9d8e734a..8719a488 100644 --- a/NEWS +++ b/NEWS @@ -1,45 +1,70 @@ -Version 2.0.0-pre1 (2017-04-29) +Version 2.0.2 (2018-03-22) + o Source-specific routing support for Linux kernel and Babel + o BGP: New option 'disable after cease' + o Filter: Allow silent filter execution + o Filter: Fixed stack overflow in BGP mask expressions. + o Several bugfixes + + Notes: + + Syntax prefix:netmask for IPv4 prefixes was dropped. Just use prefix/pxlen. + + +Version 2.0.1 (2018-01-16) + o Linux MPLS kernel support + o Better handling of channels inherited from templates + o Default EBGP Route Propagation Behavior without Policies (RFC 8212) + o Many bugfixes + + Notes: + + To satisfy requirements of RFC 8212, external BGP protocols now require + explicit configuration of import and export policies. + + +Version 2.0.0 (2017-12-11) + o Integrated IPv4 + IPv6 design o Support for MPLS next hops - o VPNv4 and VPNv6 network types + o Support for VPNv4 and VPNv6 networks + o Microsecond timers infrastructure + o Basic VRF support + o Babel: Support for dual-stack IPv4/IPv6 + o Babel: Many improvements and bugfixes + o Major BGP protocol redesign + o Full support for Multiprotocol BGP + o BGP multicast support (SAFI 2) + o BGP flowspec support (RFC 5575) o BGP with MPLS labels (RFC 3107) o BGP MPLS/VPN support (RFC 4364) o BGP 6PE - IPv6 NLRI over IPv4 MPLS (RFC 4798) o BGP IPv4 NLRI with an IPv6 Next Hop (RFC 5549) o BGP Confederations (RFC 5065) - o BGP: Simplify igp table options + o BGP Shutdown communication (RFC 8203) o BGP: Allow exchanging LOCAL_PREF with eBGP peers o BGP: Allow to specify interface for regular sessions - o Babel support restored - o Static: Minor overhaul - o Netlink: Default kernel metric changed to 32 - o Flowspec: Limit tcp mask length to 12 bits - o Update of show route command - - Notes: - - Definitions of OSPFv2, OSPFv3 and RIP NG protocols now use keywords - 'ospf v2', 'ospf v3' and 'rip ng' instead of 'ospf2', 'ospf3' and 'ripng'. - - Flows and ROAs no longer use phony next hops, so there is no need to use - 'drop' or 'unreachable' in their static route definitions. - - See doc/bird.conf.example2 for configuration examples. - - -Version 2.0.0-pre0 (2016-12-07) - o Integrated IPv4 + IPv6 design - o Major BGP protocol redesign - o BGP multicast support (SAFI 2) - o BGP flowspec support (RFC 5575) + o OSPF: Support of address families in OSPFv3 + o OSPF: Enable ECMP and Link detection by default + o RAdv: Support for more specific routes (RFC 4191) + o RAdv: Proper handling of prefix retraction + o RIP: Enable ECMP and Link detection by default + o Redesign of RPKI handling o New RPKI-Router protocol + o Static: Minor overhaul + o Static: Support for all new route types + o Kenrel: Default Linux kernel metric changed to 32 + o Kernel: Fix IPv6 ECMP handling with Linux 4.11+ + o Update of show route command + o BIRD client persistent history o New build system o Unit tests + o ... Notes: - Protocols and tables are now connected using explicit channels, most related - protocol options (table, import, export, ...) are now channel options. See - doc/bird.conf.example2 for configuration examples. + Tables are now defined with appropriate net type keyword. Protocols and tables + are now connected by explicit channels, most related protocol options (table, + import, export, ...) are now channel options. See doc/bird.conf.example2 for + configuration examples. Some options were removed/replaced. Version 1.6.3 (2016-12-21) diff --git a/README b/README index 5a6d934d..7b8fbf2e 100644 --- a/README +++ b/README @@ -6,7 +6,7 @@ (c) 1998--2008 Martin Mares (c) 1998--2000 Pavel Machek (c) 1998--2008 Ondrej Filip - (c) 2009--2016 CZ.NIC z.s.p.o. + (c) 2009--2017 CZ.NIC z.s.p.o. ================================================================================ @@ -19,7 +19,7 @@ Public License. What do we support ================== - o Both IPv4 and IPv6 (use --enable-ipv6 when configuring) + o Both IPv4 and IPv6 o Multiple routing tables o Border Gateway Protocol (BGPv4) o Routing Information Protocol (RIPv2, RIPng) diff --git a/TODO b/TODO deleted file mode 100644 index 23cd1877..00000000 --- a/TODO +++ /dev/null @@ -1,45 +0,0 @@ -Core -~~~~ -- socket open failure should not be fatal -- &&,||: priorities -- static: allow specifying a per-route filter program for setting route attributes? - -Globals -~~~~~~~ -- right usage of DBG vs. debug -- logging and tracing; use appropriate log levels -- check incoming packets and log errors!! -- check log calls for trailing newlines and log levels followed by comma -- check if all protocols set proper packet priorities and TTL's. -- try compiling with -Wunused -- does everybody test return value of sk_open? -- protocols: implement CLI hooks and per-procotol CLI commands -- protocols: implement reconfigure hook -- protocols: use locking -- check use of system includes and sprintf() - -Various ideas -~~~~~~~~~~~~~ -- client: Ctrl-R eats one more enter -- bgp: timing of updates? -- netlink: import Linux route attributes to our rta's, so that they can be filtered? -- config: executable config files -- filters: user defined attributes? -- io: use poll if available -- route recalculation timing and flap dampening [see RFC2439 for algorithms] -- aggregate engine: standard route aggregation and summarization [RFC2519] -- aggregate engine: injection of manually configured pseudo-static routes -- generate default route if any working BGP connection exists (aggregate engine again?) -- generate default route to IGP's (aggregate engine yet another time?) -- look at RFC 2386 (QoS-based routing) -- cli: show tables? - -OSPF -~~~~ - - check incoming packets using neighbor cache - - RFC2328 appendix E: Use a better algorithm - - automatic generation of external route tags (RFC1403) - - RFC2370 opaque LSA's - - Limit export rate of external LSAs (like Gated does) - - Bugfix in link state retransmission list (aging) - - Graceful OSPF restart - RFC3623 diff --git a/aclocal.m4 b/aclocal.m4 index 365bfa81..c401d447 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -31,6 +31,106 @@ AC_DEFUN([BIRD_CHECK_PTHREADS], CFLAGS="$bird_tmp_cflags" ]) +AC_DEFUN([BIRD_CHECK_MPLS_KERNEL], +[ + AC_CACHE_CHECK( + [for Linux MPLS headers], + [bird_cv_mpls_kernel], + [ + AC_COMPILE_IFELSE( + [ + AC_LANG_PROGRAM( + [ + #include + #include + #include + #include + void t(int arg); + ], + [ + t(AF_MPLS); + t(RTA_VIA); + t(RTA_NEWDST); + t(RTA_ENCAP_TYPE); + t(RTA_ENCAP); + struct rtvia rtvia; + t(LWTUNNEL_ENCAP_MPLS); + ] + ) + ], + [bird_cv_mpls_kernel=yes], + [bird_cv_mpls_kernel=no] + ) + ] + ) +]) + +AC_DEFUN([BIRD_CHECK_ANDROID_GLOB], +[ + AC_CACHE_CHECK( + [for glob.h], + [bird_cv_lib_glob], + AC_LINK_IFELSE([ + AC_LANG_PROGRAM( + [ + #include + #include + ], + [ glob(NULL, 0, NULL, NULL); ] + ) + ], + [bird_cv_lib_glob=yes], + [ + bird_tmp_libs="$LIBS" + LIBS="$LIBS -landroid-glob" + AC_LINK_IFELSE([ + AC_LANG_PROGRAM( + [ + #include + #include + ], + [ glob(NULL, 0, NULL, NULL); ] + ) + ], + [bird_cv_lib_glob=-landroid-glob], + [bird_cv_lib_glob=no] + ) + LIBS="$bird_tmp_libs" + ] + ) + ) +]) + +AC_DEFUN([BIRD_CHECK_ANDROID_LOG], +[ + AC_CACHE_CHECK( + [for syslog lib flags], + [bird_cv_lib_log], + AC_LINK_IFELSE([ + AC_LANG_PROGRAM( + [ #include ], + [ syslog(0, ""); ] + ) + ], + [bird_cv_lib_log=yes], + [ + bird_tmp_libs="$LIBS" + LIBS="$LIBS -llog" + AC_LINK_IFELSE([ + AC_LANG_PROGRAM( + [ #include ], + [ syslog(0, ""); ] + ) + ], + [bird_cv_lib_log=-llog], + [bird_cv_lib_log=no] + ) + LIBS="$bird_tmp_libs" + ] + ) + ) +]) + AC_DEFUN([BIRD_CHECK_GCC_OPTION], [ bird_tmp_cflags="$CFLAGS" @@ -75,3 +175,24 @@ AC_DEFUN([BIRD_CHECK_PROG_FLAVOR_GNU], ) esac ]) + +AC_DEFUN([BIRD_CHECK_BISON_VERSION], +[ + $1=`bison --version | ( read line; echo ${line##* } )` + case "$$1" in + 1.* | 2.0* | 2.1* | 2.2* | 2.3*) + AC_MSG_ERROR([Provided Bison version $$1 is too old, need at least 2.4]) + ;; + 2.*) + bird_bison_synclines=no + bird_bison_enhanced_error=no + ;; + 3.* | 4.* | 5.* | 6.* | 7.* | 8.* | 9.*) + bird_bison_synclines=yes + bird_bison_enhanced_error=yes + ;; + *) + AC_MSG_ERROR([Couldn't parse Bison version $$1. Call the developers for help.]) + ;; + esac +]) diff --git a/bird.conf b/bird.conf index c2b47378..e383c934 100644 --- a/bird.conf +++ b/bird.conf @@ -22,13 +22,14 @@ protocol direct { # Feed routes to kernel FIB protocol kernel { - ipv4 { export all; }; -# learn; # Learn all routes from the kernel + ipv4 { export all; import all; }; + learn; # Learn all routes from the kernel # scan time 10; # Scan kernel tables every 10 seconds } protocol kernel { - ipv6; + ipv6 { import all; }; + learn; } # Static route feed @@ -52,6 +53,6 @@ protocol rip { ipv4; } -protocol ripng { +protocol rip ng { ipv6; } diff --git a/client/client.c b/client/client.c index 0d4bdf3e..97cf6639 100644 --- a/client/client.c +++ b/client/client.c @@ -25,9 +25,10 @@ #include #include #include +#include #include -#include #include +#include #include "nest/bird.h" #include "lib/resource.h" diff --git a/client/Doc b/client/progdoc similarity index 100% rename from client/Doc rename to client/progdoc diff --git a/conf/Makefile b/conf/Makefile index fb3dd052..39628bff 100644 --- a/conf/Makefile +++ b/conf/Makefile @@ -11,7 +11,7 @@ BISON_DEBUG=-t endif $(conf-y-targets): $(s)confbase.Y $(s)flowspec.Y - $(M4) -P $| $^ >$@ + $(M4) $(M4FLAGS) -P $| $^ >$@ $(o)cf-parse.y: | $(s)gen_parser.m4 $(o)keywords.h: | $(s)gen_keywords.m4 @@ -20,7 +20,7 @@ $(o)commands.h: | $(s)gen_commands.m4 $(srcdir)/client/cmds.m4 $(o)cf-parse.tab.h: $(o)cf-parse.tab.c $(o)cf-parse.tab.c: $(o)cf-parse.y - $(BISON) $(BISON_DEBUG) -dv -pcf_ -b $(@:.tab.c=) $< + $(BISON) $(BISON_DEBUG) $(BISONFLAGS) -dv -pcf_ -b $(@:.tab.c=) $< $(o)cf-lex.c: $(s)cf-lex.l $(FLEX) $(FLEX_DEBUG) -s -B -8 -Pcf_ -o$@ $< diff --git a/conf/conf.c b/conf/conf.c index e8c0dc67..885e2e7e 100644 --- a/conf/conf.c +++ b/conf/conf.c @@ -52,7 +52,7 @@ #include "lib/resource.h" #include "lib/string.h" #include "lib/event.h" -#include "sysdep/unix/timer.h" +#include "lib/timer.h" #include "conf/conf.h" #include "filter/filter.h" @@ -102,9 +102,9 @@ config_alloc(const char *name) c->pool = p; c->mem = l; c->file_name = ndup; - c->load_time = now; - c->tf_route = c->tf_proto = (struct timeformat){"%T", "%F", 20*3600}; - c->tf_base = c->tf_log = (struct timeformat){"%F %T", NULL, 0}; + c->load_time = current_time(); + c->tf_route = c->tf_proto = TM_ISO_SHORT_MS; + c->tf_base = c->tf_log = TM_ISO_LONG_MS; c->gr_wait = DEFAULT_GR_WAIT; return c; @@ -219,11 +219,6 @@ global_commit(struct config *new, struct config *old) if (!old) return 0; - if (!ipa_equal(old->listen_bgp_addr, new->listen_bgp_addr) || - (old->listen_bgp_port != new->listen_bgp_port) || - (old->listen_bgp_flags != new->listen_bgp_flags)) - log(L_WARN "Reconfiguration of BGP listening socket not implemented, please restart BIRD."); - if (!new->router_id) { new->router_id = old->router_id; @@ -307,7 +302,7 @@ config_done(void *unused UNUSED) * config_commit - commit a configuration * @c: new configuration * @type: type of reconfiguration (RECONFIG_SOFT or RECONFIG_HARD) - * @timeout: timeout for undo (or 0 for no timeout) + * @timeout: timeout for undo (in seconds; or 0 for no timeout) * * When a configuration is parsed and prepared for use, the * config_commit() function starts the process of reconfiguration. @@ -331,7 +326,7 @@ config_done(void *unused UNUSED) * are accepted. */ int -config_commit(struct config *c, int type, int timeout) +config_commit(struct config *c, int type, uint timeout) { if (shutting_down) { @@ -340,8 +335,8 @@ config_commit(struct config *c, int type, int timeout) } undo_available = 1; - if (timeout > 0) - tm_start(config_timer, timeout); + if (timeout) + tm_start(config_timer, timeout S); else tm_stop(config_timer); @@ -452,7 +447,7 @@ config_undo(void) extern void cmd_reconfig_undo_notify(void); static void -config_timeout(struct timer *t UNUSED) +config_timeout(timer *t UNUSED) { log(L_INFO "Config timeout expired, starting undo"); cmd_reconfig_undo_notify(); diff --git a/conf/conf.h b/conf/conf.h index af92f056..f174d352 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -13,7 +13,7 @@ #include "lib/ip.h" #include "lib/hash.h" #include "lib/resource.h" -#include "sysdep/unix/timer.h" +#include "lib/timer.h" /* Configuration structure */ @@ -32,16 +32,13 @@ struct config { struct iface_patt *router_id_from; /* Configured list of router ID iface patterns */ u32 router_id; /* Our Router ID */ - ip_addr listen_bgp_addr; /* Listening BGP socket should use this address */ - unsigned listen_bgp_port; /* Listening BGP socket should use this port (0 is default) */ - u32 listen_bgp_flags; /* Listening BGP socket should use these flags */ unsigned proto_default_debug; /* Default protocol debug mask */ unsigned proto_default_mrtdump; /* Default protocol mrtdump mask */ struct timeformat tf_route; /* Time format for 'show route' */ struct timeformat tf_proto; /* Time format for 'show protocol' */ struct timeformat tf_log; /* Time format for the logfile */ struct timeformat tf_base; /* Time format for other purposes */ - u32 gr_wait; /* Graceful restart wait timeout */ + u32 gr_wait; /* Graceful restart wait timeout (sec) */ int cli_debug; /* Tracing of CLI connections and commands */ int latency_debug; /* I/O loop tracks duration of each event */ @@ -57,7 +54,7 @@ struct config { struct config *fallback; /* Link to regular config for CLI parsing */ int obstacle_count; /* Number of items blocking freeing of this config */ int shutdown; /* This is a pseudo-config for daemon shutdown */ - bird_clock_t load_time; /* When we've got this configuration */ + btime load_time; /* When we've got this configuration */ }; /* Please don't use these variables in protocols. Use proto_config->global instead. */ @@ -68,7 +65,7 @@ struct config *config_alloc(const char *name); int config_parse(struct config *); int cli_parse(struct config *); void config_free(struct config *); -int config_commit(struct config *, int type, int timeout); +int config_commit(struct config *, int type, uint timeout); int config_confirm(void); int config_undo(void); void config_init(void); diff --git a/conf/confbase.Y b/conf/confbase.Y index 901ca2b2..8fd72e5e 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -14,7 +14,7 @@ CF_HDR #include "conf/conf.h" #include "lib/resource.h" #include "lib/socket.h" -#include "sysdep/unix/timer.h" +#include "lib/timer.h" #include "lib/string.h" #include "nest/protocol.h" #include "nest/iface.h" @@ -49,6 +49,8 @@ CF_DECLS struct rtable_config *r; struct channel_config *cc; struct f_inst *x; + struct f_dynamic_attr fda; + struct f_static_attr fsa; struct filter *f; struct f_tree *e; struct f_trie *trie; @@ -60,7 +62,7 @@ CF_DECLS struct lsadb_show_data *ld; struct iface *iface; void *g; - bird_clock_t time; + btime time; struct f_prefix px; struct proto_spec ps; struct channel_limit cl; @@ -80,11 +82,10 @@ CF_DECLS %type ipa_scope %type expr bool pxlen4 -%type expr_us -%type