Commit 9c7077622dd917457ced680a23b7f175769471d9 in the Linux kernel introduces a check to reject too short packets.
Scapy currently hopes that the underlying driver will add a payload if needed, but that is no longer the case, at least under Linux, so we might have to add the payload if needed.
This bug prevents Scapy from working correctly at least under ArchLinux with an Ethernet connexion.
On most Ethernet drivers, the value for net->hard_header_len seem to be 14, which only prevent Scapy from sending frames smaller than the Ethernet header (which is an uncommon use case), so the bug is hard to trigger.
On some drivers however, the value for net->hard_header_len can be (much) higher.
For example, on RNDIS-based links (when sharing a smartphone's Internet connection via USB), this value is set to 58 (14 + 11 * 4) bytes. In such cases, the bug will be triggered when trying to send an ARP request (len(Ether()/ARP()) == 42 < 58) (this prevents Scapy from updating its ARP cache and hence from sending layer 3 packets) or when trying to send a simple ICMP packet (len(Ether()/IP()/ICMP()) == 42 < 58), making Scapy effectively unusable.
Commit 9c7077622dd917457ced680a23b7f175769471d9 in the Linux kernel introduces a check to reject too short packets.
Scapy currently hopes that the underlying driver will add a payload if needed, but that is no longer the case, at least under Linux, so we might have to add the payload if needed.
This bug prevents Scapy from working correctly at least under ArchLinux with an Ethernet connexion.
On most Ethernet drivers, the value for
net->hard_header_lenseem to be 14, which only prevent Scapy from sending frames smaller than the Ethernet header (which is an uncommon use case), so the bug is hard to trigger.On some drivers however, the value for
net->hard_header_lencan be (much) higher.For example, on RNDIS-based links (when sharing a smartphone's Internet connection via USB), this value is set to 58 (14 + 11 * 4) bytes. In such cases, the bug will be triggered when trying to send an ARP request (
len(Ether()/ARP()) == 42 < 58) (this prevents Scapy from updating its ARP cache and hence from sending layer 3 packets) or when trying to send a simple ICMP packet (len(Ether()/IP()/ICMP()) == 42 < 58), making Scapy effectively unusable.