We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 016276e + 2ea00f4 commit 2881257Copy full SHA for 2881257
lib/linux_admin/network_interface.rb
@@ -42,7 +42,7 @@ def self.new(*args)
42
end
43
44
# @return [String] the interface for networking operations
45
- attr_reader :interface
+ attr_reader :interface, :link_type
46
47
# @param interface [String] Name of the network interface to manage
48
def initialize(interface)
@@ -61,7 +61,8 @@ def reload
61
return false
62
63
64
- addr_info = ip_output["addr_info"]
+ @link_type = ip_output["link_type"]
65
+ addr_info = ip_output["addr_info"]
66
67
parse_ip4(addr_info)
68
parse_ip6(addr_info, "global")
@@ -75,6 +76,10 @@ def reload
75
76
true
77
78
79
+ def loopback?
80
+ @link_type == "loopback"
81
+ end
82
+
83
# Retrieve the IPv4 address assigned to the interface
84
#
85
# @return [String] IPv4 address for the managed interface
0 commit comments