# File common/lib/symbiosis/host.rb, line 246 def self.add_ip(ip) interface = self.primary_interface # # Don#t want nils or other junk here. # raise ArgumentError, "ip not an IPAddr, but a #{ip.class.to_s}." unless ip.is_a?(IPAddr) # # Make sure the IP address is fully masked. # ip = ip.mask((ip.ipv4? ? 32 : 128)) raise ArgumentError, "Unable to find primary interface" if interface.nil? # # Don't add IPs that already exist. # raise Errno::EEXIST, ip.to_s if self.ip_addresses.include?(ip) @netlink_socket.addr.add( :index=>interface.index.to_i, :local=>ip.to_s, :prefixlen=>ip.prefixlen ) return nil end