[-]
[+]
|
Changed |
bird.changes
|
|
[-]
[+]
|
Changed |
bird.spec
^
|
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/ChangeLog
^
|
@@ -1,3 +1,270 @@
+commit a2017200c71293d0a28a39d1f250ba38d57f6289
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Mon Apr 29 22:33:50 2013 +0200
+
+ NEWS and version update.
+
+commit 572c6440432e3138ea622cfb5a4ef7580d77ef4a
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Mon Apr 29 22:08:05 2013 +0200
+
+ Fixes a crash when mrtdump is enabled and interface goes away.
+
+ Thanks to Peter Christensen for the bugfix.
+
+commit 32622d0ea366406f3afa14bb9edb4855d6979786
+Merge: efd6d12 a5e9f3d
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Tue Apr 23 02:54:13 2013 +0200
+
+ Merge branch 'birdcl'
+
+commit a5e9f3d26f887deb451a3ea086e52266c117aa0a
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Tue Apr 23 02:42:35 2013 +0200
+
+ Restructures birdc and birdcl to merge duplicated code.
+
+ The BIRD client code is restructured that most of the code (including
+ main function) is shared in client.c, while birdc.c and birdcl.c contain
+ just I/O-specific callbacks. This removes all duplicated code from
+ variant-specific files.
+
+commit d2c392d44839baaefa48f4a38060be648d3415fb
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Fri Apr 19 13:59:08 2013 +0200
+
+ Removes unnecessary client subdirectories and updates buildsystem.
+
+ Renames some files:
+ birdc/client.c -> birdc.c
+ birdcl/client.c -> birdcl.c
+ client_common.c -> common.c
+
+commit efd6d12b975441c7e1875a59dd9e0f3db7e958cb
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Wed Apr 17 15:09:50 2013 +0200
+
+ Adds two new default GCC options.
+
+ Adds two new default GCC options related to optimizations
+ (-fno-strict-aliasing and -fno-strict-overflow). This
+ should fix some hyperaggressive GCC optimizations.
+
+ Also updates autoconf option detection.
+
+commit 8df02847e8af29863c325b7297e3a2b2ed5f961c
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Wed Apr 17 13:06:40 2013 +0200
+
+ Fixes a compatibility issue in OSPFv2 PtP links.
+
+ BIRD used zero netmask in hello packets on all PtP links, not just on
+ unnumbered ones. This patch fixes it and adds option 'ptp netmask'
+ for overriding the default behavior.
+
+ Thanks to Alexander V. Chernikov for the original patch.
+
+commit cd3b02d198093abbbe671f647e4deb2470eb9cf1
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Tue Apr 16 17:53:22 2013 +0200
+
+ Allows IP of loopback to be used in automatic router ID selection.
+
+ Thanks to Alexander V. Chernikov for the patch.
+
+commit 8bd9b930c320f09d3b3792b5f991cf702e9d55be
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Tue Apr 16 17:40:44 2013 +0200
+
+ Fixes a bug in IPv6 BGP next hop processing.
+
+ BGP next hop attributes with empty link-local IPv6 addresses were not
+ handled properly.
+
+ Thanks to Sergey Popovich for the bugfix.
+
+commit 48bc232f08141d26691237c3d79db587ce16932b
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Tue Apr 16 17:27:34 2013 +0200
+
+ Implements 'next hop keep' option for BGP.
+
+ This option allows to keep the received next hop even in cases when
+ the route is sent to an interface with a different subnet.
+
+commit 9ff5257357d9975654279db17bbc8525583ba1cc
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Tue Apr 16 16:22:31 2013 +0200
+
+ Better handling of global addresses as configured NBMA neighbors in OSPFv3.
+
+ Configured NBMA neighbors in OSPFv3 should be link-local addresses, old
+ behavior was to silently ignore global ones. The patch allows BIRD to
+ accept global ones, but adds a warning and a documentation notice.
+
+ Thanks to Wilco Baan Hofman for the bugreport.
+
+commit 568d9c9faeab70951d8e9bfea521e1b38a9a3d1c
+Author: Tomas Hlavacek <tmshlvck@gmail.com>
+Date: Sat Apr 6 22:07:32 2013 +0200
+
+ Fix birdcl async message handling
+
+ Fix handling of async messafe in the bird light client. The async message
+ may occure at the any moment so we need the client to liste for the
+ message from server when it waits for user input.
+
+commit ce1348537455e5482a283f7a4cae734d13dcf34e
+Author: Tomas Hlavacek <tmshlvck@gmail.com>
+Date: Tue Mar 19 18:02:40 2013 +0100
+
+ Fix birdcl questionmark handling
+
+ Fix handling of questionmark handling in the bird light client. The
+ questionmark should display help when it is the last non-blank character on
+ command line. Otherwise the questionmark does not have any special meaning
+ and it could be a part of a pattern.
+
+commit 8322ecde124188a9408b54afead4666bb954e5a5
+Author: Tomas Hlavacek <tmshlvck@gmail.com>
+Date: Sun Feb 24 23:47:22 2013 +0100
+
+ Add lightweight client - birdcl
+
+ Restructure client/ subdir. Add two different flavors of client.
+ The full featured birdc client code is in client/birdc/.
+ The new light client birtcl is in client/birdcl/.
+ Common sources of both clients are directly in client/.
+
+ Rework on-line auto-completion in client/command.c to conditionally turn off
+ ncurses-specific code.
+
+ Add lightweight client without libreadline and ncurses dependencies - birdcl.
+ The birdcl lacks support of history, on-line auto-completion and there
+ are different implementations of "more" functionality and help on '?' press.
+ New client operates in canonical terminal mode (apart from "more" display)
+ and therefore all commands have to be executed by a return key including help
+ commands (called by '?' character in the end of the line).
+ Apart from these limitations the interaction style should be the same as
+ for the full client - birdc.
+ Build of birdcl is always on (independent on --enable-client parameter).
+
+commit e454916149d4efe66732fdd0388181813cab6ed0
+Author: Tomas Hlavacek <tmshlvck@gmail.com>
+Date: Wed Jan 23 17:14:53 2013 +0100
+
+ Pull out independent routines from client_full.c
+
+ Pull out routines for interacting with the server and interpreting
+ internal commands which are not dependent on libreadline and
+ ncurses libraries.
+
+ This is a preparation step for a new lightweight birdc client.
+
+commit 5c2c4ea8b1e924fce433094e744c0467da55aaab
+Author: Tomas Hlavacek <tmshlvck@gmail.com>
+Date: Wed Jan 23 15:51:04 2013 +0100
+
+ Rename client/client.c to client_full.c
+
+ Rename client/client.c to client-full.c and change the Makefile accordingly.
+ This is a preparation step for introducing a new lightweight client which
+ should reuse as much code as possible from the old one but it should not depend
+ on external libraries.
+
+ Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>
+
+commit a9fc659b840e13323aa43e92eb8f39ceb19b5ed6
+Author: Ondrej Filip <feela@network.cz>
+Date: Tue Feb 26 14:29:53 2013 +0100
+
+ Small typos fixed.
+
+commit de41dcd13d6f9d4785c80e6234ac38f2a15f5429
+Author: Ondrej Filip <feela@network.cz>
+Date: Tue Feb 26 14:13:11 2013 +0100
+
+ Redundant lines removed.
+
+commit e667622a35722ec007137e678f4f70841562e57f
+Author: Ondrej Filip <feela@network.cz>
+Date: Mon Feb 25 10:39:46 2013 +0100
+
+ Default rounting table for 'show route export/preexport/protocol' is the one related to a respective protocol.
+
+commit a9c38203bdcad92f7ac0a8a912241d2acb483f2c
+Author: Ondrej Filip <feela@network.cz>
+Date: Sun Feb 24 00:43:08 2013 +0100
+
+ Allow 1 sec RIP update.
+
+commit 04ddefb357b2b8759be16633f7bb1df49b0405ea
+Author: Ondrej Filip <feela@network.cz>
+Date: Fri Feb 22 07:15:27 2013 +0100
+
+ Use BIRD's ASSERT instead of assert.h
+
+commit 2bf59bf4d3e4fcaff489d3445134e5e2e2af9cf6
+Author: Ondrej Filip <feela@network.cz>
+Date: Thu Feb 21 00:44:59 2013 +0100
+
+ Hotfix to solve an issue with delaying timers reported by Aleksey Chudov.
+
+commit 9d969be5f2d867704e82bd7d6c8049623d50708f
+Author: Ondrej Filip <feela@network.cz>
+Date: Thu Feb 14 23:35:51 2013 +0100
+
+ I still believe that 0 == NULL, however this patch will make Santiago happy. :-)
+
+commit 4c2abee74e64f64fba61aad6e2b66e3895820003
+Author: Ondrej Filip <feela@network.cz>
+Date: Tue Feb 12 13:15:01 2013 +0100
+
+ Allow submitting BIRD commands from UNIX shell even in restricted mode.
+
+commit 8c4da7e01ded3f06cbf873e67c5ae1cf70cf280b
+Author: Ondrej Filip <feela@network.cz>
+Date: Sun Feb 10 19:17:38 2013 +0100
+
+ Symbol names enclosed by apostrophes can contain DOTs.
+
+commit 0bc3542ab6e0a96342e35ead8ff1c52f980facc2
+Author: Ondrej Filip <feela@network.cz>
+Date: Sun Feb 10 19:06:56 2013 +0100
+
+ Route limits can be disabled - this makes sense for protocol templates
+
+commit 155134f3960bc06a18c8c7d9a97181b786d77a3a
+Author: Ondrej Filip <feela@network.cz>
+Date: Sun Feb 10 19:04:08 2013 +0100
+
+ A few semicolons added to decrease a number of warnings.
+
+commit c6a2fe64bed8dc67af0e868052b055aa0f45cdf2
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Sat Feb 9 00:53:04 2013 +0100
+
+ Fixes handling of iface routes in static proto during reconfiguration.
+
+ During reconfiguration, iface routes were installed even when iface was down.
+
+commit 36da2857bc911924a250a234f38cf58c3b21f1bc
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Fri Feb 8 23:58:27 2013 +0100
+
+ Implements router advertisements activated by received routes.
+
+ The RAdv protocol could be configured to change its behavior based on
+ availability of routes, e.g., do not announce router lifetime when a
+ default route is not available.
+
+commit d214ae4fdc1e323f89efb8a80c068fef4a45758f
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Sat Jan 12 21:26:42 2013 +0100
+
+ Fix missing documentation for one option.
+
commit 13d4dd138d5dc6c884ded280f9244fac707c4f32
Author: Ondrej Zajicek <santiago@crfreenet.org>
Date: Fri Jan 11 14:53:20 2013 +0100
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/NEWS
^
|
@@ -1,3 +1,15 @@
+Version 1.3.10 (2013-04-30)
+ o Lightweight BIRD client for embedded environments.
+ o Dynamic IPv6 router advertisements.
+ o New 'next hop keep' option for BGP.
+ o Smart default routing table for 'show route export/preexport/protocol'.
+ o Automatic router ID selection could be configured to use address of loopback.
+ o Allows configured global addresses of NBMA neighbors in OSPFv3.
+ o Allows BIRD commands from UNIX shell even in restricted mode.
+ o Route limits inherited from templates can be disabled.
+ o Symbol names enclosed by apostrophes can contain dots.
+ o Several bugfixes.
+
Version 1.3.9 (2013-01-11)
o BIRD can be configured to keep and show filtered routes.
o Separate receive and import limits.
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/aclocal.m4
^
|
@@ -133,19 +133,23 @@
fi
])
-AC_DEFUN(BIRD_CHECK_GCC_OPTIONS,
-[AC_CACHE_VAL(bird_cv_c_option_no_pointer_sign, [
-cat >conftest.c <<EOF
-int main(void)
-{ return 0; }
-EOF
-if $CC -Wall -Wno-pointer-sign conftest.c >&AS_MESSAGE_LOG_FD 2>&1 ; then
- bird_cv_c_option_no_pointer_sign=yes
-else
- bird_cv_c_option_no_pointer_sign=no
-fi
-rm -rf conftest* a.out
-])])
+AC_DEFUN(BIRD_CHECK_GCC_OPTION,
+[
+ bird_tmp_cflags="$CFLAGS"
+
+ CFLAGS="$3 $2"
+ AC_CACHE_CHECK([whether CC supports $2], $1,
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [$1=yes], [$1=no])])
+
+ CFLAGS="$bird_tmp_cflags"
+])
+
+AC_DEFUN(BIRD_ADD_GCC_OPTION,
+[
+ if test "$$1" = yes ; then
+ CFLAGS="$CFLAGS $2"
+ fi
+])
# BIRD_CHECK_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE])
# copied autoconf internal _AC_PATH_PROG_FLAVOR_GNU
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/client/Makefile
^
|
@@ -1,5 +1,11 @@
-source=client.c commands.c util.c
+source=commands.c util.c client.c
root-rel=../
dir-name=client
+clients := $(client) birdcl
+
+source-dep := $(source) $(addsuffix .c,$(clients))
+
+subdir: $(addsuffix .o,$(clients))
+
include ../Rules
|
[-]
[+]
|
Added |
bird-1.3.10.tar.bz2/client/birdc.c
^
|
@@ -0,0 +1,223 @@
+/*
+ * BIRD Client - Readline variant I/O
+ *
+ * (c) 1999--2004 Martin Mares <mj@ucw.cz>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <termios.h>
+
+#include <readline/readline.h>
+#include <readline/history.h>
+#include <curses.h>
+
+#include "nest/bird.h"
+#include "lib/resource.h"
+#include "lib/string.h"
+#include "client/client.h"
+#include "sysdep/unix/unix.h"
+
+static int input_hidden_end;
+static int prompt_active;
+
+/*** Input ***/
+
+/* HACK: libreadline internals we need to access */
+extern int _rl_vis_botlin;
+extern void _rl_move_vert(int);
+extern Function *rl_last_func;
+
+static void
+add_history_dedup(char *cmd)
+{
+ /* Add history line if it differs from the last one */
+ HIST_ENTRY *he = history_get(history_length);
+ if (!he || strcmp(he->line, cmd))
+ add_history(cmd);
+}
+
+static void
+input_got_line(char *cmd_buffer)
+{
+ if (!cmd_buffer)
+ {
+ cleanup();
+ exit(0);
+ }
+
+ if (cmd_buffer[0])
+ {
+ add_history_dedup(cmd_buffer);
+ submit_command(cmd_buffer);
+ }
+
+ free(cmd_buffer);
+}
+
+void
+input_start_list(void)
+{
+ /* Leave the currently edited line and make space for listing */
+ _rl_move_vert(_rl_vis_botlin);
+#ifdef HAVE_RL_CRLF
+ rl_crlf();
+#endif
+}
+
+void
+input_stop_list(void)
+{
+ /* Reprint the currently edited line after listing */
+ rl_on_new_line();
+ rl_redisplay();
+}
+
+static int
+input_complete(int arg UNUSED, int key UNUSED)
+{
+ static int complete_flag;
+ char buf[256];
+
+ if (rl_last_func != input_complete)
+ complete_flag = 0;
+ switch (cmd_complete(rl_line_buffer, rl_point, buf, complete_flag))
+ {
+ case 0:
+ complete_flag = 1;
+ break;
+ case 1:
+ rl_insert_text(buf);
+ break;
+ default:
+ complete_flag = 1;
+#ifdef HAVE_RL_DING
+ rl_ding();
+#endif
+ }
+ return 0;
+}
+
+static int
+input_help(int arg, int key UNUSED)
+{
+ int i, in_string, in_bracket;
+
+ if (arg != 1)
+ return rl_insert(arg, '?');
+
+ in_string = in_bracket = 0;
+ for (i = 0; i < rl_point; i++)
+ {
+
+ if (rl_line_buffer[i] == '"')
+ in_string = ! in_string;
+ else if (! in_string)
+ {
+ if (rl_line_buffer[i] == '[')
+ in_bracket++;
+ else if (rl_line_buffer[i] == ']')
+ in_bracket--;
+ }
+ }
+
+ /* `?' inside string or path -> insert */
+ if (in_string || in_bracket)
+ return rl_insert(1, '?');
+
+ rl_begin_undo_group(); /* HACK: We want to display `?' at point position */
+ rl_insert_text("?");
+ rl_redisplay();
+ rl_end_undo_group();
+ input_start_list();
+ cmd_help(rl_line_buffer, rl_point);
+ rl_undo_command(1, 0);
+ input_stop_list();
+ return 0;
+}
+
+void
+input_init(void)
+{
+ rl_readline_name = "birdc";
+ rl_add_defun("bird-complete", input_complete, '\t');
+ rl_add_defun("bird-help", input_help, '?');
+ rl_callback_handler_install("bird> ", input_got_line);
+
+ // rl_get_screen_size();
+ term_lns = LINES ? LINES : 25;
+ term_cls = COLS ? COLS : 80;
+
+ prompt_active = 1;
+
+ // readline library does strange things when stdin is nonblocking.
+ // if (fcntl(0, F_SETFL, O_NONBLOCK) < 0)
+ // die("fcntl: %m");
+}
+
+static void
+input_reveal(void)
+{
+ /* need this, otherwise some lib seems to eat pending output when
+ the prompt is displayed */
+ fflush(stdout);
+ tcdrain(STDOUT_FILENO);
+
+ rl_end = input_hidden_end;
+ rl_expand_prompt("bird> ");
+ rl_forced_update_display();
+
+ prompt_active = 1;
+}
+
+static void
+input_hide(void)
+{
+ input_hidden_end = rl_end;
+ rl_end = 0;
+ rl_expand_prompt("");
+ rl_redisplay();
+
+ prompt_active = 0;
+}
+
+void
+input_notify(int prompt)
+{
+ if (prompt == prompt_active)
+ return;
+
+ if (prompt)
+ input_reveal();
+ else
+ input_hide();
+}
+
+void
+input_read(void)
+{
+ rl_callback_read_char();
+}
+
+void
+more_begin(void)
+{
+}
+
+void
+more_end(void)
+{
+}
+
+void
+cleanup(void)
+{
+ if (init)
+ return;
+
+ input_hide();
+ rl_callback_handler_remove();
+}
|
[-]
[+]
|
Added |
bird-1.3.10.tar.bz2/client/birdcl.c
^
|
@@ -0,0 +1,165 @@
+/*
+ * BIRD Client - Light variant I/O
+ *
+ * (c) 1999--2004 Martin Mares <mj@ucw.cz>
+ * (c) 2013 Tomas Hlavacek <tomas.hlavacek@nic.cz>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <termios.h>
+
+#include <sys/ioctl.h>
+#include <signal.h>
+
+#include "nest/bird.h"
+#include "lib/resource.h"
+#include "lib/string.h"
+#include "client/client.h"
+#include "sysdep/unix/unix.h"
+
+#define INPUT_BUF_LEN 2048
+
+struct termios tty_save;
+
+void
+input_start_list(void)
+{
+ /* Empty in non-ncurses version. */
+}
+
+void
+input_stop_list(void)
+{
+ /* Empty in non-ncurses version. */
+}
+
+void
+input_notify(int prompt)
+{
+ /* No ncurses -> no status to reveal/hide, print prompt manually. */
+ if (!prompt)
+ return;
+
+ printf("bird> ");
+ fflush(stdout);
+}
+
+
+static int
+lastnb(char *str, int i)
+{
+ while (i--)
+ if ((str[i] != ' ') && (str[i] != '\t'))
+ return str[i];
+
+ return 0;
+}
+
+void
+input_read(void)
+{
+ char buf[INPUT_BUF_LEN];
+
+ if ((fgets(buf, INPUT_BUF_LEN, stdin) == NULL) || (buf[0] == 0))
+ {
+ putchar('\n');
+ cleanup();
+ exit(0);
+ }
+
+ int l = strlen(buf);
+ if ((l+1) == INPUT_BUF_LEN)
+ {
+ printf("Input too long.\n");
+ return;
+ }
+
+ if (buf[l-1] == '\n')
+ buf[--l] = '\0';
+
+ if (!interactive)
+ printf("%s\n", buf);
+
+ if (l == 0)
+ return;
+
+ if (lastnb(buf, l) == '?')
+ {
+ cmd_help(buf, strlen(buf));
+ return;
+ }
+
+ submit_command(buf);
+}
+
+static struct termios stored_tty;
+static int more_active = 0;
+
+void
+more_begin(void)
+{
+ static struct termios tty;
+
+ tty = stored_tty;
+ tty.c_lflag &= (~ECHO);
+ tty.c_lflag &= (~ICANON);
+
+ if (tcsetattr (0, TCSANOW, &tty) < 0)
+ die("tcsetattr: %m");
+
+ more_active = 1;
+}
+
+void
+more_end(void)
+{
+ more_active = 0;
+
+ if (tcsetattr (0, TCSANOW, &stored_tty) < 0)
+ die("tcsetattr: %m");
+}
+
+static void
+sig_handler(int signal)
+{
+ cleanup();
+ exit(0);
+}
+
+void
+input_init(void)
+{
+ if (!interactive)
+ return;
+
+ if (tcgetattr(0, &stored_tty) < 0)
+ die("tcgetattr: %m");
+
+ if (signal(SIGINT, sig_handler) == SIG_IGN)
+ signal(SIGINT, SIG_IGN);
+ if (signal(SIGTERM, sig_handler) == SIG_IGN)
+ signal(SIGTERM, SIG_IGN);
+
+ struct winsize tws;
+ if (ioctl(0, TIOCGWINSZ, &tws) == 0)
+ {
+ term_lns = tws.ws_row;
+ term_cls = tws.ws_col;
+ }
+ else
+ {
+ term_lns = 25;
+ term_cls = 80;
+ }
+}
+
+void
+cleanup(void)
+{
+ if (more_active)
+ more_end();
+}
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/client/client.c
^
|
@@ -2,22 +2,32 @@
* BIRD Client
*
* (c) 1999--2004 Martin Mares <mj@ucw.cz>
+ * (c) 2013 Tomas Hlavacek <tmshlvck@gmail.com>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
+/**
+ * DOC: BIRD client
+ *
+ * There are two variants of BIRD client: regular and light. regular
+ * variant depends on readline and ncurses libraries, while light
+ * variant uses just libc. Most of the code and the main() is common
+ * for both variants (in client.c file) and just a few functions are
+ * different (in birdc.c for regular and birdcl.c for light). Two
+ * binaries are generated by linking common object files like client.o
+ * (which is compiled from client.c just once) with either birdc.o or
+ * birdcl.o for each variant.
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
-#include <termios.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/types.h>
-#include <readline/readline.h>
-#include <readline/history.h>
-#include <curses.h>
#include "nest/bird.h"
#include "lib/resource.h"
@@ -25,33 +35,31 @@
#include "client/client.h"
#include "sysdep/unix/unix.h"
+#define SERVER_READ_BUF_LEN 4096
+
static char *opt_list = "s:vr";
-static int verbose;
+static int verbose, restricted, once;
static char *init_cmd;
-static int once;
static char *server_path = PATH_CONTROL_SOCKET;
static int server_fd;
-static byte server_read_buf[4096];
+static byte server_read_buf[SERVER_READ_BUF_LEN];
static byte *server_read_pos = server_read_buf;
-#define STATE_PROMPT 0
-#define STATE_CMD_SERVER 1
-#define STATE_CMD_USER 2
-
-static int input_initialized;
-static int input_hidden_end;
-static int cstate = STATE_CMD_SERVER;
-static int nstate = STATE_CMD_SERVER;
+int init = 1; /* During intial sequence */
+int busy = 1; /* Executing BIRD command */
+int interactive; /* Whether stdin is terminal */
+
+static int num_lines, skip_input;
+int term_lns, term_cls;
-static int num_lines, skip_input, interactive;
/*** Parsing of arguments ***/
static void
-usage(void)
+usage(char *name)
{
- fprintf(stderr, "Usage: birdc [-s <control-socket>] [-v] [-r]\n");
+ fprintf(stderr, "Usage: %s [-s <control-socket>] [-v] [-r]\n", name);
exit(1);
}
@@ -70,10 +78,10 @@
verbose++;
break;
case 'r':
- init_cmd = "restrict";
+ restricted = 1;
break;
default:
- usage();
+ usage(argv[0]);
}
/* If some arguments are not options, we take it as commands */
@@ -83,9 +91,6 @@
int i;
int len = 0;
- if (init_cmd)
- usage();
-
for (i = optind; i < argc; i++)
len += strlen(argv[i]) + 1;
@@ -99,17 +104,14 @@
tmp[-1] = 0;
once = 1;
+ interactive = 0;
}
}
-/*** Input ***/
-static void server_send(char *);
+/*** Input ***/
-/* HACK: libreadline internals we need to access */
-extern int _rl_vis_botlin;
-extern void _rl_move_vert(int);
-extern Function *rl_last_func;
+static void server_send(char *cmd);
static int
handle_internal_command(char *cmd)
@@ -127,181 +129,37 @@
return 0;
}
-void
+static void
submit_server_command(char *cmd)
{
- server_send(cmd);
- nstate = STATE_CMD_SERVER;
+ busy = 1;
num_lines = 2;
-}
-
-static void
-add_history_dedup(char *cmd)
-{
- /* Add history line if it differs from the last one */
- HIST_ENTRY *he = history_get(history_length);
- if (!he || strcmp(he->line, cmd))
- add_history(cmd);
-}
-
-static void
-got_line(char *cmd_buffer)
-{
- char *cmd;
-
- if (!cmd_buffer)
- {
- cleanup();
- exit(0);
- }
- if (cmd_buffer[0])
- {
- cmd = cmd_expand(cmd_buffer);
- if (cmd)
- {
- add_history_dedup(cmd);
-
- if (!handle_internal_command(cmd))
- submit_server_command(cmd);
-
- free(cmd);
- }
- else
- add_history_dedup(cmd_buffer);
- }
- free(cmd_buffer);
-}
-
-void
-input_start_list(void) /* Leave the currently edited line and make space for listing */
-{
- _rl_move_vert(_rl_vis_botlin);
-#ifdef HAVE_RL_CRLF
- rl_crlf();
-#endif
+ server_send(cmd);
}
void
-input_stop_list(void) /* Reprint the currently edited line after listing */
-{
- rl_on_new_line();
- rl_redisplay();
-}
-
-static int
-input_complete(int arg UNUSED, int key UNUSED)
+submit_command(char *cmd_raw)
{
- static int complete_flag;
- char buf[256];
-
- if (rl_last_func != input_complete)
- complete_flag = 0;
- switch (cmd_complete(rl_line_buffer, rl_point, buf, complete_flag))
- {
- case 0:
- complete_flag = 1;
- break;
- case 1:
- rl_insert_text(buf);
- break;
- default:
- complete_flag = 1;
-#ifdef HAVE_RL_DING
- rl_ding();
-#endif
- }
- return 0;
-}
-
-static int
-input_help(int arg, int key UNUSED)
-{
- int i, in_string, in_bracket;
-
- if (arg != 1)
- return rl_insert(arg, '?');
+ char *cmd = cmd_expand(cmd_raw);
- in_string = in_bracket = 0;
- for (i = 0; i < rl_point; i++)
- {
-
- if (rl_line_buffer[i] == '"')
- in_string = ! in_string;
- else if (! in_string)
- {
- if (rl_line_buffer[i] == '[')
- in_bracket++;
- else if (rl_line_buffer[i] == ']')
- in_bracket--;
- }
- }
-
- /* `?' inside string or path -> insert */
- if (in_string || in_bracket)
- return rl_insert(1, '?');
-
- rl_begin_undo_group(); /* HACK: We want to display `?' at point position */
- rl_insert_text("?");
- rl_redisplay();
- rl_end_undo_group();
- input_start_list();
- cmd_help(rl_line_buffer, rl_point);
- rl_undo_command(1, 0);
- input_stop_list();
- return 0;
-}
+ if (!cmd)
+ return;
-static void
-input_init(void)
-{
- rl_readline_name = "birdc";
- rl_add_defun("bird-complete", input_complete, '\t');
- rl_add_defun("bird-help", input_help, '?');
- rl_callback_handler_install("bird> ", got_line);
- input_initialized = 1;
-// readline library does strange things when stdin is nonblocking.
-// if (fcntl(0, F_SETFL, O_NONBLOCK) < 0)
-// die("fcntl: %m");
-}
+ if (!handle_internal_command(cmd))
+ submit_server_command(cmd);
-static void
-input_hide(void)
-{
- input_hidden_end = rl_end;
- rl_end = 0;
- rl_expand_prompt("");
- rl_redisplay();
+ free(cmd);
}
static void
-input_reveal(void)
+init_commands(void)
{
- /* need this, otherwise some lib seems to eat pending output when
- the prompt is displayed */
- fflush(stdout);
- tcdrain(fileno(stdout));
-
- rl_end = input_hidden_end;
- rl_expand_prompt("bird> ");
- rl_forced_update_display();
-}
-
-void
-cleanup(void)
-{
- if (input_initialized)
+ if (restricted)
{
- input_initialized = 0;
- input_hide();
- rl_callback_handler_remove();
+ submit_server_command("restrict");
+ restricted = 0;
+ return;
}
-}
-
-void
-update_state(void)
-{
- if (nstate == cstate)
- return;
if (init_cmd)
{
@@ -312,40 +170,35 @@
return;
}
- if (!init_cmd && once)
+ if (once)
{
/* Initial command is finished and we want to exit */
cleanup();
exit(0);
}
- if (nstate == STATE_PROMPT)
- {
- if (input_initialized)
- input_reveal();
- else
- input_init();
- }
+ input_init();
+ init = 0;
+}
- if (nstate != STATE_PROMPT)
- input_hide();
- cstate = nstate;
-}
+/*** Output ***/
void
more(void)
{
+ more_begin();
printf("--More--\015");
fflush(stdout);
redo:
switch (getchar())
{
- case 32:
+ case ' ':
num_lines = 2;
break;
- case 13:
+ case '\n':
+ case '\r':
num_lines--;
break;
case 'q':
@@ -357,6 +210,7 @@
printf(" \015");
fflush(stdout);
+ more_end();
}
@@ -383,6 +237,7 @@
die("fcntl: %m");
}
+
#define PRINTF(LEN, PARGS...) do { if (!skip_input) len = printf(PARGS); } while(0)
static void
@@ -391,36 +246,32 @@
int code;
int len = 0;
- if (*x == '+') /* Async reply */
+ if (*x == '+') /* Async reply */
PRINTF(len, ">>> %s\n", x+1);
- else if (x[0] == ' ') /* Continuation */
+ else if (x[0] == ' ') /* Continuation */
PRINTF(len, "%s%s\n", verbose ? " " : "", x+1);
else if (strlen(x) > 4 &&
- sscanf(x, "%d", &code) == 1 && code >= 0 && code < 10000 &&
- (x[4] == ' ' || x[4] == '-'))
+ sscanf(x, "%d", &code) == 1 && code >= 0 && code < 10000 &&
+ (x[4] == ' ' || x[4] == '-'))
{
if (code)
- PRINTF(len, "%s\n", verbose ? x : x+5);
+ PRINTF(len, "%s\n", verbose ? x : x+5);
+
if (x[4] == ' ')
{
- nstate = STATE_PROMPT;
- skip_input = 0;
- return;
+ busy = 0;
+ skip_input = 0;
+ return;
}
}
else
PRINTF(len, "??? <%s>\n", x);
- if (skip_input)
- return;
-
- if (interactive && input_initialized && (len > 0))
+ if (interactive && busy && !skip_input && !init && (len > 0))
{
- int lns = LINES ? LINES : 25;
- int cls = COLS ? COLS : 80;
- num_lines += (len + cls - 1) / cls; /* Divide and round up */
- if ((num_lines >= lns) && (cstate == STATE_CMD_SERVER))
- more();
+ num_lines += (len + term_cls - 1) / term_cls; /* Divide and round up */
+ if (num_lines >= term_lns)
+ more();
}
}
@@ -465,19 +316,23 @@
}
}
-static fd_set select_fds;
-
static void
select_loop(void)
{
int rv;
while (1)
{
+ if (init && !busy)
+ init_commands();
+
+ if (!init)
+ input_notify(!busy);
+
+ fd_set select_fds;
FD_ZERO(&select_fds);
- if (cstate != STATE_CMD_USER)
- FD_SET(server_fd, &select_fds);
- if (cstate != STATE_CMD_SERVER)
+ FD_SET(server_fd, &select_fds);
+ if (!busy)
FD_SET(0, &select_fds);
rv = select(server_fd+1, &select_fds, NULL, NULL, NULL);
@@ -489,16 +344,16 @@
die("select: %m");
}
- if (FD_ISSET(server_fd, &select_fds))
+ if (FD_ISSET(0, &select_fds))
{
- server_read();
- update_state();
+ input_read();
+ continue;
}
- if (FD_ISSET(0, &select_fds))
+ if (FD_ISSET(server_fd, &select_fds))
{
- rl_callback_read_char();
- update_state();
+ server_read();
+ continue;
}
}
}
@@ -556,14 +411,22 @@
}
}
+
+/* XXXX
+
+ get_term_size();
+
+ if (tcgetattr(0, &tty_save) != 0)
+ {
+ perror("tcgetattr error");
+ return(EXIT_FAILURE);
+ }
+ }
+
+ */
int
main(int argc, char **argv)
{
-#ifdef HAVE_LIBDMALLOC
- if (!getenv("DMALLOC_OPTIONS"))
- dmalloc_debug(0x2f03d00);
-#endif
-
interactive = isatty(0);
parse_args(argc, argv);
cmd_build_tree();
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/client/client.h
^
|
@@ -6,15 +6,31 @@
* Can be freely distributed and used under the terms of the GNU GPL.
*/
-/* client.c */
-void cleanup(void);
+extern int init, busy, interactive;
+extern int term_lns, term_cls;
+
+/* birdc.c / birdcl.c */
+
void input_start_list(void);
void input_stop_list(void);
+void input_init(void);
+void input_notify(int prompt);
+void input_read(void);
+
+void more_begin(void);
+void more_end(void);
+
+void cleanup(void);
+
/* commands.c */
void cmd_build_tree(void);
void cmd_help(char *cmd, int len);
int cmd_complete(char *cmd, int len, char *buf, int again);
char *cmd_expand(char *cmd);
+
+/* client.c */
+
+void submit_command(char *cmd_raw);
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/conf/cf-lex.l
^
|
@@ -172,7 +172,7 @@
return ELSECOL;
}
-({ALPHA}{ALNUM}*|[']({ALNUM}|[-])*[']) {
+({ALPHA}{ALNUM}*|[']({ALNUM}|[-]|[\.])*[']) {
if(*yytext == '\'') {
yytext[yyleng-1] = 0;
yytext++;
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/configure
^
|
@@ -3850,32 +3850,123 @@
as_fn_error $? "This program requires the GNU C Compiler." "$LINENO" 5
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what CFLAGS should we use" >&5
-$as_echo_n "checking what CFLAGS should we use... " >&6; }
if test "$bird_cflags_default" = yes ; then
- if test "${bird_cv_c_option_no_pointer_sign+set}" = set; then :
+
+ bird_tmp_cflags="$CFLAGS"
+
+ CFLAGS="-Wall -Wno-pointer-sign"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CC supports -Wno-pointer-sign" >&5
+$as_echo_n "checking whether CC supports -Wno-pointer-sign... " >&6; }
+if test "${bird_cv_c_option_wno_pointer_sign+set}" = set; then :
$as_echo_n "(cached) " >&6
else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
-cat >conftest.c <<EOF
-int main(void)
-{ return 0; }
-EOF
-if $CC -Wall -Wno-pointer-sign conftest.c >&5 2>&1 ; then
- bird_cv_c_option_no_pointer_sign=yes
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ bird_cv_c_option_wno_pointer_sign=yes
else
- bird_cv_c_option_no_pointer_sign=no
+ bird_cv_c_option_wno_pointer_sign=no
fi
-rm -rf conftest* a.out
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bird_cv_c_option_wno_pointer_sign" >&5
+$as_echo "$bird_cv_c_option_wno_pointer_sign" >&6; }
+
+ CFLAGS="$bird_tmp_cflags"
+
+ bird_tmp_cflags="$CFLAGS"
+
+ CFLAGS=" -fno-strict-aliasing"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CC supports -fno-strict-aliasing" >&5
+$as_echo_n "checking whether CC supports -fno-strict-aliasing... " >&6; }
+if test "${bird_cv_c_option_fno_strict_aliasing+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ bird_cv_c_option_fno_strict_aliasing=yes
+else
+ bird_cv_c_option_fno_strict_aliasing=no
fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bird_cv_c_option_fno_strict_aliasing" >&5
+$as_echo "$bird_cv_c_option_fno_strict_aliasing" >&6; }
+
+ CFLAGS="$bird_tmp_cflags"
+
+
+ bird_tmp_cflags="$CFLAGS"
+
+ CFLAGS=" -fno-strict-overflow"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CC supports -fno-strict-overflow" >&5
+$as_echo_n "checking whether CC supports -fno-strict-overflow... " >&6; }
+if test "${bird_cv_c_option_fno_strict_overflow+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ bird_cv_c_option_fno_strict_overflow=yes
+else
+ bird_cv_c_option_fno_strict_overflow=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bird_cv_c_option_fno_strict_overflow" >&5
+$as_echo "$bird_cv_c_option_fno_strict_overflow" >&6; }
+
+ CFLAGS="$bird_tmp_cflags"
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wno-parentheses"
- if test "$bird_cv_c_option_no_pointer_sign" = yes ; then
- CFLAGS="$CFLAGS -Wno-pointer-sign"
- fi
+
+ if test "$bird_cv_c_option_wno_pointer_sign" = yes ; then
+ CFLAGS="$CFLAGS -Wno-pointer-sign"
+ fi
+
+
+ if test "$bird_cv_c_option_fno_strict_aliasing" = yes ; then
+ CFLAGS="$CFLAGS -fno-strict-aliasing"
+ fi
+
+
+ if test "$bird_cv_c_option_fno_strict_overflow" = yes ; then
+ CFLAGS="$CFLAGS -fno-strict-overflow"
+ fi
+
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS" >&5
+$as_echo_n "checking CFLAGS... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CFLAGS" >&5
$as_echo "$CFLAGS" >&6; }
@@ -5405,7 +5496,7 @@
CLIENT=
CLIENT_LIBS=
if test "$enable_client" = yes ; then
- CLIENT=client
+ CLIENT=birdc
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for add_history in -lhistory" >&5
$as_echo_n "checking for add_history in -lhistory... " >&6; }
if test "${ac_cv_lib_history_add_history+set}" = set; then :
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/configure.in
^
|
@@ -87,15 +87,17 @@
AC_MSG_ERROR([This program requires the GNU C Compiler.])
fi
-AC_MSG_CHECKING([what CFLAGS should we use])
if test "$bird_cflags_default" = yes ; then
- BIRD_CHECK_GCC_OPTIONS
+ BIRD_CHECK_GCC_OPTION(bird_cv_c_option_wno_pointer_sign, -Wno-pointer-sign, -Wall)
+ BIRD_CHECK_GCC_OPTION(bird_cv_c_option_fno_strict_aliasing, -fno-strict-aliasing)
+ BIRD_CHECK_GCC_OPTION(bird_cv_c_option_fno_strict_overflow, -fno-strict-overflow)
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wno-parentheses"
- if test "$bird_cv_c_option_no_pointer_sign" = yes ; then
- CFLAGS="$CFLAGS -Wno-pointer-sign"
- fi
+ BIRD_ADD_GCC_OPTION(bird_cv_c_option_wno_pointer_sign, -Wno-pointer-sign)
+ BIRD_ADD_GCC_OPTION(bird_cv_c_option_fno_strict_aliasing, -fno-strict-aliasing)
+ BIRD_ADD_GCC_OPTION(bird_cv_c_option_fno_strict_overflow, -fno-strict-overflow)
fi
+AC_MSG_CHECKING([CFLAGS])
AC_MSG_RESULT($CFLAGS)
@@ -234,7 +236,7 @@
CLIENT=
CLIENT_LIBS=
if test "$enable_client" = yes ; then
- CLIENT=client
+ CLIENT=birdc
AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory")
AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/doc/bird-3.html
^
|
@@ -237,16 +237,16 @@
using <CODE>show route filtered</CODE>. Note that this option does not
work for the pipe protocol. Default: off.
<P>
-<DT><CODE>import limit <I>number</I> [action warn | block | restart | disable]</CODE><DD><P>Specify an import route limit (a maximum number of routes
+<DT><CODE>import limit [<I>number</I> | off ] [action warn | block | restart | disable]</CODE><DD><P>Specify an import route limit (a maximum number of routes
imported from the protocol) and optionally the action to be
taken when the limit is hit. Warn action just prints warning
log message. Block action discards new routes coming from the
protocol. Restart and disable actions shut the protocol down
like appropriate commands. Disable is the default action if an
action is not explicitly specified. Note that limits are reset
-during protocol reconfigure, reload or restart. Default: <CODE>none</CODE>.
+during protocol reconfigure, reload or restart. Default: <CODE>off</CODE>.
<P>
-<DT><CODE>receive limit <I>number</I> [action warn | block | restart | disable]</CODE><DD><P>Specify an receive route limit (a maximum number of routes
+<DT><CODE>receive limit [<I>number</I> | off ] [action warn | block | restart | disable]</CODE><DD><P>Specify an receive route limit (a maximum number of routes
received from the protocol and remembered). It works almost
identically to <CODE>import limit</CODE> option, the only
difference is that if <CODE>import keep filtered</CODE> option is
@@ -255,9 +255,9 @@
receive limit is to protect routing tables from
overflow. Import limit, on the contrary, counts accepted
routes only and routes blocked by the limit are handled like
-filtered routes. Default: <CODE>none</CODE>.
+filtered routes. Default: <CODE>off</CODE>.
<P>
-<DT><CODE>export limit <I>number</I> [action warn | block | restart | disable]</CODE><DD><P>Specify an export route limit, works similarly to
+<DT><CODE>export limit [ <I>number</I> | off ] [action warn | block | restart | disable]</CODE><DD><P>Specify an export route limit, works similarly to
the <CODE>import limit</CODE> option, but for the routes exported
to the protocol. This option is experimental, there are some
problems in details of its behavior -- the number of exported
@@ -265,7 +265,7 @@
during protocol reload, exported routes counter ignores route
blocking and block action also blocks route updates of already
accepted routes -- and these details will probably change in
-the future. Default: <CODE>none</CODE>.
+the future. Default: <CODE>off</CODE>.
<P>
<DT><CODE>description "<I>text</I>"</CODE><DD><P>This is an optional
description of the protocol. It is displayed as a part of the
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/doc/bird-4.html
^
|
@@ -28,6 +28,13 @@
birdc to talk to BIRD, your own applications could do that, too
-- the format of communication between BIRD and birdc is stable
(see the programmer's documentation).
+<P>
+<P>There is also lightweight variant of BIRD client called
+birdcl, which does not support command line editing and history
+and has minimal dependencies. This is useful for running BIRD in
+resource constrained environments, where Readline library (required
+for regular BIRD client) is not available.
+<P>
<P>Many commands have the <I>name</I> of the protocol instance as an argument.
This argument can be omitted if there exists only a single instance.
<P>
@@ -63,7 +70,8 @@
<P>
<DT><CODE>show symbols [table|filter|function|protocol|template|roa|<I>symbol</I>]</CODE><DD><P>Show the list of symbols defined in the configuration (names of protocols, routing tables etc.).
<P>
-<DT><CODE>show route [[for] <I>prefix</I>|<I>IP</I>] [table <I>sym</I>] [filter <I>f</I>|where <I>c</I>] [(export|preexport) <I>p</I>] [protocol <I>p</I>] [<I>options</I>]</CODE><DD><P>Show contents of a routing table (by default of the main one),
+<DT><CODE>show route [[for] <I>prefix</I>|<I>IP</I>] [table <I>sym</I>] [filter <I>f</I>|where <I>c</I>] [(export|preexport) <I>p</I>] [protocol <I>p</I>] [<I>options</I>]</CODE><DD><P>Show contents of a routing table (by default of the main one or
+the table attached to a respective protocol),
that is routes, their metrics and (in case the <CODE>all</CODE> switch is given)
all their attributes.
<P>
@@ -83,8 +91,8 @@
<P>You can also select just routes added by a specific protocol.
<CODE>protocol <I>p</I></CODE>.
<P>
-<P>If BIRD is configured to keep filtered routes (see import keep filtered/
-option), you can show them instead of routes by using filtered/ switch.
+<P>If BIRD is configured to keep filtered routes (see <CODE>import keep filtered</CODE>
+option), you can show them instead of routes by using <CODE>filtered</CODE> switch.
<P>
<P>The <CODE>stats</CODE> switch requests showing of route statistics (the
number of networks, number of routes before and after filtering). If
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/doc/bird-6.html
^
|
@@ -154,6 +154,11 @@
circumvent misconfigurations of other routers. Default:
disabled.
<P>
+<DT><CODE>next hop keep</CODE><DD><P>Forward the received Next Hop
+attribute even in situations where the local address should be
+used instead, like when the route is sent to an interface with
+a different subnet. Default: disabled.
+<P>
<DT><CODE>missing lladdr self|drop|ignore</CODE><DD><P>Next Hop attribute
in BGP-IPv6 sometimes contains just the global IPv6 address,
but sometimes it has to contain both global and link-local
@@ -780,6 +785,7 @@
nonbroadcast|nbma|pointomultipoint|ptmp];
strict nonbroadcast <switch>;
real broadcast <switch>;
+ ptp netmask <switch>;
check link <switch>;
ecmp weight <num>;
authentication [none|simple|cryptographic];
@@ -991,6 +997,17 @@
probably is not interoperable with other OSPF
implementations. Default value is no.
<P>
+<DT><CODE>ptp netmask <I>switch</I></CODE><DD><P>In <CODE>type ptp</CODE> network configurations, OSPFv2
+implementations should ignore received netmask field in hello
+packets and should send hello packets with zero netmask field
+on unnumbered PtP links. But some OSPFv2 implementations
+perform netmask checking even for PtP links. This option
+specifies whether real netmask will be used in hello packets
+on <CODE>type ptp</CODE> interfaces. You should ignore this option
+unless you meet some compatibility problems related to this
+issue. Default value is no for unnumbered PtP links, yes
+otherwise.
+<P>
<DT><CODE>check link <I>switch</I></CODE><DD><P>If set, a hardware link state (reported by OS) is taken into
consideration. When a link disappears (e.g. an ethernet cable is
unplugged), neighbors are immediately considered unreachable
@@ -1019,7 +1036,10 @@
<P>
<DT><CODE>neighbors { <I>set</I> } </CODE><DD><P>A set of neighbors to which Hello messages on NBMA or PtMP
networks are to be sent. For NBMA networks, some of them
-could be marked as eligible.
+could be marked as eligible. In OSPFv3, link-local addresses
+should be used, using global ones is possible, but it is
+nonstandard and might be problematic. And definitely,
+link-local and global addresses should not be mixed.
<P>
</DL>
<P>
@@ -1291,6 +1311,25 @@
also as interface-specific options and there is a short
variant <CODE>dnssl <I>domain</I></CODE> that just specifies one DNS
search domain.
+<P>
+<A NAME="dsc-trigger"></A>
+<DT><CODE>trigger <I>prefix</I></CODE><DD><P>RAdv protocol could be configured to change its behavior based
+on availability of routes. When this option is used, the
+protocol waits in suppressed state until a <I>trigger route</I>
+(for the specified network) is exported to the protocol, the
+protocol also returnsd to suppressed state if the
+<I>trigger route</I> disappears. Note that route export depends
+on specified export filter, as usual. This option could be
+used, e.g., for handling failover in multihoming scenarios.
+<P>During suppressed state, router advertisements are generated,
+but with some fields zeroed. Exact behavior depends on which
+fields are zeroed, this can be configured by
+<CODE>sensitive</CODE> option for appropriate fields. By default, just
+<CODE>default lifetime</CODE> (also called <CODE>router lifetime</CODE>) is
+zeroed, which means hosts cannot use the router as a default
+router. <CODE>preferred lifetime</CODE> and <CODE>valid lifetime</CODE> could
+also be configured as <CODE>sensitive</CODE> for a prefix, which would
+cause autoconfigured IPs to be deprecated or even removed.
</DL>
<P>
<P>Interface specific options:
@@ -1328,10 +1367,12 @@
<DT><CODE>current hop limit <I>expr</I></CODE><DD><P>This option specifies which value of Hop Limit should be used
by hosts. Valid values are 0-255, 0 means unspecified. Default: 64
<P>
-<DT><CODE>default lifetime <I>expr</I></CODE><DD><P>This option specifies the time (in seconds) how long (after
+<DT><CODE>default lifetime <I>expr</I> [sensitive <I>switch</I>]</CODE><DD><P>This option specifies the time (in seconds) how long (after
the receipt of RA) hosts may use the router as a default
-router. 0 means do not use as a default router. Default: 3 *
-<CODE>max ra interval</CODE>.
+router. 0 means do not use as a default router. For
+<CODE>sensitive</CODE> option, see
+<A HREF="#dsc-trigger">trigger</A>.
+Default: 3 * <CODE>max ra interval</CODE>, <CODE>sensitive</CODE> yes.
<P>
<DT><CODE>rdnss local <I>switch</I></CODE><DD><P>Use only local (interface-specific) RDNSS definitions for this
interface. Otherwise, both global and local definitions are
@@ -1346,22 +1387,31 @@
<P>Prefix specific options:
<P>
<DL>
+<DT><CODE>skip <I>switch</I></CODE><DD><P>This option allows to specify that given prefix should not be
+advertised. This is useful for making exceptions from a
+default policy of advertising all prefixes. Note that for
+withdrawing an already advertised prefix it is more useful to
+advertise it with zero valid lifetime. Default: no
+<P>
<DT><CODE>onlink <I>switch</I></CODE><DD><P>This option specifies whether hosts may use the advertised
prefix for onlink determination. Default: yes
<P>
<DT><CODE>autonomous <I>switch</I></CODE><DD><P>This option specifies whether hosts may use the advertised
prefix for stateless autoconfiguration. Default: yes
<P>
-<DT><CODE>valid lifetime <I>expr</I></CODE><DD><P>This option specifies the time (in seconds) how long (after
+<DT><CODE>valid lifetime <I>expr</I> [sensitive <I>switch</I>]</CODE><DD><P>This option specifies the time (in seconds) how long (after
the receipt of RA) the prefix information is valid, i.e.,
autoconfigured IP addresses can be assigned and hosts with
that IP addresses are considered directly reachable. 0 means
-the prefix is no longer valid. Default: 86400 (1 day)
+the prefix is no longer valid. For <CODE>sensitive</CODE> option, see
+<A HREF="#dsc-trigger">trigger</A>. Default: 86400 (1 day), <CODE>sensitive</CODE> no.
<P>
-<DT><CODE>preferred lifetime <I>expr</I></CODE><DD><P>This option specifies the time (in seconds) how long (after
+<DT><CODE>preferred lifetime <I>expr</I> [sensitive <I>switch</I>]</CODE><DD><P>This option specifies the time (in seconds) how long (after
the receipt of RA) IP addresses generated from the prefix
-using stateless autoconfiguration remain preferred. Default:
-14400 (4 hours)
+using stateless autoconfiguration remain preferred. For
+<CODE>sensitive</CODE> option, see
+<A HREF="#dsc-trigger">trigger</A>.
+Default: 14400 (4 hours), <CODE>sensitive</CODE> no.
</DL>
<P>
<P>
@@ -1501,7 +1551,7 @@
<P>
<DT><CODE>period <I>number</I></CODE><DD><P>specifies the number of seconds between periodic updates. Default is 30 seconds. A lower
number will mean faster convergence but bigger network
-load. Do not use values lower than 10.
+load. Do not use values lower than 12.
<P>
<DT><CODE>timeout time <I>number</I></CODE><DD><P>specifies how old route has to be to be considered unreachable. Default is 4*<CODE>period</CODE>.
<P>
@@ -1531,7 +1581,7 @@
protocol rip MyRIP_test {
debug all;
port 1520;
- period 10;
+ period 12;
garbage time 60;
interface "eth0" { metric 3; mode multicast; };
interface "eth*" { metric 2; mode broadcast; };
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/doc/bird.sgml
^
|
@@ -478,7 +478,7 @@
using <cf/show route filtered/. Note that this option does not
work for the pipe protocol. Default: off.
- <tag>import limit <m/number/ [action warn | block | restart | disable]</tag>
+ <tag>import limit [<m/number/ | off ] [action warn | block | restart | disable]</tag>
Specify an import route limit (a maximum number of routes
imported from the protocol) and optionally the action to be
taken when the limit is hit. Warn action just prints warning
@@ -486,9 +486,9 @@
protocol. Restart and disable actions shut the protocol down
like appropriate commands. Disable is the default action if an
action is not explicitly specified. Note that limits are reset
- during protocol reconfigure, reload or restart. Default: <cf/none/.
+ during protocol reconfigure, reload or restart. Default: <cf/off/.
- <tag>receive limit <m/number/ [action warn | block | restart | disable]</tag>
+ <tag>receive limit [<m/number/ | off ] [action warn | block | restart | disable]</tag>
Specify an receive route limit (a maximum number of routes
received from the protocol and remembered). It works almost
identically to <cf>import limit</cf> option, the only
@@ -498,9 +498,9 @@
receive limit is to protect routing tables from
overflow. Import limit, on the contrary, counts accepted
routes only and routes blocked by the limit are handled like
- filtered routes. Default: <cf/none/.
+ filtered routes. Default: <cf/off/.
- <tag>export limit <m/number/ [action warn | block | restart | disable]</tag>
+ <tag>export limit [ <m/number/ | off ] [action warn | block | restart | disable]</tag>
Specify an export route limit, works similarly to
the <cf>import limit</cf> option, but for the routes exported
to the protocol. This option is experimental, there are some
@@ -509,7 +509,7 @@
during protocol reload, exported routes counter ignores route
blocking and block action also blocks route updates of already
accepted routes -- and these details will probably change in
- the future. Default: <cf/none/.
+ the future. Default: <cf/off/.
<tag>description "<m/text/"</tag> This is an optional
description of the protocol. It is displayed as a part of the
@@ -623,7 +623,13 @@
-- the format of communication between BIRD and <file/birdc/ is stable
(see the programmer's documentation).
-Many commands have the <m/name/ of the protocol instance as an argument.
+<p>There is also lightweight variant of BIRD client called
+<file/birdcl/, which does not support command line editing and history
+and has minimal dependencies. This is useful for running BIRD in
+resource constrained environments, where Readline library (required
+for regular BIRD client) is not available.
+
+<p>Many commands have the <m/name/ of the protocol instance as an argument.
This argument can be omitted if there exists only a single instance.
<p>Here is a brief list of supported functions:
@@ -670,7 +676,8 @@
Show the list of symbols defined in the configuration (names of protocols, routing tables etc.).
<tag>show route [[for] <m/prefix/|<m/IP/] [table <m/sym/] [filter <m/f/|where <m/c/] [(export|preexport) <m/p/] [protocol <m/p/] [<m/options/]</tag>
- Show contents of a routing table (by default of the main one),
+ Show contents of a routing table (by default of the main one or
+ the table attached to a respective protocol),
that is routes, their metrics and (in case the <cf/all/ switch is given)
all their attributes.
@@ -691,8 +698,8 @@
<p>You can also select just routes added by a specific protocol.
<cf>protocol <m/p/</cf>.
- <p>If BIRD is configured to keep filtered routes (see </cf/import keep filtered/
- option), you can show them instead of routes by using </cf/filtered/ switch.
+ <p>If BIRD is configured to keep filtered routes (see <cf/import keep filtered/
+ option), you can show them instead of routes by using <cf/filtered/ switch.
<p>The <cf/stats/ switch requests showing of route statistics (the
number of networks, number of routes before and after filtering). If
@@ -1328,6 +1335,11 @@
circumvent misconfigurations of other routers. Default:
disabled.
+ <tag>next hop keep</tag> Forward the received Next Hop
+ attribute even in situations where the local address should be
+ used instead, like when the route is sent to an interface with
+ a different subnet. Default: disabled.
+
<tag>missing lladdr self|drop|ignore</tag>Next Hop attribute
in BGP-IPv6 sometimes contains just the global IPv6 address,
but sometimes it has to contain both global and link-local
@@ -1934,6 +1946,7 @@
nonbroadcast|nbma|pointomultipoint|ptmp];
strict nonbroadcast <switch>;
real broadcast <switch>;
+ ptp netmask <switch>;
check link <switch>;
ecmp weight <num>;
authentication [none|simple|cryptographic];
@@ -2177,6 +2190,18 @@
probably is not interoperable with other OSPF
implementations. Default value is no.
+ <tag>ptp netmask <m/switch/</tag>
+ In <cf/type ptp/ network configurations, OSPFv2
+ implementations should ignore received netmask field in hello
+ packets and should send hello packets with zero netmask field
+ on unnumbered PtP links. But some OSPFv2 implementations
+ perform netmask checking even for PtP links. This option
+ specifies whether real netmask will be used in hello packets
+ on <cf/type ptp/ interfaces. You should ignore this option
+ unless you meet some compatibility problems related to this
+ issue. Default value is no for unnumbered PtP links, yes
+ otherwise.
+
<tag>check link <M>switch</M></tag>
If set, a hardware link state (reported by OS) is taken into
consideration. When a link disappears (e.g. an ethernet cable is
@@ -2211,7 +2236,10 @@
<tag>neighbors { <m/set/ } </tag>
A set of neighbors to which Hello messages on NBMA or PtMP
networks are to be sent. For NBMA networks, some of them
- could be marked as eligible.
+ could be marked as eligible. In OSPFv3, link-local addresses
+ should be used, using global ones is possible, but it is
+ nonstandard and might be problematic. And definitely,
+ link-local and global addresses should not be mixed.
</descrip>
@@ -2479,6 +2507,26 @@
also as interface-specific options and there is a short
variant <cf>dnssl <m/domain/</cf> that just specifies one DNS
search domain.
+
+ <label id="dsc-trigger"> <tag>trigger <m/prefix/</tag>
+ RAdv protocol could be configured to change its behavior based
+ on availability of routes. When this option is used, the
+ protocol waits in suppressed state until a <it/trigger route/
+ (for the specified network) is exported to the protocol, the
+ protocol also returnsd to suppressed state if the
+ <it/trigger route/ disappears. Note that route export depends
+ on specified export filter, as usual. This option could be
+ used, e.g., for handling failover in multihoming scenarios.
+
+ During suppressed state, router advertisements are generated,
+ but with some fields zeroed. Exact behavior depends on which
+ fields are zeroed, this can be configured by
+ <cf/sensitive/ option for appropriate fields. By default, just
+ <cf/default lifetime/ (also called <cf/router lifetime/) is
+ zeroed, which means hosts cannot use the router as a default
+ router. <cf/preferred lifetime/ and <cf/valid lifetime/ could
+ also be configured as <cf/sensitive/ for a prefix, which would
+ cause autoconfigured IPs to be deprecated or even removed.
</descrip>
<p>Interface specific options:
@@ -2525,11 +2573,12 @@
This option specifies which value of Hop Limit should be used
by hosts. Valid values are 0-255, 0 means unspecified. Default: 64
- <tag>default lifetime <m/expr/</tag>
+ <tag>default lifetime <m/expr/ [sensitive <m/switch/]</tag>
This option specifies the time (in seconds) how long (after
the receipt of RA) hosts may use the router as a default
- router. 0 means do not use as a default router. Default: 3 *
- <cf/max ra interval/.
+ router. 0 means do not use as a default router. For
+ <cf/sensitive/ option, see <ref id="dsc-trigger" name="trigger">.
+ Default: 3 * <cf/max ra interval/, <cf/sensitive/ yes.
<tag>rdnss local <m/switch/</tag>
Use only local (interface-specific) RDNSS definitions for this
@@ -2546,6 +2595,13 @@
<p>Prefix specific options:
<descrip>
+ <tag>skip <m/switch/</tag>
+ This option allows to specify that given prefix should not be
+ advertised. This is useful for making exceptions from a
+ default policy of advertising all prefixes. Note that for
+ withdrawing an already advertised prefix it is more useful to
+ advertise it with zero valid lifetime. Default: no
+
<tag>onlink <m/switch/</tag>
This option specifies whether hosts may use the advertised
prefix for onlink determination. Default: yes
@@ -2554,18 +2610,20 @@
This option specifies whether hosts may use the advertised
prefix for stateless autoconfiguration. Default: yes
- <tag>valid lifetime <m/expr/</tag>
+ <tag>valid lifetime <m/expr/ [sensitive <m/switch/]</tag>
This option specifies the time (in seconds) how long (after
the receipt of RA) the prefix information is valid, i.e.,
autoconfigured IP addresses can be assigned and hosts with
that IP addresses are considered directly reachable. 0 means
- the prefix is no longer valid. Default: 86400 (1 day)
+ the prefix is no longer valid. For <cf/sensitive/ option, see
+ <ref id="dsc-trigger" name="trigger">. Default: 86400 (1 day), <cf/sensitive/ no.
- <tag>preferred lifetime <m/expr/</tag>
+ <tag>preferred lifetime <m/expr/ [sensitive <m/switch/]</tag>
This option specifies the time (in seconds) how long (after
the receipt of RA) IP addresses generated from the prefix
- using stateless autoconfiguration remain preferred. Default:
- 14400 (4 hours)
+ using stateless autoconfiguration remain preferred. For
+ <cf/sensitive/ option, see <ref id="dsc-trigger" name="trigger">.
+ Default: 14400 (4 hours), <cf/sensitive/ no.
</descrip>
@@ -2704,7 +2762,7 @@
<tag>period <M>number</M>
</tag>specifies the number of seconds between periodic updates. Default is 30 seconds. A lower
number will mean faster convergence but bigger network
- load. Do not use values lower than 10.
+ load. Do not use values lower than 12.
<tag>timeout time <M>number</M>
</tag>specifies how old route has to be to be considered unreachable. Default is 4*<cf/period/.
@@ -2734,7 +2792,7 @@
protocol rip MyRIP_test {
debug all;
port 1520;
- period 10;
+ period 12;
garbage time 60;
interface "eth0" { metric 3; mode multicast; };
interface "eth*" { metric 2; mode broadcast; };
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/doc/prog-5.html
^
|
@@ -874,6 +874,12 @@
<B>radv_iface_notify()</B>, which processes asynchronous events (specified
by RA_EV_* codes), and <B>radv_timer()</B>, which triggers sending RAs and
computes the next timeout.
+<P>The RAdv protocol could receive routes (through
+<B>radv_import_control()</B> and <B>radv_rt_notify()</B>), but only the
+configured trigger route is tracked (in <I>active</I> var). When a radv
+protocol is reconfigured, the connected routing table is examined
+(in <B>radv_check_active()</B>) to have proper <I>active</I> value in case of
+the specified trigger prefix was changed.
<P>Supported standards:
- RFC 4861 - main RA standard
- RFC 6106 - DNS extensions (RDDNS, DNSSL)
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/filter/filter.c
^
|
@@ -1429,6 +1429,12 @@
int
f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struct linpool *tmp_pool, int flags)
{
+ if (filter == FILTER_ACCEPT)
+ return F_ACCEPT;
+
+ if (filter == FILTER_REJECT)
+ return F_REJECT;
+
int rte_cow = ((*rte)->flags & REF_COW);
DBG( "Running filter `%s'...", filter->name );
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/nest/config.Y
^
|
@@ -216,6 +216,7 @@
l->action = $2;
$$ = l;
}
+ | OFF { $$ = NULL; }
;
rtable:
@@ -426,7 +427,6 @@
$$ = cfg_allocz(sizeof(struct rt_show_data));
$$->pxlen = 256;
$$->filter = FILTER_ACCEPT;
- $$->table = config->master_rtc->table;
}
| r_args prefix {
$$ = $1;
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/nest/iface.c
^
|
@@ -589,7 +589,7 @@
WALK_LIST(i, iface_list)
{
if (!(i->flags & IF_ADMIN_UP) ||
- (i->flags & (IF_IGNORE | IF_SHUTDOWN)))
+ (i->flags & IF_SHUTDOWN))
continue;
WALK_LIST(a, i->addrs)
@@ -612,6 +612,10 @@
if (mask && !iface_patt_match(mask, i, a))
continue;
+ /* FIXME: This should go away too */
+ if ((i->flags & IF_IGNORE) && !mask)
+ continue;
+
/* No pattern or pattern matched */
if (!b || ipa_to_u32(a->ip) < ipa_to_u32(b->ip))
b = a;
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/nest/route.h
^
|
@@ -235,6 +235,12 @@
#define RA_ACCEPTED 2 /* Announcement of first accepted route */
#define RA_ANY 3 /* Announcement of any route change */
+/* Return value of import_control() callback */
+#define RIC_ACCEPT 1 /* Accepted by protocol */
+#define RIC_PROCESS 0 /* Process it through import filter */
+#define RIC_REJECT -1 /* Rejected by protocol */
+#define RIC_DROP -2 /* Silently dropped by protocol */
+
struct config;
void rt_init(void);
@@ -250,6 +256,7 @@
void rte_update2(struct announce_hook *ah, net *net, rte *new, struct proto *src);
static inline void rte_update(rtable *tab, net *net, struct proto *p, struct proto *src, rte *new) { rte_update2(p->main_ahook, net, new, src); }
void rte_discard(rtable *tab, rte *old);
+int rt_examine(rtable *t, ip_addr prefix, int pxlen, struct proto *p, struct filter *filter);
void rte_dump(rte *);
void rte_free(rte *);
rte *rte_do_cow(rte *);
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/nest/rt-table.c
^
|
@@ -213,7 +213,8 @@
goto reject;
stats->exp_updates_rejected++;
- rte_trace_out(D_FILTERS, p, rt, "rejected by protocol");
+ if (v == RIC_REJECT)
+ rte_trace_out(D_FILTERS, p, rt, "rejected by protocol");
goto reject;
}
if (v > 0)
@@ -1042,6 +1043,34 @@
rte_update_unlock();
}
+/* Check rtable for best route to given net whether it would be exported do p */
+int
+rt_examine(rtable *t, ip_addr prefix, int pxlen, struct proto *p, struct filter *filter)
+{
+ net *n = net_find(t, prefix, pxlen);
+ rte *rt = n ? n->routes : NULL;
+
+ if (!rte_is_valid(rt))
+ return 0;
+
+ rte_update_lock();
+
+ /* Rest is stripped down export_filter() */
+ struct proto *src = rt->attrs->proto;
+ ea_list *tmpa = src->make_tmp_attrs ? src->make_tmp_attrs(rt, rte_update_pool) : NULL;
+ int v = p->import_control ? p->import_control(p, &rt, &tmpa, rte_update_pool) : 0;
+ if (v == RIC_PROCESS)
+ v = (f_run(filter, &rt, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) <= F_ACCEPT);
+
+ /* Discard temporary rte */
+ if (rt != n->routes)
+ rte_free(rt);
+
+ rte_update_unlock();
+
+ return v > 0;
+}
+
/**
* rte_dump - dump a route
* @e: &rte to be dumped
@@ -2081,7 +2110,7 @@
ee = e;
rte_update_lock(); /* We use the update buffer for filtering */
tmpa = p0->make_tmp_attrs ? p0->make_tmp_attrs(e, rte_update_pool) : NULL;
- ok = (d->filter == FILTER_ACCEPT || f_run(d->filter, &e, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) <= F_ACCEPT);
+ ok = f_run(d->filter, &e, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) <= F_ACCEPT;
if (p2 && p2 != p0) ok = 0;
if (ok && d->export_mode)
{
@@ -2095,8 +2124,8 @@
'configure soft' command may change the export filter
and do not update routes */
- if ((a = proto_find_announce_hook(p1, d->table)) && ((a->out_filter == FILTER_REJECT) ||
- (a->out_filter && f_run(a->out_filter, &e, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) > F_ACCEPT)))
+ if ((a = proto_find_announce_hook(p1, d->table)) &&
+ (f_run(a->out_filter, &e, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) > F_ACCEPT))
ok = 0;
}
}
@@ -2175,6 +2204,11 @@
{
net *n;
+ /* Default is either a master table or a table related to a respective protocol */
+ if ((!d->table) && d->export_protocol) d->table = d->export_protocol->table;
+ if ((!d->table) && d->show_protocol) d->table = d->show_protocol->table;
+ if (!d->table) d->table = config->master_rtc->table;
+
if (d->pxlen == 256)
{
FIB_ITERATE_INIT(&d->fit, &d->table->fib);
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/bgp/attrs.c
^
|
@@ -935,7 +935,8 @@
rta->dest != RTD_ROUTER ||
ipa_equal(rta->gw, IPA_NONE) ||
ipa_has_link_scope(rta->gw) ||
- (!p->is_internal && (!p->neigh || (rta->iface != p->neigh->iface))))
+ (!p->is_internal && !p->cf->next_hop_keep &&
+ (!p->neigh || (rta->iface != p->neigh->iface))))
set_next_hop(z, p->source_addr);
else
set_next_hop(z, rta->gw);
@@ -1003,10 +1004,13 @@
/* iBGP -> keep next_hop, eBGP multi-hop -> use source_addr,
* eBGP single-hop -> keep next_hop if on the same iface.
* If the next_hop is zero (i.e. link-local), keep only if on the same iface.
+ *
+ * Note that same-iface-check uses iface from route, which is based on gw.
*/
a = ea_find(e->attrs->eattrs, EA_CODE(EAP_BGP, BA_NEXT_HOP));
if (a && !p->cf->next_hop_self &&
- ((p->is_internal && ipa_nonzero(*((ip_addr *) a->u.ptr->data))) ||
+ (p->cf->next_hop_keep ||
+ (p->is_internal && ipa_nonzero(*((ip_addr *) a->u.ptr->data))) ||
(p->neigh && (e->attrs->iface == p->neigh->iface))))
{
/* Leave the original next hop attribute, will check later where does it point */
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/bgp/bgp.h
^
|
@@ -24,6 +24,7 @@
int multihop; /* Number of hops if multihop */
int ttl_security; /* Enable TTL security [RFC5082] */
int next_hop_self; /* Always set next hop to local IP address */
+ int next_hop_keep; /* Do not touch next hop attribute */
int missing_lladdr; /* What we will do when we don' know link-local addr, see MLL_* */
int gw_mode; /* How we compute route gateway from next_hop attr, see GW_* */
int compare_path_lengths; /* Use path lengths when selecting best route */
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/bgp/config.Y
^
|
@@ -76,7 +76,8 @@
| bgp_proto KEEPALIVE TIME expr ';' { BGP_CFG->keepalive_time = $4; }
| bgp_proto MULTIHOP ';' { BGP_CFG->multihop = 64; }
| bgp_proto MULTIHOP expr ';' { BGP_CFG->multihop = $3; if (($3<1) || ($3>255)) cf_error("Multihop must be in range 1-255"); }
- | bgp_proto NEXT HOP SELF ';' { BGP_CFG->next_hop_self = 1; }
+ | bgp_proto NEXT HOP SELF ';' { BGP_CFG->next_hop_self = 1; BGP_CFG->next_hop_keep = 0; }
+ | bgp_proto NEXT HOP KEEP ';' { BGP_CFG->next_hop_keep = 1; BGP_CFG->next_hop_self = 0; }
| bgp_proto MISSING LLADDR SELF ';' { BGP_CFG->missing_lladdr = MLL_SELF; }
| bgp_proto MISSING LLADDR DROP ';' { BGP_CFG->missing_lladdr = MLL_DROP; }
| bgp_proto MISSING LLADDR IGNORE ';' { BGP_CFG->missing_lladdr = MLL_IGNORE; }
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/bgp/packets.c
^
|
@@ -58,7 +58,7 @@
buf+=4;
}
- put_u16(buf+0, p->neigh ? p->neigh->iface->index : 0);
+ put_u16(buf+0, (p->neigh && p->neigh->iface) ? p->neigh->iface->index : 0);
put_u16(buf+2, BGP_AF);
buf+=4;
buf = ipa_put_addr(buf, conn->sk ? conn->sk->daddr : IPA_NONE);
@@ -820,7 +820,7 @@
ip_addr *nexthop = (ip_addr *) nh->u.ptr->data;
#ifdef IPV6
- int second = (nh->u.ptr->length == NEXT_HOP_LENGTH);
+ int second = (nh->u.ptr->length == NEXT_HOP_LENGTH) && ipa_nonzero(nexthop[1]);
/* First address should not be link-local, but may be zero in direct mode */
if (ipa_has_link_scope(*nexthop))
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/ospf/config.Y
^
|
@@ -131,10 +131,11 @@
CF_KEYWORDS(ELIGIBLE, POLL, NETWORKS, HIDDEN, VIRTUAL, CHECK, LINK)
CF_KEYWORDS(RX, BUFFER, LARGE, NORMAL, STUBNET, HIDDEN, SUMMARY, TAG, EXTERNAL)
CF_KEYWORDS(WAIT, DELAY, LSADB, ECMP, LIMIT, WEIGHT, NSSA, TRANSLATOR, STABILITY)
-CF_KEYWORDS(GLOBAL, LSID, ROUTER, SELF, INSTANCE, REAL)
+CF_KEYWORDS(GLOBAL, LSID, ROUTER, SELF, INSTANCE, REAL, NETMASK)
%type <t> opttext
%type <ld> lsadb_args
+%type <i> nbma_eligible
CF_GRAMMAR
@@ -289,13 +290,14 @@
| TYPE POINTOMULTIPOINT { OSPF_PATT->type = OSPF_IT_PTMP ; }
| TYPE PTMP { OSPF_PATT->type = OSPF_IT_PTMP ; }
| REAL BROADCAST bool { OSPF_PATT->real_bcast = $3; if (OSPF_VERSION != 2) cf_error("Real broadcast option requires OSPFv2"); }
+ | PTP NETMASK bool { OSPF_PATT->ptp_netmask = $3; if (OSPF_VERSION != 2) cf_error("Real netmask option requires OSPFv2"); }
| TRANSMIT DELAY expr { OSPF_PATT->inftransdelay = $3 ; if (($3<=0) || ($3>65535)) cf_error("Transmit delay must be in range 1-65535"); }
| PRIORITY expr { OSPF_PATT->priority = $2 ; if (($2<0) || ($2>255)) cf_error("Priority must be in range 0-255"); }
| STRICT NONBROADCAST bool { OSPF_PATT->strictnbma = $3 ; }
| STUB bool { OSPF_PATT->stub = $2 ; }
| CHECK LINK bool { OSPF_PATT->check_link = $3; }
| ECMP WEIGHT expr { OSPF_PATT->ecmp_weight = $3 - 1; if (($3<1) || ($3>256)) cf_error("ECMP weight must be in range 1-256"); }
- | NEIGHBORS '{' ipa_list '}'
+ | NEIGHBORS '{' nbma_list '}'
| AUTHENTICATION NONE { OSPF_PATT->autype = OSPF_AUTH_NONE ; }
| AUTHENTICATION SIMPLE { OSPF_PATT->autype = OSPF_AUTH_SIMPLE ; }
| AUTHENTICATION CRYPTOGRAPHIC { OSPF_PATT->autype = OSPF_AUTH_CRYPT ; }
@@ -327,33 +329,24 @@
| TAG expr { this_pref->tag = $2; }
;
-ipa_list:
+nbma_list:
/* empty */
- | ipa_list ipa_item
+ | nbma_list nbma_item
;
-ipa_item:
- ipa_el
- | ipa_ne;
+nbma_eligible:
+ /* empty */ { $$ = 0; }
+ | ELIGIBLE { $$ = 1; }
+ ;
-ipa_el: IPA ';'
+nbma_item: IPA nbma_eligible ';'
{
this_nbma = cfg_allocz(sizeof(struct nbma_node));
add_tail(&OSPF_PATT->nbma_list, NODE this_nbma);
this_nbma->ip=$1;
- this_nbma->eligible=0;
+ this_nbma->eligible=$2;
}
;
-
-ipa_ne: IPA ELIGIBLE ';'
- {
- this_nbma = cfg_allocz(sizeof(struct nbma_node));
- add_tail(&OSPF_PATT->nbma_list, NODE this_nbma);
- this_nbma->ip=$1;
- this_nbma->eligible=1;
- }
-;
-
ospf_iface_start:
{
@@ -372,6 +365,7 @@
OSPF_PATT->type = OSPF_IT_UNDEF;
init_list(&OSPF_PATT->nbma_list);
OSPF_PATT->autype = OSPF_AUTH_NONE;
+ OSPF_PATT->ptp_netmask = 2; /* not specified */
reset_passwords();
}
;
@@ -440,7 +434,7 @@
$$ = cfg_allocz(sizeof(struct lsadb_show_data));
}
| lsadb_args GLOBAL { $$ = $1; $$->scope = LSA_SCOPE_AS; }
- | lsadb_args AREA idval { $$ = $1; $$->scope = LSA_SCOPE_AREA; $$->area = $3 }
+ | lsadb_args AREA idval { $$ = $1; $$->scope = LSA_SCOPE_AREA; $$->area = $3; }
| lsadb_args LINK { $$ = $1; $$->scope = 1; /* hack, 0 is no filter */ }
| lsadb_args TYPE NUM { $$ = $1; $$->type = $3; }
| lsadb_args LSID idval { $$ = $1; $$->lsid = $3; }
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/ospf/hello.c
^
|
@@ -253,7 +253,8 @@
#ifdef OSPFv2
pkt->netmask = ipa_mkmask(ifa->addr->pxlen);
ipa_hton(pkt->netmask);
- if ((ifa->type == OSPF_IT_VLINK) || (ifa->type == OSPF_IT_PTP))
+ if ((ifa->type == OSPF_IT_VLINK) ||
+ ((ifa->type == OSPF_IT_PTP) && !ifa->ptp_netmask))
pkt->netmask = IPA_NONE;
#endif
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/ospf/iface.c
^
|
@@ -537,6 +537,9 @@
#ifdef OSPFv2
ifa->autype = ip->autype;
ifa->passwords = ip->passwords;
+ ifa->ptp_netmask = !(addr->flags & IA_PEER);
+ if (ip->ptp_netmask < 2)
+ ifa->ptp_netmask = ip->ptp_netmask;
#endif
#ifdef OSPFv3
@@ -574,8 +577,22 @@
init_list(&ifa->nbma_list);
WALK_LIST(nb, ip->nbma_list)
- if (ipa_in_net(nb->ip, addr->prefix, addr->pxlen))
- add_nbma_node(ifa, nb, 0);
+ {
+ /* In OSPFv3, addr is link-local while configured neighbors could
+ have global IP (although RFC 5340 C.5 says link-local addresses
+ should be used). Because OSPFv3 iface is not subnet-specific,
+ there is no need for ipa_in_net() check */
+
+#ifdef OSPFv2
+ if (!ipa_in_net(nb->ip, addr->prefix, addr->pxlen))
+ continue;
+#else
+ if (!ipa_has_link_scope(nb->ip))
+ log(L_WARN "In OSPFv3, configured neighbor address (%I) should be link-local", nb->ip);
+#endif
+
+ add_nbma_node(ifa, nb, 0);
+ }
ifa->state = OSPF_IS_DOWN;
add_tail(&oa->po->iface_list, NODE ifa);
@@ -771,8 +788,14 @@
/* NBMA LIST - add new */
WALK_LIST(nb, new->nbma_list)
{
+ /* See related note in ospf_iface_new() */
+#ifdef OSPFv2
if (!ipa_in_net(nb->ip, ifa->addr->prefix, ifa->addr->pxlen))
continue;
+#else
+ if (!ipa_has_link_scope(nb->ip))
+ log(L_WARN "In OSPFv3, configured neighbor address (%I) should be link-local", nb->ip);
+#endif
if (! find_nbma_node(ifa, nb->ip))
{
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/ospf/ospf.h
^
|
@@ -273,6 +273,7 @@
u16 rxbuf; /* Buffer size */
u8 check_link; /* Whether iface link change is used */
u8 ecmp_weight; /* Weight used for ECMP */
+ u8 ptp_netmask; /* Send real netmask for P2P */
};
struct ospf_md5
@@ -810,6 +811,7 @@
u8 check_link;
u8 ecmp_weight;
u8 real_bcast; /* Not really used in OSPFv3 */
+ u8 ptp_netmask; /* bool but 2 for unspecified */
#ifdef OSPFv2
list *passwords;
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/radv/config.Y
^
|
@@ -30,9 +30,9 @@
MANAGED, OTHER, CONFIG, LINK, MTU, REACHABLE, TIME, RETRANS,
TIMER, CURRENT, HOP, LIMIT, DEFAULT, VALID, PREFERRED, MULT,
LIFETIME, SKIP, ONLINK, AUTONOMOUS, RDNSS, DNSSL, NS, DOMAIN,
- LOCAL)
+ LOCAL, TRIGGER, SENSITIVE)
-%type<i> radv_mult
+%type<i> radv_mult radv_sensitive
CF_GRAMMAR
@@ -53,6 +53,11 @@
| PREFIX radv_prefix { add_tail(&RADV_CFG->pref_list, NODE this_radv_prefix); }
| RDNSS { init_list(&radv_dns_list); } radv_rdnss { add_tail_list(&RADV_CFG->rdnss_list, &radv_dns_list); }
| DNSSL { init_list(&radv_dns_list); } radv_dnssl { add_tail_list(&RADV_CFG->dnssl_list, &radv_dns_list); }
+ | TRIGGER prefix {
+ RADV_CFG->trigger_prefix = $2.addr;
+ RADV_CFG->trigger_pxlen = $2.len;
+ RADV_CFG->trigger_valid = 1;
+ }
;
radv_proto_opts:
@@ -78,6 +83,7 @@
RADV_IFACE->min_delay = DEFAULT_MIN_DELAY;
RADV_IFACE->current_hop_limit = DEFAULT_CURRENT_HOP_LIMIT;
RADV_IFACE->default_lifetime = -1;
+ RADV_IFACE->default_lifetime_sensitive = 1;
};
radv_iface_item:
@@ -90,7 +96,11 @@
| REACHABLE TIME expr { RADV_IFACE->reachable_time = $3; if (($3 < 0) || ($3 > 3600000)) cf_error("Reachable time must be in range 0-3600000"); }
| RETRANS TIMER expr { RADV_IFACE->retrans_timer = $3; if ($3 < 0) cf_error("Retrans timer must be 0 or positive"); }
| CURRENT HOP LIMIT expr { RADV_IFACE->current_hop_limit = $4; if (($4 < 0) || ($4 > 255)) cf_error("Current hop limit must be in range 0-255"); }
- | DEFAULT LIFETIME expr { RADV_IFACE->default_lifetime = $3; if (($3 < 0) || ($3 > 9000)) cf_error("Default lifetime must be in range 0-9000"); }
+ | DEFAULT LIFETIME expr radv_sensitive {
+ RADV_IFACE->default_lifetime = $3;
+ if (($3 < 0) || ($3 > 9000)) cf_error("Default lifetime must be in range 0-9000");
+ if ($4 != -1) RADV_IFACE->default_lifetime_sensitive = $4;
+ }
| PREFIX radv_prefix { add_tail(&RADV_IFACE->pref_list, NODE this_radv_prefix); }
| RDNSS { init_list(&radv_dns_list); } radv_rdnss { add_tail_list(&RADV_IFACE->rdnss_list, &radv_dns_list); }
| DNSSL { init_list(&radv_dns_list); } radv_dnssl { add_tail_list(&RADV_IFACE->dnssl_list, &radv_dns_list); }
@@ -147,14 +157,25 @@
SKIP bool { RADV_PREFIX->skip = $2; }
| ONLINK bool { RADV_PREFIX->onlink = $2; }
| AUTONOMOUS bool { RADV_PREFIX->autonomous = $2; }
- | VALID LIFETIME expr { RADV_PREFIX->valid_lifetime = $3; if ($3 < 0) cf_error("Valid lifetime must be 0 or positive"); }
- | PREFERRED LIFETIME expr { RADV_PREFIX->preferred_lifetime = $3; if ($3 < 0) cf_error("Preferred lifetime must be 0 or positive"); }
+ | VALID LIFETIME expr radv_sensitive {
+ RADV_PREFIX->valid_lifetime = $3;
+ if ($3 < 0) cf_error("Valid lifetime must be 0 or positive");
+ if ($4 != -1) RADV_PREFIX->valid_lifetime_sensitive = $4;
+ }
+ | PREFERRED LIFETIME expr radv_sensitive {
+ RADV_PREFIX->preferred_lifetime = $3;
+ if ($3 < 0) cf_error("Preferred lifetime must be 0 or positive");
+ if ($4 != -1) RADV_PREFIX->preferred_lifetime_sensitive = $4;
+ }
;
radv_prefix_finish:
{
if (RADV_PREFIX->preferred_lifetime > RADV_PREFIX->valid_lifetime)
cf_error("Preferred lifetime must be at most Valid lifetime");
+
+ if (RADV_PREFIX->valid_lifetime_sensitive > RADV_PREFIX->preferred_lifetime_sensitive)
+ cf_error("Valid lifetime sensitive requires that Preferred lifetime is sensitive too");
};
radv_prefix_opts:
@@ -268,6 +289,11 @@
| MULT expr { $$ = 0; radv_mult_val = $2; if (($2 < 1) || ($2 > 254)) cf_error("Multiplier must be in range 1-254"); }
;
+radv_sensitive:
+ /* empty */ { $$ = -1; }
+ | SENSITIVE bool { $$ = $2; }
+ ;
+
CF_CODE
CF_END
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/radv/packets.c
^
|
@@ -240,6 +240,7 @@
{
struct proto_radv *ra = ifa->ra;
struct radv_config *cf = (struct radv_config *) (ra->p.cf);
+ struct radv_iface_config *ic = ifa->cf;
char *buf = ifa->sk->tbuf;
char *bufstart = buf;
@@ -249,21 +250,22 @@
pkt->type = ICMPV6_RA;
pkt->code = 0;
pkt->checksum = 0;
- pkt->current_hop_limit = ifa->cf->current_hop_limit;
- pkt->flags = (ifa->cf->managed ? OPT_RA_MANAGED : 0) |
- (ifa->cf->other_config ? OPT_RA_OTHER_CFG : 0);
- pkt->router_lifetime = htons(ifa->cf->default_lifetime);
- pkt->reachable_time = htonl(ifa->cf->reachable_time);
- pkt->retrans_timer = htonl(ifa->cf->retrans_timer);
+ pkt->current_hop_limit = ic->current_hop_limit;
+ pkt->flags = (ic->managed ? OPT_RA_MANAGED : 0) |
+ (ic->other_config ? OPT_RA_OTHER_CFG : 0);
+ pkt->router_lifetime = (ra->active || !ic->default_lifetime_sensitive) ?
+ htons(ic->default_lifetime) : 0;
+ pkt->reachable_time = htonl(ic->reachable_time);
+ pkt->retrans_timer = htonl(ic->retrans_timer);
buf += sizeof(*pkt);
- if (ifa->cf->link_mtu)
+ if (ic->link_mtu)
{
struct radv_opt_mtu *om = (void *) buf;
om->type = OPT_MTU;
om->length = 1;
om->reserved = 0;
- om->mtu = htonl(ifa->cf->link_mtu);
+ om->mtu = htonl(ic->link_mtu);
buf += sizeof (*om);
}
@@ -288,26 +290,28 @@
op->pxlen = addr->pxlen;
op->flags = (pc->onlink ? OPT_PX_ONLINK : 0) |
(pc->autonomous ? OPT_PX_AUTONOMOUS : 0);
- op->valid_lifetime = htonl(pc->valid_lifetime);
- op->preferred_lifetime = htonl(pc->preferred_lifetime);
+ op->valid_lifetime = (ra->active || !pc->valid_lifetime_sensitive) ?
+ htonl(pc->valid_lifetime) : 0;
+ op->preferred_lifetime = (ra->active || !pc->preferred_lifetime_sensitive) ?
+ htonl(pc->preferred_lifetime) : 0;
op->reserved = 0;
op->prefix = addr->prefix;
ipa_hton(op->prefix);
buf += sizeof(*op);
}
- if (! ifa->cf->rdnss_local)
+ if (! ic->rdnss_local)
if (radv_prepare_rdnss(ifa, &cf->rdnss_list, &buf, bufend) < 0)
goto done;
- if (radv_prepare_rdnss(ifa, &ifa->cf->rdnss_list, &buf, bufend) < 0)
+ if (radv_prepare_rdnss(ifa, &ic->rdnss_list, &buf, bufend) < 0)
goto done;
- if (! ifa->cf->dnssl_local)
+ if (! ic->dnssl_local)
if (radv_prepare_dnssl(ifa, &cf->dnssl_list, &buf, bufend) < 0)
goto done;
- if (radv_prepare_dnssl(ifa, &ifa->cf->dnssl_list, &buf, bufend) < 0)
+ if (radv_prepare_dnssl(ifa, &ic->dnssl_list, &buf, bufend) < 0)
goto done;
done:
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/radv/radv.c
^
|
@@ -30,6 +30,13 @@
* by RA_EV_* codes), and radv_timer(), which triggers sending RAs and
* computes the next timeout.
*
+ * The RAdv protocol could receive routes (through
+ * radv_import_control() and radv_rt_notify()), but only the
+ * configured trigger route is tracked (in &active var). When a radv
+ * protocol is reconfigured, the connected routing table is examined
+ * (in radv_check_active()) to have proper &active value in case of
+ * the specified trigger prefix was changed.
+ *
* Supported standards:
* - RFC 4861 - main RA standard
* - RFC 6106 - DNS extensions (RDDNS, DNSSL)
@@ -93,6 +100,16 @@
tm_start(ifa->timer, after);
}
+static void
+radv_iface_notify_all(struct proto_radv *ra, int event)
+{
+ struct radv_iface *ifa;
+
+ WALK_LIST(ifa, ra->iface_list)
+ radv_iface_notify(ifa, event);
+}
+
+
static struct radv_iface *
radv_iface_find(struct proto_radv *ra, struct iface *what)
{
@@ -238,11 +255,68 @@
radv_iface_notify(ifa, RA_EV_CHANGE);
}
+static inline int radv_net_match_trigger(struct radv_config *cf, net *n)
+{
+ return cf->trigger_valid &&
+ (n->n.pxlen == cf->trigger_pxlen) &&
+ ipa_equal(n->n.prefix, cf->trigger_prefix);
+}
+
+int
+radv_import_control(struct proto *p, rte **new, ea_list **attrs UNUSED, struct linpool *pool UNUSED)
+{
+ // struct proto_radv *ra = (struct proto_radv *) p;
+ struct radv_config *cf = (struct radv_config *) (p->cf);
+
+ if (radv_net_match_trigger(cf, (*new)->net))
+ return RIC_PROCESS;
+
+ return RIC_DROP;
+}
+
+static void
+radv_rt_notify(struct proto *p, rtable *tbl UNUSED, net *n, rte *new, rte *old UNUSED, ea_list *attrs UNUSED)
+{
+ struct proto_radv *ra = (struct proto_radv *) p;
+ struct radv_config *cf = (struct radv_config *) (p->cf);
+
+ if (radv_net_match_trigger(cf, n))
+ {
+ u8 old_active = ra->active;
+ ra->active = !!new;
+
+ if (ra->active == old_active)
+ return;
+
+ if (ra->active)
+ RADV_TRACE(D_EVENTS, "Triggered");
+ else
+ RADV_TRACE(D_EVENTS, "Suppressed");
+
+ radv_iface_notify_all(ra, RA_EV_CHANGE);
+ }
+}
+
+static int
+radv_check_active(struct proto_radv *ra)
+{
+ struct radv_config *cf = (struct radv_config *) (ra->p.cf);
+
+ if (! cf->trigger_valid)
+ return 1;
+
+ return rt_examine(ra->p.table, cf->trigger_prefix, cf->trigger_pxlen,
+ &(ra->p), ra->p.cf->out_filter);
+}
+
static struct proto *
radv_init(struct proto_config *c)
{
struct proto *p = proto_new(c, sizeof(struct proto_radv));
+ p->accept_ra_types = RA_OPTIMAL;
+ p->import_control = radv_import_control;
+ p->rt_notify = radv_rt_notify;
p->if_notify = radv_if_notify;
p->ifa_notify = radv_ifa_notify;
return p;
@@ -252,9 +326,10 @@
radv_start(struct proto *p)
{
struct proto_radv *ra = (struct proto_radv *) p;
- // struct radv_config *cf = (struct radv_config *) (p->cf);
+ struct radv_config *cf = (struct radv_config *) (p->cf);
init_list(&(ra->iface_list));
+ ra->active = !cf->trigger_valid;
return PS_UP;
}
@@ -293,6 +368,9 @@
* causing nodes to temporary remove their default routes.
*/
+ p->cf = c; /* radv_check_active() requires proper p->cf */
+ ra->active = radv_check_active(ra);
+
struct iface *iface;
WALK_LIST(iface, iface_list)
{
@@ -335,6 +413,14 @@
cfg_copy_list(&d->pref_list, &s->pref_list, sizeof(struct radv_prefix_config));
}
+static void
+radv_get_status(struct proto *p, byte *buf)
+{
+ struct proto_radv *ra = (struct proto_radv *) p;
+
+ if (!ra->active)
+ strcpy(buf, "Suppressed");
+}
struct protocol proto_radv = {
.name = "RAdv",
@@ -343,5 +429,6 @@
.start = radv_start,
.shutdown = radv_shutdown,
.reconfigure = radv_reconfigure,
- .copy_config = radv_copy_config
+ .copy_config = radv_copy_config,
+ .get_status = radv_get_status
};
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/radv/radv.h
^
|
@@ -52,6 +52,10 @@
list pref_list; /* Global list of prefix configs (struct radv_prefix_config) */
list rdnss_list; /* Global list of RDNSS configs (struct radv_rdnss_config) */
list dnssl_list; /* Global list of DNSSL configs (struct radv_dnssl_config) */
+
+ ip_addr trigger_prefix; /* Prefix of a trigger route, if defined */
+ u8 trigger_pxlen; /* Pxlen of a trigger route, if defined */
+ u8 trigger_valid; /* Whether a trigger route is defined */
};
struct radv_iface_config
@@ -75,6 +79,7 @@
u32 retrans_timer;
u32 current_hop_limit;
u32 default_lifetime;
+ u8 default_lifetime_sensitive; /* Whether default_lifetime depends on trigger */
};
struct radv_prefix_config
@@ -88,6 +93,8 @@
u8 autonomous;
u32 valid_lifetime;
u32 preferred_lifetime;
+ u8 valid_lifetime_sensitive; /* Whether valid_lifetime depends on trigger */
+ u8 preferred_lifetime_sensitive; /* Whether preferred_lifetime depends on trigger */
};
struct radv_rdnss_config
@@ -113,6 +120,7 @@
{
struct proto p;
list iface_list; /* List of active ifaces */
+ u8 active; /* Whether radv is active w.r.t. triggers */
};
struct radv_iface
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/rip/rip.c
^
|
@@ -6,15 +6,14 @@
*
* Can be freely distributed and used under the terms of the GNU GPL.
*
- FIXME: IpV6 support: packet size
- FIXME: (nonurgent) IpV6 support: receive "route using" blocks
- FIXME: (nonurgent) IpV6 support: generate "nexthop" blocks
- next hops are only advisory, and they are pretty ugly in IpV6.
+ FIXME: IPv6 support: packet size
+ FIXME: (nonurgent) IPv6 support: receive "route using" blocks
+ FIXME: (nonurgent) IPv6 support: generate "nexthop" blocks
+ next hops are only advisory, and they are pretty ugly in IPv6.
I suggest just forgetting about them.
FIXME: (nonurgent): fold rip_connection into rip_interface?
- FIXME: (nonurgent) allow bigger frequencies than 1 regular update in 6 seconds (?)
FIXME: propagation of metric=infinity into main routing table may or may not be good idea.
*/
@@ -47,6 +46,7 @@
*/
#undef LOCAL_DEBUG
+#define LOCAL_DEBUG 1
#include "nest/bird.h"
#include "nest/iface.h"
@@ -59,7 +59,6 @@
#include "lib/string.h"
#include "rip.h"
-#include <assert.h>
#define P ((struct rip_proto *) p)
#define P_CF ((struct rip_proto_config *)p->cf)
@@ -163,7 +162,7 @@
FIB_ITERATE_START(&P->rtable, &c->iter, z) {
struct rip_entry *e = (struct rip_entry *) z;
- if (!rif->triggered || (!(e->updated < now-5))) {
+ if (!rif->triggered || (!(e->updated < now-2))) { /* FIXME: Should be probably 1 or some different algorithm */
nullupdate = 0;
i = rip_tx_prepare( p, packet->block + i, e, rif, i );
if (i >= maxi) {
@@ -359,26 +358,26 @@
static void
process_block( struct proto *p, struct rip_block *block, ip_addr whotoldme, struct iface *iface )
{
+ int metric, pxlen;
+
#ifndef IPV6
- int metric = ntohl( block->metric );
+ metric = ntohl( block->metric );
+ pxlen = ipa_mklen(block->netmask);
#else
- int metric = block->metric;
+ metric = block->metric;
+ pxlen = block->pxlen;
#endif
ip_addr network = block->network;
CHK_MAGIC;
-#ifdef IPV6
- TRACE(D_ROUTES, "block: %I tells me: %I/%d available, metric %d... ",
- whotoldme, network, block->pxlen, metric );
-#else
+
TRACE(D_ROUTES, "block: %I tells me: %I/%d available, metric %d... ",
- whotoldme, network, ipa_mklen(block->netmask), metric );
-#endif
+ whotoldme, network, pxlen, metric );
if ((!metric) || (metric > P_CF->infinity)) {
-#ifdef IPV6 /* Someone is sedning us nexthop and we are ignoring it */
+#ifdef IPV6 /* Someone is sending us nexthop and we are ignoring it */
if (metric == 0xff)
- { DBG( "IpV6 nexthop ignored" ); return; }
+ { DBG( "IPv6 nexthop ignored" ); return; }
#endif
log( L_WARN "%s: Got metric %d from %I", p->name, metric, whotoldme );
return;
@@ -533,13 +532,10 @@
WALK_LIST_DELSAFE( e, et, P->garbage ) {
rte *rte;
rte = SKIP_BACK( struct rte, u.rip.garbage, e );
-#ifdef LOCAL_DEBUG
- {
- struct proto *p = rte->attrs->proto;
- CHK_MAGIC;
- }
+
+ CHK_MAGIC;
+
DBG( "Garbage: (%p)", rte ); rte_dump( rte );
-#endif
if (now - rte->lastmod > P_CF->timeout_time) {
TRACE(D_EVENTS, "entry is too old: %I", rte->net->n.prefix );
@@ -558,17 +554,23 @@
DBG( "RIP: Broadcasting routing tables\n" );
{
struct rip_interface *rif;
+
+ if ( P_CF->period > 2 ) { /* Bring some randomness into sending times */
+ if (! (P->tx_count % P_CF->period)) P->rnd_count = random_u32() % 2;
+ } else P->rnd_count = P->tx_count % P_CF->period;
+
WALK_LIST( rif, P->interfaces ) {
struct iface *iface = rif->iface;
if (!iface) continue;
if (rif->mode & IM_QUIET) continue;
if (!(iface->flags & IF_UP)) continue;
+ rif->triggered = P->rnd_count;
- rif->triggered = (P->tx_count % 6);
rip_sendto( p, IPA_NONE, 0, rif );
}
- P->tx_count ++;
+ P->tx_count++;
+ P->rnd_count--;
}
DBG( "RIP: tick tock done\n" );
@@ -583,9 +585,9 @@
struct rip_interface *rif;
DBG( "RIP: starting instance...\n" );
- assert( sizeof(struct rip_packet_heading) == 4);
- assert( sizeof(struct rip_block) == 20);
- assert( sizeof(struct rip_block_auth) == 20);
+ ASSERT(sizeof(struct rip_packet_heading) == 4);
+ ASSERT(sizeof(struct rip_block) == 20);
+ ASSERT(sizeof(struct rip_block_auth) == 20);
#ifdef LOCAL_DEBUG
P->magic = RIP_MAGIC;
@@ -596,10 +598,9 @@
init_list( &P->interfaces );
P->timer = tm_new( p->pool );
P->timer->data = p;
- P->timer->randomize = 5;
- P->timer->recurrent = (P_CF->period / 6)+1;
+ P->timer->recurrent = 1;
P->timer->hook = rip_timer;
- tm_start( P->timer, 5 );
+ tm_start( P->timer, 2 );
rif = new_iface(p, NULL, 0, NULL); /* Initialize dummy interface */
add_head( &P->interfaces, NODE rif );
CHK_MAGIC;
@@ -956,9 +957,11 @@
static void
rip_rte_remove(net *net UNUSED, rte *rte)
{
- // struct proto *p = rte->attrs->proto;
+#ifdef LOCAL_DEBUG
+ struct proto *p = rte->attrs->proto;
CHK_MAGIC;
DBG( "rip_rte_remove: %p\n", rte );
+#endif
rem_node( &rte->u.rip.garbage );
}
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/rip/rip.h
^
|
@@ -162,6 +162,7 @@
int magic;
#endif
int tx_count; /* Do one regular update once in a while */
+ int rnd_count; /* Randomize sending time */
};
#ifdef LOCAL_DEBUG
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/proto/static/static.c
^
|
@@ -461,7 +461,7 @@
WALK_LIST(r, n->iface_routes)
{
struct iface *ifa;
- if (ifa = if_find_by_name(r->if_name))
+ if ((ifa = if_find_by_name(r->if_name)) && (ifa->flags & IF_UP))
static_install(p, r, ifa);
}
WALK_LIST(r, n->other_routes)
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/sysdep/config.h
^
|
@@ -7,7 +7,7 @@
#define _BIRD_CONFIG_H_
/* BIRD version */
-#define BIRD_VERSION "1.3.9"
+#define BIRD_VERSION "1.3.10"
/* Include parameters determined by configure script */
#include "sysdep/autoconf.h"
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/tools/Makefile.in
^
|
@@ -3,22 +3,31 @@
include Rules
-.PHONY: all daemon client subdir depend clean distclean tags docs userdocs progdocs
+.PHONY: all daemon birdc birdcl subdir depend clean distclean tags docs userdocs progdocs
-all: sysdep/paths.h .dep-stamp subdir daemon @CLIENT@
+all: sysdep/paths.h .dep-stamp subdir daemon birdcl @CLIENT@
daemon: $(exedir)/bird
-client: $(exedir)/birdc
+birdc: $(exedir)/birdc
+
+birdcl: $(exedir)/birdcl
bird-dep := $(addsuffix /all.o, $(static-dirs)) conf/all.o lib/birdlib.a
$(bird-dep): sysdep/paths.h .dep-stamp subdir
-birdc-dep := client/all.o lib/birdlib.a
+birdc-dep := client/birdc.o client/all.o lib/birdlib.a
$(birdc-dep): sysdep/paths.h .dep-stamp subdir
+birdcl-dep := client/birdcl.o client/all.o lib/birdlib.a
+
+$(birdcl-dep): sysdep/paths.h .dep-stamp subdir
+
+
+export client := @CLIENT@
+
depend: sysdep/paths.h .dir-stamp
set -e ; for a in $(dynamic-dirs) ; do $(MAKE) -C $$a $@ ; done
set -e ; for a in $(static-dirs) $(client-dirs) ; do $(MAKE) -C $$a -f $(srcdir_abs)/$$a/Makefile $@ ; done
@@ -33,6 +42,9 @@
$(exedir)/birdc: $(birdc-dep)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(CLIENT_LIBS)
+$(exedir)/birdcl: $(birdcl-dep)
+ $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+
.dir-stamp: sysdep/paths.h
mkdir -p $(static-dirs) $(client-dirs) $(doc-dirs)
touch .dir-stamp
@@ -58,6 +70,7 @@
install: all
$(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/@runtimedir@
$(INSTALL_PROGRAM) -s $(exedir)/bird $(DESTDIR)/$(sbindir)/bird@SUFFIX@
+ $(INSTALL_PROGRAM) -s $(exedir)/birdcl $(DESTDIR)/$(sbindir)/birdcl@SUFFIX@
if test -n "@CLIENT@" ; then \
$(INSTALL_PROGRAM) -s $(exedir)/birdc $(DESTDIR)/$(sbindir)/birdc@SUFFIX@ ; \
fi
@@ -74,7 +87,7 @@
clean:
find . -name "*.[oa]" -o -name core -o -name depend -o -name "*.html" | xargs rm -f
rm -f conf/cf-lex.c conf/cf-parse.* conf/commands.h conf/keywords.h
- rm -f $(exedir)/bird $(exedir)/birdc $(exedir)/bird.ctl $(exedir)/bird6.ctl .dep-stamp
+ rm -f $(exedir)/bird $(exedir)/birdcl $(exedir)/birdc $(exedir)/bird.ctl $(exedir)/bird6.ctl .dep-stamp
distclean: clean
rm -f config.* configure sysdep/autoconf.h sysdep/paths.h Makefile Rules
|
[-]
[+]
|
Changed |
bird-1.3.10.tar.bz2/tools/Rules.in
^
|
@@ -11,7 +11,7 @@
static-dir-paths := $(addprefix $(srcdir)/,$(static-dirs))
dynamic-dirs := lib conf
dynamic-dir-paths := $(dynamic-dirs)
-client-dirs := @CLIENT@
+client-dirs := client
client-dir-paths := $(client-dirs)
doc-dirs := doc
doc-dir-paths := $(doc-dirs)
@@ -75,8 +75,12 @@
%.o: $(src-path)%.c
$(CC) $(CFLAGS) -o $@ -c $<
+ifndef source-dep
+source-dep := $(source)
+endif
+
depend:
- $(CC) $(CPPFLAGS) -MM $(addprefix $(src-path),$(source)) >depend
+ $(CC) $(CPPFLAGS) -MM $(addprefix $(src-path),$(source-dep)) >depend
ifneq ($(wildcard depend),)
include depend
|