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