Removing (struct rta)->cast. Never used.

This commit is contained in:
Jan Moskyto Matejka 2016-06-07 11:46:07 +02:00
parent 4e276a8920
commit 5b208e296f
14 changed files with 19 additions and 39 deletions

View file

@ -397,7 +397,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN,
SET, STRING, BGPMASK, BGPPATH, CLIST, ECLIST, LCLIST, SET, STRING, BGPMASK, BGPPATH, CLIST, ECLIST, LCLIST,
IF, THEN, ELSE, CASE, IF, THEN, ELSE, CASE,
TRUE, FALSE, RT, RO, UNKNOWN, GENERIC, TRUE, FALSE, RT, RO, UNKNOWN, GENERIC,
FROM, GW, NET, MASK, PROTO, SOURCE, SCOPE, CAST, DEST, IFNAME, IFINDEX, FROM, GW, NET, MASK, PROTO, SOURCE, SCOPE, DEST, IFNAME, IFINDEX,
PREFERENCE, PREFERENCE,
ROA_CHECK, ASN, ROA_CHECK, ASN,
LEN, MAXLEN, LEN, MAXLEN,
@ -854,7 +854,6 @@ static_attr:
| PROTO { $$ = f_new_inst(); $$->aux = T_STRING; $$->a2.i = SA_PROTO; } | PROTO { $$ = f_new_inst(); $$->aux = T_STRING; $$->a2.i = SA_PROTO; }
| SOURCE { $$ = f_new_inst(); $$->aux = T_ENUM_RTS; $$->a2.i = SA_SOURCE; } | SOURCE { $$ = f_new_inst(); $$->aux = T_ENUM_RTS; $$->a2.i = SA_SOURCE; }
| SCOPE { $$ = f_new_inst(); $$->aux = T_ENUM_SCOPE; $$->a2.i = SA_SCOPE; $$->a1.i = 1; } | SCOPE { $$ = f_new_inst(); $$->aux = T_ENUM_SCOPE; $$->a2.i = SA_SCOPE; $$->a1.i = 1; }
| CAST { $$ = f_new_inst(); $$->aux = T_ENUM_RTC; $$->a2.i = SA_CAST; }
| DEST { $$ = f_new_inst(); $$->aux = T_ENUM_RTD; $$->a2.i = SA_DEST; $$->a1.i = 1; } | DEST { $$ = f_new_inst(); $$->aux = T_ENUM_RTD; $$->a2.i = SA_DEST; $$->a1.i = 1; }
| IFNAME { $$ = f_new_inst(); $$->aux = T_STRING; $$->a2.i = SA_IFNAME; } | IFNAME { $$ = f_new_inst(); $$->aux = T_STRING; $$->a2.i = SA_IFNAME; }
| IFINDEX { $$ = f_new_inst(); $$->aux = T_INT; $$->a2.i = SA_IFINDEX; } | IFINDEX { $$ = f_new_inst(); $$->aux = T_INT; $$->a2.i = SA_IFINDEX; }

View file

@ -905,7 +905,6 @@ interpret(struct f_inst *what)
case SA_PROTO: res.val.s = rta->src->proto->name; break; case SA_PROTO: res.val.s = rta->src->proto->name; break;
case SA_SOURCE: res.val.i = rta->source; break; case SA_SOURCE: res.val.i = rta->source; break;
case SA_SCOPE: res.val.i = rta->scope; break; case SA_SCOPE: res.val.i = rta->scope; break;
case SA_CAST: res.val.i = rta->cast; break;
case SA_DEST: res.val.i = rta->dest; break; case SA_DEST: res.val.i = rta->dest; break;
case SA_IFNAME: res.val.s = rta->nh.iface ? rta->nh.iface->name : ""; break; case SA_IFNAME: res.val.s = rta->nh.iface ? rta->nh.iface->name : ""; break;
case SA_IFINDEX: res.val.i = rta->nh.iface ? rta->nh.iface->index : 0; break; case SA_IFINDEX: res.val.i = rta->nh.iface ? rta->nh.iface->index : 0; break;

View file

@ -174,10 +174,9 @@ void val_format(struct f_val v, buffer *buf);
#define SA_PROTO 4 #define SA_PROTO 4
#define SA_SOURCE 5 #define SA_SOURCE 5
#define SA_SCOPE 6 #define SA_SCOPE 6
#define SA_CAST 7 #define SA_DEST 8
#define SA_DEST 8 #define SA_IFNAME 9
#define SA_IFNAME 9 #define SA_IFINDEX 10
#define SA_IFINDEX 10
struct f_tree { struct f_tree {

View file

@ -78,7 +78,6 @@ CF_KEYWORDS(GRACEFUL, RESTART, WAIT, MAX, FLUSH, AS)
CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIRECT, CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIRECT,
RIP, OSPF, OSPF_IA, OSPF_EXT1, OSPF_EXT2, BGP, PIPE, BABEL) RIP, OSPF, OSPF_IA, OSPF_EXT1, OSPF_EXT2, BGP, PIPE, BABEL)
CF_ENUM(T_ENUM_SCOPE, SCOPE_, HOST, LINK, SITE, ORGANIZATION, UNIVERSE, UNDEFINED) CF_ENUM(T_ENUM_SCOPE, SCOPE_, HOST, LINK, SITE, ORGANIZATION, UNIVERSE, UNDEFINED)
CF_ENUM(T_ENUM_RTC, RTC_, UNICAST, BROADCAST, MULTICAST, ANYCAST)
CF_ENUM(T_ENUM_RTD, RTD_, UNICAST, BLACKHOLE, UNREACHABLE, PROHIBIT) CF_ENUM(T_ENUM_RTD, RTD_, UNICAST, BLACKHOLE, UNREACHABLE, PROHIBIT)
CF_ENUM(T_ENUM_ROA, ROA_, UNKNOWN, VALID, INVALID) CF_ENUM(T_ENUM_ROA, ROA_, UNKNOWN, VALID, INVALID)

View file

@ -358,13 +358,10 @@ typedef struct rta {
struct hostentry *hostentry; /* Hostentry for recursive next-hops */ struct hostentry *hostentry; /* Hostentry for recursive next-hops */
ip_addr from; /* Advertising router */ ip_addr from; /* Advertising router */
u32 igp_metric; /* IGP metric to next hop (for iBGP routes) */ u32 igp_metric; /* IGP metric to next hop (for iBGP routes) */
u32 bf[0]; u8 source; /* Route source (RTS_...) */
u32 source:6; /* Route source (RTS_...) */ u8 scope; /* Route scope (SCOPE_... -- see ip.h) */
u32 scope:6; /* Route scope (SCOPE_... -- see ip.h) */ u8 dest; /* Route destination type (RTD_...) */
u32 cast:6; /* Casting type (RTC_...) */ u8 aflags;
u32 dest:6; /* Route destination type (RTD_...) */
// u32 eflags:8; /* Flags (RTAF_...) */
u32 aflags:8;
struct nexthop nh; /* Next hop */ struct nexthop nh; /* Next hop */
} rta; } rta;

View file

@ -1008,7 +1008,9 @@ rta_hash(rta *a)
MIX(hostentry); MIX(hostentry);
MIX(from); MIX(from);
MIX(igp_metric); MIX(igp_metric);
mem_hash_mix(&h, a->bf, sizeof(u32)); MIX(source);
MIX(scope);
MIX(dest);
#undef MIX #undef MIX
return mem_hash_value(&h) ^ nexthop_hash(&(a->nh)) ^ ea_hash(a->eattrs); return mem_hash_value(&h) ^ nexthop_hash(&(a->nh)) ^ ea_hash(a->eattrs);
@ -1020,7 +1022,6 @@ rta_same(rta *x, rta *y)
return (x->src == y->src && return (x->src == y->src &&
x->source == y->source && x->source == y->source &&
x->scope == y->scope && x->scope == y->scope &&
x->cast == y->cast &&
x->dest == y->dest && x->dest == y->dest &&
x->igp_metric == y->igp_metric && x->igp_metric == y->igp_metric &&
ipa_equal(x->nh.gw, y->nh.gw) && ipa_equal(x->nh.gw, y->nh.gw) &&
@ -1163,11 +1164,10 @@ rta_dump(rta *a)
"RTS_STAT_DEV", "RTS_REDIR", "RTS_RIP", "RTS_STAT_DEV", "RTS_REDIR", "RTS_RIP",
"RTS_OSPF", "RTS_OSPF_IA", "RTS_OSPF_EXT1", "RTS_OSPF", "RTS_OSPF_IA", "RTS_OSPF_EXT1",
"RTS_OSPF_EXT2", "RTS_BGP", "RTS_PIPE", "RTS_BABEL" }; "RTS_OSPF_EXT2", "RTS_BGP", "RTS_PIPE", "RTS_BABEL" };
static char *rtc[] = { "", " BC", " MC", " AC" };
static char *rtd[] = { "", " DEV", " HOLE", " UNREACH", " PROHIBIT" }; static char *rtd[] = { "", " DEV", " HOLE", " UNREACH", " PROHIBIT" };
debug("p=%s uc=%d %s %s%s%s h=%04x", debug("p=%s uc=%d %s %s%s h=%04x",
a->src->proto->name, a->uc, rts[a->source], ip_scope_text(a->scope), rtc[a->cast], a->src->proto->name, a->uc, rts[a->source], ip_scope_text(a->scope),
rtd[a->dest], a->hash_key); rtd[a->dest], a->hash_key);
if (!(a->aflags & RTAF_CACHED)) if (!(a->aflags & RTAF_CACHED))
debug(" !CACHED"); debug(" !CACHED");
@ -1213,10 +1213,9 @@ rta_show(struct cli *c, rta *a, ea_list *eal)
{ {
static char *src_names[] = { "dummy", "static", "inherit", "device", "static-device", "redirect", static char *src_names[] = { "dummy", "static", "inherit", "device", "static-device", "redirect",
"RIP", "OSPF", "OSPF-IA", "OSPF-E1", "OSPF-E2", "BGP", "pipe" }; "RIP", "OSPF", "OSPF-IA", "OSPF-E1", "OSPF-E2", "BGP", "pipe" };
static char *cast_names[] = { "unicast", "broadcast", "multicast", "anycast" };
int i; int i;
cli_printf(c, -1008, "\tType: %s %s %s", src_names[a->source], cast_names[a->cast], ip_scope_text(a->scope)); cli_printf(c, -1008, "\tType: %s %s", src_names[a->source], ip_scope_text(a->scope));
if (!eal) if (!eal)
eal = a->eattrs; eal = a->eattrs;
for(; eal; eal=eal->next) for(; eal; eal=eal->next)

View file

@ -78,7 +78,6 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad)
.src = src, .src = src,
.source = RTS_DEVICE, .source = RTS_DEVICE,
.scope = SCOPE_UNIVERSE, .scope = SCOPE_UNIVERSE,
.cast = RTC_UNICAST,
.dest = RTD_UNICAST, .dest = RTD_UNICAST,
.nh = { .nh = {
.iface = ad->iface .iface = ad->iface

View file

@ -1439,7 +1439,6 @@ bgp_decode_nlri(struct bgp_parse_state *s, u32 afi, byte *nlri, uint len, ea_lis
a->source = RTS_BGP; a->source = RTS_BGP;
a->scope = SCOPE_UNIVERSE; a->scope = SCOPE_UNIVERSE;
a->cast = RTC_UNICAST;
a->dest = RTD_UNREACHABLE; a->dest = RTD_UNREACHABLE;
a->from = s->proto->cf->remote_ip; a->from = s->proto->cf->remote_ip;
a->eattrs = ea; a->eattrs = ea;

View file

@ -1951,7 +1951,6 @@ again1:
.src = p->p.main_source, .src = p->p.main_source,
.source = nf->n.type, .source = nf->n.type,
.scope = SCOPE_UNIVERSE, .scope = SCOPE_UNIVERSE,
.cast = RTC_UNICAST
}; };
nexthop_link(&a0, nf->n.nhs); nexthop_link(&a0, nf->n.nhs);

View file

@ -147,7 +147,6 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en)
.src = p->p.main_source, .src = p->p.main_source,
.source = RTS_RIP, .source = RTS_RIP,
.scope = SCOPE_UNIVERSE, .scope = SCOPE_UNIVERSE,
.cast = RTC_UNICAST
}; };
u8 rt_metric = rt->metric; u8 rt_metric = rt->metric;

View file

@ -124,7 +124,6 @@ rpki_table_add_roa(struct rpki_cache *cache, struct channel *channel, const net_
.src = p->p.main_source, .src = p->p.main_source,
.source = RTS_RPKI, .source = RTS_RPKI,
.scope = SCOPE_UNIVERSE, .scope = SCOPE_UNIVERSE,
.cast = RTC_UNICAST,
.dest = RTD_BLACKHOLE, .dest = RTD_BLACKHOLE,
}; };

View file

@ -71,7 +71,6 @@ static_install(struct proto *p, struct static_route *r)
a.src = p->main_source; a.src = p->main_source;
a.source = ((r->dest == RTD_UNICAST) && ipa_zero(r->via)) ? RTS_STATIC_DEVICE : RTS_STATIC; a.source = ((r->dest == RTD_UNICAST) && ipa_zero(r->via)) ? RTS_STATIC_DEVICE : RTS_STATIC;
a.scope = SCOPE_UNIVERSE; a.scope = SCOPE_UNIVERSE;
a.cast = RTC_UNICAST;
a.dest = r->dest; a.dest = r->dest;
if (r->dest == RTD_UNICAST) if (r->dest == RTD_UNICAST)
{ {
@ -210,13 +209,13 @@ static_add(struct proto *p, struct static_config *cf, struct static_route *r)
} }
if (count) if (count)
static_install(p, r, NULL); static_install(p, r);
break; break;
} }
default: default:
static_install(p, r, NULL); static_install(p, r);
} }
} }
@ -300,7 +299,7 @@ static_update_rte(struct proto *p, struct static_route *r)
return; return;
if (static_decide((struct static_config *) p->cf, r)) if (static_decide((struct static_config *) p->cf, r))
static_install(p, r, r->neigh->iface); static_install(p, r);
else else
static_remove(p, r); static_remove(p, r);
} }
@ -367,7 +366,7 @@ static_if_notify(struct proto *p, unsigned flags, struct iface *i)
{ {
WALK_LIST(r, c->iface_routes) WALK_LIST(r, c->iface_routes)
if (!strcmp(r->if_name, i->name)) if (!strcmp(r->if_name, i->name))
static_install(p, r, i); static_install(p, r);
} }
else if (flags & IF_CHANGE_DOWN) else if (flags & IF_CHANGE_DOWN)
{ {
@ -535,7 +534,7 @@ static_reconfigure(struct proto *p, struct proto_config *CF)
{ {
struct iface *ifa; struct iface *ifa;
if ((ifa = if_find_by_name(r->if_name)) && (ifa->flags & IF_UP)) if ((ifa = if_find_by_name(r->if_name)) && (ifa->flags & IF_UP))
static_install(p, r, ifa); static_install(p, r);
} }
WALK_LIST(r, n->other_routes) WALK_LIST(r, n->other_routes)
static_add(p, n, r); static_add(p, n, r);

View file

@ -147,7 +147,6 @@ krt_capable(rte *e)
rta *a = e->attrs; rta *a = e->attrs;
return return
a->cast == RTC_UNICAST &&
((a->dest == RTD_UNICAST && !a->nh.next) /* No multipath support */ ((a->dest == RTD_UNICAST && !a->nh.next) /* No multipath support */
#ifdef RTF_REJECT #ifdef RTF_REJECT
|| a->dest == RTD_UNREACHABLE || a->dest == RTD_UNREACHABLE
@ -470,7 +469,6 @@ krt_read_route(struct ks_msg *msg, struct krt_proto *p, int scan)
.src = p->p.main_source, .src = p->p.main_source,
.source = RTS_INHERIT, .source = RTS_INHERIT,
.scope = SCOPE_UNIVERSE, .scope = SCOPE_UNIVERSE,
.cast = RTC_UNICAST
}; };
/* reject/blackhole routes have also set RTF_GATEWAY, /* reject/blackhole routes have also set RTF_GATEWAY,

View file

@ -952,9 +952,6 @@ krt_capable(rte *e)
{ {
rta *a = e->attrs; rta *a = e->attrs;
if (a->cast != RTC_UNICAST)
return 0;
switch (a->dest) switch (a->dest)
{ {
case RTD_UNICAST: case RTD_UNICAST:
@ -1345,7 +1342,6 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
ra->src = p->p.main_source; ra->src = p->p.main_source;
ra->source = RTS_INHERIT; ra->source = RTS_INHERIT;
ra->scope = SCOPE_UNIVERSE; ra->scope = SCOPE_UNIVERSE;
ra->cast = RTC_UNICAST;
switch (i->rtm_type) switch (i->rtm_type)
{ {