-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
CNetwork - implement IPv6 #7030
Conversation
@@ -140,6 +141,25 @@ CNetwork::~CNetwork() | |||
CApplicationMessenger::Get().NetworkMessage(SERVICES_DOWN, 0); | |||
} | |||
|
|||
//Convert a struct sockaddr address to a string, IPv4 and IPv6: | |||
char *CNetwork::GetIpStr(const struct sockaddr *sa, char *s, size_t maxlen) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
I'd like to consider this for Isengard. Objections? |
I don't mind |
I've only gone over this quickly but I'm a bit concerned about how it affects CURL::Parse(we try to find port number by searching for : from the start of the string) and URIUtils::IsHostOnLAN . Has this been tested properly? Also are there changes needed on the windows side to match? I only see changes for NetworkLinux and general |
@Paxxi so no expert judgment :) |
nope, I leave that to the experts :) |
@FernetMenta @Jalle19 is this still acceptable for 15.0? |
@Paxxi's comments haven't been answered yet so I vote no. |
@Jalle19 now I'm not really sure if mine involvement was expected/asked or not. your last comment triggers such feelings from my side but personally I was still waiting for the 'experts judgement' by a 3rd party - not myself. as the original comment was saying - that's bare minimum for start for you (multi-platform code) - but is enough for deploying linux distros - thus I would not be rewriting the rest because I feel bored. I'll be happy to continue and work out other aspects too, just naturally won't be doing that on my own without prior discussion with maintainer's and setting/agreeing on some basics (before other and other code will be rewritten) |
I think it might be a bit too late for isengard at this point.
iOS & OSX: Windows: After it compiled it might need some more user testing (i mean - we should merge it after I* release and see how feedback is over some months). |
thanks for taking the lead. I can look (and will) on to osx and (at least code edit without ability to test) the x86/android. hat is (are there some specialties to install for XCode to get master compiling? according to readme.osx it is "just working") in regards to Windows - unfortunately my last know how is from dos3 and gwbasic. I will ping again when I push some updates. Honestly - I don't know EXACT workflows in the Network code (yet) - specifically if CURL::Parse is something used for ANY fs/net/xx "destination" parsing or not (meaning what to test in details) - but speaking about it because I already rolled out this commit into stable XBian builds those 20 days ago. that means ANY conflicts/problems will for sure be reported sooner or later. |
ach forgot the important - quoting you
I was targeting no change to outside. Can you go into details what I missed ? |
The choice of going with [] for ipv6 addresses is correct I think as it's commonly used. our CURL class should be fixed in a separate pr I think to add ipv6 parsing and unit testing for it before this PR goes in. @mk01 we have CURL and Curl, CURL is our path/url class that handles local and remote paths of any kind. Curl is well it's curl as we all know and love :) just to clarify which one we're talking about it's our internal CURL that I'm worried about and it needs ipv6 parsing anyhow. I can help out with whatever win32 changes are needed once this is in shape to be tested. To further clarify the win32api has two methods of anything that takes a string one ending with A(ansi) and one with W(unicode/widestring), When docs mention ANSI they mean the method takes string in ascii/oem codepage and the network methods should function mostly as on other platforms but they likely live in another header. |
|
thx for the quick tour. with the w32 then you will be fine, all by me introduced functions I found as directly supported - normally I would try to adapt the includes for w32 too, but (really) it was so different and with no installation to check against I simply left it as is... |
indeed that code I missed initially and force pushed later, so maybe you have link for the obsolete first push? can you check this please - if we are looking at the same diffo ((what is the requirement of API version to compile on for osx?)) |
Yes we are looking at the same diff. Former approach:
The new approach is fine for ipv4 addresses i think (as there is only one allowed ip format) - but the ipv6 approach might give some issues (might be out of scope of this PR though as its a new use case for dns lookup here). The former code ensured that the returned ip was properly formatted, the new approach returns the hostname if it contains an ipv6 address. Based on the man page of inet_pton there are multiple supported ipv6 formats. So whatever the format was in hostname will be the format in the returned ip address. Not sure if we would need to return a generic format here. Or even add the "[" "]" to it already - so the caller can use the returned address inside of URLs. Example:
For ipv4 this is fine.
For ipv6 this would be wrong i think (missing brackets)... |
the += is probably some kind of (evidently) wrong habit when assigning value to std::string. thanks for pointing. what particular part makes you say that hostname is returned (instead of IP) ? apropo IPs. I was just going through NetworkLinux.cpp to check/align all it's content and realised there are functions defined with u32 as IP parameter. |
just pushed few changes.
via google I came over it's implementation https://github.com/kmackay/android-ifaddrs which looks to be used on Android for this purpose. it is integrated in the commit - although I'm not sure about XBMC's policy with such injections - it is there for now to be able moving forward. @Memphiz |
Look at my example again and then i mean this assignment mk01@a18e65c#diff-3c53759a9e37920d7538e7aa60223fcaR74 In this case hostname was already an ipv6 and gets assigned 1:1 to the ip address. But there is no common format guaranteed for the ipv6 in that case. (no issue for ipv4 - this is something new because v6 can have multiple formats) up to @koying if its ok to backport lonux code to droid jenkins build this please |
I have no idea on the status of IPV6 in android/NDK and have my hands full, so I'd suggest to ifdef out android for now, if possible, to not be blocking. |
@mk01 you stated you compiled this successfully on osx? Well jenkins says no. Just search for "NetworkLinux.cpp" in the logs: http://jenkins.kodi.tv/job/OSX-64/4503/console |
compiled - and forgot to include it's changes into commit (because having different source dirs for different platforms). doing it right away. |
only interfaces with flag IFF_UP (interface has (some) configuration and is UP - bind() will not fail) (this means non empty interfaces list is sufficient prerequisite to start network services without errors)
specific handler in LinuxNetwork code. Prepare for easy w32 watcher integration.
- fix FreeBSD/OSX MacAddr fetch - fix NetworkInterfaceLinux::IsConnected()
announcements. This avoids unnecessary reconfigurations when IFs are changing back to IFF_UP as part of resuming process.
- remove network api calls from wakeonlan, use new CNetwork API - move HostToIp() to CDNSNameCache / rename to Lookup(), adapt calls accordingly - remove Lookup() failure logging from WakeOnLane (as this is logged in CDNSNameCache itself)
(Upstream commit 254d0d8)
…ockaddr_storage down to socks layer
…ready creating lock.
- remove announcer use from CDNSNameCache - flush name cache from Network on services start/restart (cherry picked from commit 36666d3173633f125f7d3494a8e3c90f365a9d54)
We might want to move ahead with this now, as we're in pre-alpha status right now. |
I would still like to see this merged, as it's early in the v18 cycle and even if we break nightlies for some days, so be it. |
this needs more than just a single additional round. first it needs a rebase, ... |
@mk01 this needs a rebase |
I will close this PR. If there's interest please open a new one (with required changes if needed). |
rewrite of network class(es) for abstracted universal ipv6/v4 support