From: Igor Putovny Date: Thu, 22 Feb 2024 14:07:40 +0000 (+0100) Subject: Create and assign net to default route X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4621925ff4f40b856be2e52225e29ba421253eb6;p=thirdparty%2Fbird.git Create and assign net to default route --- diff --git a/proto/aggregator/aggregator.c b/proto/aggregator/aggregator.c index 2c9dfdce8..33edad648 100644 --- a/proto/aggregator/aggregator.c +++ b/proto/aggregator/aggregator.c @@ -1465,6 +1465,10 @@ aggregator_start(struct proto *P) .data = p, }; + struct network *default_net = mb_alloc(P->pool, sizeof(struct network) + sizeof(struct net_addr_ip4)); + net_fill_ip4(default_net->n.addr, (struct ip4_addr) { 0 }, 0); + log("Creating net %p for default route", default_net); + /* Create route attributes with zero nexthop */ struct rta rta = { 0 }; @@ -1484,7 +1488,12 @@ aggregator_start(struct proto *P) arte->rte.next = new_bucket->rte; new_bucket->rte = &arte->rte; new_bucket->count++; + + arte->rte.net = default_net; + default_net->routes = &arte->rte; + HASH_INSERT2(p->routes, AGGR_RTE, p->p.pool, arte); + HASH_INSERT2(p->buckets, AGGR_BUCK, p->p.pool, new_bucket); /* Assign default route to the root */ p->root->bucket = new_bucket;