[-]
[+]
|
Changed |
bird.changes
|
|
[-]
[+]
|
Changed |
bird.spec
^
|
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/ChangeLog
^
|
@@ -1,3 +1,173 @@
+commit 13d4dd138d5dc6c884ded280f9244fac707c4f32
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Fri Jan 11 14:53:20 2013 +0100
+
+ NEWS update.
+
+commit b662290f40ea0fa0b1a1ba283e50e833724f2050
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Thu Jan 10 13:07:33 2013 +0100
+
+ Separate import and receive limits.
+
+ They have different behavior w.r.t. filtered routes that are kept.
+
+commit 79b4e12e6032faf6bb1f3feac385bd36ee53019e
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Thu Dec 27 12:56:23 2012 +0100
+
+ Implements interface masks for choosing router id.
+
+ Router ID could be automatically determined based of subset of
+ ifaces/addresses specified by 'router id from' option. The patch also
+ does some minor changes related to router ID reconfiguration.
+
+ Thanks to Alexander V. Chernikov for most of the work.
+
+commit a92cf57dd6ba021a495fe7268c86dc8e6aeecbb2
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Wed Dec 26 12:40:48 2012 +0100
+
+ Implements undo command and optional timeout for configuration
+
+ Several new configure command variants:
+
+ configure undo - undo last reconfiguration
+ configure timeout - configure with scheduled undo if not confirmed in timeout
+ configure confirm - confirm last configuration
+ configure check - just parse and validate config file
+
+commit 80a9cadc76101157707aecc0b482ad88ad702fc3
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Tue Nov 27 02:08:04 2012 +0100
+
+ Changes static route targets drop/reject to blackhole/unreachable.
+
+ To be consistent with rest of BIRD and Linux. Old names are also
+ allowed for compatibility.
+
+commit b31774eeb01a2f63e4ce4dc83f36ffd17879593e
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Tue Nov 27 01:30:09 2012 +0100
+
+ Removes some nonsense.
+
+commit 3e40f3e795e39f0b92445fd5295382220077c77f
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Tue Nov 27 01:25:47 2012 +0100
+
+ Fixes setting of route attributes of type router id.
+
+commit c93c02088a026b83f452fbd260135ba4c8da7ecf
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Fri Nov 16 13:30:54 2012 +0100
+
+ NEWS and version update.
+
+commit 70577529244d6d920b75d95e797156e05141db30
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Fri Nov 16 13:29:16 2012 +0100
+
+ Fixes route tracing w.r.t. kept filtered routes.
+
+commit cf3a704b6a2263aba6bb6adb4c2c9dd93b72f470
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Fri Nov 16 02:34:12 2012 +0100
+
+ Updates the documentation.
+
+commit 6cadbf325bfcf25a04d869778abb443f9e1b6119
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Thu Nov 15 14:08:20 2012 +0100
+
+ Change unnamed ptp link description on OSPFv2.
+
+ Although it is a slight deviation from the standard, it has no ill
+ consequences for OSPFv2 and the change fixes a compatibility issue
+ with some broken implementations.
+
+commit 15550957957f3c790f3bec3f6b8721559ea25969
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Thu Nov 15 01:29:01 2012 +0100
+
+ Changes 'rejected' to 'filtered' in one of the last patches.
+
+commit e16469bc4d182428687a5ef5f2fb4707afa15abd
+Author: Ondrej Filip <feela@network.cz>
+Date: Mon Nov 12 13:48:29 2012 +0100
+
+ AS# in bgp.agreggator was a signed integer - fixed.
+
+commit 227af52fb5be09c841fbd9f86e7bb3992b981a4a
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Sat Nov 10 16:18:12 2012 +0100
+
+ Fixes OSPF reconfigure w.r.t. downed ifaces.
+
+commit a55a90faec5cce09cee65f484e3731207af00335
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Sat Nov 10 14:54:35 2012 +0100
+
+ Peer address of stub iface should be announced in OSPF Router LSA.
+
+commit cf98be7b6743e45dde9e0458664cc0762bf08867
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Sat Nov 10 14:26:13 2012 +0100
+
+ Allows rejected routes to be kept and examined.
+
+ When 'import keep rejected' protocol option is activated, routes
+ rejected by the import filter are kept in the routing table, but they
+ are hidden and not propagated to other protocols. It is possible to
+ examine them using 'show route rejected'.
+
+commit dd4da6f640fb581cbd7d1ca537bf382558492b8e
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Wed Oct 31 17:14:35 2012 +0100
+
+ Fixes another bug in OSPFv3 vlinks.
+
+commit 8249ad9b304ea88b29e3aea76ebe49bb50348aaa
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Mon Oct 29 20:39:03 2012 +0100
+
+ Fixes sorting in OSPF show state.
+
+commit e4404cef0be10e639566986a2f8c1906c9f37de1
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Mon Oct 29 20:29:31 2012 +0100
+
+ Fixes several bugs related to OSPFv3 vlinks.
+
+commit 0343d066dab077d1391640c53198199b16bef993
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Wed Aug 29 12:42:49 2012 +0200
+
+ Fixes a bug in primary IP selection.
+
+commit 8ecbaf9c70b802a1200ad37f2bfd4bc64173c5fe
+Author: Ondrej Zajicek <santiago@crfreenet.org>
+Date: Thu Aug 16 13:09:26 2012 +0200
+
+ Fixes a bug with neighbor cache and overlapping IP prefixes.
+
+ When there are overlapping IP prefixes and one disappears,
+ neighbors associated with it was removed even if there
+ is another covering IP prefix.
+
+commit d760229ab897fa1bf1fd0fe7019cc2431d21a1cc
+Author: Ondrej Filip <feela@network.cz>
+Date: Wed Aug 8 14:10:31 2012 +0200
+
+ DragonFly support add - thanks to john@marino.st
+
+commit 60c412b9368fd7c3b0a8df2200f02140adcb0cf3
+Merge: 3fe1d9e 94e2f1c
+Author: Ondrej Filip <feela@network.cz>
+Date: Tue Aug 7 11:15:23 2012 +0200
+
+ Merge branch 'master' of ssh://git.nic.cz/bird
+
commit 94e2f1c111721d6213ea65cac5c53036e38e3973
Author: Ondrej Zajicek <santiago@crfreenet.org>
Date: Tue Aug 7 11:06:57 2012 +0200
@@ -88,6 +258,13 @@
Implements RDNSS and DNSSL support for RAdv.
+commit 3fe1d9e4a40663b93b59f5b6f9d61af9dc6a8ae6
+Merge: 72b2db8 95127cb
+Author: Ondrej Filip <feela@network.cz>
+Date: Tue May 15 23:40:37 2012 +0200
+
+ Merge branch 'master' of ssh://git.nic.cz/bird
+
commit 95127cbbb76e8870e029454a5313bc4b6ce69a4a
Author: Ondrej Zajicek <santiago@crfreenet.org>
Date: Mon May 14 11:47:41 2012 +0200
@@ -112,6 +289,13 @@
Fixes a bug in RA_ACCEPTED handling.
+commit 72b2db8db7534c52e928618410ec1f18787752c8
+Merge: 2795700 95616c8
+Author: Ondrej Filip <feela@network.cz>
+Date: Fri May 11 00:01:29 2012 +0200
+
+ Merge branch 'master' of ssh://git.nic.cz/bird
+
commit 95616c820248018f4999972cad315f2da60e4960
Author: Ondrej Zajicek <santiago@crfreenet.org>
Date: Fri May 4 16:38:25 2012 +0200
@@ -139,6 +323,13 @@
Implements build options to specify socket dir and suffix.
+commit 2795700c3158fa52b6cf957e9d0b9ad4a27c67a5
+Merge: 1f85226 bf42207
+Author: Ondrej Filip <feela@network.cz>
+Date: Wed May 2 11:10:40 2012 +0200
+
+ Merge branch 'master' of ssh://git.nic.cz/bird
+
commit 7a2c48dafce9420a23fd57408c31eecfc20c4fe0
Author: Ondrej Zajicek <santiago@crfreenet.org>
Date: Mon Apr 30 22:34:06 2012 +0200
@@ -209,6 +400,13 @@
Some minor fixes.
+commit 1f85226ecb76d3803b8fe37eb0891c45a6557dcd
+Merge: 92f8f7e d9b77cc
+Author: Ondrej Filip <feela@network.cz>
+Date: Thu Apr 26 17:03:53 2012 +0200
+
+ Merge branch 'master' of ssh://git.nic.cz/bird
+
commit d9b77cc28115e5c1ef64c69722c9d1fd1392dcd1
Author: Ondrej Zajicek <santiago@crfreenet.org>
Date: Tue Apr 24 23:39:57 2012 +0200
@@ -224,6 +422,12 @@
Merge commit 'origin/master'
+commit 92f8f7e3a3a5a42768c18c1f3d4d8f9f98150c61
+Author: Ondrej Filip <feela@network.cz>
+Date: Tue Apr 24 16:31:17 2012 +0200
+
+ Small bug in detection of class-A networks.
+
commit cca970666a90af02eaeb6848bbfc3d5a2222fa21
Author: Ondrej Filip <feela@network.cz>
Date: Sun Apr 22 14:03:07 2012 +0200
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/NEWS
^
|
@@ -1,3 +1,12 @@
+Version 1.3.9 (2013-01-11)
+ o BIRD can be configured to keep and show filtered routes.
+ o Separate receive and import limits.
+ o Several new reconfiguration cmd options (undo, timeout, check).
+ o Configurable automatic router ID selection.
+ o Dragonfly BSD support.
+ o Fixed OSPFv3 vlinks.
+ o Several minor bugfixes.
+
Version 1.3.8 (2012-08-07)
o Generalized import and export route limits.
o RDNSS and DNSSL support for RAdv.
@@ -11,7 +20,7 @@
Version 1.3.7 (2012-03-22)
o Route Origin Authorization basics.
o RIPng working again.
- o Extended clist operations in filters.
+ o Extended clist operations in filters.
o Fixes several bugs in BSD iface handling.
o Several minor bugfixes and enhancements.
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/README
^
|
@@ -3,7 +3,7 @@
(c) 1998--2008 Martin Mares <mj@ucw.cz>
(c) 1998--2000 Pavel Machek <pavel@ucw.cz>
(c) 1998--2008 Ondrej Filip <feela@network.cz>
- (c) 2009--2011 CZ.NIC z.s.p.o.
+ (c) 2009--2013 CZ.NIC z.s.p.o.
================================================================================
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/conf/conf.c
^
|
@@ -21,9 +21,12 @@
* There can exist up to four different configurations at one time: an active
* one (pointed to by @config), configuration we are just switching from
* (@old_config), one queued for the next reconfiguration (@future_config;
- * if it's non-%NULL and the user wants to reconfigure once again, we just
+ * if there is one and the user wants to reconfigure once again, we just
* free the previous queued config and replace it with the new one) and
- * finally a config being parsed (@new_config).
+ * finally a config being parsed (@new_config). The stored @old_config
+ * is also used for undo reconfiguration, which works in a similar way.
+ * Reconfiguration could also have timeout (using @config_timer) and undo
+ * is automatically called if the new configuration is not confirmed later.
*
* Loading of new configuration is very simple: just call config_alloc()
* to get a new &config structure, then use config_parse() to parse a
@@ -55,10 +58,23 @@
static jmp_buf conf_jmpbuf;
-struct config *config, *new_config, *old_config, *future_config;
-static event *config_event;
-int shutting_down, future_type;
-bird_clock_t boot_time;
+struct config *config, *new_config;
+
+static struct config *old_config; /* Old configuration */
+static struct config *future_config; /* New config held here if recon requested during recon */
+static int old_cftype; /* Type of transition old_config -> config (RECONFIG_SOFT/HARD) */
+static int future_cftype; /* Type of scheduled transition, may also be RECONFIG_UNDO */
+/* Note that when future_cftype is RECONFIG_UNDO, then future_config is NULL,
+ therefore proper check for future scheduled config checks future_cftype */
+
+static event *config_event; /* Event for finalizing reconfiguration */
+static timer *config_timer; /* Timer for scheduled configuration rollback */
+
+/* These are public just for cmd_show_status(), should not be accessed elsewhere */
+int shutting_down; /* Shutdown requested, do not accept new config changes */
+int configuring; /* Reconfiguration is running */
+int undo_available; /* Undo was not requested from last reconfiguration */
+/* Note that both shutting_down and undo_available are related to requests, not processing */
/**
* config_alloc - allocate a new configuration
@@ -82,8 +98,6 @@
c->load_time = now;
c->tf_base.fmt1 = c->tf_log.fmt1 = "%d-%m-%Y %T";
- if (!boot_time)
- boot_time = now;
return c;
}
@@ -154,7 +168,8 @@
void
config_free(struct config *c)
{
- rfree(c->pool);
+ if (c)
+ rfree(c->pool);
}
void
@@ -170,10 +185,7 @@
DBG("+++ deleting obstacle %d\n", c->obstacle_count);
c->obstacle_count--;
if (!c->obstacle_count)
- {
- ASSERT(config_event);
- ev_schedule(config_event);
- }
+ ev_schedule(config_event);
}
static int
@@ -188,25 +200,50 @@
log(L_WARN "Reconfiguration of BGP listening socket not implemented, please restart BIRD.");
if (!new->router_id)
- new->router_id = old->router_id;
- if (new->router_id != old->router_id)
- return 1;
+ {
+ new->router_id = old->router_id;
+
+ if (new->router_id_from)
+ {
+ u32 id = if_choose_router_id(new->router_id_from, old->router_id);
+ if (!id)
+ log(L_WARN "Cannot determine router ID, using old one");
+ else
+ new->router_id = id;
+ }
+ }
+
return 0;
}
static int
config_do_commit(struct config *c, int type)
{
- int force_restart, nobs;
+ if (type == RECONFIG_UNDO)
+ {
+ c = old_config;
+ type = old_cftype;
+ }
+ else
+ config_free(old_config);
- DBG("do_commit\n");
old_config = config;
- config = new_config = c;
+ old_cftype = type;
+ config = c;
+
+ configuring = 1;
+ if (old_config && !config->shutdown)
+ log(L_INFO "Reconfiguring");
+
+ /* This should not be necessary, but it seems there are some
+ functions that access new_config instead of config */
+ new_config = config;
+
if (old_config)
old_config->obstacle_count++;
DBG("sysdep_commit\n");
- force_restart = sysdep_commit(c, old_config);
+ int force_restart = sysdep_commit(c, old_config);
DBG("global_commit\n");
force_restart |= global_commit(c, old_config);
DBG("rt_commit\n");
@@ -214,38 +251,38 @@
roa_commit(c, old_config);
DBG("protos_commit\n");
protos_commit(c, old_config, force_restart, type);
- new_config = NULL; /* Just to be sure nobody uses that now */
+
+ /* Just to be sure nobody uses that now */
+ new_config = NULL;
+
+ int obs = 0;
if (old_config)
- nobs = --old_config->obstacle_count;
- else
- nobs = 0;
- DBG("do_commit finished with %d obstacles remaining\n", nobs);
- return !nobs;
+ obs = --old_config->obstacle_count;
+
+ DBG("do_commit finished with %d obstacles remaining\n", obs);
+ return !obs;
}
static void
config_done(void *unused UNUSED)
{
- struct config *c;
+ if (config->shutdown)
+ sysdep_shutdown_done();
+
+ configuring = 0;
+ if (old_config)
+ log(L_INFO "Reconfigured");
- DBG("config_done\n");
- for(;;)
+ if (future_cftype)
{
- if (config->shutdown)
- sysdep_shutdown_done();
- log(L_INFO "Reconfigured");
- if (old_config)
- {
- config_free(old_config);
- old_config = NULL;
- }
- if (!future_config)
- break;
- c = future_config;
+ int type = future_cftype;
+ struct config *conf = future_config;
+ future_cftype = RECONFIG_NONE;
future_config = NULL;
+
log(L_INFO "Reconfiguring to queued configuration");
- if (!config_do_commit(c, future_type))
- break;
+ if (config_do_commit(conf, type))
+ config_done(NULL);
}
}
@@ -253,6 +290,7 @@
* 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)
*
* When a configuration is parsed and prepared for use, the
* config_commit() function starts the process of reconfiguration.
@@ -265,6 +303,10 @@
* using config_del_obstacle(), the old configuration is freed and
* everything runs according to the new one.
*
+ * When @timeout is nonzero, the undo timer is activated with given
+ * timeout. The timer is deactivated when config_commit(),
+ * config_confirm() or config_undo() is called.
+ *
* Result: %CONF_DONE if the configuration has been accepted immediately,
* %CONF_PROGRESS if it will take some time to switch to it, %CONF_QUEUED
* if it's been queued due to another reconfiguration being in progress now
@@ -272,49 +314,147 @@
* are accepted.
*/
int
-config_commit(struct config *c, int type)
+config_commit(struct config *c, int type, int timeout)
{
- if (!config) /* First-time configuration */
+ if (shutting_down)
{
- config_do_commit(c, RECONFIG_HARD);
- return CONF_DONE;
+ config_free(c);
+ return CONF_SHUTDOWN;
}
- if (old_config) /* Reconfiguration already in progress */
+
+ undo_available = 1;
+ if (timeout > 0)
+ tm_start(config_timer, timeout);
+ else
+ tm_stop(config_timer);
+
+ if (configuring)
{
- if (shutting_down == 2)
- {
- log(L_INFO "New configuration discarded due to shutdown");
- config_free(c);
- return CONF_SHUTDOWN;
- }
- if (future_config)
+ if (future_cftype)
{
log(L_INFO "Queueing new configuration, ignoring the one already queued");
config_free(future_config);
}
else
- log(L_INFO "Queued new configuration");
+ log(L_INFO "Queueing new configuration");
+
+ future_cftype = type;
future_config = c;
- future_type = type;
return CONF_QUEUED;
}
- if (!shutting_down)
- log(L_INFO "Reconfiguring");
-
if (config_do_commit(c, type))
{
config_done(NULL);
return CONF_DONE;
}
- if (!config_event)
+ return CONF_PROGRESS;
+}
+
+/**
+ * config_confirm - confirm a commited configuration
+ *
+ * When the undo timer is activated by config_commit() with nonzero timeout,
+ * this function can be used to deactivate it and therefore confirm
+ * the current configuration.
+ *
+ * Result: %CONF_CONFIRM when the current configuration is confirmed,
+ * %CONF_NONE when there is nothing to confirm (i.e. undo timer is not active).
+ */
+int
+config_confirm(void)
+{
+ if (config_timer->expires == 0)
+ return CONF_NOTHING;
+
+ tm_stop(config_timer);
+
+ return CONF_CONFIRM;
+}
+
+/**
+ * config_undo - undo a configuration
+ *
+ * Function config_undo() can be used to change the current
+ * configuration back to stored %old_config. If no reconfiguration is
+ * running, this stored configuration is commited in the same way as a
+ * new configuration in config_commit(). If there is already a
+ * reconfiguration in progress and no next reconfiguration is
+ * scheduled, then the undo is scheduled for later processing as
+ * usual, but if another reconfiguration is already scheduled, then
+ * such reconfiguration is removed instead (i.e. undo is applied on
+ * the last commit that scheduled it).
+ *
+ * Result: %CONF_DONE if the configuration has been accepted immediately,
+ * %CONF_PROGRESS if it will take some time to switch to it, %CONF_QUEUED
+ * if it's been queued due to another reconfiguration being in progress now,
+ * %CONF_UNQUEUED if a scheduled reconfiguration is removed, %CONF_NOTHING
+ * if there is no relevant configuration to undo (the previous config request
+ * was config_undo() too) or %CONF_SHUTDOWN if BIRD is in shutdown mode and
+ * no new configuration changes are accepted.
+ */
+int
+config_undo(void)
+{
+ if (shutting_down)
+ return CONF_SHUTDOWN;
+
+ if (!undo_available || !old_config)
+ return CONF_NOTHING;
+
+ undo_available = 0;
+ tm_stop(config_timer);
+
+ if (configuring)
{
- config_event = ev_new(&root_pool);
- config_event->hook = config_done;
+ if (future_cftype)
+ {
+ config_free(future_config);
+ future_config = NULL;
+
+ log(L_INFO "Removing queued configuration");
+ future_cftype = RECONFIG_NONE;
+ return CONF_UNQUEUED;
+ }
+ else
+ {
+ log(L_INFO "Queueing undo configuration");
+ future_cftype = RECONFIG_UNDO;
+ return CONF_QUEUED;
+ }
+ }
+
+ if (config_do_commit(NULL, RECONFIG_UNDO))
+ {
+ config_done(NULL);
+ return CONF_DONE;
}
return CONF_PROGRESS;
}
+extern void cmd_reconfig_undo_notify(void);
+
+static void
+config_timeout(struct timer *t)
+{
+ log(L_INFO "Config timeout expired, starting undo");
+ cmd_reconfig_undo_notify();
+
+ int r = config_undo();
+ if (r < 0)
+ log(L_ERR "Undo request failed");
+}
+
+void
+config_init(void)
+{
+ config_event = ev_new(&root_pool);
+ config_event->hook = config_done;
+
+ config_timer = tm_new(&root_pool);
+ config_timer->hook = config_timeout;
+}
+
/**
* order_shutdown - order BIRD shutdown
*
@@ -328,15 +468,16 @@
if (shutting_down)
return;
+
log(L_INFO "Shutting down");
c = lp_alloc(config->mem, sizeof(struct config));
memcpy(c, config, sizeof(struct config));
init_list(&c->protos);
init_list(&c->tables);
c->shutdown = 1;
+
+ config_commit(c, RECONFIG_HARD, 0);
shutting_down = 1;
- config_commit(c, RECONFIG_HARD);
- shutting_down = 2;
}
/**
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/conf/conf.h
^
|
@@ -26,6 +26,7 @@
int mrtdump_file; /* Configured MRTDump file (sysdep, fd in unix) */
char *syslog_name; /* Name used for syslog (NULL -> no syslog) */
struct rtable_config *master_rtc; /* Configuration of master routing table */
+ 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 */
@@ -54,28 +55,33 @@
/* Please don't use these variables in protocols. Use proto_config->global instead. */
extern struct config *config; /* Currently active configuration */
extern struct config *new_config; /* Configuration being parsed */
-extern struct config *old_config; /* Old configuration when reconfiguration is in progress */
-extern struct config *future_config; /* New config held here if recon requested during recon */
-
-extern int shutting_down;
-extern bird_clock_t boot_time;
struct config *config_alloc(byte *name);
int config_parse(struct config *);
int cli_parse(struct config *);
void config_free(struct config *);
-int config_commit(struct config *, int type);
-#define RECONFIG_HARD 0
-#define RECONFIG_SOFT 1
+int config_commit(struct config *, int type, int timeout);
+int config_confirm(void);
+int config_undo(void);
+void config_init(void);
void cf_error(char *msg, ...) NORET;
void config_add_obstacle(struct config *);
void config_del_obstacle(struct config *);
void order_shutdown(void);
-#define CONF_DONE 0
-#define CONF_PROGRESS 1
-#define CONF_QUEUED 2
-#define CONF_SHUTDOWN 3
+#define RECONFIG_NONE 0
+#define RECONFIG_HARD 1
+#define RECONFIG_SOFT 2
+#define RECONFIG_UNDO 3
+
+#define CONF_DONE 0
+#define CONF_PROGRESS 1
+#define CONF_QUEUED 2
+#define CONF_UNQUEUED 3
+#define CONF_CONFIRM 4
+#define CONF_SHUTDOWN -1
+#define CONF_NOTHING -2
+
/* Pools */
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/conf/gen_commands.m4
^
|
@@ -10,6 +10,9 @@
m4_define(CF_CLI, `m4_divert(0){ "m4_translit($1,A-Z,a-z)", "$3", "$4", 1 },
m4_divert(-1)')
+m4_define(CF_CLI_CMD, `m4_divert(0){ "m4_translit($1,A-Z,a-z)", "$2", "$3", 1 },
+m4_divert(-1)')
+
m4_define(CF_CLI_HELP, `m4_divert(0){ "m4_translit($1,A-Z,a-z)", "$2", "$3", 0 },
m4_divert(-1)')
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/conf/gen_parser.m4
^
|
@@ -44,6 +44,7 @@
m4_divert(2)CF_KEYWORDS(m4_translit($1, [[ ]], [[,]]))
m4_divert(3)CF_ADDTO(cli_cmd, CF_cmd)
CF_cmd: $1 $2 END')
+m4_define(CF_CLI_CMD, `')
m4_define(CF_CLI_HELP, `')
# ENUM declarations are ignored
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/configure
^
|
@@ -4362,6 +4362,10 @@
;;
ipv4:freebsd*) sysdesc=bsd
;;
+ ipv6:dragonfly*) sysdesc=bsd-v6
+ ;;
+ ipv4:dragonfly*) sysdesc=bsd
+ ;;
ipv6:kfreebsd*) sysdesc=bsd-v6
;;
ipv4:kfreebsd*) sysdesc=bsd
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/configure.in
^
|
@@ -142,6 +142,10 @@
;;
ipv4:freebsd*) sysdesc=bsd
;;
+ ipv6:dragonfly*) sysdesc=bsd-v6
+ ;;
+ ipv4:dragonfly*) sysdesc=bsd
+ ;;
ipv6:kfreebsd*) sysdesc=bsd-v6
;;
ipv4:kfreebsd*) sysdesc=bsd
|
|
Added |
bird-1.3.9.tar.bz2/doc/b138.tgz
^
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/doc/bird-3.html
^
|
@@ -108,7 +108,17 @@
Besides, there are some predefined numeric constants based on /etc/iproute2/rt_* files.
A list of defined constants can be seen (together with other symbols) using 'show symbols' command.
<P>
-<DT><CODE>router id <I>IPv4 address</I></CODE><DD><P>Set BIRD's router ID. It's a world-wide unique identification of your router, usually one of router's IPv4 addresses. Default: in IPv4 version, the lowest IP address of a non-loopback interface. In IPv6 version, this option is mandatory.
+<DT><CODE>router id <I>IPv4 address</I></CODE><DD><P>Set BIRD's router ID. It's a world-wide unique identification
+of your router, usually one of router's IPv4 addresses.
+Default: in IPv4 version, the lowest IP address of a
+non-loopback interface. In IPv6 version, this option is
+mandatory.
+<P>
+<DT><CODE>router id from [-] [ "<I>mask</I>" ] [ <I>prefix</I> ] [, ...]</CODE><DD><P>Set BIRD's router ID based on an IP address of an interface
+specified by an interface pattern. The option is applicable
+for IPv4 version only. See
+<A HREF="#dsc-iface">interface</A>
+section for detailed description of interface patterns.
<P>
<DT><CODE>listen bgp [address <I>address</I>] [port <I>port</I>] [dual]</CODE><DD><P>This option allows to specify address and port where BGP
protocol should listen. It is global option as listening
@@ -220,15 +230,32 @@
works in the direction from the routing table to the protocol.
Default: <CODE>none</CODE>.
<P>
+<DT><CODE>import keep filtered <I>bool</I></CODE><DD><P>Usually, if an import filter rejects a route, the route is
+forgotten. When this option is active, these routes are
+kept in the routing table, but they are hidden and not
+propagated to other protocols. But it is possible to show them
+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
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 ignores new routes coming from the
+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>none</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
+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
+active, filtered routes are counted towards the limit and
+blocked routes are forgotten, as the main purpose of the
+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>.
<P>
<DT><CODE>export limit <I>number</I> [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
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/doc/bird-4.html
^
|
@@ -83,6 +83,9 @@
<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>
<P>The <CODE>stats</CODE> switch requests showing of route statistics (the
number of networks, number of routes before and after filtering). If
you use <CODE>count</CODE> instead, only the statistics will be printed.
@@ -106,17 +109,41 @@
<P>
<DT><CODE>flush roa [table <I>t</I>>]</CODE><DD><P>Remove all dynamic ROA entries from a ROA table.
<P>
-<DT><CODE>configure [soft] ["<I>config file</I>"]</CODE><DD><P>Reload configuration from a given file. BIRD will smoothly
+<DT><CODE>configure [soft] ["<I>config file</I>"] [timeout [<I>num</I>]]</CODE><DD><P>Reload configuration from a given file. BIRD will smoothly
switch itself to the new configuration, protocols are
reconfigured if possible, restarted otherwise. Changes in
-filters usually lead to restart of affected protocols. If
-<CODE>soft</CODE> option is used, changes in filters does not cause
+filters usually lead to restart of affected protocols.
+<P>If <CODE>soft</CODE> option is used, changes in filters does not cause
BIRD to restart affected protocols, therefore already accepted
routes (according to old filters) would be still propagated,
but new routes would be processed according to the new
filters.
-<P>
-<DT><CODE>enable|disable|restart <I>name</I>|"<I>pattern</I>"|all</CODE><DD><P>Enable, disable or restart a given protocol instance, instances matching the <CODE><I>pattern</I></CODE> or <CODE>all</CODE> instances.
+<P>If <CODE>timeout</CODE> option is used, config timer is activated. The
+new configuration could be either confirmed using
+<CODE>configure confirm</CODE> command, or it will be reverted to the
+old one when the config timer expires. This is useful for cases
+when reconfiguration breaks current routing and a router becames
+inaccessible for an administrator. The config timeout expiration is
+equivalent to <CODE>configure undo</CODE> command. The timeout duration
+could be specified, default is 300 s.
+<P>
+<DT><CODE>configure confirm</CODE><DD><P>Deactivate the config undo timer and therefore confirm the current
+configuration.
+<P>
+<DT><CODE>configure undo</CODE><DD><P>Undo the last configuration change and smoothly switch back to
+the previous (stored) configuration. If the last configuration
+change was soft, the undo change is also soft. There is only
+one level of undo, but in some specific cases when several
+reconfiguration requests are given immediately in a row and
+the intermediate ones are skipped then the undo also skips them back.
+<P>
+<DT><CODE>configure check ["<I>config file</I>"]</CODE><DD><P>Read and parse given config file, but do not use it. useful
+for checking syntactic and some semantic validity of an config
+file.
+<P>
+<DT><CODE>enable|disable|restart <I>name</I>|"<I>pattern</I>"|all</CODE><DD><P>Enable, disable or restart a given protocol instance,
+instances matching the <CODE><I>pattern</I></CODE> or
+<CODE>all</CODE> instances.
<P>
<DT><CODE>reload [in|out] <I>name</I>|"<I>pattern</I>"|all</CODE><DD><P>Reload a given protocol instance, that means re-import routes
from the protocol instance and re-export preferred routes to
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/doc/bird-6.html
^
|
@@ -533,6 +533,15 @@
routing protocol), in most cases it is not needed to have these device
routes in BIRD routing table and to use the direct protocol.
<P>
+<P>There is one notable case when you definitely want to use the
+direct protocol -- running BIRD on BSD systems. Having high priority
+device routes for directly connected networks from the direct protocol
+protects kernel device routes from being overwritten or removed by IGP
+routes during some transient network conditions, because a lower
+priority IGP route for the same network is not exported to the kernel
+routing table. This is an issue on BSD systems only, as on Linux
+systems BIRD cannot change non-BIRD route in the kernel routing table.
+<P>
<P>The only configurable thing about direct is what interfaces it watches:
<P>
<P>
@@ -1324,12 +1333,12 @@
router. 0 means do not use as a default router. Default: 3 *
<CODE>max ra interval</CODE>.
<P>
-<DT><CODE>rdnss local <I>bool</I></CODE><DD><P>Use only local (interface-specific) RDNSS definitions for this
+<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
used. Could also be used to disable RDNSS for given interface
if no local definitons are specified. Default: no.
<P>
-<DT><CODE>dnssl local <I>bool</I></CODE><DD><P>Use only local DNSSL definitions for this interface. See
+<DT><CODE>dnssl local <I>switch</I></CODE><DD><P>Use only local DNSSL definitions for this interface. See
<CODE>rdnss local</CODE> option above. Default: no.
</DL>
<P>
@@ -1570,9 +1579,10 @@
route through an interface to hosts on a directly connected network.
<DT><CODE>route <I>prefix</I> recursive <I>ip</I></CODE><DD><P>Static recursive route,
its nexthop depends on a route table lookup for given IP address.
-<DT><CODE>route <I>prefix</I> drop|reject|prohibit</CODE><DD><P>Special routes
-specifying to drop the packet, return it as unreachable or return
-it as administratively prohibited.
+<DT><CODE>route <I>prefix</I> blackhole|unreachable|prohibit</CODE><DD><P>Special routes
+specifying to silently drop the packet, return it as unreachable or return
+it as administratively prohibited. First two targets are also known
+as <CODE>drop</CODE> and <CODE>reject</CODE>.
<P>
<DT><CODE>check link <I>switch</I></CODE><DD><P>If set, hardware link states of network interfaces are taken
into consideration. When link disappears (e.g. ethernet cable
@@ -1599,7 +1609,7 @@
via 198.51.100.10 weight 2
via 198.51.100.20
via 192.0.2.1;
- route 203.0.113.0/24 reject; # Sink route
+ route 203.0.113.0/24 unreachable; # Sink route
route 10.2.0.0/24 via "arc0"; # Secondary network
}
</PRE>
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/doc/bird.conf.example
^
|
@@ -67,8 +67,8 @@
# debug { states, routes, filters, interfaces, events, packets };
# debug all;
# route 0.0.0.0/0 via 198.51.100.13;
-# route 198.51.100.0/25 reject;
-# route 10.0.0.0/8 reject;
+# route 198.51.100.0/25 unreachable;
+# route 10.0.0.0/8 unreachable;
# route 10.1.1.0:255.255.255.0 via 198.51.100.3;
# route 10.1.2.0:255.255.255.0 via 198.51.100.3;
# route 10.1.3.0:255.255.255.0 via 198.51.100.4;
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/doc/bird.sgml
^
|
@@ -337,7 +337,18 @@
Besides, there are some predefined numeric constants based on /etc/iproute2/rt_* files.
A list of defined constants can be seen (together with other symbols) using 'show symbols' command.
- <tag>router id <m/IPv4 address/</tag> Set BIRD's router ID. It's a world-wide unique identification of your router, usually one of router's IPv4 addresses. Default: in IPv4 version, the lowest IP address of a non-loopback interface. In IPv6 version, this option is mandatory.
+ <tag>router id <m/IPv4 address/</tag>
+ Set BIRD's router ID. It's a world-wide unique identification
+ of your router, usually one of router's IPv4 addresses.
+ Default: in IPv4 version, the lowest IP address of a
+ non-loopback interface. In IPv6 version, this option is
+ mandatory.
+
+ <tag>router id from [-] [ "<m/mask/" ] [ <m/prefix/ ] [, ...]</tag>
+ Set BIRD's router ID based on an IP address of an interface
+ specified by an interface pattern. The option is applicable
+ for IPv4 version only. See <ref id="dsc-iface" name="interface">
+ section for detailed description of interface patterns.
<tag>listen bgp [address <m/address/] [port <m/port/] [dual]</tag>
This option allows to specify address and port where BGP
@@ -459,16 +470,35 @@
works in the direction from the routing table to the protocol.
Default: <cf/none/.
+ <tag>import keep filtered <m/bool/</tag>
+ Usually, if an import filter rejects a route, the route is
+ forgotten. When this option is active, these routes are
+ kept in the routing table, but they are hidden and not
+ propagated to other protocols. But it is possible to show them
+ 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>
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 ignores new routes coming from the
+ 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: <cf/none/.
+ during protocol reconfigure, reload or restart. Default: <cf/none/.
+
+ <tag>receive limit <m/number/ [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
+ difference is that if <cf/import keep filtered/ option is
+ active, filtered routes are counted towards the limit and
+ blocked routes are forgotten, as the main purpose of the
+ 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/.
<tag>export limit <m/number/ [action warn | block | restart | disable]</tag>
Specify an export route limit, works similarly to
@@ -661,6 +691,9 @@
<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>The <cf/stats/ switch requests showing of route statistics (the
number of networks, number of routes before and after filtering). If
you use <cf/count/ instead, only the statistics will be printed.
@@ -688,19 +721,48 @@
<tag>flush roa [table <m/t/>]</tag>
Remove all dynamic ROA entries from a ROA table.
- <tag>configure [soft] ["<m/config file/"]</tag>
+ <tag>configure [soft] ["<m/config file/"] [timeout [<m/num/]]</tag>
Reload configuration from a given file. BIRD will smoothly
switch itself to the new configuration, protocols are
reconfigured if possible, restarted otherwise. Changes in
- filters usually lead to restart of affected protocols. If
- <cf/soft/ option is used, changes in filters does not cause
+ filters usually lead to restart of affected protocols.
+
+ If <cf/soft/ option is used, changes in filters does not cause
BIRD to restart affected protocols, therefore already accepted
routes (according to old filters) would be still propagated,
but new routes would be processed according to the new
filters.
+ If <cf/timeout/ option is used, config timer is activated. The
+ new configuration could be either confirmed using
+ <cf/configure confirm/ command, or it will be reverted to the
+ old one when the config timer expires. This is useful for cases
+ when reconfiguration breaks current routing and a router becames
+ inaccessible for an administrator. The config timeout expiration is
+ equivalent to <cf/configure undo/ command. The timeout duration
+ could be specified, default is 300 s.
+
+ <tag>configure confirm</tag>
+ Deactivate the config undo timer and therefore confirm the current
+ configuration.
+
+ <tag>configure undo</tag>
+ Undo the last configuration change and smoothly switch back to
+ the previous (stored) configuration. If the last configuration
+ change was soft, the undo change is also soft. There is only
+ one level of undo, but in some specific cases when several
+ reconfiguration requests are given immediately in a row and
+ the intermediate ones are skipped then the undo also skips them back.
+
+ <tag>configure check ["<m/config file/"]</tag>
+ Read and parse given config file, but do not use it. useful
+ for checking syntactic and some semantic validity of an config
+ file.
+
<tag>enable|disable|restart <m/name/|"<m/pattern/"|all</tag>
- Enable, disable or restart a given protocol instance, instances matching the <cf><m/pattern/</cf> or <cf/all/ instances.
+ Enable, disable or restart a given protocol instance,
+ instances matching the <cf><m/pattern/</cf> or
+ <cf/all/ instances.
<tag>reload [in|out] <m/name/|"<m/pattern/"|all</tag>
@@ -1640,6 +1702,15 @@
routing protocol), in most cases it is not needed to have these device
routes in BIRD routing table and to use the direct protocol.
+<p>There is one notable case when you definitely want to use the
+direct protocol -- running BIRD on BSD systems. Having high priority
+device routes for directly connected networks from the direct protocol
+protects kernel device routes from being overwritten or removed by IGP
+routes during some transient network conditions, because a lower
+priority IGP route for the same network is not exported to the kernel
+routing table. This is an issue on BSD systems only, as on Linux
+systems BIRD cannot change non-BIRD route in the kernel routing table.
+
<p>The only configurable thing about direct is what interfaces it watches:
<p><descrip>
@@ -2460,13 +2531,13 @@
router. 0 means do not use as a default router. Default: 3 *
<cf/max ra interval/.
- <tag>rdnss local <m/bool/</tag>
+ <tag>rdnss local <m/switch/</tag>
Use only local (interface-specific) RDNSS definitions for this
interface. Otherwise, both global and local definitions are
used. Could also be used to disable RDNSS for given interface
if no local definitons are specified. Default: no.
- <tag>dnssl local <m/bool/</tag>
+ <tag>dnssl local <m/switch/</tag>
Use only local DNSSL definitions for this interface. See
<cf/rdnss local/ option above. Default: no.
</descrip>
@@ -2710,9 +2781,10 @@
route through an interface to hosts on a directly connected network.
<tag>route <m/prefix/ recursive <m/ip/</tag> Static recursive route,
its nexthop depends on a route table lookup for given IP address.
- <tag>route <m/prefix/ drop|reject|prohibit</tag> Special routes
- specifying to drop the packet, return it as unreachable or return
- it as administratively prohibited.
+ <tag>route <m/prefix/ blackhole|unreachable|prohibit</tag> Special routes
+ specifying to silently drop the packet, return it as unreachable or return
+ it as administratively prohibited. First two targets are also known
+ as <cf/drop/ and <cf/reject/.
<tag>check link <m/switch/</tag>
If set, hardware link states of network interfaces are taken
@@ -2738,7 +2810,7 @@
via 198.51.100.10 weight 2
via 198.51.100.20
via 192.0.2.1;
- route 203.0.113.0/24 reject; # Sink route
+ route 203.0.113.0/24 unreachable; # Sink route
route 10.2.0.0/24 via "arc0"; # Secondary network
}
</code>
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/doc/prog-2.html
^
|
@@ -1125,12 +1125,13 @@
<HR><H3>Function</H3>
<P><I>void</I>
<B>proto_notify_limit</B>
-(<I>struct announce_hook *</I> <B>ah</B>, <I>struct proto_limit *</I> <B>l</B>, <I>u32</I> <B>rt_count</B>)
+(<I>struct announce_hook *</I> <B>ah</B>, <I>struct proto_limit *</I> <B>l</B>, <I>int</I> <B>dir</B>, <I>u32</I> <B>rt_count</B>)
<H3>Arguments</H3>
<P>
<DL>
<DT><I>struct announce_hook *</I> <B>ah</B><DD><P>announce hook
<DT><I>struct proto_limit *</I> <B>l</B><DD><P>limit being hit
+<DT><I>int</I> <B>dir</B><DD><P>limit direction (PLD_*)
<DT><I>u32</I> <B>rt_count</B><DD><P>the number of routes
</DL>
<H3>Description</H3>
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/doc/prog-3.html
^
|
@@ -28,9 +28,12 @@
<P>There can exist up to four different configurations at one time: an active
one (pointed to by <B>config</B>), configuration we are just switching from
(<B>old_config</B>), one queued for the next reconfiguration (<B>future_config</B>;
-if it's non-<I>NULL</I> and the user wants to reconfigure once again, we just
+if there is one and the user wants to reconfigure once again, we just
free the previous queued config and replace it with the new one) and
-finally a config being parsed (<B>new_config</B>).
+finally a config being parsed (<B>new_config</B>). The stored <B>old_config</B>
+is also used for undo reconfiguration, which works in a similar way.
+Reconfiguration could also have timeout (using <B>config_timer</B>) and undo
+is automatically called if the new configuration is not confirmed later.
<P>Loading of new configuration is very simple: just call <B>config_alloc()</B>
to get a new <I>config</I> structure, then use <B>config_parse()</B> to parse a
configuration file and fill all fields of the structure
@@ -111,13 +114,14 @@
<HR><H3>Function</H3>
<P><I>int</I>
<B>config_commit</B>
-(<I>struct config *</I> <B>c</B>, <I>int</I> <B>type</B>) -- commit a configuration
+(<I>struct config *</I> <B>c</B>, <I>int</I> <B>type</B>, <I>int</I> <B>timeout</B>) -- commit a configuration
<P>
<H3>Arguments</H3>
<P>
<DL>
<DT><I>struct config *</I> <B>c</B><DD><P>new configuration
<DT><I>int</I> <B>type</B><DD><P>type of reconfiguration (RECONFIG_SOFT or RECONFIG_HARD)
+<DT><I>int</I> <B>timeout</B><DD><P>timeout for undo (or 0 for no timeout)
</DL>
<H3>Description</H3>
<P>When a configuration is parsed and prepared for use, the
@@ -130,6 +134,9 @@
to complete the reconfiguration. After all such obstacles are removed
using <B>config_del_obstacle()</B>, the old configuration is freed and
everything runs according to the new one.
+<P>When <B>timeout</B> is nonzero, the undo timer is activated with given
+timeout. The timer is deactivated when <B>config_commit()</B>,
+<B>config_confirm()</B> or <B>config_undo()</B> is called.
<H3>Result</H3>
<P><I>CONF_DONE</I> if the configuration has been accepted immediately,
<I>CONF_PROGRESS</I> if it will take some time to switch to it, <I>CONF_QUEUED</I>
@@ -139,6 +146,47 @@
<HR><H3>Function</H3>
+<P><I>int</I>
+<B>config_confirm</B>
+(<B>void</B>) -- confirm a commited configuration
+<P>
+<H3>Description</H3>
+<P>
+<P>When the undo timer is activated by <B>config_commit()</B> with nonzero timeout,
+this function can be used to deactivate it and therefore confirm
+the current configuration.
+<H3>Result</H3>
+<P><I>CONF_CONFIRM</I> when the current configuration is confirmed,
+<I>CONF_NONE</I> when there is nothing to confirm (i.e. undo timer is not active).
+
+
+<HR><H3>Function</H3>
+<P><I>int</I>
+<B>config_undo</B>
+(<B>void</B>) -- undo a configuration
+<P>
+<H3>Description</H3>
+<P>
+<P>Function <B>config_undo()</B> can be used to change the current
+configuration back to stored <I>old_config</I>. If no reconfiguration is
+running, this stored configuration is commited in the same way as a
+new configuration in <B>config_commit()</B>. If there is already a
+reconfiguration in progress and no next reconfiguration is
+scheduled, then the undo is scheduled for later processing as
+usual, but if another reconfiguration is already scheduled, then
+such reconfiguration is removed instead (i.e. undo is applied on
+the last commit that scheduled it).
+<H3>Result</H3>
+<P><I>CONF_DONE</I> if the configuration has been accepted immediately,
+<I>CONF_PROGRESS</I> if it will take some time to switch to it, <I>CONF_QUEUED</I>
+if it's been queued due to another reconfiguration being in progress now,
+<I>CONF_UNQUEUED</I> if a scheduled reconfiguration is removed, <I>CONF_NOTHING</I>
+if there is no relevant configuration to undo (the previous config request
+was <B>config_undo()</B> too) or <I>CONF_SHUTDOWN</I> if BIRD is in shutdown mode and
+no new configuration changes are accepted.
+
+
+<HR><H3>Function</H3>
<P><I>void</I>
<B>order_shutdown</B>
(<B>void</B>) -- order BIRD shutdown
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/doc/reply_codes
^
|
@@ -25,6 +25,12 @@
0014 Route count
0015 Reloading
0016 Access restricted
+0017 Reconfiguration already in progress, removing queued config
+0018 Reconfiguration confirmed
+0019 Nothing to do (configure undo/confirm)
+0020 Configuration OK
+0021 Undo requested
+0022 Undo scheduled
1000 BIRD version
1001 Interface list
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/filter/filter.c
^
|
@@ -622,9 +622,6 @@
case T_VOID: runtime( "Can't operate with values of type void" );
case T_INT: if (v2.val.i == 0) runtime( "Mother told me not to divide by 0" );
res.val.i = v1.val.i / v2.val.i; break;
- case T_IP: if (v2.type != T_INT)
- runtime( "Incompatible types in / operator" );
- break;
default: runtime( "Usage of unknown type" );
}
break;
@@ -956,11 +953,25 @@
l->attrs[0].type = what->aux | EAF_ORIGINATED;
switch (what->aux & EAF_TYPE_MASK) {
case EAF_TYPE_INT:
- case EAF_TYPE_ROUTER_ID:
if (v1.type != T_INT)
runtime( "Setting int attribute to non-int value" );
l->attrs[0].u.data = v1.val.i;
break;
+
+ case EAF_TYPE_ROUTER_ID:
+#ifndef IPV6
+ /* IP->Quad implicit conversion */
+ if (v1.type == T_IP) {
+ l->attrs[0].u.data = ipa_to_u32(v1.val.px.ip);
+ break;
+ }
+#endif
+ /* T_INT for backward compatibility */
+ if ((v1.type != T_QUAD) && (v1.type != T_INT))
+ runtime( "Setting quad attribute to non-quad value" );
+ l->attrs[0].u.data = v1.val.i;
+ break;
+
case EAF_TYPE_OPAQUE:
runtime( "Setting opaque attribute is not allowed" );
break;
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/nest/cli.c
^
|
@@ -122,6 +122,7 @@
va_list args;
byte buf[CLI_LINE_SIZE];
int cd = code;
+ int errcode;
int size, cnt;
if (cd < 0)
@@ -131,16 +132,26 @@
size = bsprintf(buf, " ");
else
size = bsprintf(buf, "%04d-", cd);
+ errcode = -8000;
+ }
+ else if (cd == CLI_ASYNC_CODE)
+ {
+ size = 1; buf[0] = '+';
+ errcode = cd;
}
else
- size = bsprintf(buf, "%04d ", cd);
+ {
+ size = bsprintf(buf, "%04d ", cd);
+ errcode = 8000;
+ }
+
c->last_reply = cd;
va_start(args, msg);
cnt = bvsnprintf(buf+size, sizeof(buf)-size-1, msg, args);
va_end(args);
if (cnt < 0)
{
- cli_printf(c, code < 0 ? -8000 : 8000, "<line overflow>");
+ cli_printf(c, errcode, "<line overflow>");
return;
}
size += cnt;
@@ -385,12 +396,17 @@
}
}
+/* Hack for scheduled undo notification */
+extern cli *cmd_reconfig_stored_cli;
+
void
cli_free(cli *c)
{
cli_set_log_echo(c, 0, 0);
if (c->cleanup)
c->cleanup(c);
+ if (c == cmd_reconfig_stored_cli)
+ cmd_reconfig_stored_cli = NULL;
rfree(c->pool);
}
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/nest/cli.h
^
|
@@ -49,6 +49,8 @@
extern pool *cli_pool;
extern struct cli *this_cli; /* Used during parsing */
+#define CLI_ASYNC_CODE 10000
+
/* Functions to be called by command handlers */
void cli_printf(cli *, int, char *, ...);
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/nest/cmds.c
^
|
@@ -14,6 +14,9 @@
#include "lib/string.h"
#include "lib/resource.h"
+extern int shutting_down;
+extern int configuring;
+
void
cmd_show_status(void)
{
@@ -27,9 +30,10 @@
cli_msg(-1011, "Last reboot on %s", tim);
tm_format_datetime(tim, &config->tf_base, config->load_time);
cli_msg(-1011, "Last reconfiguration on %s", tim);
+
if (shutting_down)
cli_msg(13, "Shutdown in progress");
- else if (old_config)
+ else if (configuring)
cli_msg(13, "Reconfiguration in progress");
else
cli_msg(13, "Daemon is up and running");
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/nest/config.Y
^
|
@@ -44,7 +44,7 @@
CF_KEYWORDS(ROUTER, ID, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT)
CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, TABLE, STATES, ROUTES, FILTERS)
-CF_KEYWORDS(LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE)
+CF_KEYWORDS(RECEIVE, LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERED)
CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES)
CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS, PREEXPORT, GENERATE, ROA, MAX, FLUSH)
CF_KEYWORDS(LISTEN, BGP, V6ONLY, DUAL, ADDRESS, PORT, PASSWORDS, DESCRIPTION, SORTED)
@@ -75,9 +75,9 @@
CF_ADDTO(conf, rtrid)
-rtrid: ROUTER ID idval ';' {
- new_config->router_id = $3;
- }
+rtrid:
+ ROUTER ID idval ';' { new_config->router_id = $3; }
+ | ROUTER ID FROM iface_patt ';' { new_config->router_id_from = this_ipatt; }
;
idval:
@@ -185,8 +185,10 @@
| MRTDUMP mrtdump_mask { this_proto->mrtdump = $2; }
| IMPORT imexport { this_proto->in_filter = $2; }
| EXPORT imexport { this_proto->out_filter = $2; }
+ | RECEIVE LIMIT limit_spec { this_proto->rx_limit = $3; }
| IMPORT LIMIT limit_spec { this_proto->in_limit = $3; }
| EXPORT LIMIT limit_spec { this_proto->out_limit = $3; }
+ | IMPORT KEEP FILTERED bool { this_proto->in_keep_filtered = $4; }
| TABLE rtable { this_proto->table = $2; }
| ROUTER ID idval { this_proto->router_id = $3; }
| DESCRIPTION TEXT { this_proto->dsc = $2; }
@@ -263,6 +265,17 @@
| iface_patt_list ',' iface_patt_node
;
+iface_patt_init: {
+ /* Generic this_ipatt init */
+ this_ipatt = cfg_allocz(sizeof(struct iface_patt));
+ init_list(&this_ipatt->ipn_list);
+ }
+ ;
+
+iface_patt:
+ iface_patt_init iface_patt_list
+ ;
+
/* Direct device route protocol */
@@ -405,7 +418,7 @@
{ if_show_summary(); } ;
CF_CLI_HELP(SHOW ROUTE, ..., [[Show routing table]])
-CF_CLI(SHOW ROUTE, r_args, [[[<prefix>|for <prefix>|for <ip>] [table <t>] [filter <f>|where <cond>] [all] [primary] [(export|preexport) <p>] [protocol <p>] [stats|count]]], [[Show routing table]])
+CF_CLI(SHOW ROUTE, r_args, [[[<prefix>|for <prefix>|for <ip>] [table <t>] [filter <f>|where <cond>] [all] [primary] [filtered] [(export|preexport) <p>] [protocol <p>] [stats|count]]], [[Show routing table]])
{ rt_show($3); } ;
r_args:
@@ -451,6 +464,10 @@
$$ = $1;
$$->primary_only = 1;
}
+ | r_args FILTERED {
+ $$ = $1;
+ $$->filtered = 1;
+ }
| r_args export_or_preexport SYM {
struct proto_config *c = (struct proto_config *) $3->def;
$$ = $1;
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/nest/iface.c
^
|
@@ -35,8 +35,6 @@
static pool *if_pool;
-static void auto_router_id(void);
-
list iface_list;
/**
@@ -354,9 +352,6 @@
struct iface *i;
struct ifa *a, *b;
- if (!config->router_id)
- auto_router_id();
-
WALK_LIST(i, iface_list)
{
if (!(i->flags & IF_UPDATED))
@@ -583,24 +578,57 @@
}
}
-static void
-auto_router_id(void)
+u32
+if_choose_router_id(struct iface_patt *mask, u32 old_id)
{
#ifndef IPV6
- struct iface *i, *j;
+ struct iface *i;
+ struct ifa *a, *b;
- j = NULL;
+ b = NULL;
WALK_LIST(i, iface_list)
- if ((i->flags & IF_ADMIN_UP) &&
- !(i->flags & (IF_IGNORE | IF_SHUTDOWN)) &&
- i->addr &&
- !(i->addr->flags & IA_PEER) &&
- (!j || ipa_to_u32(i->addr->ip) < ipa_to_u32(j->addr->ip)))
- j = i;
- if (!j)
- die("Cannot determine router ID (no suitable network interface found), please configure it manually");
- log(L_INFO "Guessed router ID %I according to interface %s", j->addr->ip, j->name);
- config->router_id = ipa_to_u32(j->addr->ip);
+ {
+ if (!(i->flags & IF_ADMIN_UP) ||
+ (i->flags & (IF_IGNORE | IF_SHUTDOWN)))
+ continue;
+
+ WALK_LIST(a, i->addrs)
+ {
+ if (a->flags & IA_SECONDARY)
+ continue;
+
+ if (a->scope <= SCOPE_LINK)
+ continue;
+
+ /* FIXME: This should go away */
+ if (a->flags & IA_PEER)
+ continue;
+
+ /* FIXME: This should go away too */
+ if (!mask && (a != i->addr))
+ continue;
+
+ /* Check pattern if specified */
+ if (mask && !iface_patt_match(mask, i, a))
+ continue;
+
+ /* No pattern or pattern matched */
+ if (!b || ipa_to_u32(a->ip) < ipa_to_u32(b->ip))
+ b = a;
+ }
+ }
+
+ if (!b)
+ return 0;
+
+ u32 id = ipa_to_u32(b->ip);
+ if (id != old_id)
+ log(L_INFO "Chosen router ID %R according to interface %s", id, b->iface->name);
+
+ return id;
+
+#else
+ return 0;
#endif
}
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/nest/iface.h
^
|
@@ -101,6 +101,7 @@
struct iface *if_get_by_name(char *);
void ifa_recalc_all_primary_addresses(void);
+
/* The Neighbor Cache */
typedef struct neighbor {
@@ -161,4 +162,7 @@
struct iface_patt *iface_patt_find(list *l, struct iface *i, struct ifa *a);
int iface_patts_equal(list *, list *, int (*)(struct iface_patt *, struct iface_patt *));
+
+u32 if_choose_router_id(struct iface_patt *mask, u32 old_id);
+
#endif
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/nest/neighbor.c
^
|
@@ -114,7 +114,7 @@
neigh_find2(struct proto *p, ip_addr *a, struct iface *ifa, unsigned flags)
{
neighbor *n;
- int class, scope = -1; ;
+ int class, scope = -1;
unsigned int h = neigh_hash(p, a);
struct iface *i;
@@ -240,7 +240,21 @@
n->proto->neigh_notify(n);
rem_node(&n->n);
if (n->flags & NEF_STICKY)
- add_tail(&sticky_neigh_list, &n->n);
+ {
+ add_tail(&sticky_neigh_list, &n->n);
+
+ /* Respawn neighbor if there is another matching prefix */
+ struct iface *i;
+ int scope;
+
+ if (!n->iface)
+ WALK_LIST(i, iface_list)
+ if ((scope = if_connected(&n->addr, i)) >= 0)
+ {
+ neigh_up(n, i, scope);
+ return;
+ }
+ }
else
sl_free(neigh_slab, n);
}
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/nest/proto.c
^
|
@@ -344,6 +344,7 @@
WALK_LIST(x, c->protos)
{
DBG(" %s", x->name);
+
p = x->protocol;
if (p->postconfig)
p->postconfig(x);
@@ -382,11 +383,9 @@
/* If there is a too big change in core attributes, ... */
if ((nc->protocol != oc->protocol) ||
(nc->disabled != p->disabled) ||
- (nc->table->table != oc->table->table) ||
- (proto_get_router_id(nc) != proto_get_router_id(oc)))
+ (nc->table->table != oc->table->table))
return 0;
-
p->debug = nc->debug;
p->mrtdump = nc->mrtdump;
proto_reconfig_type = type;
@@ -412,8 +411,10 @@
{
p->main_ahook->in_filter = nc->in_filter;
p->main_ahook->out_filter = nc->out_filter;
+ p->main_ahook->rx_limit = nc->rx_limit;
p->main_ahook->in_limit = nc->in_limit;
p->main_ahook->out_limit = nc->out_limit;
+ p->main_ahook->in_keep_filtered = nc->in_keep_filtered;
}
/* Update routes when filters changed. If the protocol in not UP,
@@ -515,7 +516,7 @@
p->down_code = nc->disabled ? PDC_CF_DISABLE : PDC_CF_RESTART;
p->cf_new = nc;
}
- else if (!shutting_down)
+ else if (!new->shutdown)
{
log(L_INFO "Removing protocol %s", p->name);
p->down_code = PDC_CF_REMOVE;
@@ -536,7 +537,7 @@
WALK_LIST(nc, new->protos)
if (!nc->proto)
{
- if (old_config) /* Not a first-time configuration */
+ if (old) /* Not a first-time configuration */
log(L_INFO "Adding protocol %s", nc->name);
proto_init(nc);
}
@@ -551,6 +552,16 @@
initial_device_proto = NULL;
}
+ /* Determine router ID for the first time - it has to be here and not in
+ global_commit() because it is postponed after start of device protocol */
+ if (!config->router_id)
+ {
+ config->router_id = if_choose_router_id(config->router_id_from, 0);
+ if (!config->router_id)
+ die("Cannot determine router ID, please configure it manually");
+ }
+
+ /* Start all other protocols */
WALK_LIST_DELSAFE(p, n, initial_proto_list)
proto_rethink_goal(p);
}
@@ -719,8 +730,9 @@
{
DBG("Protocol %s down\n", p->name);
- if (p->stats.imp_routes != 0)
- log(L_ERR "Protocol %s is down but still has %d routes", p->name, p->stats.imp_routes);
+ u32 all_routes = p->stats.imp_routes + p->stats.filt_routes;
+ if (all_routes != 0)
+ log(L_ERR "Protocol %s is down but still has %d routes", p->name, all_routes);
bzero(&p->stats, sizeof(struct proto_stats));
proto_free_ahooks(p);
@@ -794,8 +806,11 @@
p->main_ahook = proto_add_announce_hook(p, p->table, &p->stats);
p->main_ahook->in_filter = p->cf->in_filter;
p->main_ahook->out_filter = p->cf->out_filter;
+ p->main_ahook->rx_limit = p->cf->rx_limit;
p->main_ahook->in_limit = p->cf->in_limit;
p->main_ahook->out_limit = p->cf->out_limit;
+ p->main_ahook->in_keep_filtered = p->cf->in_keep_filtered;
+ proto_reset_limit(p->main_ahook->rx_limit);
proto_reset_limit(p->main_ahook->in_limit);
proto_reset_limit(p->main_ahook->out_limit);
}
@@ -967,6 +982,7 @@
* proto_notify_limit: notify about limit hit and take appropriate action
* @ah: announce hook
* @l: limit being hit
+ * @dir: limit direction (PLD_*)
* @rt_count: the number of routes
*
* The function is called by the route processing core when limit @l
@@ -974,10 +990,11 @@
* according to @l->action.
*/
void
-proto_notify_limit(struct announce_hook *ah, struct proto_limit *l, u32 rt_count)
+proto_notify_limit(struct announce_hook *ah, struct proto_limit *l, int dir, u32 rt_count)
{
+ const char *dir_name[PLD_MAX] = { "receive", "import" , "export" };
+ const byte dir_down[PLD_MAX] = { PDC_RX_LIMIT_HIT, PDC_IN_LIMIT_HIT, PDC_OUT_LIMIT_HIT };
struct proto *p = ah->proto;
- int dir = (ah->in_limit == l);
if (l->state == PLS_BLOCKED)
return;
@@ -985,7 +1002,7 @@
/* For warning action, we want the log message every time we hit the limit */
if (!l->state || ((l->action == PLA_WARN) && (rt_count == l->limit)))
log(L_WARN "Protocol %s hits route %s limit (%d), action: %s",
- p->name, dir ? "import" : "export", l->limit, proto_limit_name(l));
+ p->name, dir_name[dir], l->limit, proto_limit_name(l));
switch (l->action)
{
@@ -1000,8 +1017,7 @@
case PLA_RESTART:
case PLA_DISABLE:
l->state = PLS_BLOCKED;
- proto_schedule_down(p, l->action == PLA_RESTART,
- dir ? PDC_IN_LIMIT_HIT : PDC_OUT_LIMIT_HIT);
+ proto_schedule_down(p, l->action == PLA_RESTART, dir_down[dir]);
break;
}
}
@@ -1093,10 +1109,15 @@
}
static void
-proto_show_stats(struct proto_stats *s)
+proto_show_stats(struct proto_stats *s, int in_keep_filtered)
{
- cli_msg(-1006, " Routes: %u imported, %u exported, %u preferred",
- s->imp_routes, s->exp_routes, s->pref_routes);
+ if (in_keep_filtered)
+ cli_msg(-1006, " Routes: %u imported, %u filtered, %u exported, %u preferred",
+ s->imp_routes, s->filt_routes, s->exp_routes, s->pref_routes);
+ else
+ cli_msg(-1006, " Routes: %u imported, %u exported, %u preferred",
+ s->imp_routes, s->exp_routes, s->pref_routes);
+
cli_msg(-1006, " Route change stats: received rejected filtered ignored accepted");
cli_msg(-1006, " Import updates: %10u %10u %10u %10u %10u",
s->imp_updates_received, s->imp_updates_invalid,
@@ -1130,11 +1151,12 @@
cli_msg(-1006, " Input filter: %s", filter_name(p->cf->in_filter));
cli_msg(-1006, " Output filter: %s", filter_name(p->cf->out_filter));
+ proto_show_limit(p->cf->rx_limit, "Receive limit:");
proto_show_limit(p->cf->in_limit, "Import limit:");
proto_show_limit(p->cf->out_limit, "Export limit:");
if (p->proto_state != PS_DOWN)
- proto_show_stats(&p->stats);
+ proto_show_stats(&p->stats, p->cf->in_keep_filtered);
}
void
@@ -1251,7 +1273,10 @@
* Perhaps, but these hooks work asynchronously.
*/
if (!p->proto->multitable)
- proto_reset_limit(p->main_ahook->in_limit);
+ {
+ proto_reset_limit(p->main_ahook->rx_limit);
+ proto_reset_limit(p->main_ahook->in_limit);
+ }
}
/* re-exporting routes */
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/nest/protocol.h
^
|
@@ -91,9 +91,12 @@
int class; /* SYM_PROTO or SYM_TEMPLATE */
u32 debug, mrtdump; /* Debugging bitfields, both use D_* constants */
unsigned preference, disabled; /* Generic parameters */
+ int in_keep_filtered; /* Routes rejected in import filter are kept */
u32 router_id; /* Protocol specific router ID */
struct rtable_config *table; /* Table we're attached to */
struct filter *in_filter, *out_filter; /* Attached filters */
+ struct proto_limit *rx_limit; /* Limit for receiving routes from protocol
+ (relevant when in_keep_filtered is active) */
struct proto_limit *in_limit; /* Limit for importing routes from protocol */
struct proto_limit *out_limit; /* Limit for exporting routes to protocol */
@@ -106,7 +109,8 @@
struct proto_stats {
/* Import - from protocol to core */
u32 imp_routes; /* Number of routes successfully imported to the (adjacent) routing table */
- u32 pref_routes; /* Number of routes that are preferred, sum over all routing table */
+ u32 filt_routes; /* Number of routes rejected in import filter but kept in the routing table */
+ u32 pref_routes; /* Number of routes that are preferred, sum over all routing tables */
u32 imp_updates_received; /* Number of route updates received */
u32 imp_updates_invalid; /* Number of route updates rejected as invalid */
u32 imp_updates_filtered; /* Number of route updates rejected by filters */
@@ -223,8 +227,9 @@
#define PDC_CMD_DISABLE 0x11 /* Result of disable command */
#define PDC_CMD_RESTART 0x12 /* Result of restart command */
#define PDC_CMD_SHUTDOWN 0x13 /* Result of global shutdown */
-#define PDC_IN_LIMIT_HIT 0x21 /* Route import limit reached */
-#define PDC_OUT_LIMIT_HIT 0x22 /* Route export limit reached */
+#define PDC_RX_LIMIT_HIT 0x21 /* Route receive limit reached */
+#define PDC_IN_LIMIT_HIT 0x22 /* Route import limit reached */
+#define PDC_OUT_LIMIT_HIT 0x23 /* Route export limit reached */
void *proto_new(struct proto_config *, unsigned size);
@@ -371,6 +376,11 @@
* Protocol limits
*/
+#define PLD_RX 0 /* Receive limit */
+#define PLD_IN 1 /* Import limit */
+#define PLD_OUT 2 /* Export limit */
+#define PLD_MAX 3
+
#define PLA_WARN 1 /* Issue log warning */
#define PLA_BLOCK 2 /* Block new routes */
#define PLA_RESTART 4 /* Force protocol restart */
@@ -386,7 +396,7 @@
byte state; /* State of limit (PLS_*) */
};
-void proto_notify_limit(struct announce_hook *ah, struct proto_limit *l, u32 rt_count);
+void proto_notify_limit(struct announce_hook *ah, struct proto_limit *l, int dir, u32 rt_count);
static inline void
proto_reset_limit(struct proto_limit *l)
@@ -406,10 +416,12 @@
struct proto *proto;
struct filter *in_filter; /* Input filter */
struct filter *out_filter; /* Output filter */
+ struct proto_limit *rx_limit; /* Receive limit (for in_keep_filtered) */
struct proto_limit *in_limit; /* Input limit */
struct proto_limit *out_limit; /* Output limit */
struct proto_stats *stats; /* Per-table protocol statistics */
struct announce_hook *next; /* Next hook for the same protocol */
+ int in_keep_filtered; /* Routes rejected in import filter are kept */
};
struct announce_hook *proto_add_announce_hook(struct proto *p, struct rtable *t, struct proto_stats *stats);
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/nest/route.h
^
|
@@ -221,6 +221,14 @@
} rte;
#define REF_COW 1 /* Copy this rte on write */
+#define REF_FILTERED 2 /* Route is rejected by import filter */
+
+/* Route is valid for propagation (may depend on other flags in the future), accepts NULL */
+static inline int rte_is_valid(rte *r) { return r && !(r->flags & REF_FILTERED); }
+
+/* Route just has REF_FILTERED flag */
+static inline int rte_is_filtered(rte *r) { return !!(r->flags & REF_FILTERED); }
+
/* Types of route announcement, also used as flags */
#define RA_OPTIMAL 1 /* Announcement of optimal route change */
@@ -263,7 +271,7 @@
struct fib_iterator fit;
struct proto *show_protocol;
struct proto *export_protocol;
- int export_mode, primary_only;
+ int export_mode, primary_only, filtered;
struct config *running_on_config;
int net_counter, rt_counter, show_counter;
int stats, show_for;
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/nest/rt-table.c
^
|
@@ -69,7 +69,7 @@
{
a0 = ipa_and(a, ipa_mkmask(len));
n = fib_find(&tab->fib, &a0, len);
- if (n && n->routes)
+ if (n && rte_is_valid(n->routes))
return n;
len--;
}
@@ -139,8 +139,11 @@
{
int (*better)(rte *, rte *);
- if (!old)
+ if (!rte_is_valid(old))
return 1;
+ if (!rte_is_valid(new))
+ return 0;
+
if (new->pref > old->pref)
return 1;
if (new->pref < old->pref)
@@ -282,7 +285,7 @@
if (l && new)
{
if ((!old || refeed) && (stats->exp_routes >= l->limit))
- proto_notify_limit(ah, l, stats->exp_routes);
+ proto_notify_limit(ah, l, PLD_OUT, stats->exp_routes);
if (l->state == PLS_BLOCKED)
{
@@ -399,9 +402,13 @@
rte *old_free = NULL;
rte *r;
- /* Used to track whether we met old_changed position. If it is NULL
- it was the first and met it implicitly before current best route. */
- int old_meet = (old_changed && !before_old) ? 1 : 0;
+ /* Used to track whether we met old_changed position. If before_old is NULL
+ old_changed was the first and we met it implicitly before current best route. */
+ int old_meet = old_changed && !before_old;
+
+ /* Note that before_old is either NULL or valid (not rejected) route.
+ If old_changed is valid, before_old have to be too. If old changed route
+ was not valid, caller must use NULL for both old_changed and before_old. */
if (new_changed)
stats->exp_updates_received++;
@@ -409,7 +416,7 @@
stats->exp_withdraws_received++;
/* First, find the new_best route - first accepted by filters */
- for (r=net->routes; r; r=r->next)
+ for (r=net->routes; rte_is_valid(r); r=r->next)
{
if (new_best = export_filter(ah, r, &new_free, &tmpa, 0))
break;
@@ -428,7 +435,8 @@
if (feed)
{
if (feed == 2) /* refeed */
- old_best = new_best ? new_best : net->routes;
+ old_best = new_best ? new_best :
+ (rte_is_valid(net->routes) ? net->routes : NULL);
else
old_best = NULL;
@@ -477,7 +485,7 @@
}
/* Fourth case */
- for (r=r->next; r; r=r->next)
+ for (r=r->next; rte_is_valid(r); r=r->next)
{
if (old_best = export_filter(ah, r, &old_free, NULL, 1))
goto found;
@@ -531,7 +539,14 @@
static void
rte_announce(rtable *tab, unsigned type, net *net, rte *new, rte *old, rte *before_old, ea_list *tmpa)
{
- struct announce_hook *a;
+ if (!rte_is_valid(old))
+ old = before_old = NULL;
+
+ if (!rte_is_valid(new))
+ new = NULL;
+
+ if (!old && !new)
+ return;
if (type == RA_OPTIMAL)
{
@@ -544,6 +559,7 @@
rt_notify_hostcache(tab, net);
}
+ struct announce_hook *a;
WALK_LIST(a, tab->hooks)
{
ASSERT(a->proto->core_state == FS_HAPPY || a->proto->core_state == FS_FEEDING);
@@ -611,6 +627,8 @@
(!x->attrs->proto->rte_same || x->attrs->proto->rte_same(x, y));
}
+static inline int rte_is_ok(rte *e) { return e && !rte_is_filtered(e); }
+
static void
rte_recalculate(struct announce_hook *ah, net *net, rte *new, ea_list *tmpa, struct proto *src)
{
@@ -650,8 +668,13 @@
if (new && rte_same(old, new))
{
/* No changes, ignore the new route */
- stats->imp_updates_ignored++;
- rte_trace_in(D_ROUTES, p, new, "ignored");
+
+ if (!rte_is_filtered(new))
+ {
+ stats->imp_updates_ignored++;
+ rte_trace_in(D_ROUTES, p, new, "ignored");
+ }
+
rte_free_quick(new);
#ifdef CONFIG_RIP
/* lastmod is used internally by RIP as the last time
@@ -677,14 +700,22 @@
return;
}
- struct proto_limit *l = ah->in_limit;
+ int new_ok = rte_is_ok(new);
+ int old_ok = rte_is_ok(old);
+
+ struct proto_limit *l = ah->rx_limit;
if (l && !old && new)
{
- if (stats->imp_routes >= l->limit)
- proto_notify_limit(ah, l, stats->imp_routes);
+ u32 all_routes = stats->imp_routes + stats->filt_routes;
+
+ if (all_routes >= l->limit)
+ proto_notify_limit(ah, l, PLD_RX, all_routes);
if (l->state == PLS_BLOCKED)
{
+ /* In receive limit the situation is simple, old is NULL so
+ we just free new and exit like nothing happened */
+
stats->imp_updates_ignored++;
rte_trace_in(D_FILTERS, p, new, "ignored [limit]");
rte_free_quick(new);
@@ -692,15 +723,53 @@
}
}
- if (new)
+ l = ah->in_limit;
+ if (l && !old_ok && new_ok)
+ {
+ if (stats->imp_routes >= l->limit)
+ proto_notify_limit(ah, l, PLD_IN, stats->imp_routes);
+
+ if (l->state == PLS_BLOCKED)
+ {
+ /* In import limit the situation is more complicated. We
+ shouldn't just drop the route, we should handle it like
+ it was filtered. We also have to continue the route
+ processing if old or new is non-NULL, but we should exit
+ if both are NULL as this case is probably assumed to be
+ already handled. */
+
+ stats->imp_updates_ignored++;
+ rte_trace_in(D_FILTERS, p, new, "ignored [limit]");
+
+ if (ah->in_keep_filtered)
+ new->flags |= REF_FILTERED;
+ else
+ { rte_free_quick(new); new = NULL; }
+
+ /* Note that old && !new could be possible when
+ ah->in_keep_filtered changed in the recent past. */
+
+ if (!old && !new)
+ return;
+
+ new_ok = 0;
+ goto skip_stats1;
+ }
+ }
+
+ if (new_ok)
stats->imp_updates_accepted++;
- else
+ else if (old_ok)
stats->imp_withdraws_accepted++;
+ else
+ stats->imp_withdraws_ignored++;
+
+ skip_stats1:
if (new)
- stats->imp_routes++;
+ rte_is_filtered(new) ? stats->filt_routes++ : stats->imp_routes++;
if (old)
- stats->imp_routes--;
+ rte_is_filtered(old) ? stats->filt_routes-- : stats->imp_routes--;
if (table->config->sorted)
{
@@ -785,17 +854,19 @@
new->lastmod = now;
/* Log the route change */
- if (new)
- rte_trace_in(D_ROUTES, p, new, net->routes == new ? "added [best]" : "added");
-
- if (!new && (p->debug & D_ROUTES))
+ if (p->debug & D_ROUTES)
{
- if (old != old_best)
- rte_trace_in(D_ROUTES, p, old, "removed");
- else if (net->routes)
- rte_trace_in(D_ROUTES, p, old, "removed [replaced]");
- else
- rte_trace_in(D_ROUTES, p, old, "removed [sole]");
+ if (new_ok)
+ rte_trace(p, new, '>', new == net->routes ? "added [best]" : "added");
+ else if (old_ok)
+ {
+ if (old != old_best)
+ rte_trace(p, old, '>', "removed");
+ else if (rte_is_ok(net->routes))
+ rte_trace(p, old, '>', "removed [replaced]");
+ else
+ rte_trace(p, old, '>', "removed [sole]");
+ }
}
/* Propagate the route change */
@@ -810,17 +881,13 @@
(table->gc_time + table->config->gc_min_time <= now))
rt_schedule_gc(table);
+ if (old_ok && p->rte_remove)
+ p->rte_remove(net, old);
+ if (new_ok && p->rte_insert)
+ p->rte_insert(net, new);
+
if (old)
- {
- if (p->rte_remove)
- p->rte_remove(net, old);
- rte_free_quick(old);
- }
- if (new)
- {
- if (p->rte_insert)
- p->rte_insert(net, new);
- }
+ rte_free_quick(old);
}
static int rte_update_nest_cnt; /* Nesting counter to allow recursive updates */
@@ -900,27 +967,41 @@
stats->imp_updates_invalid++;
goto drop;
}
+
if (filter == FILTER_REJECT)
{
stats->imp_updates_filtered++;
rte_trace_in(D_FILTERS, p, new, "filtered out");
- goto drop;
+
+ if (! ah->in_keep_filtered)
+ goto drop;
+
+ /* new is a private copy, i could modify it */
+ new->flags |= REF_FILTERED;
}
- if (src->make_tmp_attrs)
- tmpa = src->make_tmp_attrs(new, rte_update_pool);
- if (filter)
- {
- ea_list *old_tmpa = tmpa;
- int fr = f_run(filter, &new, &tmpa, rte_update_pool, 0);
- if (fr > F_ACCEPT)
+ else
+ {
+ if (src->make_tmp_attrs)
+ tmpa = src->make_tmp_attrs(new, rte_update_pool);
+ if (filter && (filter != FILTER_REJECT))
{
- stats->imp_updates_filtered++;
- rte_trace_in(D_FILTERS, p, new, "filtered out");
- goto drop;
+ ea_list *old_tmpa = tmpa;
+ int fr = f_run(filter, &new, &tmpa, rte_update_pool, 0);
+ if (fr > F_ACCEPT)
+ {
+ stats->imp_updates_filtered++;
+ rte_trace_in(D_FILTERS, p, new, "filtered out");
+
+ if (! ah->in_keep_filtered)
+ goto drop;
+
+ new->flags |= REF_FILTERED;
+ }
+ if (tmpa != old_tmpa && src->store_tmp_attrs)
+ src->store_tmp_attrs(new, tmpa);
}
- if (tmpa != old_tmpa && src->store_tmp_attrs)
- src->store_tmp_attrs(new, tmpa);
}
+
if (!(new->attrs->aflags & RTAF_CACHED)) /* Need to copy attributes */
new->attrs = rta_lookup(new->attrs);
new->flags |= REF_COW;
@@ -1553,9 +1634,11 @@
return 0;
}
+ /* XXXX perhaps we should change feed for RA_ACCEPTED to not use 'new' */
+
if ((p->accept_ra_types == RA_OPTIMAL) ||
(p->accept_ra_types == RA_ACCEPTED))
- if (e)
+ if (rte_is_valid(e))
{
if (p->core_state != FS_FEEDING)
return 1; /* In the meantime, the protocol fell down. */
@@ -1564,7 +1647,7 @@
}
if (p->accept_ra_types == RA_ANY)
- for(e = n->routes; e != NULL; e = e->next)
+ for(e = n->routes; rte_is_valid(e); e = e->next)
{
if (p->core_state != FS_FEEDING)
return 1; /* In the meantime, the protocol fell down. */
@@ -1817,7 +1900,8 @@
net *n = net_route(tab, he->addr, MAX_PREFIX_LENGTH);
if (n)
{
- rta *a = n->routes->attrs;
+ rte *e = n->routes;
+ rta *a = e->attrs;
pxlen = n->n.pxlen;
if (a->hostentry)
@@ -1850,7 +1934,7 @@
}
he->src = rta_clone(a);
- he->igp_metric = rt_get_igp_metric(n->routes);
+ he->igp_metric = rt_get_igp_metric(e);
}
done:
@@ -1980,14 +2064,19 @@
int ok;
bsprintf(ia, "%I/%d", n->n.prefix, n->n.pxlen);
- if (n->routes)
- d->net_counter++;
+
for(e=n->routes; e; e=e->next)
{
+ if (rte_is_filtered(e) != d->filtered)
+ continue;
+
struct ea_list *tmpa;
struct proto *p0 = e->attrs->proto;
struct proto *p1 = d->export_protocol;
struct proto *p2 = d->show_protocol;
+
+ if (ia[0])
+ d->net_counter++;
d->rt_counter++;
ee = e;
rte_update_lock(); /* We use the update buffer for filtering */
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/proto/bgp/attrs.c
^
|
@@ -238,7 +238,7 @@
as = get_u32(data);
data += 4;
- bsprintf(buf, "%d.%d.%d.%d AS%d", data[0], data[1], data[2], data[3], as);
+ bsprintf(buf, "%d.%d.%d.%d AS%u", data[0], data[1], data[2], data[3], as);
}
static int
@@ -1346,7 +1346,7 @@
/* The default case - find a new best-in-group route */
r = new; /* new may not be in the list */
- for (s=net->routes; s; s=s->next)
+ for (s=net->routes; rte_is_valid(s); s=s->next)
if (use_deterministic_med(s) && same_group(s, lpref, lasn))
{
s->u.bgp.suppressed = 1;
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/proto/bgp/bgp.c
^
|
@@ -878,6 +878,7 @@
subcode = 4; // Errcode 6, 4 - administrative reset
break;
+ case PDC_RX_LIMIT_HIT:
case PDC_IN_LIMIT_HIT:
subcode = 1; // Errcode 6, 1 - max number of prefixes reached
/* log message for compatibility */
@@ -1009,6 +1010,9 @@
struct bgp_proto *p = (struct bgp_proto *) P;
struct bgp_config *old = p->cf;
+ if (proto_get_router_id(C) != p->local_id)
+ return 0;
+
int same = !memcmp(((byte *) old) + sizeof(struct proto_config),
((byte *) new) + sizeof(struct proto_config),
// password item is last and must be checked separately
@@ -1188,7 +1192,7 @@
cli_msg(-1006, " Source address: %I", p->source_addr);
if (P->cf->in_limit)
cli_msg(-1006, " Route limit: %d/%d",
- p->p.stats.imp_routes, P->cf->in_limit->limit);
+ p->p.stats.imp_routes + p->p.stats.filt_routes, P->cf->in_limit->limit);
cli_msg(-1006, " Hold timer: %d/%d",
tm_remains(c->hold_timer), c->hold_time);
cli_msg(-1006, " Keepalive timer: %d/%d",
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/proto/ospf/config.Y
^
|
@@ -92,6 +92,7 @@
if (cf->abr && !backbone)
{
struct ospf_area_config *ac = cfg_allocz(sizeof(struct ospf_area_config));
+ ac->type = OPT_E; /* Backbone is non-stub */
add_head(&cf->area_list, NODE ac);
init_list(&ac->patt_list);
init_list(&ac->net_list);
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/proto/ospf/hello.c
^
|
@@ -261,7 +261,7 @@
pkt->priority = ifa->priority;
#ifdef OSPFv3
- pkt->iface_id = htonl(ifa->iface->index);
+ pkt->iface_id = htonl(ifa->iface_id);
pkt->options3 = ifa->oa->options >> 16;
pkt->options2 = ifa->oa->options >> 8;
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/proto/ospf/iface.c
^
|
@@ -567,6 +567,8 @@
log(L_WARN "%s: Cannot use interface %s as %s, forcing %s",
p->name, iface->name, ospf_it[old_type], ospf_it[ifa->type]);
+ /* Assign iface ID, for vlinks, this is ugly hack */
+ ifa->iface_id = (ifa->type != OSPF_IT_VLINK) ? iface->index : oa->po->last_vlink_id++;
init_list(&ifa->neigh_list);
init_list(&ifa->nbma_list);
@@ -884,6 +886,10 @@
struct ifa *a;
WALK_LIST(iface, iface_list)
+ {
+ if (! (iface->flags & IF_UP))
+ continue;
+
WALK_LIST(a, iface->addrs)
{
if (a->flags & IA_SECONDARY)
@@ -909,6 +915,7 @@
ospf_iface_new(oa, a, ip);
}
}
+ }
}
@@ -1012,6 +1019,10 @@
struct ifa *a;
WALK_LIST(iface, iface_list)
+ {
+ if (! (iface->flags & IF_UP))
+ continue;
+
WALK_LIST(a, iface->addrs)
{
if (a->flags & IA_SECONDARY)
@@ -1040,6 +1051,7 @@
ospf_iface_new(oa, a, ip);
}
}
+ }
}
#endif
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/proto/ospf/lsupd.c
^
|
@@ -112,6 +112,10 @@
{
u32 scope = LSA_SCOPE(lsa);
+ /* Handle inactive vlinks */
+ if (ifa->state == OSPF_IS_DOWN)
+ return 0;
+
/* 4.5.2 (Case 2) */
if (unknown_lsa_type(lsa) && !(lsa->type & LSA_UBIT))
scope = LSA_SCOPE_LINK;
@@ -119,7 +123,7 @@
switch (scope)
{
case LSA_SCOPE_LINK:
- return ifa->iface->index == domain;
+ return ifa->iface_id == domain;
case LSA_SCOPE_AREA:
return ifa->oa->areaid == domain;
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/proto/ospf/neighbor.c
^
|
@@ -459,7 +459,7 @@
#else /* OSPFv3 */
me.dr = ifa->drid;
me.bdr = ifa->bdrid;
- me.iface_id = ifa->iface->index;
+ me.iface_id = ifa->iface_id;
#endif
add_tail(&ifa->neigh_list, NODE & me);
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/proto/ospf/ospf.c
^
|
@@ -232,6 +232,7 @@
struct ospf_area_config *ac;
po->router_id = proto_get_router_id(p->cf);
+ po->last_vlink_id = 0x80000000;
po->rfc1583 = c->rfc1583;
po->ebit = 0;
po->ecmp = c->ecmp;
@@ -728,6 +729,9 @@
struct ospf_iface *ifa, *ifx;
struct ospf_iface_patt *ip;
+ if (proto_get_router_id(c) != po->router_id)
+ return 0;
+
if (po->rfc1583 != new->rfc1583)
return 0;
@@ -953,8 +957,10 @@
struct ospf_lsa_header *lsa1 = &(he1->lsa);
struct ospf_lsa_header *lsa2 = &(he2->lsa);
- if (he1->domain != he2->domain)
- return he1->domain - he2->domain;
+ if (he1->domain < he2->domain)
+ return -1;
+ if (he1->domain > he2->domain)
+ return 1;
#ifdef OSPFv3
struct ospf_lsa_header lsatmp1, lsatmp2;
@@ -979,14 +985,18 @@
{
#ifdef OSPFv3
/* In OSPFv3, neworks are named base on ID of DR */
- if (lsa1->rt != lsa2->rt)
- return lsa1->rt - lsa2->rt;
+ if (lsa1->rt < lsa2->rt)
+ return -1;
+ if (lsa1->rt > lsa2->rt)
+ return 1;
#endif
/* For OSPFv2, this is IP of the network,
for OSPFv3, this is interface ID */
- if (lsa1->id != lsa2->id)
- return lsa1->id - lsa2->id;
+ if (lsa1->id < lsa2->id)
+ return -1;
+ if (lsa1->id > lsa2->id)
+ return 1;
#ifdef OSPFv3
if (px1 != px2)
@@ -997,14 +1007,20 @@
}
else
{
- if (lsa1->rt != lsa2->rt)
- return lsa1->rt - lsa2->rt;
-
- if (lsa1->type != lsa2->type)
- return lsa1->type - lsa2->type;
-
- if (lsa1->id != lsa2->id)
- return lsa1->id - lsa2->id;
+ if (lsa1->rt < lsa2->rt)
+ return -1;
+ if (lsa1->rt > lsa2->rt)
+ return 1;
+
+ if (lsa1->type < lsa2->type)
+ return -1;
+ if (lsa1->type > lsa2->type)
+ return 1;
+
+ if (lsa1->id < lsa2->id)
+ return -1;
+ if (lsa1->id > lsa2->id)
+ return 1;
#ifdef OSPFv3
if (px1 != px2)
@@ -1023,12 +1039,16 @@
struct ospf_lsa_header *lsa1 = &(he1->lsa);
struct ospf_lsa_header *lsa2 = &(he2->lsa);
- if (lsa1->rt != lsa2->rt)
- return lsa1->rt - lsa2->rt;
+ if (lsa1->rt < lsa2->rt)
+ return -1;
+ if (lsa1->rt > lsa2->rt)
+ return 1;
+
+ if (lsa1->id < lsa2->id)
+ return -1;
+ if (lsa1->id > lsa2->id)
+ return 1;
- if (lsa1->id != lsa2->id)
- return lsa1->id - lsa2->id;
-
return lsa1->sn - lsa2->sn;
}
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/proto/ospf/ospf.h
^
|
@@ -189,7 +189,8 @@
u32 rxmtint; /* number of seconds between LSA retransmissions */
u32 pollint; /* Poll interval */
u32 deadint; /* after "deadint" missing hellos is router dead */
- u32 vid; /* Id of peer of virtual link */
+ u32 iface_id; /* Interface ID (iface->index or new value for vlinks) */
+ u32 vid; /* ID of peer of virtual link */
ip_addr vip; /* IP of peer of virtual link */
struct ospf_iface *vifa; /* OSPF iface which the vlink goes through */
struct ospf_area *voa; /* OSPF area which the vlink goes through */
@@ -776,6 +777,7 @@
int lsab_size, lsab_used;
linpool *nhpool; /* Linpool used for next hops computed in SPF */
u32 router_id;
+ u32 last_vlink_id; /* Interface IDs for vlinks (starts at 0x80000000) */
};
struct ospf_iface_patt
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/proto/ospf/topology.c
^
|
@@ -258,8 +258,17 @@
ln = lsab_alloc(po, sizeof(struct ospf_lsa_rt_link));
ln->type = LSART_PTP;
ln->id = neigh->rid;
- ln->data = (ifa->addr->flags & IA_PEER) ?
- ifa->iface->index : ipa_to_u32(ifa->addr->ip);
+
+ /*
+ * ln->data should be ifa->iface_id in case of no/ptp
+ * address (ifa->addr->flags & IA_PEER) on PTP link (see
+ * RFC 2328 12.4.1.1.), but the iface ID value has no use,
+ * while using IP address even in this case is here for
+ * compatibility with some broken implementations that use
+ * this address as a next-hop.
+ */
+ ln->data = ipa_to_u32(ifa->addr->ip);
+
ln->metric = ifa->cost;
ln->padding = 0;
i++;
@@ -305,7 +314,7 @@
/* Now we will originate stub area if there is no primary */
if (net_lsa ||
(ifa->type == OSPF_IT_VLINK) ||
- (ifa->addr->flags & IA_PEER) ||
+ ((ifa->addr->flags & IA_PEER) && ! ifa->cf->stub) ||
configured_stubnet(oa, ifa->addr))
continue;
@@ -368,7 +377,7 @@
ln->type = type;
ln->padding = 0;
ln->metric = ifa->cost;
- ln->lif = ifa->iface->index;
+ ln->lif = ifa->iface_id;
ln->nif = nif;
ln->id = id;
}
@@ -546,7 +555,7 @@
if (n->state == NEIGHBOR_FULL)
{
#ifdef OSPFv3
- en = ospf_hash_find(po->gr, ifa->iface->index, n->iface_id, n->rid, LSA_T_LINK);
+ en = ospf_hash_find(po->gr, ifa->iface_id, n->iface_id, n->rid, LSA_T_LINK);
if (en)
options |= ((struct ospf_lsa_link *) en->lsa_body)->options;
#endif
@@ -596,7 +605,7 @@
lsa.options = ifa->oa->options;
lsa.id = ipa_to_u32(ifa->addr->ip);
#else /* OSPFv3 */
- lsa.id = ifa->iface->index;
+ lsa.id = ifa->iface_id;
#endif
lsa.rt = po->router_id;
@@ -1207,10 +1216,10 @@
lsa.age = 0;
lsa.type = LSA_T_LINK;
- lsa.id = ifa->iface->index;
+ lsa.id = ifa->iface_id;
lsa.rt = po->router_id;
lsa.sn = get_seqnum(ifa->link_lsa);
- u32 dom = ifa->iface->index;
+ u32 dom = ifa->iface_id;
body = originate_link_lsa_body(ifa, &lsa.length);
lsasum_calculate(&lsa, body);
@@ -1249,7 +1258,6 @@
struct ospf_config *cf = (struct ospf_config *) (po->proto.cf);
struct ospf_iface *ifa;
struct ospf_lsa_prefix *lp;
- struct ifa *vlink_addr = NULL;
int host_addr = 0;
int net_lsa;
int i = 0;
@@ -1263,7 +1271,7 @@
WALK_LIST(ifa, po->iface_list)
{
- if ((ifa->oa != oa) || (ifa->state == OSPF_IS_DOWN))
+ if ((ifa->oa != oa) || (ifa->type == OSPF_IT_VLINK) || (ifa->state == OSPF_IS_DOWN))
continue;
ifa->px_pos_beg = i;
@@ -1282,9 +1290,6 @@
(a->scope <= SCOPE_LINK))
continue;
- if (!vlink_addr)
- vlink_addr = a;
-
if (((a->pxlen < MAX_PREFIX_LENGTH) && net_lsa) ||
configured_stubnet(oa, a))
continue;
@@ -1304,23 +1309,41 @@
ifa->px_pos_end = i;
}
- /* If there are some configured vlinks, add some global address,
- which will be used as a vlink endpoint. */
- if (!EMPTY_LIST(cf->vlink_list) && !host_addr && vlink_addr)
- {
- lsa_put_prefix(po, vlink_addr->ip, MAX_PREFIX_LENGTH, 0);
- i++;
- }
-
struct ospf_stubnet_config *sn;
if (oa->ac)
WALK_LIST(sn, oa->ac->stubnet_list)
if (!sn->hidden)
{
lsa_put_prefix(po, sn->px.addr, sn->px.len, sn->cost);
+ if (sn->px.len == MAX_PREFIX_LENGTH)
+ host_addr = 1;
i++;
}
+ /* If there are some configured vlinks, find some global address
+ (even from another area), which will be used as a vlink endpoint. */
+ if (!EMPTY_LIST(cf->vlink_list) && !host_addr)
+ {
+ WALK_LIST(ifa, po->iface_list)
+ {
+ if ((ifa->type == OSPF_IT_VLINK) || (ifa->state == OSPF_IS_DOWN))
+ continue;
+
+ struct ifa *a;
+ WALK_LIST(a, ifa->iface->addrs)
+ {
+ if ((a->flags & IA_SECONDARY) || (a->scope <= SCOPE_LINK))
+ continue;
+
+ /* Found some IP */
+ lsa_put_prefix(po, a->ip, MAX_PREFIX_LENGTH, 0);
+ i++;
+ goto done;
+ }
+ }
+ }
+
+ done:
lp = po->lsab;
lp->pxcount = i;
*length = po->lsab_used + sizeof(struct ospf_lsa_header);
@@ -1389,15 +1412,12 @@
{
u32 *pxl = lsab_offset(po, offset);
int i;
- for (i = 0; i < *pxc; i++)
+ for (i = 0; i < *pxc; pxl = prefix_advance(pxl), i++)
+ if (prefix_same(px, pxl))
{
- if (prefix_same(px, pxl))
- {
- /* Options should be logically OR'ed together */
- *pxl |= *px;
- return;
- }
- pxl = prefix_advance(pxl);
+ /* Options should be logically OR'ed together */
+ *pxl |= (*px & 0x00FF0000);
+ return;
}
ASSERT(pxl == lsab_end(po));
@@ -1405,6 +1425,7 @@
int pxspace = prefix_space(px);
pxl = lsab_alloc(po, pxspace);
memcpy(pxl, px, pxspace);
+ *pxl &= 0xFFFF0000; /* Set metric to zero */
(*pxc)++;
}
@@ -1415,11 +1436,21 @@
u32 *pxb = ll->rest;
int j;
- for (j = 0; j < ll->pxcount; j++)
- {
- add_prefix(po, pxb, offset, pxc);
- pxb = prefix_advance(pxb);
- }
+ for (j = 0; j < ll->pxcount; pxb = prefix_advance(pxb), j++)
+ {
+ u8 pxlen = (pxb[0] >> 24);
+ u8 pxopts = (pxb[0] >> 16);
+
+ /* Skip NU or LA prefixes */
+ if (pxopts & (OPT_PX_NU | OPT_PX_LA))
+ continue;
+
+ /* Skip link-local prefixes */
+ if ((pxlen >= 10) && ((pxb[1] & 0xffc00000) == 0xfe800000))
+ continue;
+
+ add_prefix(po, pxb, offset, pxc);
+ }
}
@@ -1449,7 +1480,7 @@
WALK_LIST(n, ifa->neigh_list)
if ((n->state == NEIGHBOR_FULL) &&
- (en = ospf_hash_find(po->gr, ifa->iface->index, n->iface_id, n->rid, LSA_T_LINK)))
+ (en = ospf_hash_find(po->gr, ifa->iface_id, n->iface_id, n->rid, LSA_T_LINK)))
add_link_lsa(po, en, offset, &pxc);
lp = po->lsab;
@@ -1471,7 +1502,7 @@
lsa.age = 0;
lsa.type = LSA_T_PREFIX;
- lsa.id = ifa->iface->index;
+ lsa.id = ifa->iface_id;
lsa.rt = po->router_id;
lsa.sn = get_seqnum(ifa->pxn_lsa);
u32 dom = ifa->oa->areaid;
@@ -1642,7 +1673,7 @@
switch (type & LSA_SCOPE_MASK)
{
case LSA_SCOPE_LINK:
- return ifa->iface->index;
+ return ifa->iface_id;
case LSA_SCOPE_AREA:
return ifa->oa->areaid;
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/proto/pipe/pipe.c
^
|
@@ -200,6 +200,11 @@
cf_error("Name of peer routing table not specified");
if (c->peer == C->table)
cf_error("Primary table and peer table must be different");
+
+ if (C->in_keep_filtered)
+ cf_error("Pipe protocol prohibits keeping filtered routes");
+ if (C->rx_limit)
+ cf_error("Pipe protocol does not support receive limits");
}
extern int proto_reconfig_type;
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/proto/static/config.Y
^
|
@@ -18,7 +18,7 @@
CF_DECLS
CF_KEYWORDS(STATIC, ROUTE, VIA, DROP, REJECT, PROHIBIT, PREFERENCE, CHECK, LINK)
-CF_KEYWORDS(MULTIPATH, WEIGHT, RECURSIVE, IGP, TABLE)
+CF_KEYWORDS(MULTIPATH, WEIGHT, RECURSIVE, IGP, TABLE, BLACKHOLE, UNREACHABLE)
CF_GRAMMAR
@@ -86,9 +86,12 @@
this_srt->dest = RTDX_RECURSIVE;
this_srt->via = $3;
}
- | stat_route0 DROP { this_srt->dest = RTD_BLACKHOLE; }
- | stat_route0 REJECT { this_srt->dest = RTD_UNREACHABLE; }
- | stat_route0 PROHIBIT { this_srt->dest = RTD_PROHIBIT; }
+
+ | stat_route0 DROP { this_srt->dest = RTD_BLACKHOLE; }
+ | stat_route0 REJECT { this_srt->dest = RTD_UNREACHABLE; }
+ | stat_route0 BLACKHOLE { this_srt->dest = RTD_BLACKHOLE; }
+ | stat_route0 UNREACHABLE { this_srt->dest = RTD_UNREACHABLE; }
+ | stat_route0 PROHIBIT { this_srt->dest = RTD_PROHIBIT; }
;
CF_CLI(SHOW STATIC, optsym, [<name>], [[Show details of static protocol]])
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/sysdep/bsd/sysio.h
^
|
@@ -6,6 +6,9 @@
* Can be freely distributed and used under the terms of the GNU GPL.
*/
+#ifdef __DragonFly__
+#define TCP_MD5SIG TCP_SIGNATURE_ENABLE
+#endif
#ifdef IPV6
static inline void
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/sysdep/config.h
^
|
@@ -7,7 +7,7 @@
#define _BIRD_CONFIG_H_
/* BIRD version */
-#define BIRD_VERSION "1.3.8"
+#define BIRD_VERSION "1.3.9"
/* Include parameters determined by configure script */
#include "sysdep/autoconf.h"
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/sysdep/unix/config.Y
^
|
@@ -14,9 +14,9 @@
CF_DECLS
CF_KEYWORDS(LOG, SYSLOG, ALL, DEBUG, TRACE, INFO, REMOTE, WARNING, ERROR, AUTH, FATAL, BUG, STDERR, SOFT)
-CF_KEYWORDS(TIMEFORMAT, ISO, SHORT, LONG, BASE, NAME)
+CF_KEYWORDS(TIMEFORMAT, ISO, SHORT, LONG, BASE, NAME, CONFIRM, UNDO, CHECK, TIMEOUT)
-%type <i> log_mask log_mask_list log_cat
+%type <i> log_mask log_mask_list log_cat cfg_timeout
%type <g> log_file
%type <t> cfg_name
%type <tf> timeformat_which
@@ -104,13 +104,26 @@
/* Unix specific commands */
-CF_CLI_HELP(CONFIGURE, [soft] [\"<file>\"], [[Reload configuration]])
+CF_CLI_HELP(CONFIGURE, ..., [[Reload configuration]])
-CF_CLI(CONFIGURE, cfg_name, [\"<file>\"], [[Reload configuration]])
-{ cmd_reconfig($2, RECONFIG_HARD); } ;
+CF_CLI(CONFIGURE, cfg_name cfg_timeout, [\"<file>\"] [timeout [<sec>]], [[Reload configuration]])
+{ cmd_reconfig($2, RECONFIG_HARD, $3); } ;
-CF_CLI(CONFIGURE SOFT, cfg_name, [\"<file>\"], [[Reload configuration and ignore changes in filters]])
-{ cmd_reconfig($3, RECONFIG_SOFT); } ;
+CF_CLI(CONFIGURE SOFT, cfg_name cfg_timeout, [\"<file>\"] [timeout [<sec>]], [[Reload configuration and ignore changes in filters]])
+{ cmd_reconfig($3, RECONFIG_SOFT, $4); } ;
+
+/* Hack to get input completion for 'timeout' */
+CF_CLI_CMD(CONFIGURE TIMEOUT, [<sec>], [[Reload configuration with undo timeout]])
+CF_CLI_CMD(CONFIGURE SOFT TIMEOUT, [<sec>], [[Reload configuration with undo timeout]])
+
+CF_CLI(CONFIGURE CONFIRM,,, [[Confirm last configuration change - deactivate undo timeout]])
+{ cmd_reconfig_confirm(); } ;
+
+CF_CLI(CONFIGURE UNDO,,, [[Undo last configuration change]])
+{ cmd_reconfig_undo(); } ;
+
+CF_CLI(CONFIGURE CHECK, cfg_name, [\"<file>\"], [[Parse configuration and check its validity]])
+{ cmd_check_config($3); } ;
CF_CLI(DOWN,,, [[Shut the daemon down]])
{ cmd_shutdown(); } ;
@@ -120,6 +133,12 @@
| TEXT
;
+cfg_timeout:
+ /* empty */ { $$ = 0; }
+ | TIMEOUT { $$ = UNIX_DEFAULT_CONFIGURE_TIMEOUT; }
+ | TIMEOUT expr { $$ = $2; }
+ ;
+
CF_CODE
CF_END
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/sysdep/unix/io.c
^
|
@@ -121,7 +121,7 @@
static bird_clock_t first_far_timer = TIME_INFINITY;
/* now must be different from 0, because 0 is a special value in timer->expires */
-bird_clock_t now = 1, now_real;
+bird_clock_t now = 1, now_real, boot_time;
static void
update_times_plain(void)
@@ -1530,6 +1530,7 @@
krt_io_init();
init_times();
update_times();
+ boot_time = now;
srandom((int) now_real);
}
@@ -1557,7 +1558,7 @@
tm_shot();
continue;
}
- timo.tv_sec = events ? 0 : tout - now;
+ timo.tv_sec = events ? 0 : MIN(tout - now, 3);
timo.tv_usec = 0;
if (sock_recalc_fdsets_p)
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/sysdep/unix/krt.c
^
|
@@ -114,12 +114,18 @@
}
static inline int
-prefer_scope(struct ifa *a, struct ifa *b)
-{ return (a->scope > SCOPE_LINK) && (b->scope <= SCOPE_LINK); }
-
-static inline int
prefer_addr(struct ifa *a, struct ifa *b)
-{ return ipa_compare(a->ip, b->ip) < 0; }
+{
+ int sa = a->scope > SCOPE_LINK;
+ int sb = b->scope > SCOPE_LINK;
+
+ if (sa < sb)
+ return 0;
+ else if (sa > sb)
+ return 1;
+ else
+ return ipa_compare(a->ip, b->ip) < 0;
+}
static inline struct ifa *
find_preferred_ifa(struct iface *i, ip_addr prefix, ip_addr mask)
@@ -130,7 +136,7 @@
{
if (!(a->flags & IA_SECONDARY) &&
ipa_equal(ipa_and(a->ip, mask), prefix) &&
- (!b || prefer_scope(a, b) || prefer_addr(a, b)))
+ (!b || prefer_addr(a, b)))
b = a;
}
@@ -575,7 +581,7 @@
{
net *n = (net *) f;
rte *e = n->routes;
- if (e && (n->n.flags & KRF_INSTALLED))
+ if (rte_is_valid(e) && (n->n.flags & KRF_INSTALLED))
{
/* FIXME: this does not work if gw is changed in export filter */
krt_replace_rte(p, e->net, NULL, e, NULL);
@@ -650,7 +656,7 @@
}
old = net->routes;
- if ((net->n.flags & KRF_INSTALLED) && old)
+ if ((net->n.flags & KRF_INSTALLED) && rte_is_valid(old))
{
/* There may be changes in route attributes, we ignore that.
Also, this does not work well if gw is changed in export filter */
@@ -894,7 +900,7 @@
{
struct krt_proto *p = (struct krt_proto *) P;
- if (shutting_down)
+ if (config->shutdown)
return;
if (!(net->n.flags & KRF_INSTALLED))
old = NULL;
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/sysdep/unix/main.c
^
|
@@ -210,7 +210,7 @@
else
die("Unable to open configuration file %s: %m", config_name);
}
- config_commit(conf, RECONFIG_HARD);
+ config_commit(conf, RECONFIG_HARD, 0);
}
void
@@ -228,19 +228,17 @@
config_free(conf);
}
else
- config_commit(conf, RECONFIG_HARD);
+ config_commit(conf, RECONFIG_HARD, 0);
}
-void
-cmd_reconfig(char *name, int type)
+static struct config *
+cmd_read_config(char *name)
{
struct config *conf;
- if (cli_access_restricted())
- return;
-
if (!name)
name = config_name;
+
cli_msg(-2, "Reading configuration from %s", name);
if (!unix_read_config(&conf, name))
{
@@ -249,24 +247,94 @@
else
cli_msg(8002, "%s: %m", name);
config_free(conf);
+ conf = NULL;
}
- else
+
+ return conf;
+}
+
+void
+cmd_check_config(char *name)
+{
+ struct config *conf = cmd_read_config(name);
+ if (!conf)
+ return;
+
+ cli_msg(20, "Configuration OK");
+ config_free(conf);
+}
+
+static void
+cmd_reconfig_msg(int r)
+{
+ switch (r)
{
- switch (config_commit(conf, type))
- {
- case CONF_DONE:
- cli_msg(3, "Reconfigured.");
- break;
- case CONF_PROGRESS:
- cli_msg(4, "Reconfiguration in progress.");
- break;
- case CONF_SHUTDOWN:
- cli_msg(6, "Reconfiguration ignored, shutting down.");
- break;
- default:
- cli_msg(5, "Reconfiguration already in progress, queueing new config");
- }
+ case CONF_DONE: cli_msg( 3, "Reconfigured"); break;
+ case CONF_PROGRESS: cli_msg( 4, "Reconfiguration in progress"); break;
+ case CONF_QUEUED: cli_msg( 5, "Reconfiguration already in progress, queueing new config"); break;
+ case CONF_UNQUEUED: cli_msg(17, "Reconfiguration already in progress, removing queued config"); break;
+ case CONF_CONFIRM: cli_msg(18, "Reconfiguration confirmed"); break;
+ case CONF_SHUTDOWN: cli_msg( 6, "Reconfiguration ignored, shutting down"); break;
+ case CONF_NOTHING: cli_msg(19, "Nothing to do"); break;
+ default: break;
+ }
+}
+
+/* Hack for scheduled undo notification */
+cli *cmd_reconfig_stored_cli;
+
+void
+cmd_reconfig_undo_notify(void)
+{
+ if (cmd_reconfig_stored_cli)
+ {
+ cli *c = cmd_reconfig_stored_cli;
+ cli_printf(c, CLI_ASYNC_CODE, "Config timeout expired, starting undo");
+ cli_write_trigger(c);
+ }
+}
+
+void
+cmd_reconfig(char *name, int type, int timeout)
+{
+ if (cli_access_restricted())
+ return;
+
+ struct config *conf = cmd_read_config(name);
+ if (!conf)
+ return;
+
+ int r = config_commit(conf, type, timeout);
+
+ if ((r >= 0) && (timeout > 0))
+ {
+ cmd_reconfig_stored_cli = this_cli;
+ cli_msg(-22, "Undo scheduled in %d s", timeout);
}
+
+ cmd_reconfig_msg(r);
+}
+
+void
+cmd_reconfig_confirm(void)
+{
+ if (cli_access_restricted())
+ return;
+
+ int r = config_confirm();
+ cmd_reconfig_msg(r);
+}
+
+void
+cmd_reconfig_undo(void)
+{
+ if (cli_access_restricted())
+ return;
+
+ cli_msg(-21, "Undo requested");
+
+ int r = config_undo();
+ cmd_reconfig_msg(r);
}
/*
@@ -623,6 +691,7 @@
rt_init();
if_init();
roa_init();
+ config_init();
uid_t use_uid = get_uid(use_user);
gid_t use_gid = get_gid(use_group);
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/sysdep/unix/timer.h
^
|
@@ -32,6 +32,7 @@
extern bird_clock_t now; /* Relative, monotonic time in seconds */
extern bird_clock_t now_real; /* Time in seconds since fixed known epoch */
+extern bird_clock_t boot_time;
static inline bird_clock_t
tm_remains(timer *t)
|
[-]
[+]
|
Changed |
bird-1.3.9.tar.bz2/sysdep/unix/unix.h
^
|
@@ -19,9 +19,14 @@
void async_config(void);
void async_dump(void);
void async_shutdown(void);
-void cmd_reconfig(char *name, int type);
+void cmd_check_config(char *name);
+void cmd_reconfig(char *name, int type, int timeout);
+void cmd_reconfig_confirm(void);
+void cmd_reconfig_undo(void);
void cmd_shutdown(void);
+#define UNIX_DEFAULT_CONFIGURE_TIMEOUT 300
+
/* io.c */
volatile int async_config_flag;
|