diff --git a/lib/linux_admin/network_interface.rb b/lib/linux_admin/network_interface.rb index 1159478..32d010a 100644 --- a/lib/linux_admin/network_interface.rb +++ b/lib/linux_admin/network_interface.rb @@ -42,7 +42,7 @@ def self.new(*args) end # @return [String] the interface for networking operations - attr_reader :interface + attr_reader :interface, :link_type # @param interface [String] Name of the network interface to manage def initialize(interface) @@ -61,7 +61,8 @@ def reload return false end - addr_info = ip_output["addr_info"] + @link_type = ip_output["link_type"] + addr_info = ip_output["addr_info"] parse_ip4(addr_info) parse_ip6(addr_info, "global") @@ -75,6 +76,10 @@ def reload true end + def loopback? + @link_type == "loopback" + end + # Retrieve the IPv4 address assigned to the interface # # @return [String] IPv4 address for the managed interface