Skip to content

Commit 0f9baef

Browse files
AlexanderChernikovgpotter2
authored andcommitted
Fix scapy init on FreeBSD.
- Read ipv4 table in read_routes() instead of all, fixing IPv6-only setups. - Address FreeBSD 13 netstat -rnW output change by skipping "nhop" column.
1 parent 32211b4 commit 0f9baef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scapy/arch/unix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def read_routes():
4949
if SOLARIS:
5050
f = os.popen("netstat -rvn -f inet")
5151
elif FREEBSD:
52-
f = os.popen("netstat -rnW") # -W to handle long interface names
52+
f = os.popen("netstat -rnW -f inet") # -W to show long interface names
5353
else:
5454
f = os.popen("netstat -rn -f inet")
5555
ok = 0
@@ -71,7 +71,7 @@ def read_routes():
7171
mtu_present = "mtu" in line
7272
prio_present = "prio" in line
7373
refs_present = "ref" in line # There is no s on Solaris
74-
use_present = "use" in line
74+
use_present = "use" in line or "nhop" in line
7575
continue
7676
if not line:
7777
break

0 commit comments

Comments
 (0)