Public bug reported: The scapy sniff() function loads a BPF program into the kernel which apparently fails to load on s390x (Ubuntu 20.04). Contact Information = Alexander Schmidt ---uname output--- Linux pok1-qz1-sr1-rk011-s21 5.4.0-51-generic #56-Ubuntu SMP Mon Oct 5 14:25:32 UTC 2020 s390x s390x s390x GNU/Linux Machine Type = 8562 ---Steps to Reproduce--- root@e4943f38d89b:/# cat /bin/tlb.py #!/usr/bin/env python
import argparse from scapy.all import scapy, sniff, Ether, IP, TCP def tlb_sniff_cb(dip, dport): def send_pkt_to_target_vm(x): x[Ether].src = x[Ether].dst x[Ether].dst = None del x[IP].chksum x[IP].dst = dip if x.haslayer(TCP): del x[TCP].chksum x[TCP].dport = dport scapy.sendrecv.sendp(x) return send_pkt_to_target_vm def main(): parser = argparse.ArgumentParser(description="TLB Simulator") parser.add_argument("dip", help="IP address of the target VM") parser.add_argument("dport", type=int, help="Dst port") parser.add_argument("lport", type=int, help="lb listener port") args = parser.parse_args() sniff(filter="dst port " + str(args.lport), prn=tlb_sniff_cb(args.dip, args.dport)) if __name__ == "__main__": main() root@e4943f38d89b:/# python /bin/tlb.py 191.168.100.100 81 2001 Traceback (most recent call last): File "/bin/tlb.py", line 33, in <module> main() File "/bin/tlb.py", line 29, in main sniff(filter="dst port " + str(args.lport), prn=tlb_sniff_cb(args.dip, args.dport)) File "/usr/lib/python2.7/dist-packages/scapy/sendrecv.py", line 731, in sniff *arg, **karg)] = iface File "/usr/lib/python2.7/dist-packages/scapy/arch/linux.py", line 578, in __init__ attach_filter(self.ins, filter, iface) File "/usr/lib/python2.7/dist-packages/scapy/arch/linux.py", line 165, in attach_filter s.setsockopt(socket.SOL_SOCKET, SO_ATTACH_FILTER, bp) File "/usr/lib/python2.7/socket.py", line 229, in meth return getattr(self._sock,name)(*args) socket.error: [Errno 22] Invalid argument Stack trace output: no Oops output: no System Dump Info: The system is not configured to capture a system dump. *Additional Instructions for Alexander Schmidt: -Attach sysctl -a output output to the bug. Upstream is fixed: https://github.com/secdev/scapy/commit/474eb1f6930601e444227445f9e315b35c06a996. It's a bit more complicated than s/int/ushort/, because that would break FreeBSD. This should be picked up by Canonical ** Affects: scapy (Ubuntu) Importance: Undecided Assignee: Skipper Bug Screeners (skipper-screen-team) Status: New ** Tags: architecture-s39064 bugnameltc-188965 severity-medium targetmilestone-inin20041 ** Tags added: architecture-s39064 bugnameltc-188965 severity-medium targetmilestone-inin20041 ** Changed in: ubuntu Assignee: (unassigned) => Skipper Bug Screeners (skipper-screen-team) ** Package changed: ubuntu => scapy (Ubuntu) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1908280 Title: Ubuntu 20.04: scapy fails to load BPF program To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/scapy/+bug/1908280/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs