* 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.
Created attachment 58485 [details] a 2 line patch to fix this problem
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.
Included patch in latest version. I agree that this inconsistency causes more frustration than worth keeping. Read ya, Phil