[SRU] ufw ValueError when supplying dotted-decimal netmask

Bug #224842 reported by Lestat the vampire
12
Affects Status Importance Assigned to Milestone
ufw (Ubuntu)
Fix Released
Undecided
Jamie Strandboge
Hardy
Fix Released
Undecided
Jamie Strandboge

Bug Description

Binary package hint: ufw

ufw crashed when I typed "sudo ufw allow to 192.168.0.0/255.255.255.0 port 49152" in a terminal.
It seems that I made a mistake in the syntax.

The answer was :
Traceback (most recent call last):
  File "/usr/sbin/ufw", line 1362, in <module>
    (action, rule, type, dryrun) = process_args()
  File "/usr/sbin/ufw", line 178, in process_args
    if valid_address(saddr, True):
  File "/usr/sbin/ufw", line 304, in valid_address
    if int(net[1]) < 0 or int(net[1]) > 128:
ValueError: invalid literal for int() with base 10: '255.255.255.0'

ProblemType: Crash
Architecture: i386
Date: Wed Apr 30 19:55:18 2008
DistroRelease: Ubuntu 8.04
ExecutablePath: /usr/sbin/ufw
InterpreterPath: /usr/bin/python2.5
NonfreeKernelModules: nvidia
Package: ufw 0.16.2
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/sbin/ufw allow to 192.168.0.0/255.255.255.0 port 49152
ProcEnviron:
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
 LANG=fr_FR.UTF-8
 SHELL=/bin/bash
PythonArgs: ['/usr/sbin/ufw', 'allow', 'to', '192.168.0.0/255.255.255.0', 'port', '49152']
SourcePackage: ufw
Title: ufw crashed with ValueError in valid_address()
Uname: Linux 2.6.24-16-generic i686
UserGroups:

Revision history for this message
Lestat the vampire (lestat-vampire) wrote :
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Thank you for using Ubuntu and taking the time to report a bug. Currently ufw supports /INTEGER notation and does not support dotted decimal netmasks. This will change in a future release of Ubuntu. That said, I will submit a patch for a StableReleaseUpdate which will prevent the python traceback.

Changed in ufw:
assignee: nobody → jdstrand
status: New → Triaged
Revision history for this message
Jamie Strandboge (jdstrand) wrote : Re: ufw ValueError when supplying dotted-decimal netmask

=== REQUEST FOR STABLE RELEASE UPDATE ===

1. While the bug does no harm (it exits with error because the netmask is invalid), it is confusing for end users to see a python traceback

2. This has been addressed by adjusted src/ufw to return 'False' in valid_address() with non-integer netmasks, allowing ufw to provide a helpful message rather than a traceback.

3. Patch to src/ufw is 2 lines (without whitespace or comments) and very minimal. Build tests have been updated as well to verify more valid and invalid netmask combinations.

4. TEST CASE:
sudo ufw allow to 192.168.0.0/255.255.255.0

5. It is believed there is no regression potential

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ufw - 0.16.3

---------------
ufw (0.16.3) intrepid; urgency=low

  * prevent traceback with dotted decimal netmasks (LP: #224842)
  * update tests to test for more valid and invalid netmasks

 -- Jamie Strandboge <email address hidden> Wed, 23 Apr 2008 09:52:02 -0400

Changed in ufw:
status: Triaged → Fix Released
Changed in ufw:
assignee: nobody → jdstrand
status: New → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted into -proposed, please test and give feedback here

Changed in ufw:
status: In Progress → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

Sorry, I was too quick, it doesn't get accepted:

FAILED: ufw (The source ufw - 0.16.3 is already accepted in ubuntu/intrepid and you cannot upload the same version within the same distribution. You have to modify the source version and re-upload.)

That error speaks for itself. I rejected the upload. Jamie, please lower the version number (0.16.2.1 perhaps?) and reupload.

Changed in ufw:
status: Fix Committed → In Progress
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Uploaded 0.16.2.1.

Revision history for this message
Martin Pitt (pitti) wrote :

Accepted into hardy-proposed.

Changed in ufw:
status: In Progress → Fix Committed
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Verified 0.16.2.1 fixes the issue. Testing revealed no regressions.

Revision history for this message
Martin Pitt (pitti) wrote :

Copied to hardy-updates.

Changed in ufw:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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