#5201·scapy

opc_da: `OpcDaFack(selack=None)` now builds silently as zeros instead of failing (since #5095)

Author: IcantFind-a-usernameCreated Sep 26, 2026Updated Sep 26, 2026

Brief description

Since #5095 ("opc_da: fix STDOBJREF IPID and Fack selack field types"), building an OpcDaFack with selack=None succeeds and serializes the entry as zero bytes. Before #5095 the build failed with While building field 'selack': cannot convert 'NoneType' object to bytes.

This is an edge case and may well be acceptable; reporting it in case the silent zero value is not intended, since selack is a list of integers and None is not a valid entry.

Scapy version

master at c5e9a5b0 (2026-09-26)

Python version

3.10

Operating system

Linux (Docker)

Additional environment information

No response

How to reproduce

python
from scapy.contrib.opc_da import OpcDaFack
from scapy.all import raw

pkt = OpcDaFack(selack=None)
print(pkt.selack, pkt.selackLen)   # [None] 0
print(raw(pkt).hex())

Actual result

[None] 0
000000000000000000000000000000000000000000

selackLen stays 0, but the packet is 4 bytes longer than raw(OpcDaFack()) (17 bytes): the None entry is written as a zero integer, so the length field and the list disagree.

Expected result

An error for the invalid None entry, as before, or at least a length field consistent with the list.

Related resources

#5095 (cc @mmadersbacher). Found by differential testing of recent pull requests and reproduced by hand on current master.