The existing routing table is an array of structs. Storing the
index+1 into the into the addrs table array requires some index
arithmetic, but that is relatively cheap. Yes, u_short would
save considerable memory.
- Brian
On Mon, May 01, 2017 at 09:11:17PM +0200, Rob Janssen wrote:
Yes. Of course a single pointer would be 8 bytes when
it is compiled for 64 bits,
but it would not need to be. When your existing route table is an array
rather than a collection of malloc'ed objects linked by pointers, the
"pointer"
from the address lookup table into the route table could be the smaller index
into the route table (that would easily fit in an unsigned short integer, allowing
for 65535 gateways).
Or, in 32 bit mode a simple pointer can be used (4 bytes per entry).