Skip to content

Commit

Permalink
Merge pull request #254 from agrare/add_network_interface_loopback
Browse files Browse the repository at this point in the history
Add network interface loopback
  • Loading branch information
bdunne authored Aug 13, 2024
2 parents 016276e + 2ea00f4 commit 2881257
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/linux_admin/network_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
Expand All @@ -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
Expand Down

0 comments on commit 2881257

Please sign in to comment.