jech / babeld

The Babel routing daemon
http://www.irif.fr/~jch/software/babel/
MIT License
385 stars 92 forks source link

Upper Bound on Interface Count? #83

Closed andrew-hoff closed 2 years ago

andrew-hoff commented 2 years ago

Based on my reading of the get_old_if function, we can have at most 1024 interfaces total for the entire lifetime of the process because we never clean the old_if data structure until shut down. Is this the case or am I misreading the code?

jech commented 2 years ago

No. max_old_if is the size of the allocation of the old_if array, if we exceed its value we will reallocate the array and increase the value of max_old_if. See here: https://github.com/jech/babeld/blob/master/kernel_netlink.c#L668

(I'll see if we can clean up the architecture so this code is no longer needed, though.)

andrew-hoff commented 2 years ago

But doesn't this line imply that if we reallocate enough times, eventually we'll hit an upper bound (MAX_INTERFACES == 1024)? https://github.com/jech/babeld/blob/master/kernel_netlink.c#L660

jech commented 2 years ago

Yes, you're right. Note that if you run babeld with the skip-kernel-setup option (which should be the case under OpenWRT) the old_if table is not used.

Note further that if a new interface appears that has the same name as an old interface, the entry in the table will be reused. I should add some code to remove obsolete entries when enough entries have been freed.

jech commented 2 years ago

Fixed in 4b51a3b.