class Inspec::Resources::LinuxBridge

Linux Bridge If /sys/class/net/{interface}/bridge exists then it must be a bridge /sys/class/net/{interface}/brif contains the network interfaces @see www.tldp.org/HOWTO/BRIDGE-STP-HOWTO/set-up-the-bridge.html @see unix.stackexchange.com/questions/40560/how-to-know-if-a-network-interface-is-tap-tun-bridge-or-physical

Public Instance Methods

bridge_info(bridge_name) click to toggle source
# File lib/inspec/resources/bridge.rb, line 74
def bridge_info(bridge_name)
  # read bridge information
  bridge = inspec.file("/sys/class/net/#{bridge_name}/bridge").directory?
  return nil unless bridge

  # load interface names
  interfaces = inspec.command("ls -1 /sys/class/net/#{bridge_name}/brif/")
  interfaces = interfaces.stdout.chomp.split("\n")
  {
    name: bridge_name,
    interfaces: interfaces,
  }
end