# File lib/vmstat/netopenbsd.rb, line 23
  def self.network_interfaces
    bytes = `netstat -ibq`.lines.grep(/<Link>/) # bytes
    pkgs = `netstat -iqd`.lines.grep(/<Link>/) # packages
  
    itf = Hash.new { |h, k| h[k] = NetworkInterface.new(k) }
  
    bytes.each do |line|
      # Name Mtu Network Address Ibytes Obytes
      name, _, _, _, ibytes, obytes = line.split(/\s+/)
      itf[name].in_bytes = ibytes.to_i
      itf[name].out_bytes = obytes.to_i
    end
  
    pkgs.each do |line| 
      # Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Colls Drop
      name, _, _, _, _, ierrs, _, oerrs, _, drop = line.split(/\s+/)
      itf[name].in_errors = ierrs.to_i
      itf[name].in_drops = drop.to_i
      itf[name].out_errors = oerrs.to_i
    end
    
    itf.each do |name, nic|
      if name =~ /lo\d+/ 
        nic.type = NetworkInterface::LOOPBACK_TYPE
      else
        nic.type = NetworkInterface::ETHERNET_TYPE
      end
    end
  
    itf.values      
  end