Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scapy/contrib/isotp/isotp_soft_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def __init__(self,

if LINUX and isinstance(can_socket, str):
from scapy.contrib.cansocket_native import NativeCANSocket
can_socket = NativeCANSocket(can_socket)
can_socket = NativeCANSocket(can_socket, fd=fd)
elif isinstance(can_socket, str):
raise Scapy_Exception("Provide a CANSocket object instead")

Expand Down
14 changes: 14 additions & 0 deletions test/contrib/isotp_soft_socket.uts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ from scapy.layers.can import *
from scapy.contrib.isotp import *
from scapy.contrib.isotp.isotp_soft_socket import TimeoutScheduler
from test.testsocket import TestSocket, cleanup_testsockets
with open(scapy_path("test/contrib/automotive/interface_mockup.py")) as f:
exec(f.read())

= Redirect logging
import logging
Expand Down Expand Up @@ -58,6 +60,18 @@ assert sniffed[0]['ISOTP'].rx_ext_address == 0xEA

+ ISOTPSoftSocket tests

= CAN socket FD
~ not_pypy needs_root linux vcan_socket

with ISOTPSoftSocket(iface0, tx_id=0x641, rx_id=0x241, fd=True) as s:
assert s.impl.can_socket.fd == True

= CAN socket non-FD
~ not_pypy needs_root linux vcan_socket

with ISOTPSoftSocket(iface0, tx_id=0x641, rx_id=0x241) as s:
assert s.impl.can_socket.fd == False

= Single-frame receive

with TestSocket(CAN) as cans, TestSocket(CAN) as stim, ISOTPSoftSocket(cans, tx_id=0x641, rx_id=0x241) as s:
Expand Down