I can't set the following address: fe80:80::1/64 using the command: ifconfig wg.p-test inet6 fe80:80::1 It will create: inet6 fe80::1%wg.p-test prefixlen 64 scopeid 0x7 If I try: fe80:80:80::1 it will set inet6 fe80:0:80::1 The second segment is always set to 0 only when using the fe80 prefix. any idea why this happens? it is a bug or maybe a filter? I am trying to add the IP to a wiregurd VPN interface.
(In reply to nbari from comment #0) See section 2.5.6 of RFC 4291, for Link-Local IPv6 unicast addresses, the first 10 bits are `fe80`, the following 54 bits are zero.
IIRC FreeBSD use embeded form of Link-Local IPv6 addresses and use some bits internally. Then end user shall not use these bits.
Thanks for the reference to RFC section 2.5.6, I was testing a tunnel against a Linux box, and since it works there I thought it could be an issue.
The scope id is stored in second word of IPv6 address. See https://github.com/freebsd/freebsd-src/blob/7f2109f240c2cdb916ca0047422ccfb2a697cee7/sys/netinet6/scope6.c#L468-L501
To add to Zhenlei's answer: there are plans to remove kernel scope embedding, but there is no firm timeframe attached.