diff --git a/filter/config.Y b/filter/config.Y index 7b4178be..94a7e307 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -397,7 +397,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN, SET, STRING, BGPMASK, BGPPATH, CLIST, ECLIST, LCLIST, IF, THEN, ELSE, CASE, 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, ROA_CHECK, ASN, LEN, MAXLEN, @@ -854,7 +854,6 @@ static_attr: | PROTO { $$ = f_new_inst(); $$->aux = T_STRING; $$->a2.i = SA_PROTO; } | 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; } - | 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; } | IFNAME { $$ = f_new_inst(); $$->aux = T_STRING; $$->a2.i = SA_IFNAME; } | IFINDEX { $$ = f_new_inst(); $$->aux = T_INT; $$->a2.i = SA_IFINDEX; } diff --git a/filter/filter.c b/filter/filter.c index 926316ac..bc80997f 100644 --- a/filter/filter.c +++ b/filter/filter.c @@ -905,7 +905,6 @@ interpret(struct f_inst *what) case SA_PROTO: res.val.s = rta->src->proto->name; break; case SA_SOURCE: res.val.i = rta->source; 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_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; diff --git a/filter/filter.h b/filter/filter.h index a4808731..0482b83b 100644 --- a/filter/filter.h +++ b/filter/filter.h @@ -174,10 +174,9 @@ void val_format(struct f_val v, buffer *buf); #define SA_PROTO 4 #define SA_SOURCE 5 #define SA_SCOPE 6 -#define SA_CAST 7 -#define SA_DEST 8 -#define SA_IFNAME 9 -#define SA_IFINDEX 10 +#define SA_DEST 8 +#define SA_IFNAME 9 +#define SA_IFINDEX 10 struct f_tree { diff --git a/nest/config.Y b/nest/config.Y index 95ce59cd..511936ef 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -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, 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_RTC, RTC_, UNICAST, BROADCAST, MULTICAST, ANYCAST) CF_ENUM(T_ENUM_RTD, RTD_, UNICAST, BLACKHOLE, UNREACHABLE, PROHIBIT) CF_ENUM(T_ENUM_ROA, ROA_, UNKNOWN, VALID, INVALID) diff --git a/nest/route.h b/nest/route.h index 37c9abfb..154e027e 100644 --- a/nest/route.h +++ b/nest/route.h @@ -358,13 +358,10 @@ typedef struct rta { struct hostentry *hostentry; /* Hostentry for recursive next-hops */ ip_addr from; /* Advertising router */ u32 igp_metric; /* IGP metric to next hop (for iBGP routes) */ - u32 bf[0]; - u32 source:6; /* Route source (RTS_...) */ - u32 scope:6; /* Route scope (SCOPE_... -- see ip.h) */ - u32 cast:6; /* Casting type (RTC_...) */ - u32 dest:6; /* Route destination type (RTD_...) */ -// u32 eflags:8; /* Flags (RTAF_...) */ - u32 aflags:8; + u8 source; /* Route source (RTS_...) */ + u8 scope; /* Route scope (SCOPE_... -- see ip.h) */ + u8 dest; /* Route destination type (RTD_...) */ + u8 aflags; struct nexthop nh; /* Next hop */ } rta; diff --git a/nest/rt-attr.c b/nest/rt-attr.c index 0eacfe3f..e575ba4a 100644 --- a/nest/rt-attr.c +++ b/nest/rt-attr.c @@ -1008,7 +1008,9 @@ rta_hash(rta *a) MIX(hostentry); MIX(from); MIX(igp_metric); - mem_hash_mix(&h, a->bf, sizeof(u32)); + MIX(source); + MIX(scope); + MIX(dest); #undef MIX 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 && x->source == y->source && x->scope == y->scope && - x->cast == y->cast && x->dest == y->dest && x->igp_metric == y->igp_metric && ipa_equal(x->nh.gw, y->nh.gw) && @@ -1163,11 +1164,10 @@ rta_dump(rta *a) "RTS_STAT_DEV", "RTS_REDIR", "RTS_RIP", "RTS_OSPF", "RTS_OSPF_IA", "RTS_OSPF_EXT1", "RTS_OSPF_EXT2", "RTS_BGP", "RTS_PIPE", "RTS_BABEL" }; - static char *rtc[] = { "", " BC", " MC", " AC" }; static char *rtd[] = { "", " DEV", " HOLE", " UNREACH", " PROHIBIT" }; - debug("p=%s uc=%d %s %s%s%s h=%04x", - a->src->proto->name, a->uc, rts[a->source], ip_scope_text(a->scope), rtc[a->cast], + debug("p=%s uc=%d %s %s%s h=%04x", + a->src->proto->name, a->uc, rts[a->source], ip_scope_text(a->scope), rtd[a->dest], a->hash_key); if (!(a->aflags & RTAF_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", "RIP", "OSPF", "OSPF-IA", "OSPF-E1", "OSPF-E2", "BGP", "pipe" }; - static char *cast_names[] = { "unicast", "broadcast", "multicast", "anycast" }; 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) eal = a->eattrs; for(; eal; eal=eal->next) diff --git a/nest/rt-dev.c b/nest/rt-dev.c index 43628af8..5edd1c5d 100644 --- a/nest/rt-dev.c +++ b/nest/rt-dev.c @@ -78,7 +78,6 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad) .src = src, .source = RTS_DEVICE, .scope = SCOPE_UNIVERSE, - .cast = RTC_UNICAST, .dest = RTD_UNICAST, .nh = { .iface = ad->iface diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 0baa84c9..9c59e6d8 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -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->scope = SCOPE_UNIVERSE; - a->cast = RTC_UNICAST; a->dest = RTD_UNREACHABLE; a->from = s->proto->cf->remote_ip; a->eattrs = ea; diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 09cc5776..d28d463b 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -1951,7 +1951,6 @@ again1: .src = p->p.main_source, .source = nf->n.type, .scope = SCOPE_UNIVERSE, - .cast = RTC_UNICAST }; nexthop_link(&a0, nf->n.nhs); diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 8b09330c..9bed9249 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -147,7 +147,6 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en) .src = p->p.main_source, .source = RTS_RIP, .scope = SCOPE_UNIVERSE, - .cast = RTC_UNICAST }; u8 rt_metric = rt->metric; diff --git a/proto/rpki/rpki.c b/proto/rpki/rpki.c index 6360dbaf..81268e83 100644 --- a/proto/rpki/rpki.c +++ b/proto/rpki/rpki.c @@ -124,7 +124,6 @@ rpki_table_add_roa(struct rpki_cache *cache, struct channel *channel, const net_ .src = p->p.main_source, .source = RTS_RPKI, .scope = SCOPE_UNIVERSE, - .cast = RTC_UNICAST, .dest = RTD_BLACKHOLE, }; diff --git a/proto/static/static.c b/proto/static/static.c index f3cfec01..a63d4d29 100644 --- a/proto/static/static.c +++ b/proto/static/static.c @@ -71,7 +71,6 @@ static_install(struct proto *p, struct static_route *r) a.src = p->main_source; a.source = ((r->dest == RTD_UNICAST) && ipa_zero(r->via)) ? RTS_STATIC_DEVICE : RTS_STATIC; a.scope = SCOPE_UNIVERSE; - a.cast = RTC_UNICAST; a.dest = r->dest; if (r->dest == RTD_UNICAST) { @@ -210,13 +209,13 @@ static_add(struct proto *p, struct static_config *cf, struct static_route *r) } if (count) - static_install(p, r, NULL); + static_install(p, r); break; } 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; if (static_decide((struct static_config *) p->cf, r)) - static_install(p, r, r->neigh->iface); + static_install(p, r); else 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) if (!strcmp(r->if_name, i->name)) - static_install(p, r, i); + static_install(p, r); } else if (flags & IF_CHANGE_DOWN) { @@ -535,7 +534,7 @@ static_reconfigure(struct proto *p, struct proto_config *CF) { struct iface *ifa; 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) static_add(p, n, r); diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c index fbaa8e32..2e0f194b 100644 --- a/sysdep/bsd/krt-sock.c +++ b/sysdep/bsd/krt-sock.c @@ -147,7 +147,6 @@ krt_capable(rte *e) rta *a = e->attrs; return - a->cast == RTC_UNICAST && ((a->dest == RTD_UNICAST && !a->nh.next) /* No multipath support */ #ifdef RTF_REJECT || 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, .source = RTS_INHERIT, .scope = SCOPE_UNIVERSE, - .cast = RTC_UNICAST }; /* reject/blackhole routes have also set RTF_GATEWAY, diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c index 6e75ee53..c9a30719 100644 --- a/sysdep/linux/netlink.c +++ b/sysdep/linux/netlink.c @@ -952,9 +952,6 @@ krt_capable(rte *e) { rta *a = e->attrs; - if (a->cast != RTC_UNICAST) - return 0; - switch (a->dest) { 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->source = RTS_INHERIT; ra->scope = SCOPE_UNIVERSE; - ra->cast = RTC_UNICAST; switch (i->rtm_type) {