fib/rib: allow storing void * instead of nexthop index

Robin Jarry rjarry at redhat.com
Wed Jul 31 17:04:32 CEST 2024


Hi Vladimir,

I noticed that the fib/rib APIs (both IPv4 and IPv6) require the next 
hops to be represented as integer indexes. Reading the code, I noticed 
that they are stored as uint64_t with the MSB used for internal 
purposes.

This require either having a contiguous array of nexthop objects and 
choose an index in that array, or store pointer offsets as nexthop 
indexes and do pointer arithmetics to reconstruct the real pointers. 
Both are not very practical and/or hacky.

Would it be possible to store arbitrary pointers? That would mean 
moving that 64th bit information elsewhere.

I'd love to hear what you think on the matter.

Cheers,
Robin



More information about the dev mailing list