Bug #1461
closedNFD crashes if system does not support IPv6
0%
Description
In FaceManager we hard-coded that TCP and UDP factory create IPv4 and IPv6 channels:
face-manager.cpp:291:
shared_ptr<TcpChannel> ipv4Channel = factory->createChannel("0.0.0.0", port);
shared_ptr<TcpChannel> ipv6Channel = factory->createChannel("::", port);
face-manager.cpp:
shared_ptr<UdpChannel> v4Channel =
factory->createChannel("0.0.0.0", port, time::seconds(timeout));
shared_ptr<UdpChannel> v6Channel =
factory->createChannel("::", port, time::seconds(timeout));
On platforms that do not support IPv6 (but I guess, there should be a similar problem if platform doesn't support IPv4), this causes exception during Channel creation, which is caught by main:
1397168136.392115 DEBUG: [TcpFactory] Channel [[::]:6363] created
1397168136.409649 FATAL: [Main] open: Address family not supported by protocol
There could be a couple of solutions to the problem. The ideal is to provide config parameter, specifying either explicit ipv4/ipv6 addresses to listen on, or just variable to enable/disable ipv4/ipv6.
Updated by Junxiao Shi over 10 years ago
- Status changed from New to Rejected
Steps to reproduce is incomplete: please spell out which system does not support IPv6, or specify how to configure an supported platform not to support IPv6.
Updated by Alex Afanasyev over 10 years ago
- Status changed from Rejected to New
- Target version changed from v0.1 to Unsupported
I'm moving it to "undetermined" version for now, since it is not that a big deal. This problem was discovered on Raspberry Pi when ipv6 module was not loaded.
I have no idea how to make sure ipv6 is not loaded, but I believe it can be done on any Ubuntu system as well.
Updated by Anonymous over 10 years ago
This problem is actually worse than just the FaceManager being hardcoded. I think we I also use "0.0.0.0" and "::" for the prohibited endpoint sets in Tcp/UdpFactory.
While this can be viewed as a bug for unsupported platforms, I think you could rephrase this as a feature for supported ones. Namely, the ability to restrict NFD to certain endpoints.
Maybe something along the lines of:
- Define
enable_v(4|6) (yes|no)
to allow completely disabling either family (default is yes for both and enable_* statement is implied) - Define
endpoint LocalFaceUri
to specify channels to create (or the keyword could bechannel
,endpoint
is a little more intuitive to me, but whatever you want).
I recall have a channels
configuration section at one point. Maybe it should be brought back for this purpose (with naming to match whatever we go with for item 2).
Also, if we go with the "feature" route, then I would recommend targeting version 2. I'm happy to take the task.
Updated by Alex Afanasyev over 10 years ago
I like the first approach (enabling/disabling ipv4/6). Specifying channels may not be good thing, since the daemon is "supposed" to listen on all interfaces anyways (and I would force this and don't give options to the end-user).
Updated by Anonymous over 10 years ago
- Status changed from In Progress to Code review
Updated by Alex Afanasyev over 10 years ago
- Status changed from Code review to Closed
I think that's it.