Embedded IPv4 Addr in IPv6
-
- Posts: 624
- Joined: Mon May 12, 2008 10:55 am
Embedded IPv4 Addr in IPv6
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
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.
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.
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: Embedded IPv4 Addr in IPv6
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
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
What's the reason for mapping all IPV4 addresses like that, Pbreed?
Re: Embedded IPv4 Addr in IPv6
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)
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)