Hi,

I'm nearly done with the implementation of the IPv6 stuff, but I always end up 
with a problem I'm not able to solve.

After conversion from string to binary (RTNETADDRIPV6) we lose some data that 
is necessary for the OS to decide which interface to use.

E.g.:

"[2001:db8::1%interface_identifier]:12345" represents a valid IPv6 address as 
string. 

- The address itself can be converted to RTNETADDRIPV6 ("2001:db8::1")
- The port can be converted to uint16_t/uint32_t (12345)
- The interface identifier can't be converted to anything/anywhere.

So what does the interface identifier do?

In IPv6 the recommended way to assign ip addresses to a system is to add the 
same address to all network interfaces. To be able to select only one interface 
out of the pool, the OS adds a so called "interface identifier", sometimes 
referred to as "scope" to the address string. As of now, the interface 
identifier is not lladdr only.

On Linux the identifier is the interface's name, so this "2001:db8::1%eth0" 
would be the Linux version.

Windows adds the interface index to the address, so this "2001:db8::1%123" is 
the Windows version.

Other systems have to be checked.

The problem with this is, that only the application/library that opens the 
socket should convert the address to binary and then bind to the interface that 
is named in the "interface identifier". So as long as VBox is not the "low 
level" - provider, the interface identifier has to be preserved.

At the moment I'm thinking of creating a struct that holds all the necessary 
information in string representation. As the interface identifier is not 
transmitted over the wire and can have _ANY_ length with _ANY_ character, the 
final size of the struct is not known and I'd have to create a struct that 
holds a pointer to a memory area containing the interface identifier, but I'm 
not sure.

I'm open for any ideas/suggestions/hints/...

KR,

Oliver 



Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
vbox-dev mailing list
[email protected]
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to