Menu

#15 Does not Support IP v6

v0.1.0a
open
nobody
5
2008-01-25
2008-01-25
Doug
No

I'm running Vista and use IP v6 and noticed that there were a couple bugs

1) doest recognize ip v6 Loopback address. In ContextCallback(IAsyncResult ar) {) the local check should be something like this:

IPAddress clientIp = con.Request.RemoteEndPoint.Address;

if (remoteAccess != "true" && (
(clientIp.AddressFamily == AddressFamily.InterNetworkV6 && !clientIp.Equals(IPAddress.IPv6Loopback)) ||
(clientIp.AddressFamily == AddressFamily.InterNetwork && !clientIp.Equals(IPAddress.Loopback)) )){

PrintAccessDenied(con);
return;
}

2) That "return" right after PrintAccessDenied(con) should be included otherwise you code continues to try and render the actual admin page (or save settings page) even thouhg it wont be sent to client.

This then means you need to do the http.BeginGetContext(ContextCallback, http); right after the EndGetContext.

3) the most important, in Beacon() in TivoDotNet.cs you need to check if "Socket.SupportsIPv6" instead of just grabbing the first IP. Here is a little funciton to grab the first valid IP before binding to socket (it uses .NET 3.5 which i converted you solution to):

private IPAddress GetFirstAvailIP() {
AddressFamily validFamily = Socket.SupportsIPv6 ? AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork;

return (from ip in Dns.GetHostAddresses(Dns.GetHostName())
where ip.AddressFamily == validFamily
select ip).First<IPAddress>();
}

Discussion

  • Doug

    Doug - 2008-01-25

    TivoDotNet bug fix

     
  • Doug

    Doug - 2008-01-25

    UI server bug fix

     
  • Doug

    Doug - 2008-01-25

    Logged In: YES
    user_id=1991206
    Originator: YES

    File Added: UIServer.cs

     

Log in to post a comment.

MongoDB Logo MongoDB