Page 1 of 1

Embedded IPv4 Addr in IPv6

Posted: Wed Aug 28, 2019 7:30 am
by SeeCwriter
As I read RFC 2373 about embedding an IPv4 address in an IPv6 address, it says that the IPv4 address is assigned to the low-order bits (0-31). But looking at the IPADDR6 structure, it assumes the IPv4 address is in the high-order bits (95-127). Is this because of big-endian/little-endian issues?

Re: Embedded IPv4 Addr in IPv6

Posted: Thu Sep 19, 2019 12:26 pm
by dciliske
I'm just going to go with: yes.

An IPv6 address is by definition a 128-bit long bit sequence; the IPADDR6 structure is a 128-bit long array of 32-bit values. Since we can only access the 128-bits in 32-bit chunks, we have to slide the window until the correct chunk appears underneath our index. Thus, to get to the "low" order bits for the embedded IPv4 address, you need to slide the window to a higher address.

Re: Embedded IPv4 Addr in IPv6

Posted: Sat Sep 21, 2019 10:49 am
by pbreed
Take a look here:
https://www.iana.org/assignments/iana-i ... stry.xhtml

We map all IPV4 addresses to the space labeled IPv4-mapped Address
In RFC 4291 see 2.5.5.2

Re: Embedded IPv4 Addr in IPv6

Posted: Tue Oct 01, 2019 5:14 am
by Delleem
What's the reason for mapping all IPV4 addresses like that, Pbreed?

Re: Embedded IPv4 Addr in IPv6

Posted: Tue Oct 01, 2019 4:39 pm
by pbreed
So all of the network function calls, send, connect, sendto, receive etc.. can have the same exact interface.
IE IPV4 and IPV6 are treated EXACTLY the same by your code.
You don't have to do ANYTHING different.


Under the hood things are different, but for the user/programmer the interface is identical.
Same for UDP both Send and Receive
Same for listen/accept a TCP connection then query its address...

If you want to convert text to an IP address it works for both a V4 and V6 address...
If you want to printout an address onto a webpage, or console, it works the same....

IE
IPADDR ipa;
ipa=GetAddressFromSomewhere();

printf("%I",ipa);
Will print out a V4 address if its V4 and a V6 if its V6...

(%I is a netburner extension to our printf , spprintf,fdprintf snprintf etc.. that prints IP addresses)