Bug 65473

Summary: inconsistent numeric base on command line options
Product: [Retired] Red Hat Linux Reporter: Mike McLean <mikem>
Component: iprouteAssignee: Phil Knirsch <pknirsch>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-05-25 03:02:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
a 2 line patch to fix this problem none

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