Skip to content

Allow specifying interface for IPv6 addresses

Hanicef requested to merge Hanicef/SRB2:allow-percent-ipv6-address into next

in case you didn't know, IPv6 allows you to connect to and use multiple networks simultaneously. this is possible thanks to a feature in IPv6 called scopes, in which you have multiple IP addresses assigned to you and the address that will be picked is based on what the target address and specified interface is.

to illustrate how this works: let's say there are two systems on a network, with system 1 having the address fe80::7a24:afff:fe9f:d0df on interface re0 and system 2 having fe80::dabb:c1ff:fea6:f874 on interface eth0. then, system 1 can connect to system 2 by specifying fe80::dabb:c1ff:fea6:f874%re0 and system 2 can connect to system 1 by specifying fe80::7a24:afff:fe9f:d0df%eth0.

what's important to notice in the example here is that it specifies the remote address but the local interface. this is because a system can have multiple interfaces, each with it's own scopes, and even duplicate addresses between each interface! in such a case, the system would have no way of knowing which interface, and thus which address, to use when connecting, which can cause connection issues if the wrong interface is chosen. this is solved by allowing addresses to contain which interface to use, since that tells the system which local address to use when establishing a connection.

Merge request reports