Commit ef83a5c5 authored by vieira's avatar vieira Committed by Brian May

Work around non tabular headers in BSD netstat

netstat outputs some headers in BSD (that the Linux version does not)
that are not tabular and were breaking our 'split line into columns
and get nth column' logic. We now skip such headers.

Should fix #141.
parent af9ebd0f
...@@ -67,6 +67,8 @@ def _shl(n, bits): ...@@ -67,6 +67,8 @@ def _shl(n, bits):
def _route_netstat(line): def _route_netstat(line):
cols = line.split(None) cols = line.split(None)
if len(cols) < 3:
return None, None
ipw = _ipmatch(cols[0]) ipw = _ipmatch(cols[0])
maskw = _ipmatch(cols[2]) # linux only maskw = _ipmatch(cols[2]) # linux only
mask = _maskbits(maskw) # returns 32 if maskw is null mask = _maskbits(maskw) # returns 32 if maskw is null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment