diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-07 23:54:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-07 23:54:48 -0500 |
commit | 1fc050a13473348f5c439de2bb41c8e92dba5588 (patch) | |
tree | b2cecf15f5de87997fb44b4a1025b48d473cd038 /net/ipv4/fib_frontend.c | |
parent | 6118e35a7126c1062b1a0f6737b84b4fe4d5c8d4 (diff) |
ipv4: Cache source address in nexthop entries.
When doing output route lookups, we have to select the source address
if the user has not specified an explicit one.
First, if the route has an explicit preferred source address
specified, then we use that.
Otherwise we search the route's outgoing interface for a suitable
address.
This search can be precomputed and cached at route insertion time.
The only missing part is that we have to refresh this precomputed
value any time addresses are added or removed from the interface, and
this is accomplished by fib_update_nh_saddrs().
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_frontend.c')
-rw-r--r-- | net/ipv4/fib_frontend.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index ad0778a3fa53..1d2233cd99e6 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -890,10 +890,12 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
890 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 890 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
891 | fib_sync_up(dev); | 891 | fib_sync_up(dev); |
892 | #endif | 892 | #endif |
893 | fib_update_nh_saddrs(dev); | ||
893 | rt_cache_flush(dev_net(dev), -1); | 894 | rt_cache_flush(dev_net(dev), -1); |
894 | break; | 895 | break; |
895 | case NETDEV_DOWN: | 896 | case NETDEV_DOWN: |
896 | fib_del_ifaddr(ifa); | 897 | fib_del_ifaddr(ifa); |
898 | fib_update_nh_saddrs(dev); | ||
897 | if (ifa->ifa_dev->ifa_list == NULL) { | 899 | if (ifa->ifa_dev->ifa_list == NULL) { |
898 | /* Last address was deleted from this interface. | 900 | /* Last address was deleted from this interface. |
899 | * Disable IP. | 901 | * Disable IP. |