1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

poib: assign link-local address according to RFC

RFC 4391 specifies that the IB interface GID should be re-used as IPv6
link-local address.  Since the code in in6_get_hw_ifid() ignored
IFT_INFINIBAND case, ibX interfaces ended up with the local address
borrowed from some other interface, which is non-compliant.

Use lowest eight bytes from GID for filling the link-local address,
same as Linux.

Reviewed by:	bz (previous version), ae, hselasky, slavash,
Sponsored by:	Mellanox Technologies
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D20006
This commit is contained in:
Konstantin Belousov 2019-04-23 12:23:44 +00:00
parent d86ecbe993
commit c4cc609796
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346596

View File

@ -328,6 +328,14 @@ in6_get_hw_ifid(struct ifnet *ifp, struct in6_addr *in6)
NET_EPOCH_EXIT(et);
return -1;
case IFT_INFINIBAND:
if (addrlen != 20) {
NET_EPOCH_EXIT(et);
return -1;
}
bcopy(addr + 12, &in6->s6_addr[8], 8);
break;
default:
NET_EPOCH_EXIT(et);
return -1;