In order to make Vyatta/Brocade router work with LPM code I ended up redoing the layout. It is:
/** Tbl24 entry structure. */ struct rte_lpm_tbl24_entry { /* Using single uint8_t to store 3 values. */ uint8_t valid :1; /**< Validation flag. */ uint8_t ext_entry :1; /**< external entry? */ uint8_t depth; /**< Rule depth. */ /* Stores Next hop or group index (i.e. gindex)into tbl8. */ union { uint16_t next_hop; uint16_t tbl8_gindex; }; }; /** Tbl8 entry structure. */ struct rte_lpm_tbl8_entry { uint16_t next_hop; /**< next hop. */ uint8_t depth; /**< Rule depth. */ uint8_t valid :1; /**< Validation flag. */ uint8_t valid_group :1; /**< Group validation flag. */ }; And also several other scalability improvements (plus IPv6) and the correct handling of /32. Unfortunately, this is such a big binary change that I was reluctant to break any tests or applications using existing code and therefore never submitted the patches.