0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-10-18 18:08:45 +00:00

Merge commit 'f623ab9875cad2d129f708e95021d3a252930000' into integrated

Conflicts:

	proto/ospf/config.Y
	proto/ospf/ospf.c
	proto/ospf/rt.c
	proto/ospf/topology.c
This commit is contained in:
Ondrej Zajicek 2013-07-30 21:59:36 +02:00
commit f24ea8155b
6 changed files with 38 additions and 11 deletions

View File

@ -1904,6 +1904,7 @@ on nonbroadcast networks.
<code> <code>
protocol ospf &lt;name&gt; { protocol ospf &lt;name&gt; {
rfc1583compat &lt;switch&gt;; rfc1583compat &lt;switch&gt;;
stub router &lt;switch&gt;;
tick &lt;num&gt;; tick &lt;num&gt;;
ecmp &lt;switch&gt; [limit &lt;num&gt;]; ecmp &lt;switch&gt; [limit &lt;num&gt;];
area &lt;id&gt; { area &lt;id&gt; {
@ -1983,6 +1984,15 @@ protocol ospf &lt;name&gt; {
url="ftp://ftp.rfc-editor.org/in-notes/rfc1583.txt">. Default url="ftp://ftp.rfc-editor.org/in-notes/rfc1583.txt">. Default
value is no. value is no.
<tag>stub router <M>switch</M></tag>
This option configures the router to be a stub router, i.e.,
a router that participates in the OSPF topology but does not
allow transit traffic. In OSPFv2, this is implemented by
advertising maximum metric for outgoing links, as suggested
by RFC 3137<htmlurl url="ftp://ftp.rfc-editor.org/in-notes/rfc3137.txt">.
In OSPFv3, the stub router behavior is announced by clearing
the R-bit in the router LSA. Default value is no.
<tag>tick <M>num</M></tag> <tag>tick <M>num</M></tag>
The routing table calculation and clean-up of areas' databases The routing table calculation and clean-up of areas' databases
is not performed when a single link state is not performed when a single link state

View File

@ -148,6 +148,7 @@ ospf_proto:
ospf_proto_item: ospf_proto_item:
proto_item proto_item
| RFC1583COMPAT bool { OSPF_CFG->rfc1583 = $2; } | RFC1583COMPAT bool { OSPF_CFG->rfc1583 = $2; }
| STUB ROUTER bool { OSPF_CFG->stub_router = $3; }
| ECMP bool { OSPF_CFG->ecmp = $2 ? OSPF_DEFAULT_ECMP_LIMIT : 0; } | ECMP bool { OSPF_CFG->ecmp = $2 ? OSPF_DEFAULT_ECMP_LIMIT : 0; }
| ECMP bool LIMIT expr { OSPF_CFG->ecmp = $2 ? $4 : 0; if ($4 < 0) cf_error("ECMP limit cannot be negative"); } | ECMP bool LIMIT expr { OSPF_CFG->ecmp = $2 ? $4 : 0; if ($4 < 0) cf_error("ECMP limit cannot be negative"); }
| TICK expr { OSPF_CFG->tick = $2; if($2<=0) cf_error("Tick must be greater than zero"); } | TICK expr { OSPF_CFG->tick = $2; if($2<=0) cf_error("Tick must be greater than zero"); }

View File

@ -164,7 +164,10 @@ ospf_area_add(struct proto_ospf *po, struct ospf_area_config *ac, int reconf)
if (oa->areaid == 0) if (oa->areaid == 0)
po->backbone = oa; po->backbone = oa;
oa->options = ospf_is_v2(po) ? ac->type : (OPT_R | ac->type | OPT_V6); if (ospf_is_v2(po))
oa->options = ac->type;
else
oa->options = ac->type | OPT_V6 | (po->stub_router ? 0 : OPT_R);
/* /*
* Set E-bit for NSSA ABR routers. No need to explicitly call * Set E-bit for NSSA ABR routers. No need to explicitly call
@ -230,6 +233,7 @@ ospf_start(struct proto *p)
po->router_id = proto_get_router_id(p->cf); po->router_id = proto_get_router_id(p->cf);
po->last_vlink_id = 0x80000000; po->last_vlink_id = 0x80000000;
po->rfc1583 = c->rfc1583; po->rfc1583 = c->rfc1583;
po->stub_router = c->stub_router;
po->ebit = 0; po->ebit = 0;
po->ecmp = c->ecmp; po->ecmp = c->ecmp;
po->tick = c->tick; po->tick = c->tick;
@ -678,7 +682,10 @@ ospf_area_reconfigure(struct ospf_area *oa, struct ospf_area_config *nac)
oa->ac = nac; oa->ac = nac;
// FIXME better area type reconfiguration // FIXME better area type reconfiguration
oa->options = ospf_is_v2(oa->po) ? nac->type : (OPT_R | nac->type | OPT_V6); if (ospf_is_v2(po))
oa->options = nac->type;
else
oa->options = nac->type | OPT_V6 | (oa->po->stub_router ? 0 : OPT_R);
if (oa_is_nssa(oa) && (oa->po->areano > 1)) if (oa_is_nssa(oa) && (oa->po->areano > 1))
oa->po->ebit = 1; oa->po->ebit = 1;
@ -726,6 +733,7 @@ ospf_reconfigure(struct proto *p, struct proto_config *c)
if (old->abr != new->abr) if (old->abr != new->abr)
return 0; return 0;
po->stub_router = new->stub_router;
po->ecmp = new->ecmp; po->ecmp = new->ecmp;
po->tick = new->tick; po->tick = new->tick;
po->disp_timer->recurrent = po->tick; po->disp_timer->recurrent = po->tick;
@ -819,6 +827,7 @@ ospf_sh(struct proto *p)
cli_msg(-1014, "%s:", p->name); cli_msg(-1014, "%s:", p->name);
cli_msg(-1014, "RFC1583 compatibility: %s", (po->rfc1583 ? "enable" : "disabled")); cli_msg(-1014, "RFC1583 compatibility: %s", (po->rfc1583 ? "enable" : "disabled"));
cli_msg(-1014, "Stub router: %s", (po->stub_router ? "Yes" : "No"));
cli_msg(-1014, "RT scheduler tick: %d", po->tick); cli_msg(-1014, "RT scheduler tick: %d", po->tick);
cli_msg(-1014, "Number of areas: %u", po->areano); cli_msg(-1014, "Number of areas: %u", po->areano);
cli_msg(-1014, "Number of LSAs in DB:\t%u", po->gr->hash_entries); cli_msg(-1014, "Number of LSAs in DB:\t%u", po->gr->hash_entries);

View File

@ -72,6 +72,7 @@ struct ospf_config
unsigned tick; unsigned tick;
byte ospf2; byte ospf2;
byte rfc1583; byte rfc1583;
byte stub_router;
byte abr; byte abr;
byte ecmp; byte ecmp;
list area_list; /* list of struct ospf_area_config */ list area_list; /* list of struct ospf_area_config */
@ -710,6 +711,7 @@ struct proto_ospf
struct fib rtf; /* Routing table */ struct fib rtf; /* Routing table */
byte ospf2; /* OSPF v2 or v3 */ byte ospf2; /* OSPF v2 or v3 */
byte rfc1583; /* RFC1583 compatibility */ byte rfc1583; /* RFC1583 compatibility */
byte stub_router; /* Do not forward transit traffic */
byte ebit; /* Did I originate any ext lsa? */ byte ebit; /* Did I originate any ext lsa? */
byte ecmp; /* Maximal number of nexthops in ECMP route, or 0 */ byte ecmp; /* Maximal number of nexthops in ECMP route, or 0 */
struct ospf_area *backbone; /* If exists */ struct ospf_area *backbone; /* If exists */

View File

@ -332,6 +332,10 @@ spfa_process_rt(struct ospf_area *oa, struct top_hash_entry *act)
ri_install_rt(oa, act->lsa.rt, &nf); ri_install_rt(oa, act->lsa.rt, &nf);
} }
/* Errata 2078 to RFC 5340 4.8.1 - skip links from non-routing nodes */
if (ospf_is_v3(po) && (act != oa->rt) && !(rt->options & OPT_R))
break;
/* Now process Rt links */ /* Now process Rt links */
for (lsa_walk_rt_init(po, act, &rtl), i = 0; lsa_walk_rt(&rtl); i++) for (lsa_walk_rt_init(po, act, &rtl), i = 0; lsa_walk_rt(&rtl); i++)
{ {
@ -1712,12 +1716,12 @@ add_cand(list * l, struct top_hash_entry *en, struct top_hash_entry *par,
return; return;
if (ospf_is_v3(po) && (en->lsa_type == LSA_T_RT)) if (ospf_is_v3(po) && (en->lsa_type == LSA_T_RT))
{ {
/* In OSPFv3, check V6 and R flags */ /* In OSPFv3, check V6 flag */
struct ospf_lsa_rt *rt = en->lsa_body; struct ospf_lsa_rt *rt = en->lsa_body;
if (!(rt->options & OPT_V6) || !(rt->options & OPT_R)) if (!(rt->options & OPT_V6))
return; return;
} }
/* 16.1. (2c) */ /* 16.1. (2c) */
if (en->color == INSPF) if (en->color == INSPF)

View File

@ -219,6 +219,7 @@ prepare_rt2_lsa_body(struct proto_ospf *po, struct ospf_area *oa)
WALK_LIST(ifa, po->iface_list) WALK_LIST(ifa, po->iface_list)
{ {
int net_lsa = 0; int net_lsa = 0;
u32 link_cost = po->stub_router ? 0xffff : ifa->cost;
if ((ifa->type == OSPF_IT_VLINK) && (ifa->voa == oa) && if ((ifa->type == OSPF_IT_VLINK) && (ifa->voa == oa) &&
(!EMPTY_LIST(ifa->neigh_list))) (!EMPTY_LIST(ifa->neigh_list)))
@ -249,7 +250,7 @@ prepare_rt2_lsa_body(struct proto_ospf *po, struct ospf_area *oa)
* compatibility with some broken implementations that use * compatibility with some broken implementations that use
* this address as a next-hop. * this address as a next-hop.
*/ */
add_rt2_lsa_link(po, LSART_PTP, neigh->rid, ipa_to_u32(ifa->addr->ip), ifa->cost); add_rt2_lsa_link(po, LSART_PTP, neigh->rid, ipa_to_u32(ifa->addr->ip), link_cost);
i++; i++;
} }
break; break;
@ -258,7 +259,7 @@ prepare_rt2_lsa_body(struct proto_ospf *po, struct ospf_area *oa)
case OSPF_IT_NBMA: case OSPF_IT_NBMA:
if (bcast_net_active(ifa)) if (bcast_net_active(ifa))
{ {
add_rt2_lsa_link(po, LSART_NET, ipa_to_u32(ifa->drip), ipa_to_u32(ifa->addr->ip), ifa->cost); add_rt2_lsa_link(po, LSART_NET, ipa_to_u32(ifa->drip), ipa_to_u32(ifa->addr->ip), link_cost);
i++; i++;
net_lsa = 1; net_lsa = 1;
} }
@ -267,7 +268,7 @@ prepare_rt2_lsa_body(struct proto_ospf *po, struct ospf_area *oa)
case OSPF_IT_VLINK: case OSPF_IT_VLINK:
neigh = (struct ospf_neighbor *) HEAD(ifa->neigh_list); neigh = (struct ospf_neighbor *) HEAD(ifa->neigh_list);
if ((!EMPTY_LIST(ifa->neigh_list)) && (neigh->state == NEIGHBOR_FULL) && (ifa->cost <= 0xffff)) if ((!EMPTY_LIST(ifa->neigh_list)) && (neigh->state == NEIGHBOR_FULL) && (ifa->cost <= 0xffff))
add_rt2_lsa_link(po, LSART_VLNK, neigh->rid, ipa_to_u32(ifa->addr->ip), ifa->cost), i++; add_rt2_lsa_link(po, LSART_VLNK, neigh->rid, ipa_to_u32(ifa->addr->ip), link_cost), i++;
break; break;
default: default: