File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
lib/facter/util/resolvers/networking
spec/facter/util/resolvers/networking Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ def find_valid_binding(bindings)
66
66
67
67
IPV4_LINK_LOCAL_ADDR = IPAddr . new ( '169.254.0.0/16' ) . freeze # RFC5735
68
68
IPV6_LINK_LOCAL_ADDR = IPAddr . new ( 'fe80::/10' ) . freeze # RFC4291
69
+ IPV6_UNIQUE_LOCAL_ADDR = IPAddr . new ( 'fc00::/7' ) . freeze # RFC4193
69
70
70
71
def ignored_ip_address ( addr )
71
72
return true if addr . empty?
@@ -75,7 +76,8 @@ def ignored_ip_address(addr)
75
76
76
77
[
77
78
IPV4_LINK_LOCAL_ADDR ,
78
- IPV6_LINK_LOCAL_ADDR
79
+ IPV6_LINK_LOCAL_ADDR ,
80
+ IPV6_UNIQUE_LOCAL_ADDR
79
81
] . each do |range |
80
82
return true if range . include? ( ip )
81
83
end
Original file line number Diff line number Diff line change 263
263
end
264
264
end
265
265
266
+ context 'when there is a unique local 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 : 'fdfc:f496:4c6f:0:b0e3:7bff:fe3a:6baf' ,
277
+ netmask : 'ffff:ffff:ffff:ffff::' ,
278
+ network : 'fdfc:f496:4c6f:0::' } ] } }
279
+ }
280
+ end
281
+
282
+ it 'expands the correct binding' do
283
+ expected = {
284
+ ip6 : '::1' ,
285
+ netmask6 : 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' ,
286
+ network6 : '::1' ,
287
+ scope6 : 'host'
288
+ }
289
+
290
+ networking_helper . expand_main_bindings ( networking_facts )
291
+
292
+ expect ( networking_facts [ :interfaces ] [ 'lo0' ] ) . to include ( expected )
293
+ end
294
+ end
295
+
266
296
context 'when there is a global ip address' do
267
297
let ( :networking_facts ) do
268
298
{
You can’t perform that action at this time.
0 commit comments