From 30c734fc73648e4c43af4f45e68ac2de3d7ddea1 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Fri, 17 Feb 2017 22:54:06 +0100 Subject: [PATCH 1/6] Static: Fix bug in static route filter expressions During reconfiguration, old and new filter expressions in static routes are compared using i_same() function. When filter expressions contain function calls, it is necessary that old filter expressions are the second argument in i_same(), as it is internally modified by i_same(). Otherwise pointers to old (and freed) data appear in the config structure. Thanks to Lennert Buytenhek for tracking and reporting the bug. --- proto/static/static.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proto/static/static.c b/proto/static/static.c index 0c088cd7..849067b9 100644 --- a/proto/static/static.c +++ b/proto/static/static.c @@ -498,7 +498,8 @@ static_same_dest(struct static_route *x, struct static_route *y) static inline int static_same_rte(struct static_route *x, struct static_route *y) { - return static_same_dest(x, y) && i_same(x->cmds, y->cmds); + /* Note that i_same() requires arguments in (new, old) order */ + return static_same_dest(x, y) && i_same(y->cmds, x->cmds); } From 9be12a7d95d668a64922f935057c0b401b58ab75 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Sun, 19 Feb 2017 11:25:16 +0100 Subject: [PATCH 2/6] Doc: Fix RIP example Thanks to Steve Leung for the bugreport. --- doc/bird.sgml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/doc/bird.sgml b/doc/bird.sgml index 6af0e0f6..11fe2190 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -3806,16 +3806,17 @@ protocol rip [<name>] {

protocol rip { - debug all; - port 1520; - period 12; - garbage time 60; - interface "eth0" { metric 3; mode multicast; }; - interface "eth*" { metric 2; mode broadcast; }; - authentication cryptographic; - password "secret-shared-key" { algorithm hmac sha256; }; - import filter { print "importing"; accept; }; - export filter { print "exporting"; accept; }; + import all; + export all; + interface "eth*" { + metric 2; + port 1520; + mode multicast; + update time 12; + timeout time 60; + authentication cryptographic; + password "secret" { algorithm hmac sha256; }; + }; } From 4e379bde60172823452cf96e9c0b6b1737c490f0 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Sun, 19 Feb 2017 12:02:39 +0100 Subject: [PATCH 3/6] BGP: Update RFC references --- proto/bgp/attrs.c | 7 +++---- proto/bgp/bgp.h | 6 +++--- proto/bgp/packets.c | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index 9d23374a..2b0a92dc 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -51,10 +51,9 @@ * implementations that pass invalid AS_CONFED_* segments are * widespread. * - * Error handling of AS4_* attributes is done as specified by - * draft-ietf-idr-rfc4893bis-03. There are several possible - * inconsistencies between AGGREGATOR and AS4_AGGREGATOR that are not - * handled by that draft, these are logged and ignored (see + * Error handling of AS4_* attributes is done as specified by RFC 6793. There + * are several possible inconsistencies between AGGREGATOR and AS4_AGGREGATOR + * that are not handled by that RFC, these are logged and ignored (see * bgp_reconstruct_4b_attrs()). */ diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h index d028bef4..bf933554 100644 --- a/proto/bgp/bgp.h +++ b/proto/bgp/bgp.h @@ -48,7 +48,7 @@ struct bgp_config { int passive; /* Do not initiate outgoing connection */ int interpret_communities; /* Hardwired handling of well-known communities */ int secondary; /* Accept also non-best routes (i.e. RA_ACCEPTED) */ - int add_path; /* Use ADD-PATH extension [draft] */ + int add_path; /* Use ADD-PATH extension [RFC7911] */ int allow_local_as; /* Allow that number of local ASNs in incoming AS_PATHs */ int gr_mode; /* Graceful restart mode (BGP_GR_*) */ int setkey; /* Set MD5 password to system SA/SP database */ @@ -104,7 +104,7 @@ struct bgp_conn { int start_state; /* protocol start_state snapshot when connection established */ u8 peer_refresh_support; /* Peer supports route refresh [RFC2918] */ u8 peer_as4_support; /* Peer supports 4B AS numbers [RFC4893] */ - u8 peer_add_path; /* Peer supports ADD-PATH [draft] */ + u8 peer_add_path; /* Peer supports ADD-PATH [RFC7911] */ u8 peer_enhanced_refresh_support; /* Peer supports enhanced refresh [RFC7313] */ u8 peer_gr_aware; u8 peer_gr_able; @@ -310,7 +310,7 @@ void bgp_log_error(struct bgp_proto *p, u8 class, char *msg, unsigned code, unsi #define BA_EXT_COMMUNITY 0x10 /* [RFC4360] */ #define BA_AS4_PATH 0x11 /* [RFC4893] */ #define BA_AS4_AGGREGATOR 0x12 -#define BA_LARGE_COMMUNITY 0x20 /* [draft-ietf-idr-large-community] */ +#define BA_LARGE_COMMUNITY 0x20 /* [RFC8092] */ /* BGP connection states */ diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 3e816839..d100b7d0 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -856,7 +856,7 @@ bgp_parse_capabilities(struct bgp_conn *conn, byte *opt, int len) conn->advertised_as = get_u32(opt + 2); break; - case 69: /* ADD-PATH capability, draft */ + case 69: /* ADD-PATH capability, RFC 7911 */ if (cl % 4) goto err; for (i = 0; i < cl; i += 4) From 1950a479c020d1972b6007d8ea0f66e3d4f8564a Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Thu, 23 Feb 2017 16:32:07 +0100 Subject: [PATCH 4/6] BGP: Allow exchanging LOCAL_PREF with eBGP peers Adds option 'allow bgp_local_pref' to override the usual restriction of LOCAL_PREF on eBGP sessions. Thanks to Lennert Buytenhek for the patch. --- doc/bird.sgml | 8 ++++++++ proto/bgp/attrs.c | 20 +++++++++++++++----- proto/bgp/bgp.h | 1 + proto/bgp/config.Y | 1 + 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/doc/bird.sgml b/doc/bird.sgml index 11fe2190..dd4472ae 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -2043,6 +2043,14 @@ using the following configuration parameters: TX direction. When active, all available routes accepted by the export filter are advertised to the neighbor. Default: off. +