summaryrefslogtreecommitdiff
path: root/nest/rt-table.c
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2017-04-05 15:11:10 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2017-04-12 16:05:56 +0200
commit7ee07a3c3966ec787bcb7e5100c1add4abef9213 (patch)
tree5cd09824b5c7470e6aa85096c15e23e893fcac24 /nest/rt-table.c
parent97e48b6a18142d1aa11e909d094812f3fff4ea61 (diff)
Nest: Fix route lookup
Diffstat (limited to 'nest/rt-table.c')
-rw-r--r--nest/rt-table.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 73cfc9e2..41f0f649 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -68,12 +68,11 @@ make_tmp_attrs(struct rte *rt, struct linpool *pool)
/* Like fib_route(), but skips empty net entries */
static inline void *
-net_route_ip4(struct fib *f, net_addr_ip4 *n)
+net_route_ip4(rtable *t, net_addr_ip4 *n)
{
net *r;
- while (r = fib_find(f, (net_addr *) n),
- !(r && rte_is_valid(r->routes)) && (n->pxlen > 0))
+ while (r = net_find_valid(t, (net_addr *) n), (!r) && (n->pxlen > 0))
{
n->pxlen--;
ip4_clrbit(&n->prefix, n->pxlen);
@@ -83,12 +82,11 @@ net_route_ip4(struct fib *f, net_addr_ip4 *n)
}
static inline void *
-net_route_ip6(struct fib *f, net_addr_ip6 *n)
+net_route_ip6(rtable *t, net_addr_ip6 *n)
{
net *r;
- while (r = fib_find(f, (net_addr *) n),
- !(r && rte_is_valid(r->routes)) && (n->pxlen > 0))
+ while (r = net_find_valid(t, (net_addr *) n), (!r) && (n->pxlen > 0))
{
n->pxlen--;
ip6_clrbit(&n->prefix, n->pxlen);
@@ -110,12 +108,12 @@ net_route(rtable *tab, const net_addr *n)
case NET_IP4:
case NET_VPN4:
case NET_ROA4:
- return net_route_ip4(&tab->fib, (net_addr_ip4 *) n0);
+ return net_route_ip4(tab, (net_addr_ip4 *) n0);
case NET_IP6:
case NET_VPN6:
case NET_ROA6:
- return net_route_ip6(&tab->fib, (net_addr_ip6 *) n0);
+ return net_route_ip6(tab, (net_addr_ip6 *) n0);
default:
return NULL;