summaryrefslogtreecommitdiff
path: root/lib/ipaddress/ipv6.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ipaddress/ipv6.rb')
-rw-r--r--lib/ipaddress/ipv6.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/ipaddress/ipv6.rb b/lib/ipaddress/ipv6.rb
index 6ae651d..57ed143 100644
--- a/lib/ipaddress/ipv6.rb
+++ b/lib/ipaddress/ipv6.rb
@@ -422,6 +422,20 @@ module IPAddress;
@prefix == 128 and @compressed == "::1"
end
+ #
+ # Checks if an IPv4 address objects belongs
+ # to a link-local network RFC4291
+ #
+ # Example:
+ #
+ # ip = IPAddress "fe80::1"
+ # ip.link_local?
+ # #=> true
+ #
+ def link_local?
+ [self.class.new("fe80::/64")].any? {|i| i.include? self}
+ end
+
#
# Returns true if the address is a mapped address
#