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

LAN with IPv4 + IPv6 #56

Closed
nhathaway opened this issue Sep 25, 2014 · 8 comments
Closed

LAN with IPv4 + IPv6 #56

nhathaway opened this issue Sep 25, 2014 · 8 comments
Labels

Comments

@nhathaway
Copy link

There is a problem on LANs with IPv6, where DNS provides both IPv4 and IPv6 addresses. TVHeadend itself only serves on IPv4, even if the box it is on is dual stack. When getting the name (from DNS), TVHGuide picks up the IPv6 address in preference over the IPv4, and tries to connect on IPv6, which results in connection refused.

@rsiebert
Copy link
Owner

Thanks for reporting. I'll look into this.

@rsiebert rsiebert added the bug label Sep 29, 2014
@nhathaway
Copy link
Author

It turns out, you can start up TVHeadend with IPv6 support (the -6 option) but it is not enabled by default. Maybe there needs to be an "IPv4 only" checkbox in the settings.

@rsiebert
Copy link
Owner

Txh. Good to know that this is possible. A setting is probably the best, in
case some people do actually use ipv6.

2014-09-29 11:07 GMT+02:00 Nigel Hathaway notifications@github.com:

It turns out, you can start up TVHeadend with IPv6 support (the -6 option)
but it is not enabled by default. Maybe there needs to be an "IPv4 only"
checkbox in the settings.


Reply to this email directly or view it on GitHub
#56 (comment).

@dstolpmann
Copy link

Another option is to use something like the "Happy Eyeballs" algorithm to choose the protocol.

@rsiebert
Copy link
Owner

rsiebert commented Oct 5, 2014

I looked in the code. See HTSConnection in line 62: System.setProperty("java.net.preferIPv6Addresses", "false");
I can also add this line: System.setProperty("java.net.preferIPv4Stack", "true");
But I can't test this.

@dstolpmann
Copy link

In my opinion the current code looks right.

If you set java.net.preferIPv4Stack to true, IPv6 will be completely disabled.

This is the log while trying to connect via hostname in a dual-stack environment:

E/HTSPConnection(13138): Can't read message
E/HTSPConnection(13138): java.net.ConnectException: failed to connect to HOSTNAME/IPV6-ADDRESS (port 9982): isConnected failed: ECONNREFUSED (Connection refused)
E/HTSPConnection(13138): at libcore.io.IoBridge.isConnected(IoBridge.java:223)
E/HTSPConnection(13138): at java.nio.SocketChannelImpl.finishConnect(SocketChannelImpl.java:259)
E/HTSPConnection(13138): at org.tvheadend.tvhclient.htsp.HTSConnection.processTcpSelectionKey(HTSConnection.java:279)
E/HTSPConnection(13138): at org.tvheadend.tvhclient.htsp.HTSConnection.run(HTSConnection.java:257)
E/HTSPConnection(13138): Caused by: libcore.io.ErrnoException: isConnected failed: ECONNREFUSED (Connection refused)
E/HTSPConnection(13138): at libcore.io.IoBridge.isConnected(IoBridge.java:208)
E/HTSPConnection(13138): ... 3 more
E/HTSPConnection(13138): Can't close connection
E/HTSPConnection(13138): java.nio.channels.ClosedChannelException
E/HTSPConnection(13138): at java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:130)
E/HTSPConnection(13138): at java.nio.channels.SelectableChannel.register(SelectableChannel.java:143)
E/HTSPConnection(13138): at org.tvheadend.tvhclient.htsp.HTSConnection.close(HTSConnection.java:229)
E/HTSPConnection(13138): at org.tvheadend.tvhclient.htsp.HTSConnection.run(HTSConnection.java:273)

@rsiebert
Copy link
Owner

Someone seems to have a similar problem:
http://stackoverflow.com/questions/3853286/java-application-wanting-to-use-both-inet4address-and-inet6address-at-the-same-t
I would need a patch / pull request because I don't have any IPv6 enabled devices here.

@rsiebert
Copy link
Owner

I'm closing this issue. It can be reopened when it is required or a patch has been provided.

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

No branches or pull requests

3 participants