That is exactly what I'm doing. It is necessary to clear and reload the
global array if a subnet is added or deleted, but not when it is aged
(as part of the route expiry system) or the gateway next-hop address
is changed.
The delay is entirely caused by clearing the array. I'm using 'bzero()'
to do that, as that's the fastest way I know of to zero an existing
array, but it still takes 25ms to zero a vector of 16 million shorts.
(Stepping through it with a for loop takes roughly 5 times as long.)
Luckily most changes in the encap routing table are indeed just revisions
to the gateway next-hop address caused by gateways with dynamic addresses
that change. That only takes less than 3ms to do all 600+ subnets.
- Brian
On Tue, May 02, 2017 at 09:16:23AM +0200, Rob Janssen wrote:
Another possibility would be to first scan for the
"common case" of all subnets
and gateways remaining the same but only the endpoint address of one or two
gateways changing, and in that case omit the entire table setup and only patch the
nexthop addresses of those gateways.
Rob