Skip to content

Commit c273b76

Browse files
committed
(FACT-3171) Fix Link-local unicast range
RFC4291 define the Link-local unicast range as fe80::/10, not fe80::/16. As a consequence some Link-local unicast addresses where not correctly filtered, e.g. fe87::. While here, add a "working" example with an actual global IPv6 address from the 2001:0DB8::/32 range reserved for documentation (RFC3849).
1 parent f5d2b54 commit c273b76

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

lib/facter/util/resolvers/networking/networking.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def find_valid_binding(bindings)
6565
end
6666

6767
IPV4_LINK_LOCAL_ADDR = IPAddr.new('169.254.0.0/16').freeze # RFC5735
68-
IPV6_LINK_LOCAL_ADDR = IPAddr.new('fe80::/16').freeze # RFC4291
68+
IPV6_LINK_LOCAL_ADDR = IPAddr.new('fe80::/10').freeze # RFC4291
6969

7070
def ignored_ip_address(addr)
7171
return true if addr.empty?

spec/facter/util/resolvers/networking/networking_spec.rb

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
expect(networking_facts).to include(expected)
234234
end
235235

236-
context 'when there is a global ip address' do
236+
context 'when there is a link-local ip address' do
237237
let(:networking_facts) do
238238
{
239239
interfaces:
@@ -251,10 +251,40 @@
251251

252252
it 'expands the correct binding' do
253253
expected = {
254-
ip6: 'fe87::1',
254+
ip6: '::1',
255+
netmask6: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
256+
network6: '::1',
257+
scope6: 'host'
258+
}
259+
260+
networking_helper.expand_main_bindings(networking_facts)
261+
262+
expect(networking_facts[:interfaces]['lo0']).to include(expected)
263+
end
264+
end
265+
266+
context 'when there is a global ip address' do
267+
let(:networking_facts) do
268+
{
269+
interfaces:
270+
{ 'lo0' =>
271+
{ mtu: 16_384,
272+
bindings6:
273+
[{ address: '::1',
274+
netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
275+
network: '::1' },
276+
{ address: '2001:0DB8::1',
277+
netmask: 'ffff:ffff:ffff:ffff::',
278+
network: '2001:0DB8::' }] } }
279+
}
280+
end
281+
282+
it 'expands the correct binding' do
283+
expected = {
284+
ip6: '2001:0DB8::1',
255285
netmask6: 'ffff:ffff:ffff:ffff::',
256-
network6: 'fe87::',
257-
scope6: 'link'
286+
network6: '2001:0DB8::',
287+
scope6: 'global'
258288
}
259289

260290
networking_helper.expand_main_bindings(networking_facts)

0 commit comments

Comments
 (0)