]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Nest: Expand rte_src.private_id to u64
authorOndrej Zajicek <santiago@crfreenet.org>
Mon, 2 Oct 2023 13:09:30 +0000 (15:09 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Mon, 2 Oct 2023 13:09:30 +0000 (15:09 +0200)
In general, private_id is sparse and protocols may want to map some
internal values directly into it. For example, L3VPN needs to
map VPN route discriminators to private_id.

OTOH, u32 is enough for global_id, as these identifiers are dense.

nest/route.h
nest/rt-attr.c
nest/rt-table.c
proto/bgp/packets.c
proto/mrt/mrt.c

index feb1fa60d039989dba18290a3c00abf25e24dec3..4fe43e6ff5bdcfbc81fc1e58d4f7de9dfcbce981 100644 (file)
@@ -439,7 +439,7 @@ struct nexthop {
 struct rte_src {
   struct rte_src *next;                        /* Hash chain */
   struct proto *proto;                 /* Protocol the source is based on */
-  u32 private_id;                      /* Private ID, assigned by the protocol */
+  u64 private_id;                      /* Private ID, assigned by the protocol */
   u32 global_id;                       /* Globally unique ID of the source */
   unsigned uc;                         /* Use count */
 };
index b341ff46381bfa6a758ae4ff407c14759634aabf..9e29abc8f9dcfaf17827917d5efa5fd7b86ca84f 100644 (file)
@@ -101,7 +101,7 @@ static struct idm src_ids;
 #define RSH_KEY(n)             n->proto, n->private_id
 #define RSH_NEXT(n)            n->next
 #define RSH_EQ(p1,n1,p2,n2)    p1 == p2 && n1 == n2
-#define RSH_FN(p,n)            p->hash_key ^ u32_hash(n)
+#define RSH_FN(p,n)            p->hash_key ^ u64_hash(n)
 
 #define RSH_REHASH             rte_src_rehash
 #define RSH_PARAMS             /2, *2, 1, 1, 8, 20
index 8b41ffee11fb5ead5b3a0898332d76fb592d4c00..5e6774651f64467d6678487e2d562e87cd89ee8d 100644 (file)
@@ -675,7 +675,7 @@ rte_mergable(rte *pri, rte *sec)
 static void
 rte_trace(struct channel *c, rte *e, int dir, char *msg)
 {
-  log(L_TRACE "%s.%s %c %s %N %uL %uG %s",
+  log(L_TRACE "%s.%s %c %s %N %luL %uG %s",
       c->proto->name, c->name ?: "?", dir, msg, e->net->n.addr, e->src->private_id, e->src->global_id,
       rta_dest_name(e->attrs->dest));
 }
index fd7828f0c49f9ced5fc5707a57fdf967f5995751..054e6c3c14a4f343f810dd535585fbae8578c88b 100644 (file)
@@ -2499,7 +2499,7 @@ bgp_bmp_encode_rte(struct bgp_channel *c, byte *buf, const net_addr *n,
   /* Sham prefix */
   struct bgp_prefix *px = alloca(prefix_size);
   *px = (struct bgp_prefix) { };
-  px->path_id = src->private_id;
+  px->path_id = (u32) src->private_id;
   net_copy(px->net, n);
   add_tail(&b->prefixes, &px->buck_node);
 
index d1c334e121e0ea175c60a4a70995732e9395a1bc..3378baceced1890e4414aae949c68bc77ee07a46 100644 (file)
@@ -488,7 +488,7 @@ mrt_rib_table_entry(struct mrt_table_dump_state *s, rte *r)
 
   /* Path Identifier */
   if (s->add_path)
-    mrt_put_u32(b, r->src->private_id);
+    mrt_put_u32(b, (u32) r->src->private_id);
 
   /* Route Attributes */
   mrt_put_u16(b, 0);