Bug 268973 - can't add a different second segment other than 0 when using the fe80::/10 local link range
Summary: can't add a different second segment other than 0 when using the fe80::/10 lo...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 13.1-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-net (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-15 18:49 UTC by nbari
Modified: 2023-01-17 11:02 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nbari 2023-01-15 18:49:46 UTC
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.
Comment 1 Zhenlei Huang freebsd_committer freebsd_triage 2023-01-16 10:12:56 UTC
(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.
Comment 2 Zhenlei Huang freebsd_committer freebsd_triage 2023-01-16 10:15:31 UTC
IIRC FreeBSD use embeded form of Link-Local IPv6 addresses and use some bits internally. Then end user shall not use these bits.
Comment 3 nbari 2023-01-16 11:18:52 UTC
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.
Comment 4 Zhenlei Huang freebsd_committer freebsd_triage 2023-01-17 01:56:11 UTC
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
Comment 5 Alexander V. Chernikov freebsd_committer freebsd_triage 2023-01-17 11:02:43 UTC
To add to Zhenlei's answer: there are plans to remove kernel scope embedding, but there is no firm timeframe attached.