rapid7/metasploit-framework — pull request #613 by mephos (2012-07-17 10:03:52+00:00)
Title: linux meterpreter : correct netmask computation for "route" and "ifconfig"

Correct netmask calculation in "ifconfig" and "route" commands for netmask != /8 /16 /24 and /32

for instance, a /25 netmask is 255.255.255.128 and a /26 is 255.255.255.192

in route -n on the linux host

1.1.1.0 192.168.0.1 255.255.255.128 UG 0 0 0 eth0
2.2.2.0 192.168.0.1 255.255.255.192 UG 0 0 0 eth0

before :

meterpreter > route
1.1.1.0 255.255.255.1 192.168.0.1 0 eth0
2.2.2.0 255.255.255.3 192.168.0.1 0 eth0

now :

meterpreter > route
1.1.1.0 255.255.255.128 192.168.0.1 0 eth0
2.2.2.0 255.255.255.192 192.168.0.1 0 eth0