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

Retry until network interfaces become available. #55

Open
crocket opened this issue Mar 16, 2017 · 3 comments
Open

Retry until network interfaces become available. #55

crocket opened this issue Mar 16, 2017 · 3 comments
Milestone

Comments

@crocket
Copy link

crocket commented Mar 16, 2017

During boot, network interfaces could be temporarily unavailable.
After boot, network interfaces can randomly go down and up.

On OpenWrt, during boot, wlan0 goes up lately because it has to establish a connection with another wireless router. /etc/smcroute.conf tries to bind to wlan0 during boot and gives up instantly after a failure.

~# logread | grep smcroute
Wed Mar 15 23:05:28 2017 daemon.notice smcroute[1132]: SMCRoute version 2.0.0 build 160131
Wed Mar 15 23:05:28 2017 daemon.warn smcroute[1132]: Join multicast group, unknown interface wlan0
Wed Mar 15 23:05:28 2017 daemon.warn smcroute[1132]: 32: Invalid inbound IPv4 interface: wlan0

It is desirable for smcroute to retry for a while or for ever whenever network interfaces specified in /etc/smcroute.conf seem to be down during boot or after boot.

With this, smcroute doesn't need -t SEC option and doesn't need to care about the order of programs started during boot.

@troglobit
Copy link
Owner

Reasonable feature request, except that it would require quite a bit of refactoring to achieve. If someone submits a pull request I can have a look at it, but at the moment this is not something I have time to work on, unfortunately.

Background: when a multicast routing daemon starts it registers with the UNIX kernel to get a multicast routing socket. To set up multicast routes in the kernel it also needs to register virtual interfaces, or VIFs, based on actual interfaces. VIFs can basically be any interface that has the MULTICAST flag set, so they don't have to be up yet or anything only exist and not change their ifindex.

Now, smcroute.conf is just one way of setting up multicast routes. Many people start the SMCRoute daemon without a .conf file and the use the client to add and remove routes at runtime, so SMCRoute needs to register all interfaces in the system it can find, not just the ones listed in smcroute.conf.

What I think would be neat to have in SMCRoute is a way to re-enumerate VIFs at runtime if an interface is added or removed. This would be tricky though and in most cases it's easier to just restart SMCRoute, however, in some cases it is crucial to not get any interruptions in established multicast streams.

Also, having a startup delay in SMCRoute can help with other use-cases as well. So even if the above gets implemented I see no reason to remove the new -t SEC option.

@crocket
Copy link
Author

crocket commented Mar 16, 2017

Sure, having -t SEC option doesn't hurt.

@troglobit troglobit added this to the v2.4 milestone May 21, 2017
@troglobit troglobit modified the milestones: v2.4, v2.6 Jul 10, 2017
troglobit added a commit that referenced this issue Nov 2, 2018
We periodically refresh our cache of interfaces, in case an interface
did not have an address at startup/SIGHUP.  On refresh we currently
don't want to add new interfaces (see GitHub issue #55), only refresh
the address of existing ones so we can retry failed IGMP joins.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
@troglobit
Copy link
Owner

The latest couple of releases have slightly improved configuration handling. On systems like Linux and FreeBSD, where interfaces can be "enumerated" to VIFs using ifindex, everything can be set up before an interface gets an IP address. Routing only commences when the kernel has an IP address (in a matching address family) for the given interfaces to a multicast route.

As of v2.5 (soon to be released) this applies also to joining of multicast groups on FreeBSD. SMCRoute now uses the struct ip_mreqn on both Linux and FreeBSD.

However, detecting new interfaces at runtime, probed or added after SMCRoute has started is not supported and still someone to provide a patch for. In cases of startup behavior we still recommend the startup delay -d SEC. External detection using, e.g., netlink on Linux can of course also be used and then SIGHUP smcrouted to activate interfaces and its routes.

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

2 participants