# File lib/simp/cli/config/items/data/simp_options_trusted_nets.rb, line 41 def validate_item( net ) ### warn "'#{net}' doesn't end like a CIDR"; return false if net !~ %r{/\d+$} ### warn "list item '#{net}' is not in proper CIDR notation"; return false if net.split('/').size > 2 subnet,cidr = net.split('/') # NOTE: if we support IPv6, we should redo netmask & validations ### warn "subnet '#{subnet}' is not a valid IP!"; return false if !((subnet =~ Resolv::IPv4::Regex) || (subnet =~ Resolv::IPv6::Regex)) ### warn "/#{cidr} is not a valid CIDR suffix"; return false if !(cidr.to_i >= 0 && cidr.to_i <= 32) true end