Hello,

I rebuild a kernel with your patch on debian wheezy with the debian config-3.2.0-4-686-pae file. It's not functionnal.

Thanks.

Nico


On 07/11/13 07:58 AM, Andreas Henriksson wrote:
On Fri, Sep 27, 2013 at 01:53:14PM -0400, Nicolas HICHER wrote:
[...]
On debian wheezy, jessie, sid, if you try to delete an inexistant
table with ip rule, the local table will be deleted. The table number must
be greater than 256:

There are two different code-paths for table id < 256 and above or equal.
For the "above or equal to 256" path, the table id is attached as a
netlink attribute instead of using the (8bit) table field.
When the netlink attribute is used, the table field is set to RT_TABLE_UNSPEC
which is defined as 0.

There's a helper function to handle getting the correct table id
in include/net/fib_rules.h called "frh_get_table", see:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/net/fib_rules.h#n111

It looks like for the delete rule case, this is called from the
"list_for_each" loop in "fib_nl_delrule" in file net/core/fib_rules.c, see:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/net/core/fib_rules.c#n464
If I understand the code correctly, the loop is trying to locate the correct
rule based on the matching criterias (skipping any criteria which is not set).
The precondition to check if specified table id and rule table id matches
seems to be buggy though:
"          if (frh->table && (frh_get_table(frh, tb) != rule->table))"

When iproute2 is using the netlink attribute I think frh->table will be
RT_TABLE_UNSPEC, which means 0. So the matching is not performed
and (given that all other criterias match) the first rule (local) will
be deleted.

Would be very welcome if you could rebuild the kernel with the attached patch
and report back if it solves the problem for you or not.



--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to