]> git.baikalelectronics.ru Git - kernel.git/commit
ipv4: Fallback to FIB local table in __ip_dev_find().
authorDavid S. Miller <davem@davemloft.net>
Wed, 23 Mar 2011 04:56:23 +0000 (21:56 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Mar 2011 19:16:15 +0000 (12:16 -0700)
commit8c298120f96d72fb1f2f4efd4fc3d911c92f6d3f
tree0e197be8a5239c8b0c414f7ef3cf91a844a4271c
parentbe09c0f2515869d59206bd72cbd990794cce948e
ipv4: Fallback to FIB local table in __ip_dev_find().

In commit f6d2567473d5874739a7ff7a93a01f24ee03f535
("ipv4: Implement __ip_dev_find using new interface address hash.")
we reimplemented __ip_dev_find() so that it doesn't have to
do a full FIB table lookup.

Instead, it consults a hash table of addresses configured to
interfaces.

This works identically to the old code in all except one case,
and that is for loopback subnets.

The old code would match the loopback device for any IP address
that falls within a subnet configured to the loopback device.

Handle this corner case by doing the FIB lookup.

We could implement this via inet_addr_onlink() but:

1) Someone could configure many addresses to loopback and
   inet_addr_onlink() is a simple list traversal.

2) We know the old code works.

Reported-by: Julian Anastasov <ja@ssi.bg>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/devinet.c