diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-10 06:00:30 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-24 21:24:00 -0400 |
commit | 6b75d0908185bf853b188afa6f269426f6554c5b (patch) | |
tree | 85f28296077f3d873bbda249dc0eafcc911164fd /net/ipv6/route.c | |
parent | 4725474584d6aa2f07b3d47442dfbc4f6544f65e (diff) |
[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>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index a4b5aee0f68a..aa3f08718e44 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1034,15 +1034,17 @@ static int ipv6_get_mtu(struct net_device *dev) | |||
1034 | return mtu; | 1034 | return mtu; |
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | int ipv6_get_hoplimit(struct net_device *dev) | 1037 | int ip6_dst_hoplimit(struct dst_entry *dst) |
1038 | { | 1038 | { |
1039 | int hoplimit = ipv6_devconf.hop_limit; | 1039 | int hoplimit = dst_metric(dst, RTAX_HOPLIMIT); |
1040 | struct inet6_dev *idev; | 1040 | if (hoplimit < 0) { |
1041 | 1041 | struct net_device *dev = dst->dev; | |
1042 | idev = in6_dev_get(dev); | 1042 | struct inet6_dev *idev = in6_dev_get(dev); |
1043 | if (idev) { | 1043 | if (idev) { |
1044 | hoplimit = idev->cnf.hop_limit; | 1044 | hoplimit = idev->cnf.hop_limit; |
1045 | in6_dev_put(idev); | 1045 | in6_dev_put(idev); |
1046 | } else | ||
1047 | hoplimit = ipv6_devconf.hop_limit; | ||
1046 | } | 1048 | } |
1047 | return hoplimit; | 1049 | return hoplimit; |
1048 | } | 1050 | } |