From bbcfd5a0485a8df9568d8da0fc524e272e3e7601 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Thu, 26 Jul 2012 13:59:50 +0200 Subject: [PATCH 1/4] Fixes default route in OSPF multiple area setting. --- proto/ospf/ospf.c | 2 +- proto/ospf/rt.c | 4 ++-- proto/ospf/topology.c | 15 +++++++-------- proto/ospf/topology.h | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index ef7b0363..aa62da14 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -575,7 +575,7 @@ ospf_rt_notify(struct proto *p, rtable *tbl UNUSED, net * n, rte * new, rte * ol if (fn->x1 != EXT_EXPORT) return; - flush_ext_lsa(oa, fn); + flush_ext_lsa(oa, fn, oa_is_nssa(oa)); /* Old external route might blocked some NSSA translation */ if (po->areano > 1) diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 42c54dfd..4b8de4b8 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -1066,7 +1066,7 @@ check_nssa_lsa(struct proto_ospf *po, ort *nf) originate_ext_lsa(po->backbone, fn, EXT_NSSA, rt_metric, rt_fwaddr, rt_tag, 0); else if (fn->x1 == EXT_NSSA) - flush_ext_lsa(po->backbone, fn); + flush_ext_lsa(po->backbone, fn, 0); } /* RFC 2328 16.7. p2 - find new/lost vlink endpoints */ @@ -1189,7 +1189,7 @@ ospf_rt_abr1(struct proto_ospf *po) if (oa_is_nssa(oa) && oa->ac->default_nssa) originate_ext_lsa(oa, &default_nf->fn, 0, oa->ac->default_cost, IPA_NONE, 0, 0); else - flush_ext_lsa(oa, &default_nf->fn); + flush_ext_lsa(oa, &default_nf->fn, 1); /* RFC 2328 16.4. (3) - precompute preferred ASBR entries */ diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index 7e9bad50..ec012b22 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -862,6 +862,9 @@ flush_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type) if ((en = ospf_hash_find_header(po->gr, oa->areaid, &lsa)) != NULL) { + OSPF_TRACE(D_EVENTS, "Flushing summary-LSA (id=%R, type=%d)", + en->lsa.id, en->lsa.type); + if ((type == ORT_NET) && check_sum_net_lsaid_collision(fn, en)) { log(L_ERR "%s: LSAID collision for %I/%d", @@ -873,9 +876,6 @@ flush_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type) en->lsa.age = LSA_MAXAGE; en->lsa.sn = LSA_MAXSEQNO; lsasum_calculate(&en->lsa, sum); - - OSPF_TRACE(D_EVENTS, "Flushing summary-LSA (id=%R, type=%d)", - en->lsa.id, en->lsa.type); ospf_lsupd_flood(po, NULL, NULL, &en->lsa, oa->areaid, 1); if (can_flush_lsa(po)) flush_lsa(en, po); } @@ -1131,15 +1131,11 @@ originate_ext_lsa(struct ospf_area *oa, struct fib_node *fn, int src, } void -flush_ext_lsa(struct ospf_area *oa, struct fib_node *fn) +flush_ext_lsa(struct ospf_area *oa, struct fib_node *fn, int nssa) { struct proto_ospf *po = oa->po; struct proto *p = &po->proto; struct top_hash_entry *en; - int nssa = oa_is_nssa(oa); - - OSPF_TRACE(D_EVENTS, "Flushing %s-LSA for %I/%d", - nssa ? "NSSA" : "AS-external", fn->prefix, fn->pxlen); u32 dom = nssa ? oa->areaid : 0; u32 type = nssa ? LSA_T_NSSA : LSA_T_EXT; @@ -1147,6 +1143,9 @@ flush_ext_lsa(struct ospf_area *oa, struct fib_node *fn) if (en = ospf_hash_find(po->gr, dom, lsaid, po->router_id, type)) { + OSPF_TRACE(D_EVENTS, "Flushing %s-LSA for %I/%d", + nssa ? "NSSA" : "AS-external", fn->prefix, fn->pxlen); + if (check_ext_lsa(en, fn, 0, IPA_NONE, 0) < 0) { log(L_ERR "%s: LSAID collision for %I/%d", diff --git a/proto/ospf/topology.h b/proto/ospf/topology.h index b9bc9cf6..cb876487 100644 --- a/proto/ospf/topology.h +++ b/proto/ospf/topology.h @@ -72,7 +72,7 @@ void originate_sum_net_lsa(struct ospf_area *oa, struct fib_node *fn, int metric void originate_sum_rt_lsa(struct ospf_area *oa, struct fib_node *fn, int metric, u32 options UNUSED); void flush_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type); void originate_ext_lsa(struct ospf_area *oa, struct fib_node *fn, int src, u32 metric, ip_addr fwaddr, u32 tag, int pbit); -void flush_ext_lsa(struct ospf_area *oa, struct fib_node *fn); +void flush_ext_lsa(struct ospf_area *oa, struct fib_node *fn, int nssa); #ifdef OSPFv2 From 5400c0e7f982757418a0aeb892459b52fbbcffc3 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Mon, 6 Aug 2012 02:42:24 +0200 Subject: [PATCH 2/4] Fixes BGP subcode during global shutdown. --- doc/bird.sgml | 2 +- nest/proto.c | 14 ++++++++------ nest/protocol.h | 3 ++- proto/bgp/bgp.c | 1 + 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/doc/bird.sgml b/doc/bird.sgml index 86ae5b0d..24bc3026 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -477,7 +477,7 @@ to zero to disable it. An empty is equivalent to disabled && nc->disabled) log(L_INFO "Disabling protocol %s", p->name); - PD(p, "Restarting"); p->down_code = nc->disabled ? PDC_CF_DISABLE : PDC_CF_RESTART; p->cf_new = nc; } - else + else if (!shutting_down) { - if (!shutting_down) - log(L_INFO "Removing protocol %s", p->name); - PD(p, "Unconfigured"); + log(L_INFO "Removing protocol %s", p->name); p->down_code = PDC_CF_REMOVE; p->cf_new = NULL; } - p->reconfiguring = 1; + else /* global shutdown */ + { + p->down_code = PDC_CMD_SHUTDOWN; + p->cf_new = NULL; + } + p->reconfiguring = 1; config_add_obstacle(old); proto_rethink_goal(p); } diff --git a/nest/protocol.h b/nest/protocol.h index 8a632715..11fcb164 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -222,8 +222,9 @@ struct proto_spec { #define PDC_CF_RESTART 0x03 /* Restart due to reconfiguration */ #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 - not implemented */ +#define PDC_OUT_LIMIT_HIT 0x22 /* Route export limit reached */ void *proto_new(struct proto_config *, unsigned size); diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index 0b52dedc..dbc59eea 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -870,6 +870,7 @@ bgp_shutdown(struct proto *P) break; case PDC_CMD_DISABLE: + case PDC_CMD_SHUTDOWN: subcode = 2; // Errcode 6, 2 - administrative shutdown break; From c06de722ddf36f3d6aaabfd4ae9d74a3ea72bbf9 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Mon, 6 Aug 2012 11:09:13 +0200 Subject: [PATCH 3/4] Some minor fixes. --- proto/ospf/lsupd.c | 6 ++++-- sysdep/linux/netlink.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c index f71c72d1..16967a7f 100644 --- a/proto/ospf/lsupd.c +++ b/proto/ospf/lsupd.c @@ -502,15 +502,17 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa, continue; } #else /* OSPFv3 */ + u16 scope = ntoht(lsa->type) & LSA_SCOPE_MASK; + /* 4.5.1 (2) */ - if ((LSA_SCOPE(lsa) == LSA_SCOPE_AS) && !oa_is_ext(ifa->oa)) + if ((scope == LSA_SCOPE_AS) && !oa_is_ext(ifa->oa)) { log(L_WARN "Received LSA with AS scope in stub area from %I", n->ip); continue; } /* 4.5.1 (3) */ - if ((LSA_SCOPE(lsa) == LSA_SCOPE_RES)) + if (scope == LSA_SCOPE_RES) { log(L_WARN "Received LSA with invalid scope from %I", n->ip); continue; diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c index eaaf048e..d1b203ef 100644 --- a/sysdep/linux/netlink.c +++ b/sysdep/linux/netlink.c @@ -737,7 +737,7 @@ nl_parse_route(struct nlmsghdr *h, int scan) (a[RTA_GATEWAY] && RTA_PAYLOAD(a[RTA_GATEWAY]) != sizeof(ip_addr)) || (a[RTA_PRIORITY] && RTA_PAYLOAD(a[RTA_PRIORITY]) != 4) || (a[RTA_PREFSRC] && RTA_PAYLOAD(a[RTA_PREFSRC]) != sizeof(ip_addr)) || - (a[RTA_FLOW] && RTA_PAYLOAD(a[RTA_OIF]) != 4)) + (a[RTA_FLOW] && RTA_PAYLOAD(a[RTA_FLOW]) != 4)) { log(L_ERR "KRT: Malformed message received"); return; From 94e2f1c111721d6213ea65cac5c53036e38e3973 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Tue, 7 Aug 2012 11:06:57 +0200 Subject: [PATCH 4/4] NEWS and version update. --- NEWS | 9 +++++++++ misc/bird.spec | 2 +- sysdep/config.h | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 8193b54a..3aaa4dd6 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,12 @@ +Version 1.3.8 (2012-08-07) + o Generalized import and export route limits. + o RDNSS and DNSSL support for RAdv. + o Include in config file support wildcards. + o History deduplication in BIRD client. + o New route attributes krt_source, krt_metric. + o Different instance ID support for OSPFv3. + o Real broadcast mode for OSPFv2. + o Several minor bugfixes. Version 1.3.7 (2012-03-22) o Route Origin Authorization basics. diff --git a/misc/bird.spec b/misc/bird.spec index 60002a5d..de63a6a0 100644 --- a/misc/bird.spec +++ b/misc/bird.spec @@ -1,6 +1,6 @@ Summary: BIRD Internet Routing Daemon Name: bird -Version: 1.3.7 +Version: 1.3.8 Release: 1 Copyright: GPL Group: Networking/Daemons diff --git a/sysdep/config.h b/sysdep/config.h index 8d93d381..7106e4ba 100644 --- a/sysdep/config.h +++ b/sysdep/config.h @@ -7,7 +7,7 @@ #define _BIRD_CONFIG_H_ /* BIRD version */ -#define BIRD_VERSION "1.3.7" +#define BIRD_VERSION "1.3.8" /* Include parameters determined by configure script */ #include "sysdep/autoconf.h"