Bug 237305 - Multiple sys.netpfil.pf.* tests failing on ^/head and ^/stable/12 because of TypeError with scapy library reading interfaces from bpf
Summary: Multiple sys.netpfil.pf.* tests failing on ^/head and ^/stable/12 because of ...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: tests (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Li-Wen Hsu
Depends on:
Reported: 2019-04-16 01:11 UTC by Enji Cooper
Modified: 2019-04-29 11:09 UTC (History)
2 users (show)

See Also:

Patch from https://github.com/secdev/scapy/pull/1991 (5.73 KB, patch)
2019-04-18 09:41 UTC, Li-Wen Hsu
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer 2019-04-16 01:11:47 UTC
The following tests are failing on amd64/i386 on ^/head and recent back ports to ^/stable/12:


The error message seems to be coming from scapy. From https://ci.freebsd.org/job/FreeBSD-head-amd64-test/10846/testReport/junit/sys.netpfil.pf/forward/v4/ :


Fail: incorrect exit status: 1, expected: 0

Traceback (most recent call last):
  File "/usr/tests/sys/netpfil/pf/pft_ping.py", line 4, in <module>
    import scapy.all as sp
  File "/usr/local/lib/python2.7/site-packages/scapy/all.py", line 27, in <module>
    from scapy.route import *
  File "/usr/local/lib/python2.7/site-packages/scapy/route.py", line 203, in <module>
    conf.iface = get_working_if()
  File "/usr/local/lib/python2.7/site-packages/scapy/arch/bpf/core.py", line 180, in get_working_if
    ifaces = get_working_ifaces()
  File "/usr/local/lib/python2.7/site-packages/scapy/arch/bpf/core.py", line 164, in get_working_ifaces
    interfaces.append((ifname, int(ifname[-1])))
ValueError: invalid literal for int() with base r10: 'a'

Files left in work directory after failure: created_interfaces.lst, created_jails.lst


All in all, this looks like package breakage, but it's resulting in failed tests.
Comment 1 Enji Cooper freebsd_committer 2019-04-16 01:39:38 UTC
This isn't happening on my ^/head@r346039 system, so it might be something related to the CI environment, or something specific to a later revision.
Comment 2 Muhammad Moinur Rahman freebsd_committer 2019-04-16 12:47:06 UTC
Recently I have updated scapy plus some of it's dependency like libdnet. Unfortunately the previous libdnet actually couldn't detect pf/bpf properly and would not compile the relevent codes applicable to a FreeBSD system. So I have changed some detection part and now it compiles with pf/bpf support. I will need to check in details whether if this is a pf issue or scapy issue.

Can anyone please share the pipelines for our builds? Or is it publicly available? I can't login to https://ci.freebsd.org with my freefall creds.
Comment 3 Li-Wen Hsu freebsd_committer 2019-04-16 13:17:19 UTC
(In reply to Muhammad Moinur Rahman from comment #2)
All the codes are available here: https://github.com/freebsd/freebsd-ci
I think you can test by just downloading the test disk image from: 


And install the new scapy to test.
Comment 4 Li-Wen Hsu freebsd_committer 2019-04-16 13:22:12 UTC
I think this might help: https://github.com/secdev/scapy/pull/1990/
Comment 5 Li-Wen Hsu freebsd_committer 2019-04-18 09:41:23 UTC
Created attachment 203760 [details]
Patch from https://github.com/secdev/scapy/pull/1991
Comment 6 commit-hook freebsd_committer 2019-04-18 18:51:30 UTC
A commit references this bug:

Author: lwhsu
Date: Thu Apr 18 18:50:57 UTC 2019
New revision: 499307
URL: https://svnweb.freebsd.org/changeset/ports/499307

  Add a patch from upstream which solves the interface name may not end by digit

  PR:		237305
  Obtained from:	https://github.com/secdev/scapy/pull/1991
  Sponsored by:	The FreeBSD Foundation

Comment 7 Li-Wen Hsu freebsd_committer 2019-04-29 11:09:03 UTC
New package is available on the official mirror and test are passing in the CI system.