Bug 65473 - inconsistent numeric base on command line options
inconsistent numeric base on command line options
Product: Red Hat Linux
Classification: Retired
Component: iproute (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Knirsch
Depends On:
  Show dependency treegraph
Reported: 2002-05-24 22:48 EDT by Mike McLean
Modified: 2015-03-04 20:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-05-24 23:02:15 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description Mike McLean 2002-05-24 22:48:22 EDT
* 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
from all lookup local 
from all fwmark       23 lookup main unreachable
from all fwmark       23 lookup main unreachable
from all lookup main 
from all lookup 253 

I am including a patch that fixes this problem.
Comment 1 Mike McLean 2002-05-24 22:50:44 EDT
Created attachment 58485 [details]
a 2 line patch to fix this problem
Comment 2 Mike McLean 2002-05-24 23:02:09 EDT
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 07:18:33 EDT
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.