summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-05-04 12:41:54 +0200
committerMaria Matejka <mq@ucw.cz>2022-05-04 15:39:21 +0200
commit702c04fbef222e802ca4dfac645dc75ede522db6 (patch)
treecf962b4003b0e7115ab230924cbdb0775a7cba45
parent0c4e0e4a635169cada395144dd67d1e66f1c9649 (diff)
Removing the route scope attribute. Use custom attributes instead.
The route scope attribute was used for simple user route marking. As there is a better tool for this (custom attributes), the old and limited way can be dropped.
-rw-r--r--doc/bird.sgml8
-rw-r--r--filter/config.Y1
-rw-r--r--filter/data.h1
-rw-r--r--filter/f-inst.c5
-rw-r--r--filter/test.conf26
-rw-r--r--lib/route.h1
-rw-r--r--nest/rt-attr.c8
-rw-r--r--nest/rt-dev.c1
-rw-r--r--proto/babel/babel.c2
-rw-r--r--proto/bgp/packets.c1
-rw-r--r--proto/ospf/rt.c1
-rw-r--r--proto/perf/perf.c1
-rw-r--r--proto/rip/rip.c1
-rw-r--r--proto/rpki/rpki.c1
-rw-r--r--proto/static/static.c1
-rw-r--r--sysdep/bsd/krt-sock.c1
-rw-r--r--sysdep/linux/netlink.c1
17 files changed, 3 insertions, 38 deletions
diff --git a/doc/bird.sgml b/doc/bird.sgml
index a71624aa..aa058b37 100644
--- a/doc/bird.sgml
+++ b/doc/bird.sgml
@@ -1723,14 +1723,6 @@ Common route attributes are:
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.
diff --git a/filter/config.Y b/filter/config.Y
index 7dcdb779..6af39c10 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -766,7 +766,6 @@ static_attr:
| 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); }
diff --git a/filter/data.h b/filter/data.h
index a0a164ed..49b29499 100644
--- a/filter/data.h
+++ b/filter/data.h
@@ -26,7 +26,6 @@ enum f_sa_code {
SA_NET,
SA_PROTO,
SA_SOURCE,
- SA_SCOPE,
SA_DEST,
SA_IFNAME,
SA_IFINDEX,
diff --git a/filter/f-inst.c b/filter/f-inst.c
index 7158d22e..5eacc716 100644
--- a/filter/f-inst.c
+++ b/filter/f-inst.c
@@ -537,7 +537,6 @@
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;
@@ -579,10 +578,6 @@
}
break;
- case SA_SCOPE:
- rta->scope = v1.val.i;
- break;
-
case SA_DEST:
{
int i = v1.val.i;
diff --git a/filter/test.conf2 b/filter/test.conf2
index e95f9563..9fc8330f 100644
--- a/filter/test.conf2
+++ b/filter/test.conf2
@@ -38,12 +38,6 @@ protocol static {
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;
diff --git a/lib/route.h b/lib/route.h
index e02c63b3..40ba150d 100644
--- a/lib/route.h
+++ b/lib/route.h
@@ -86,7 +86,6 @@ typedef struct rta {
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;
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index 87f54b0d..a892bfd5 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -1235,7 +1235,6 @@ rta_hash(rta *a)
#define BMIX(f) mem_hash_mix_num(&h, a->f);
MIX(hostentry);
BMIX(source);
- BMIX(scope);
BMIX(dest);
#undef MIX
@@ -1246,7 +1245,6 @@ static inline int
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)) &&
@@ -1396,8 +1394,8 @@ rta_dump(rta *a)
"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");
@@ -1443,7 +1441,7 @@ rta_dump_all(void)
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++)
diff --git a/nest/rt-dev.c b/nest/rt-dev.c
index 696b37b8..ffd5afd5 100644
--- a/nest/rt-dev.c
+++ b/nest/rt-dev.c
@@ -84,7 +84,6 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad)
rta a0 = {
.source = RTS_DEVICE,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_UNICAST,
.nh.iface = ad->iface,
};
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
index f4503b99..cd221c7b 100644
--- a/proto/babel/babel.c
+++ b/proto/babel/babel.c
@@ -659,7 +659,6 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
rta a0 = {
.source = RTS_BABEL,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_UNICAST,
.nh.gw = r->next_hop,
.nh.iface = r->neigh->ifa->iface,
@@ -685,7 +684,6 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
/* Unreachable */
rta a0 = {
.source = RTS_BABEL,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_UNREACHABLE,
};
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index 9760ebee..62d60e9a 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -2475,7 +2475,6 @@ bgp_decode_nlri(struct bgp_parse_state *s, u32 afi, byte *nlri, uint len, ea_lis
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));
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c
index 3d8cf22c..ddc5b162 100644
--- a/proto/ospf/rt.c
+++ b/proto/ospf/rt.c
@@ -2054,7 +2054,6 @@ again1:
{
rta a0 = {
.source = nf->n.type,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_UNICAST,
.nh = *(nf->n.nhs),
};
diff --git a/proto/perf/perf.c b/proto/perf/perf.c
index 7b18866c..47a2867d 100644
--- a/proto/perf/perf.c
+++ b/proto/perf/perf.c
@@ -144,7 +144,6 @@ perf_loop(void *data)
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,
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index 7c097a92..f5442606 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -153,7 +153,6 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en)
/* Update */
rta a0 = {
.source = RTS_RIP,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_UNICAST,
};
diff --git a/proto/rpki/rpki.c b/proto/rpki/rpki.c
index 710764e2..af963f49 100644
--- a/proto/rpki/rpki.c
+++ b/proto/rpki/rpki.c
@@ -122,7 +122,6 @@ rpki_table_add_roa(struct rpki_cache *cache, struct channel *channel, const net_
rta a0 = {
.source = RTS_RPKI,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_NONE,
};
diff --git a/proto/static/static.c b/proto/static/static.c
index d4b1c5f3..ff833b16 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -56,7 +56,6 @@ static_announce_rte(struct static_proto *p, struct static_route *r)
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);
diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c
index 844b9f83..bc6b1839 100644
--- a/sysdep/bsd/krt-sock.c
+++ b/sysdep/bsd/krt-sock.c
@@ -521,7 +521,6 @@ krt_read_route(struct ks_msg *msg, struct krt_proto *p, int scan)
rta a = {
.src = p->p.main_source,
.source = RTS_INHERIT,
- .scope = SCOPE_UNIVERSE,
};
/* reject/blackhole routes have also set RTF_GATEWAY,
diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index 23d41b56..c506c71c 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -1855,7 +1855,6 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
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]);