primary key of the routing table. Read-only. (See the <ref id="routes"
name="chapter about routes">.)
- <tag><label id="rta-scope"><m/enum/ scope</tag>
- The scope of the route. Possible values: <cf/SCOPE_HOST/ for routes
- local to this host, <cf/SCOPE_LINK/ for those specific for a physical
- link, <cf/SCOPE_SITE/ and <cf/SCOPE_ORGANIZATION/ for private routes and
- <cf/SCOPE_UNIVERSE/ for globally visible routes. This attribute is not
- interpreted by BIRD and can be used to mark routes in filters. The
- default value for new routes is <cf/SCOPE_UNIVERSE/.
-
<tag><label id="rta-preference"><m/int/ preference</tag>
Preference of the route.
| NET { $$ = f_new_static_attr(T_NET, SA_NET, 1); }
| PROTO { $$ = f_new_static_attr(T_STRING, SA_PROTO, 1); }
| SOURCE { $$ = f_new_static_attr(T_ENUM_RTS, SA_SOURCE, 1); }
- | SCOPE { $$ = f_new_static_attr(T_ENUM_SCOPE, SA_SCOPE, 0); }
| DEST { $$ = f_new_static_attr(T_ENUM_RTD, SA_DEST, 0); }
| IFNAME { $$ = f_new_static_attr(T_STRING, SA_IFNAME, 0); }
| IFINDEX { $$ = f_new_static_attr(T_INT, SA_IFINDEX, 1); }
SA_NET,
SA_PROTO,
SA_SOURCE,
- SA_SCOPE,
SA_DEST,
SA_IFNAME,
SA_IFINDEX,
case SA_NET: RESULT(sa.type, net, (*fs->rte)->net->n.addr); break;
case SA_PROTO: RESULT(sa.type, s, (*fs->rte)->src->proto->name); break;
case SA_SOURCE: RESULT(sa.type, i, rta->source); break;
- case SA_SCOPE: RESULT(sa.type, i, rta->scope); break;
case SA_DEST: RESULT(sa.type, i, rta->dest); break;
case SA_IFNAME: RESULT(sa.type, s, rta->nh.iface ? rta->nh.iface->name : ""); break;
case SA_IFINDEX: RESULT(sa.type, i, rta->nh.iface ? rta->nh.iface->index : 0); break;
}
break;
- case SA_SCOPE:
- rta->scope = v1.val.i;
- break;
-
case SA_DEST:
{
int i = v1.val.i;
print from;
from = 1.2.3.4;
print from;
- print scope;
- scope = SCOPE_HOST;
- print scope;
- if !(scope ~ [ SCOPE_HOST, SCOPE_SITE ]) then {
- print "Failed in test";
- }
preference = 15;
print preference;
struct hostentry *hostentry; /* Hostentry for recursive next-hops */
u16 cached:1; /* Are attributes cached? */
u16 source:7; /* Route source (RTS_...) */
- u16 scope:4; /* Route scope (SCOPE_... -- see ip.h) */
u16 dest:4; /* Route destination type (RTD_...) */
struct nexthop nh; /* Next hop */
} rta;
#define BMIX(f) mem_hash_mix_num(&h, a->f);
MIX(hostentry);
BMIX(source);
- BMIX(scope);
BMIX(dest);
#undef MIX
rta_same(rta *x, rta *y)
{
return (x->source == y->source &&
- x->scope == y->scope &&
x->dest == y->dest &&
x->hostentry == y->hostentry &&
nexthop_same(&(x->nh), &(y->nh)) &&
"RTS_OSPF_EXT2", "RTS_BGP", "RTS_PIPE", "RTS_BABEL" };
static char *rtd[] = { "", " DEV", " HOLE", " UNREACH", " PROHIBIT" };
- debug("uc=%d %s %s%s h=%04x",
- a->uc, rts[a->source], ip_scope_text(a->scope),
+ debug("uc=%d %s %s h=%04x",
+ a->uc, rts[a->source],
rtd[a->dest], a->hash_key);
if (!a->cached)
debug(" !CACHED");
void
rta_show(struct cli *c, rta *a)
{
- cli_printf(c, -1008, "\tType: %s %s", rta_src_names[a->source], ip_scope_text(a->scope));
+ cli_printf(c, -1008, "\tType: %s", rta_src_names[a->source]);
for(ea_list *eal = a->eattrs; eal; eal=eal->next)
for(int i=0; i<eal->count; i++)
rta a0 = {
.source = RTS_DEVICE,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_UNICAST,
.nh.iface = ad->iface,
};
rta a0 = {
.source = RTS_BABEL,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_UNICAST,
.nh.gw = r->next_hop,
.nh.iface = r->neigh->ifa->iface,
/* Unreachable */
rta a0 = {
.source = RTS_BABEL,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_UNREACHABLE,
};
a = allocz(RTA_MAX_SIZE);
a->source = RTS_BGP;
- a->scope = SCOPE_UNIVERSE;
a->eattrs = ea;
ea_set_attr_data(&a->eattrs, &ea_gen_from, 0, &s->proto->remote_ip, sizeof(ip_addr));
{
rta a0 = {
.source = nf->n.type,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_UNICAST,
.nh = *(nf->n.nhs),
};
if (!p->attrs_per_rte || !(i % p->attrs_per_rte)) {
struct rta a0 = {
.source = RTS_PERF,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_UNICAST,
.nh.iface = p->ifa->iface,
.nh.gw = gw,
/* Update */
rta a0 = {
.source = RTS_RIP,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_UNICAST,
};
rta a0 = {
.source = RTS_RPKI,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_NONE,
};
rta *a = allocz(RTA_MAX_SIZE);
struct rte_src *src = static_get_source(p, r->index);
a->source = RTS_STATIC;
- a->scope = SCOPE_UNIVERSE;
a->dest = r->dest;
ea_set_attr_u32(&a->eattrs, &ea_gen_preference, 0, p->p.main_channel->preference);
rta a = {
.src = p->p.main_source,
.source = RTS_INHERIT,
- .scope = SCOPE_UNIVERSE,
};
/* reject/blackhole routes have also set RTF_GATEWAY,
rta *ra = lp_allocz(s->pool, RTA_MAX_SIZE);
ra->source = RTS_INHERIT;
- ra->scope = SCOPE_UNIVERSE;
if (a[RTA_FLOW])
s->rta_flow = rta_get_u32(a[RTA_FLOW]);