Land #9787, Fix adding IPv6 routes with subnets or CIDR masks

4.x
Brent Cook 2018-04-02 22:57:15 -05:00 committed by Jeffrey Martin
parent d98e85f97c
commit f956bb9943
No known key found for this signature in database
GPG Key ID: 0CD9BBC2AF15F171
1 changed files with 5 additions and 10 deletions

View File

@ -867,15 +867,14 @@ class Core
action = args.shift
case action
when "add", "remove", "del"
subnet = args.shift
subnet, cidr_mask = subnet.split("/")
if Rex::Socket.is_ipv4?(args.first)
if Rex::Socket.is_ip_addr?(args.first)
netmask = args.shift
else
cidr_mask = '32' if cidr_mask.nil?
netmask = Rex::Socket.addr_ctoa(cidr_mask.to_i)
elsif Rex::Socket.is_ip_addr?(subnet)
netmask = Rex::Socket.addr_ctoa(cidr_mask, v6: Rex::Socket.is_ipv6?(subnet))
end
netmask = args.shift if netmask.nil?
@ -886,8 +885,6 @@ class Core
return false
end
gateway = nil
case gateway_name
when /local/i
gateway = Rex::Socket::Comm::Local
@ -2439,8 +2436,6 @@ class Core
all_lines.slice(start..finish)
end
end
end end end end