[feisty] scapy crashes using any version of python

Bug #96753 reported by Scott Zawalski
18
Affects Status Importance Assigned to Milestone
scapy (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: scapy

Scapy crashes using python 2.4 or 2.5 in feisty:

/usr/bin/scapy.py
Traceback (most recent call last):
  File "/usr/bin/scapy.py", line 10647, in ?
    class Conf(ConfClass):
  File "/usr/bin/scapy.py", line 10693, in Conf
    route = Route()
  File "/usr/bin/scapy.py", line 1911, in __init__
    self.resync()
  File "/usr/bin/scapy.py", line 1915, in resync
    self.routes = read_routes()
  File "/usr/bin/scapy.py", line 2234, in read_routes
    ifreq = ioctl(s, SIOCGIFADDR,struct.pack("16s16x",iff))
IOError: [Errno 99] Cannot assign requested address

Related branches

Revision history for this message
Dan O'Huiginn (daniel-ohuiginn) wrote :

Thanks for your report. What exactly do you do to make scapy crash in this way? Just starting it from the command-line seems to work OK for me.

Changed in scapy:
assignee: nobody → daniel-ohuiginn
status: Unconfirmed → Needs Info
Revision history for this message
Scott Zawalski (cowbud) wrote :

Huh maybe a recent update fixed this because it now starts fine here as well. Thanks for going over the bug.

Changed in scapy:
status: Needs Info → Rejected
Revision history for this message
Eimann (eimann) wrote :

Please merge/reference to #106768.

Same problem here:
# uname -a
Linux laila 2.6.20-15-generic #2 SMP Sun Apr 15 07:36:31 UTC 2007 i686 GNU/Lin

# python --version
Python 2.5.1c1

# scapy -s test
/usr/bin/scapy:3101: Warning: 'with' will become a reserved keyword in Python 2.6
/usr/bin/scapy:3103: Warning: 'with' will become a reserved keyword in Python 2.6
INFO: Can't open /etc/ethertypes file
Traceback (most recent call last):
  File "/usr/bin/scapy", line 10647, in <module>
    class Conf(ConfClass):
  File "/usr/bin/scapy", line 10693, in Conf
    route = Route()
  File "/usr/bin/scapy", line 1911, in __init__
    self.resync()
  File "/usr/bin/scapy", line 1915, in resync
    self.routes = read_routes()
  File "/usr/bin/scapy", line 2234, in read_routes
    ifreq = ioctl(s, SIOCGIFADDR,struct.pack("16s16x",iff))
IOError: [Errno 99] Cannot assign requested address

Regards,
Dominik

Revision history for this message
Jim Cheetham (jim.cheetham) wrote :

/etc/ethertypes (provided by ebtables) is not relevant to this; fixing that message doesn't fix the fault.

The problem appears to trigger for unconfigured interfaces; I have an eth0 that is not configured at boot time (no cable plugged in to the UTP socket), and 'scapy -h' (which should print out only the usage information, another issue in itself) fails as described. Give the interface an address ('sudo ifconfig eth0 10.10.10.10'), and 'scapy -h' works as desired.

scapy reads /proc/net/route for the interface list, and then tries to gather data about each one. It consults the Flags field, and will continue if the RTF_UP flag is set - this is supposed to represent a state of "route useable" from net/route.h

I'll do some more investigation after the next reboot :-)

Revision history for this message
Jim Cheetham (jim.cheetham) wrote :
Download full text (4.9 KiB)

My scapy (1.0.4-1) cannot be invoked from the command line without crashing :-
$ scapy -h
/usr/bin/scapy:3101: Warning: 'with' will become a reserved keyword in Python 2.6
/usr/bin/scapy:3103: Warning: 'with' will become a reserved keyword in Python 2.6
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump()
Traceback (most recent call last):
  File "/usr/bin/scapy", line 10647, in <module>
    class Conf(ConfClass):
  File "/usr/bin/scapy", line 10693, in Conf
    route = Route()
  File "/usr/bin/scapy", line 1911, in __init__
    self.resync()
  File "/usr/bin/scapy", line 1915, in resync
    self.routes = read_routes()
  File "/usr/bin/scapy", line 2234, in read_routes
    ifreq = ioctl(s, SIOCGIFADDR,struct.pack("16s16x",iff))
IOError: [Errno 99] Cannot assign requested address

I have one interface up, and one interface unconfigured (no cable present at boot time)
$ ifconfig
eth0 Link encap:Ethernet HWaddr <DELETED>
          UP BROADCAST MULTICAST MTU:1500 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
          Interrupt:9 Base address:0x2c00

eth1 Link encap:Ethernet HWaddr <DELETED>
          inet addr:<DELETED> Bcast:<DELETED> Mask:255.255.255.192
          inet6 addr: <DELETED>/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:474 errors:0 dropped:0 overruns:0 frame:0
          TX packets:233 errors:0 dropped:0 overruns:0 carrier:0
          collisions:25 txqueuelen:1000
          RX bytes:214769 (209.7 KiB) TX bytes:22745 (22.2 KiB)
          Interrupt:11 Base address:0x8800

/proc/net/route doesn't seem to offer any differentiation between eth0 and eth1 ... I have no idea if this is correct/valid or not.

$ cat /proc/net/route
Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
eth1 <DELETED> 00000000 0001 0 0 0 C0FFFFFF 0 0 0
eth0 0000FEA9 00000000 0001 0 0 0 0000FFFF 0 0 0
eth1 0000FEA9 00000000 0001 0 0 1000 0000FFFF 0 0 0
eth1 00000000 <DELETED> 0003 0 0 0 00000000 0 0 0
eth0 00000000 00000000 0001 0 0 1000 00000000 0 0 0

(This seems to be the same as the output of netstat)
$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
<DELETED> 0.0.0.0 255.255.255.192 U 0 0 0 eth1
1...

Read more...

Revision history for this message
Scott Kitterman (kitterman) wrote :

Based on the discussion here and the dupe, I'm reopening this and I'll take a look at it.

Changed in scapy:
assignee: daniel-ohuiginn → kitterman
importance: Undecided → Medium
status: Rejected → Confirmed
Revision history for this message
Scott Kitterman (kitterman) wrote :

For me, on the machine I'm testing this on, I have a wired interface defined in /etc/network/interfaces and a wireless interface controlled by networkmanager. When the only active interface is the one defined in /etc/network/interfaces, then scapy works fine. If there is no active interface or if the interface defined in /etc/network/interfaces is not active, it crashes as you all describe. It seems to me that there are two issues here:

1. Crashes when it can't find the network. This is clearly a "Bug" that should be corrected as unexpected input should not crash a program.

2. Doesn't work the network interfaces not defined in /etc/network/interfaces. I think that this is a feature request that those of you using scapy (I don't) should take to the upstream authors and ask them to include in a future release. Talking with them is MUCH more likely to get this added than filing bugs on Launchpad.

Revision history for this message
Jim Cheetham (jim.cheetham) wrote :

I've suggested a fix/workaround on the upstream bug tracker, http://trac.secdev.org/scapy/ticket/40
In the meantime, there's probably enough information in this bug report to get people around the problem.

Revision history for this message
Scott Kitterman (kitterman) wrote :

I tried your suggestion and that works (as in doesn't crash). I also discovered a simple workaround (at least if the unused interface is dhcp). I tried

$ sudo /etc/init.d/networking restart

after dhcp failed to find any leases and went to sleep, no more crash. I'd be curious if the same works for a connection set up for static.

I checked with the current upstream release and this still happens with it, so hopefully they'll do something with your suggestion.

Changed in scapy:
assignee: kitterman → nobody
Revision history for this message
Scott Kitterman (kitterman) wrote :

Attempted to reproduce this in Debian Testing and was unsuccessful. It looks like this is triggered by the way networks are managed in Ubuntu and not necessarily in other distros.

Revision history for this message
Scott Kitterman (kitterman) wrote :

Patch for Gutsy. Added patch system to make this more maintainable, since it's likely Ubuntu unique.

Revision history for this message
Scott Kitterman (kitterman) wrote :

Note that the patch currently FTBFS in the Feisty pbuilder that I have. Also, the scapy package what substantially reworked in Debian after Feisty was frozen, so the packaging of this patch would not work at all with the Feisty scapy version.

Revision history for this message
Scott Kitterman (kitterman) wrote :

FTBFS was due to hard coding Python 2.4 paths in the new Debian scapy package. This fix is included with the proposed fix to Bug #111221 for Gutsy.

Revision history for this message
Scott Kitterman (kitterman) wrote :

For Gutsy.

Changed in scapy:
status: Confirmed → Fix Committed
Changed in scapy:
status: Fix Committed → Fix Released
Revision history for this message
Scott Kitterman (kitterman) wrote :
Download full text (3.9 KiB)

scapy (1.1.1-1ubuntu1) gutsy; urgency=low

  * Merge from Debian unstable. Remaining Ubuntu changes:
    - ubuntuinterface.patch to wrap interface call to prevent crash due to
      call to uninitialized interface.
      Ubuntu unique interface management confounds scapy interface status
      detection (Tested and not reproduced on Debian Testing) (LP: #96753)
    - Change maintainer to MOTU

scapy (1.1.1-1) unstable; urgency=low

  * New upstream release
  * debian/control
    - Added Uploaders: Debian Python Modules Team <email address hidden>
    - build-depends-indep to build-depends: python-all-dev, python-support
    - Changed Suggest: acroread to xpdf
  * debian/python-scapy.install
    - Changed to usr/lib/python2.*/site-packages/scapy.py (Closes: #421603)
  * debian/copyright:
    - Updated download location and author e-mail address
  * Thanks to Scott Kitterman <email address hidden> for his patch

scapy (1.0.5.20-1ubuntu1) gutsy; urgency=low

  * Fix FTBFS due to hard coded Python 2.4 paths in Debian package (LP: #111221)
  * Move Build-Dep-Indep to Build-Dep
  * Wrap interface call to prevent crash due to call to uninitialized interface.
    Ubuntu unique interface management confounds scapy interface status
    detection (Tested and not reproduced on Debian Testing) (LP: #96753)
  * Add cdbs support for simple-patchsys and debian/patches
  * Change maintainer to MOTU

scapy (1.0.5.20-1) unstable; urgency=low

  * New upstream release. (Closes: #407918)
  * Include revision number in debian version. (Closes: #407920)
  * Corrected copyright information. (Closes: #407916)
  * Repacked upstream tarball with latest upstream revision, and
    documented this in README.Debian.
  * Added watch file.
  * Bumped compat level to 5.
  * debian/rules: Switch to CDBS.
  * debian/control:
    - Added Suggest: imagemagick and graphviz, for graph stuff. (Closes: #408130)
    - Added Suggest: python-crypto, needed for decrypting WEP messages.
    - Added Suggest: acroread, gv. (for psdump() and pdfdump())
    - Added Suggest: sox (for VOIP stuff)
    - Added Suggest: python-visual (for trace3D())
  * Removed outdated file `scapy.html'.
  * Thanks to Marcus Better <email address hidden> for his unrelesed version.

scapy (1.0.5-1) unstable; urgency=low

  * New upstream release
  * debian/rules: Updated to new python policy. Thanks to Francisco Moya
    <email address hidden> (Closes: #397958).
  * debian/control:
    - Binary package name changes according to Python Policy (Section 2.2)
    - Added dummy transitional package to provide an upgrade path from scapy.

scapy (1.0.4-1) unstable; urgency=low

  * New maintainer, with permission of previous maintainer
  * New upstream release (Closes: #362655)
  * Lets use scapy as library (Closes: #270267)
  * debian/control
    - Added Suggests: tcpdump

scapy (1.0.2-1) unstable; urgency=low

  * New upstream release (Closes: #346271)
  * debian/control:
    - Changed Depends on python2.3 to python.
    - Bumped Standards-Version to 3.6.1. No change.
    - Added Suggests: python-gnuplot, python-pyx, ebtables

scapy (1.0.0-1) unstable; urgency=low

  * New upstream release (Closes: ...

Read more...

Revision history for this message
Scott Kitterman (kitterman) wrote :

scapy (1.1.1-2ubuntu1) gutsy; urgency=low

  * Merge from Debian unstable. Remaining Ubuntu changes:
    - ubuntuinterface.patch to wrap interface call to prevent crash due to
      call to uninitialized interface.
      Ubuntu unique interface management confounds scapy interface status
      detection (Tested and not reproduced on Debian Testing) (LP: #96753)
    - Change maintainer to MOTU

scapy (1.1.1-2) unstable; urgency=low

  * debian/control
    - XS-Python-Version: >= 2.4 (Closes: #426504)

 -- Scott Kitterman <email address hidden> Wed, 30 May 2007 08:22:55 -0400

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.