[IPV6]: Optimize hop-limit determination.

Last part of hop-limit determination is always:
    hoplimit = dst_metric(dst, RTAX_HOPLIMIT);
    if (hoplimit < 0)
        hoplimit = ipv6_get_hoplimit(dst->dev).

Let's consolidate it as ip6_dst_hoplimit(dst).

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
This commit is contained in:
YOSHIFUJI Hideaki
2008-03-10 06:00:30 -04:00
parent 4725474584
commit 6b75d09081
8 changed files with 18 additions and 28 deletions

View File

@@ -1034,15 +1034,17 @@ static int ipv6_get_mtu(struct net_device *dev)
return mtu;
}
int ipv6_get_hoplimit(struct net_device *dev)
int ip6_dst_hoplimit(struct dst_entry *dst)
{
int hoplimit = ipv6_devconf.hop_limit;
struct inet6_dev *idev;
idev = in6_dev_get(dev);
if (idev) {
hoplimit = idev->cnf.hop_limit;
in6_dev_put(idev);
int hoplimit = dst_metric(dst, RTAX_HOPLIMIT);
if (hoplimit < 0) {
struct net_device *dev = dst->dev;
struct inet6_dev *idev = in6_dev_get(dev);
if (idev) {
hoplimit = idev->cnf.hop_limit;
in6_dev_put(idev);
} else
hoplimit = ipv6_devconf.hop_limit;
}
return hoplimit;
}