I am working on integrating scapy with twisted, but I ran into this very weird bug on OSX that I can\'t seem to figure out.
Basically I am unable to send a valid TCP pac
I have no hard evidence, but I think this might be related to the ethernet minimum payload size.
From wikipedia:
The minimum payload is 42 octets when 802.1Q tag is present and 46 octets when absent.
Your first example packet was only 40 bytes, so it'd be below the limit in either case. You could experiment with changing the padding from 20 bytes to those values to verify that it stops working at one of the limits.
If so, the behavior makes perfect sense; the OS is rejecting the packet because you aren't giving it enough data to construct a valid packet.