Bug 65473 - inconsistent numeric base on command line options
Summary: inconsistent numeric base on command line options
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: iproute
Version: 7.3
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Phil Knirsch
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-05-25 02:48 UTC by Mike McLean
Modified: 2015-03-05 01:10 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-05-25 03:02:15 UTC
Embargoed:


Attachments (Terms of Use)
a 2 line patch to fix this problem (723 bytes, patch)
2002-05-25 02:50 UTC, Mike McLean
no flags Details | Diff

Description Mike McLean 2002-05-25 02:48:22 UTC
* RH 7.3 and earlier
* iproute-2.4.7-1

When specifying fwmark based routing rules, /sbin/ip silently assumes that the
number on the command line is in hex, whether or not it is prefixed with 0x.  
Furthermore, when the rule is listed it is not indicated to be hex.

This behavior might be acceptable, except that *no other numbers* entered on the
command line are treated this way.

[root@ha7 iproute2]# ip rule add priority 23 fwmark 23 unreachable
[root@ha7 iproute2]# ip rule add priority 0x23 fwmark 0x23 unreachable
[root@ha7 iproute2]# ip rule list
0:
from all lookup local 
23:
from all fwmark       23 lookup main unreachable
35:
from all fwmark       23 lookup main unreachable
32766:
from all lookup main 
32767:
from all lookup 253 

I am including a patch that fixes this problem.

Comment 1 Mike McLean 2002-05-25 02:50:44 UTC
Created attachment 58485 [details]
a 2 line patch to fix this problem

Comment 2 Mike McLean 2002-05-25 03:02:09 UTC
This patch has two effects:
 1) fwmark numbers are clearly indicated as being in hex when printed.
 2) fwmark numbers entered on the command line assumed to be decimal unless
indicated otherwise (strtoul is passed base 0 rather than base 16).  This
matches the behavior of the priority option.

While (2) could make break script compatibility, I doubt that many are using
fwmark routing in scripts, and if they aren't prepending 0x then shame on them.  

I'm certain that this change will prevent many more headaches than it causes. 
In fact, a group of us lost nearly 2 hours of work this afternoon to this bug.

Comment 3 Phil Knirsch 2002-05-27 11:18:33 UTC
Included patch in latest version. I agree that this inconsistency causes more
frustration than worth keeping.

Read ya, Phil


Note You need to log in before you can comment on or make changes to this bug.