add IPv6 support#189
Conversation
|
I gave this a try and it is not binding to udp6 sockets as expected. |
|
So apparently IPv6 binds require a specific address rather than "::". In my case, a bind to "::" is needed so I can use both my external address and use the link address within my local environment because my cloud provider does not bill for local traffic. |
|
how about to run "xlxd <xlxd_ipv4> <ambed_ipv4> <xlxxd_ipv6>" as root? (xlxd uses both ipv4 and ipv6 address) |
Hi Takayoshi, can you please send me your E-Mail via dvc@rlx.lu Tnx, Luc - |
|
Due to added D-STAR G3 support (it is not IPv6 friendly), current xlxd needs IPv4 address first (IPv4 address is required). |
|
To clarify: G3 needs to provide an IP4 endpoint back to the requestor, so that the terminal knows where to send the DV stream. Terminals do not offer an option for a IPv6 address, nor the address space in the response packet (it's only 4 bytes long). |
|
@jg1uaa thank you. I had determined by reviewing the code that the IPv6 addr should be argv[4]. I did confirm that I can establish an IPv6 connection to the reflector. Thank you for this. The problem remains that I need to bind to 2 v6 IP addresses, a global address and a link address. As currently written there seems to be no way to do this. Normally to bind to all IPv6 interface we would use :: (the IPv6 version of 0.0.0.0). |
|
As a workaround, and acceptable to me, I now have xlxd binding to both the global and link interfaces. I had to change UDP_SOCKET_MAX in cudpsocket.h from 2 to 3 and then in main.cpp I added: g_Reflector.SetListenIp(2, ( argc >= 6 ) ? CIp(argv[5]) : CIp()); to process an additional argument. |
|
Update...while the workaround I specified to listen on both the global and link IPv6 addresses did in fact bind to both sockets, xlxd receives the incoming packets but communicates back using the first configured IPv6 address, creating an asynchronous routing problem. The client therefore does not recognize that xlxd has responded. |
To disable ICOM G3 support function for testing, add new definition.
|
For testing, I added disable ICOM G3 support option. Define DEBUG_NO_G3_SUPPORT at main.h if needed. BTW, how many sockets do we have to open simultaneously? |
|
I can now start xlxd with: xlxd :: <ambed_Ipv4> Of course, I do use terminal mode so will need that to work as well. Here is the output of my netstat -an Unfortunately, this does not seem to actually pass audio for the IPv4 connections. Yet they appear as connected on the dashboard. A tcpdump shows the receipt of the IPv4 packets but the reflector does not seem to respond. If I start xlxd with an IPv6 in the argv[1] field and an IPv4 in the argv[4] field there is no socket opened explicity for IPv4. The ideal use case for my environment would be if I could use: xlxd <xlxd_ipv4> <ambed_ipv4> <xlxd_ipv4/ipv6> <xlxd_ipv4/ipv6> and have everything work, including terminal mode. This is because I'd use 0.0.0.0 for the IPv4 and then 2 specific IPv6s (global and local). Since my transcoders are via remote IPv4 this would be practical. |
Usage: xlxd callsign xlxdip ambedip (xlxdip2) ... (xlxdipX) * X: UDP_SOCKET_MAX
|
I've started like this (real IP addresses from a test server): All the proper sockets seem to be created, although it does also create IPv6 socks for the terminal mode ports (12345, 12346, 40000). I have not yet tested voice operation. Before I do move on to voice testing, is there anything else you want tested in terms of startup and socket creation? Also note that to create the link address sockets I did have to specify the scope in the command line, but this is not unexpected for a link address. |
|
well...? (seeing code) I got it. Class CUdpSocket handles IPv6/IPv4 equivalently, so I think adding CUdpSocket::Open(uint16 uiPort, int af) to selective open. If there is better idea, please tell me. |
Open(uint16 uiPort) -> Open(uint16 uiPort, int af = AF_UNSPEC)
For a while, this code is needed to surpress unwanted UDP port listening. If ICOM will implement G3 on IPv6, this should be reverted.
|
With DEBUG_NO_G3_SUPPORT the Terminal Mode port (40000,12345,12346) are not enabled. |
|
Why not use IPv6 per default? It also support opening a IPv4 connection if the address is translated into the proper format? I attached a modified dual stack class based on the one from XLXD, which I used on an unfinished project, which uses this approach... |
|
Regarding the G3 code, it would make sense to migrate all its ports to use cudpmsgsocket instead of udpsocket, which are functional identical and just do things a little different, to be able to get the incoming local IP of a connection, thus keeping G3 IPv4 only (since there is no IPv6 client in existence). |
|
@yo2loj If all users runs xlxd on Linux, using v4-mapped address will be a choice. But I am an OpenBSD user. *BSD prohibits using v4-mapped address as default for security reason. So using both IPv4 and IPv6 socket implementation is required. And I have a question, does G3 code support multiple client? For example, working G3 with 0.0.0.0 (INADDR_ANY) address, what will happen? If this is causes a problem, I think modified cudpmsgsocket.cpp with multiply sockets might not work. |
|
I have written cudpmsgsocket exactly for this reason, so that G3 works with 0.0.0.0. The methods allow detection of the local IP which is assumed to be known or to be irrelevant in the rest of the code, but not in cudpmsgsocket, since G3 needs it to send it back to the requestor. It can be forced manually in the configuration file for servers behind NAT. |
|
This disucssion is very enlightening to me. The problem that @yo2loj describes as being solved with cudpmsgsocket seems to be what I have encountered in testing, with voice streams breaking because the expected source address in connections back to the requesting client is not seen. |
|
current xlxd requires: but I want to improve: to achieve this, I modified cudpmsgsocket.cpp. Does anyone who can replace to attached file test G3 server with |
|
May I have another suggestion here, to remain compatible?
xlxd <callsign> <comma separated list of IPv4 or IPv6 address> <ambed_ip>
Something like:
|xlxd XLX101 192.168.1.2,[fd::1] 127.0.0.1
- If we have an IPv4 address only it will be the same command line like
before
- If we have an IPv6 address only it will not start G3
- If both addresses will be there, G3 will only use IPv4, the rest
should use both addresses.
|
This is added for CIp(AF_UNSPEC), uninitialized CIp state. CIp() is same as CIp(AF_INET) to have backward compatibility (the default value of CIp() is 0.0.0.0 IPv4 address).
old:
xlxd callsign xlxdip ambedip (xlxdip2 xlxdip3 ... xlxdipX)
new
xlxd callsign xlxdip,(xlxdip2,xlxdip3,...,xlxdipX) ambedip
IP address is comma-separated
All implemented. current limitation is IP addresses should be written IPv4,IPv6 order (the first address should be v4). |
|
Sorry, CUdpSocket::Send(everything) has a bug. |
|
What would be the use case which would require that to happen? A socket instance is used for each connection, so there is only a single IP involved. Unless you are using IPv6 with hybrid addresses, you need a distinct listening socket for each address family. Clients need one per connection, as a connection is from a single IP only. |
|
@yo2loj for example, running xlxd IPv4-1,IPv4-2 <ambed_ip>. |
|
@yo2loj I presented this use case earlier in the thread. I require to bind to 0.0.0.0 on IPv4 and to an IPv6 link local and an IPv6 global address. If I could use 0.0.0.0 and :: that might work as my transcoding is not on the loopback interface at this time. |
|
This is how sockets using the IP protocol work. They send ONLY from the source address of the interface they are bound to. And regarding ::, it works, I use applications that bind to that address without any issues. So there is definitively something wrong with this approach. |
|
To clarify my use case and prevent misundertanding, all of my IP addresses, whether v4 or v6 are tied to the same physical interface. This not a multiple interface use case. Really, just 0.0.0.0 and :: will work fine for me. I presented the need for the global and local IP6 addresses because :: did not work when I tested an earlier iteration. |
|
Ok, I have pushed my version of the IPv6 support on own repositories, if you like to test and compare... It works with IPv4 while listening on [::], but I have no IPv6 client to test with. LE: Up and running, bound to [::] - everything seems to be fine, all IPv4 clients are back and transcoding is working. |
|
Ok. I also fixed the disconnect bug on ICMP... So this should be it. I will leave it running on XLX227. No change in the dashbord for now. Feel free to test. There is also a Peanut access for module B which is usually free. |
|
Regarding the question with 2 different IP addresses: that's not possible in the current code. It uses a single socket for listening to each port. So unless someone wants to radically change the software architecture, I see no solution for this.
|
|
@yo2loj code also running on XLXIP6. |
|
Now we need to decide which way to go... |
|
@yo2loj Just now I thought using ipv4-mapped-ipv6 address on IPv4/v6 dual socket implementation. Maybe it works same as IPv6 socket only implementation? IMHO, I have no reason to object against using ipv4-mapped-ipv6 address (simple code is the best way to maintain, I think so!). But dual socket would be required from the point of view of flexible configuration for users. |
|
I am not sure if this is applicable to the reflector software, but there have long been security concerns about ipv4-mapped-ipv6 addresses. https://tools.ietf.org/html/draft-itojun-v6ops-v4mapped-harmful-02 |
|
@jg1ua yes, the addresses become 0::FFFF. and are handle just as any other IPv6. The same sockaddr size, the same structures in sin6. |
|
@yo2loj Marius, I had been running your IPv6 code for some months now and it works fine and it is completely stable. However, I just upgraded to the latest xlxd with IMRS support and have lost my IPv6 capability. Would you please consider updating your branch so that it can be merged here and then issue a PR? Perhaps @LX3JL would then consider adding to the master... |
|
I tried to update the code before the IMRS support and had issues with the stability of the build (it crashed somehow every 1-2 weeks). If the current code stabilizes, I will do an migration of the IPv6 code. Unfortunately I am a little pressed for the moment and don't have the necessary time. But the upcoming December would be an excellent option. |
|
continue to #205 |
No need to say. This is reconstruction of previous PR, #122 or #162.
Brandmeister and MMDVMHost/DMRGateway is already IPv6 supported, how about xlxd?