Fixes in netstat parsing
Pierre LALET <pierre <at> droids-corp.org>
2005-09-02 20:22:41 GMT
I attach a patch that contains two fixes for "netstat -rn" output parsing.
The first one is there because BSD systems add a route for each entry in
the MAC table. On systems running with many interfaces and with many
computers directly seen, this makes Scapy unusable. These entries have
the flags L and c, and I use that to ignore them (tested only on OpenBSD).
The second one is a fix for the netstat calculation. The "netmask = (1L
<< int(netmask))-1" only works with the masks /0, /8, /16, /24 and /32.
But it does not work with others.
I have only looked at that part of the code, but a fast search in the
code shows that the same issue appears in other parts. For example :
- Route:make_route (line 1370),
- Route:ifchange (line 1389),
- Route:ifadd (line 1416).
But I did not have time to check these parts of the code, so for these
ones I'm not sure.
--- scapy.py.orig 2005-08-31 15:26:07.000000000 +0200
+++ scapy.py 2005-08-31 15:26:07.000000000 +0200
<at> <at> -1573,15 +1573,18 <at> <at> if not LINUX:
dest,gw,fl,ref,use,mtu,netif = l.split()[:7]