scapy fails to load BPF program
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu on IBM z Systems |
Fix Released
|
Medium
|
Skipper Bug Screeners | ||
scapy (Ubuntu) |
Fix Released
|
Medium
|
Frank Heimes | ||
Hirsute |
Fix Released
|
Medium
|
Frank Heimes |
Bug Description
SRU Bug Template:
=================
[Impact]
* There is an endianess problem in sock_fprog on s390x.
* Compared to bpf_program where an int is used, sock_fprog uses a ushort length field.
* This results in a different layout on big-endian machines and eventually prevents scapy to load BPF programs.
* The fix is to define sock_fprog and copy the field values over from bpf_program.
[Fix]
* 474eb1f6930601e
[Test Case]
* Have an Ubuntu Server 20.04 system or newer installed on LPAR, z/VM or KVM that comes with scapy 2.4.3.
* Run the python test script: 'tlb.py' provided in the original bug descripton
(like: python /bin/tlb.py 191.168.100.100 81 2001)
* Verify the output returned by the python script
* An error that indicates "socket.error: [Errno 22] Invalid argument" that this issue still exists.
[Where problems could occur]
* It's not simply possible to replace ushort by int, since this would break FreeBSD.
* So this got fixed by defining sock_fprog and copying over field values from bpf_program.
* In case the modification is broken it can have an impact on other architectures.
* The fix for PyPy got moved and slightly changed - in case of a problem with the affected versions this may have no or a false effect.
* But the changes are traceable, were discussed upstream in issue 3298, the fix was tested by IBM and is upstream accepted.
* Further more a patched Ubuntu package was build and shared in PPA: https:/
__________
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-
Machine Type = 8562
---Steps to Reproduce---
root@e4943f38d
#!/usr/bin/env python
import argparse
from scapy.all import scapy, sniff, Ether, IP, TCP
def tlb_sniff_cb(dip, dport):
def send_pkt_
del x[IP].chksum
x[IP].dst = dip
if x.haslayer(TCP):
del x[TCP].chksum
return send_pkt_
def main():
parser = argparse.
parser.
parser.
parser.
args = parser.parse_args()
sniff(
if __name__ == "__main__":
main()
root@e4943f38d8
Traceback (most recent call last):
File "/bin/tlb.py", line 33, in <module>
main()
File "/bin/tlb.py", line 29, in main
sniff(
File "/usr/lib/
*arg, **karg)] = iface
File "/usr/lib/
attach_
File "/usr/lib/
s.setsockop
File "/usr/lib/
return getattr(
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:/
This should be picked up by Canonical
Related branches
- Christian Ehrhardt (community): Approve
-
Diff: 137 lines (+105/-1)4 files modifieddebian/changelog (+9/-0)
debian/control (+2/-1)
debian/patches/scapy-lp1908280-hirsute.patch (+93/-0)
debian/patches/series (+1/-0)
tags: | added: architecture-s39064 bugnameltc-188965 severity-medium targetmilestone-inin20041 |
Changed in ubuntu: | |
assignee: | nobody → Skipper Bug Screeners (skipper-screen-team) |
affects: | ubuntu → scapy (Ubuntu) |
tags: | added: universe |
Changed in scapy (Ubuntu): | |
importance: | Undecided → Medium |
Changed in ubuntu-z-systems: | |
importance: | Undecided → Medium |
Changed in scapy (Ubuntu): | |
assignee: | Skipper Bug Screeners (skipper-screen-team) → nobody |
Changed in ubuntu-z-systems: | |
assignee: | nobody → Skipper Bug Screeners (skipper-screen-team) |
description: | updated |
Changed in scapy (Ubuntu Focal): | |
importance: | Undecided → Medium |
Changed in scapy (Ubuntu Groovy): | |
importance: | Undecided → Medium |
Changed in ubuntu-z-systems: | |
status: | Triaged → In Progress |
Changed in scapy (Ubuntu Groovy): | |
status: | New → Incomplete |
Changed in scapy (Ubuntu Focal): | |
status: | New → Incomplete |
The attachment "debdiff for hirsute" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.
[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]