Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete VIF/MIF exhaustion on systems with many interfaces #71

Open
troglobit opened this issue May 20, 2017 · 8 comments
Open

Complete VIF/MIF exhaustion on systems with many interfaces #71

troglobit opened this issue May 20, 2017 · 8 comments
Assignees
Milestone

Comments

@troglobit
Copy link
Owner

troglobit commented May 20, 2017

On systems with many interfaces smcrouted will fail due to exhaustion of the VIF/MIF space. There is,
per routing table, usually only 32 VIFs (IPv4) and 32 MIFs (IPv6) available in total.

smcrouted should allocate a VIF/MIF per interface on demand instead, and also free unused VIF/MIF on removal of routes. A simple reference count per interface should be sufficient.

@troglobit troglobit added this to the 2.3.0 milestone May 20, 2017
@troglobit
Copy link
Owner Author

troglobit commented May 20, 2017

Related to #55, in that if #71 (this issue) is fixed a SIGHUP of the daemon or smcroute add command would rectify the situation.

@troglobit troglobit self-assigned this May 20, 2017
@troglobit
Copy link
Owner Author

A reference counter for struct iface does not help. All routes coming in to smcrouted, either via the configuration file or smcroutectl, are today translated into a struct mroute, which depends on VIF/MIF already having been set up.

There is a related problem in #55, in particular for non-Linux systems which need an actual IP address for the kernel to enumerate a VIF/MIF. On Linux we can enumerate using the ifindex.

So, my take on how to best handle this issue is to add a list of "requested routes" that do not yet have any inbound or outbound interface enumerated. Then periodically check for new interfaces (with address on non-Linux systems) and add VIFs at runtime. For each new enumerated interface we can add routes, and interfaces to existing matching routes.

This would be a quite extensive change to SMCRoute, which might even affect struct mroute, so I'm postponing this issue until the v2.4 series.

@troglobit troglobit modified the milestones: v2.4, v2.3 May 21, 2017
@troglobit troglobit modified the milestones: v2.4, v2.6 Jul 10, 2017
@rene-d
Copy link

rene-d commented Jan 29, 2019

Hi,
In Linux ifindex is a int (4 bytes), but in the struct iface, the index is stored into a u_short.
On a machine running Docker and tests (creating, destroying bridges and interfaces), I have interface indices greater than 65536, that prevents running smcroute.
It would probably a good idea to change type of this variable to int.

@troglobit
Copy link
Owner Author

@rene-d That's a serious issue and should be reported separately from this one. Could you please file a separate issue so I can schedule a fix for v2.4.4?

@rene-d
Copy link

rene-d commented Jan 29, 2019

Of course. Thanks :)

@troglobit
Copy link
Owner Author

Note to self: on FreeBSD MAXVIFS and MAXMIFS are different, 32 vs 64, so we (may) need to be able to allocate them separately. Hence, the phyint directive may have to be given an optional inet6 flag, or similar. For a first implementation we can assume MAXVIFS and MAXMIFS are of equal size (as they are on Linux).

@FranzKafkaYu
Copy link

@troglobit hello,thanks for your great work.Smcroute is really nice but now I encounter a problem,and the error info is:
Kernel MAXVIFS(32) too small for number of interfaces:Can't allocate memory

Any solutions for this error?

@FranzKafkaYu
Copy link

@troglobit hello,thanks for your great work.Smcroute is really nice but now I encounter a problem,and the error info is: Kernel MAXVIFS(32) too small for number of interfaces:Can't allocate memory

Any solutions for this error?

Update:after using SMCroute v2.5.6,this error disappeared.Sorry to bother u~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants