diff mbox

[net-next] fib_trie: Only display main table in /proc/net/route

Message ID 20150311233536.1696.1657.stgit@ahduyck-vm-fedora20
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Alexander Duyck March 11, 2015, 11:36 p.m. UTC
When we merged the tries for local and main I had overlooked the iterator
for /proc/net/route.  As a result it was outputting both local and main
when the two tries were merged.

This patch resolves that by only providing output for aliases that are
actually in the main trie.  As a result we should go back to the original
behavior which I assume will be necessary to maintain legacy support.

Fixes: 0ddcf43d5 ("ipv4: FIB Local/MAIN table collapse")

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
---
 net/ipv4/fib_trie.c |    5 +++++
 1 file changed, 5 insertions(+)


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller March 12, 2015, 1:22 a.m. UTC | #1
From: Alexander Duyck <alexander.h.duyck@redhat.com>
Date: Wed, 11 Mar 2015 16:36:08 -0700

> When we merged the tries for local and main I had overlooked the iterator
> for /proc/net/route.  As a result it was outputting both local and main
> when the two tries were merged.
> 
> This patch resolves that by only providing output for aliases that are
> actually in the main trie.  As a result we should go back to the original
> behavior which I assume will be necessary to maintain legacy support.
> 
> Fixes: 0ddcf43d5 ("ipv4: FIB Local/MAIN table collapse")
> 
> Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>

Applied, thanks Alex.

Please don't put empty lines between Fixes: tags and the signoffs
and acks, they belong together.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander H Duyck March 12, 2015, 1:36 a.m. UTC | #2
On 03/11/2015 06:22 PM, David Miller wrote:
> From: Alexander Duyck <alexander.h.duyck@redhat.com>
> Date: Wed, 11 Mar 2015 16:36:08 -0700
>
>> When we merged the tries for local and main I had overlooked the iterator
>> for /proc/net/route.  As a result it was outputting both local and main
>> when the two tries were merged.
>>
>> This patch resolves that by only providing output for aliases that are
>> actually in the main trie.  As a result we should go back to the original
>> behavior which I assume will be necessary to maintain legacy support.
>>
>> Fixes: 0ddcf43d5 ("ipv4: FIB Local/MAIN table collapse")
>>
>> Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
> Applied, thanks Alex.
>
> Please don't put empty lines between Fixes: tags and the signoffs
> and acks, they belong together.

I'll try to remember that for any other patches.

Thanks.

- Alex
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet March 12, 2015, 7:13 p.m. UTC | #3
Alex,

I caught this message with latest net-next

[   31.449563] WARNING: CPU: 2 PID: 10307 at net/ipv4/fib_trie.c:1124 fib_table_insert+0x467/0x4d0()
[   31.449564] Modules linked in: w1_therm wire cdc_acm ehci_pci ehci_hcd i2c_dev i2c_i801 i2c_core msr cpuid ib_uverbs mlx4_ib ib_sa ib_mad ib_core ib_addr ip6table_mangle ip6_tables ipv6 xt_multiport iptable_mangle
[   31.449576] CPU: 2 PID: 10307 Comm: route Not tainted 4.0.0-smp-DEV #1321
[   31.449578]  ffffffff8197e8b3 ffff883ff235fa78 ffffffff8160c40f 00000000000000d5
[   31.449579]  0000000000000000 ffff883ff235fab8 ffffffff810a35d7 0000000000000000
[   31.449581]  0000000000000000 000000007f000000 ffff883ff235fb90 0000000000000008
[   31.449582] Call Trace:
[   31.449587]  [<ffffffff8160c40f>] dump_stack+0x45/0x57
[   31.449591]  [<ffffffff810a35d7>] warn_slowpath_common+0x97/0xe0
[   31.449592]  [<ffffffff810a363a>] warn_slowpath_null+0x1a/0x20
[   31.449594]  [<ffffffff815e5fc7>] fib_table_insert+0x467/0x4d0
[   31.449597]  [<ffffffff815e10de>] ip_rt_ioctl+0x30e/0x460
[   31.449599]  [<ffffffff811e0000>] ? do_readv_writev+0x70/0x2e0
[   31.449601]  [<ffffffff815d9485>] inet_ioctl+0x65/0x90
[   31.449604]  [<ffffffff81541e90>] sock_do_ioctl+0x30/0x70
[   31.449606]  [<ffffffff81541fef>] routing_ioctl+0x11f/0x220
[   31.449608]  [<ffffffff81546c68>] ? sk_prot_alloc+0x48/0x1a0
[   31.449610]  [<ffffffff811e0000>] ? do_readv_writev+0x70/0x2e0
[   31.449611]  [<ffffffff81542a52>] compat_sock_ioctl+0x702/0x930
[   31.449613]  [<ffffffff81542d11>] ? sock_alloc_file+0x91/0x120
[   31.449616]  [<ffffffff811fc7bb>] ? __fd_install+0x2b/0x60
[   31.449617]  [<ffffffff811fc815>] ? fd_install+0x25/0x30
[   31.449619]  [<ffffffff81542deb>] ? sock_map_fd+0x4b/0x70
[   31.449621]  [<ffffffff81230233>] compat_SyS_ioctl+0xf3/0x1220
[   31.449624]  [<ffffffff8157f27e>] ? compat_SyS_socketcall+0x9e/0x4a0
[   31.449626]  [<ffffffff81095dec>] ? do_page_fault+0xc/0x10
[   31.449629]  [<ffffffff81614c93>] sysenter_dispatch+0x7/0x1a
[   31.449630] ---[ end trace 0f37afa3e6f481a5 ]---



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander H Duyck March 12, 2015, 7:56 p.m. UTC | #4
On 03/12/2015 12:13 PM, Eric Dumazet wrote:
> Alex,
>
> I caught this message with latest net-next
>
> [   31.449563] WARNING: CPU: 2 PID: 10307 at net/ipv4/fib_trie.c:1124 fib_table_insert+0x467/0x4d0()
> [   31.449564] Modules linked in: w1_therm wire cdc_acm ehci_pci ehci_hcd i2c_dev i2c_i801 i2c_core msr cpuid ib_uverbs mlx4_ib ib_sa ib_mad ib_core ib_addr ip6table_mangle ip6_tables ipv6 xt_multiport iptable_mangle
> [   31.449576] CPU: 2 PID: 10307 Comm: route Not tainted 4.0.0-smp-DEV #1321
> [   31.449578]  ffffffff8197e8b3 ffff883ff235fa78 ffffffff8160c40f 00000000000000d5
> [   31.449579]  0000000000000000 ffff883ff235fab8 ffffffff810a35d7 0000000000000000
> [   31.449581]  0000000000000000 000000007f000000 ffff883ff235fb90 0000000000000008
> [   31.449582] Call Trace:
> [   31.449587]  [<ffffffff8160c40f>] dump_stack+0x45/0x57
> [   31.449591]  [<ffffffff810a35d7>] warn_slowpath_common+0x97/0xe0
> [   31.449592]  [<ffffffff810a363a>] warn_slowpath_null+0x1a/0x20
> [   31.449594]  [<ffffffff815e5fc7>] fib_table_insert+0x467/0x4d0
> [   31.449597]  [<ffffffff815e10de>] ip_rt_ioctl+0x30e/0x460
> [   31.449599]  [<ffffffff811e0000>] ? do_readv_writev+0x70/0x2e0
> [   31.449601]  [<ffffffff815d9485>] inet_ioctl+0x65/0x90
> [   31.449604]  [<ffffffff81541e90>] sock_do_ioctl+0x30/0x70
> [   31.449606]  [<ffffffff81541fef>] routing_ioctl+0x11f/0x220
> [   31.449608]  [<ffffffff81546c68>] ? sk_prot_alloc+0x48/0x1a0
> [   31.449610]  [<ffffffff811e0000>] ? do_readv_writev+0x70/0x2e0
> [   31.449611]  [<ffffffff81542a52>] compat_sock_ioctl+0x702/0x930
> [   31.449613]  [<ffffffff81542d11>] ? sock_alloc_file+0x91/0x120
> [   31.449616]  [<ffffffff811fc7bb>] ? __fd_install+0x2b/0x60
> [   31.449617]  [<ffffffff811fc815>] ? fd_install+0x25/0x30
> [   31.449619]  [<ffffffff81542deb>] ? sock_map_fd+0x4b/0x70
> [   31.449621]  [<ffffffff81230233>] compat_SyS_ioctl+0xf3/0x1220
> [   31.449624]  [<ffffffff8157f27e>] ? compat_SyS_socketcall+0x9e/0x4a0
> [   31.449626]  [<ffffffff81095dec>] ? do_page_fault+0xc/0x10
> [   31.449629]  [<ffffffff81614c93>] sysenter_dispatch+0x7/0x1a
> [   31.449630] ---[ end trace 0f37afa3e6f481a5 ]---

The WARN_ON that is being triggered here is indicating that you have a
route that had identical prefix length, tos, and priority but belonged
to the other half of the merged table.

It should probably just be dropped though as I don't know if it is
really necessary.  I assume I could probably go though and just verify
the ordering for insertion so that we have local and then main in such a
case.

- Alex
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 7b2badd..dd488c1 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2539,6 +2539,8 @@  static unsigned int fib_flag_trans(int type, __be32 mask, const struct fib_info
  */
 static int fib_route_seq_show(struct seq_file *seq, void *v)
 {
+	struct fib_route_iter *iter = seq->private;
+	struct fib_table *tb = iter->main_tb;
 	struct fib_alias *fa;
 	struct key_vector *l = v;
 	__be32 prefix;
@@ -2561,6 +2563,9 @@  static int fib_route_seq_show(struct seq_file *seq, void *v)
 		    (fa->fa_type == RTN_MULTICAST))
 			continue;
 
+		if (fa->tb_id != tb->tb_id)
+			continue;
+
 		seq_setwidth(seq, 127);
 
 		if (fi)