mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-06 13:23:18 +00:00
[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:
parent
4725474584
commit
6b75d09081
@ -123,8 +123,6 @@ extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr);
|
|||||||
|
|
||||||
extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len);
|
extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len);
|
||||||
|
|
||||||
extern int ipv6_get_hoplimit(struct net_device *dev);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* anycast prototypes (anycast.c)
|
* anycast prototypes (anycast.c)
|
||||||
*/
|
*/
|
||||||
|
@ -88,6 +88,8 @@ extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
|
|||||||
const struct in6_addr *addr,
|
const struct in6_addr *addr,
|
||||||
int anycast);
|
int anycast);
|
||||||
|
|
||||||
|
extern int ip6_dst_hoplimit(struct dst_entry *dst);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* support functions for ND
|
* support functions for ND
|
||||||
*
|
*
|
||||||
|
@ -464,9 +464,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
|
|||||||
else
|
else
|
||||||
hlimit = np->hop_limit;
|
hlimit = np->hop_limit;
|
||||||
if (hlimit < 0)
|
if (hlimit < 0)
|
||||||
hlimit = dst_metric(dst, RTAX_HOPLIMIT);
|
hlimit = ip6_dst_hoplimit(dst);
|
||||||
if (hlimit < 0)
|
|
||||||
hlimit = ipv6_get_hoplimit(dst->dev);
|
|
||||||
|
|
||||||
tclass = np->tclass;
|
tclass = np->tclass;
|
||||||
if (tclass < 0)
|
if (tclass < 0)
|
||||||
@ -560,9 +558,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
|
|||||||
else
|
else
|
||||||
hlimit = np->hop_limit;
|
hlimit = np->hop_limit;
|
||||||
if (hlimit < 0)
|
if (hlimit < 0)
|
||||||
hlimit = dst_metric(dst, RTAX_HOPLIMIT);
|
hlimit = ip6_dst_hoplimit(dst);
|
||||||
if (hlimit < 0)
|
|
||||||
hlimit = ipv6_get_hoplimit(dst->dev);
|
|
||||||
|
|
||||||
tclass = np->tclass;
|
tclass = np->tclass;
|
||||||
if (tclass < 0)
|
if (tclass < 0)
|
||||||
|
@ -237,9 +237,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
|
|||||||
if (np)
|
if (np)
|
||||||
hlimit = np->hop_limit;
|
hlimit = np->hop_limit;
|
||||||
if (hlimit < 0)
|
if (hlimit < 0)
|
||||||
hlimit = dst_metric(dst, RTAX_HOPLIMIT);
|
hlimit = ip6_dst_hoplimit(dst);
|
||||||
if (hlimit < 0)
|
|
||||||
hlimit = ipv6_get_hoplimit(dst->dev);
|
|
||||||
|
|
||||||
tclass = -1;
|
tclass = -1;
|
||||||
if (np)
|
if (np)
|
||||||
|
@ -904,9 +904,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
|
|||||||
dst = sk_dst_get(sk);
|
dst = sk_dst_get(sk);
|
||||||
if (dst) {
|
if (dst) {
|
||||||
if (val < 0)
|
if (val < 0)
|
||||||
val = dst_metric(dst, RTAX_HOPLIMIT);
|
val = ip6_dst_hoplimit(dst);
|
||||||
if (val < 0)
|
|
||||||
val = ipv6_get_hoplimit(dst->dev);
|
|
||||||
dst_release(dst);
|
dst_release(dst);
|
||||||
}
|
}
|
||||||
if (val < 0)
|
if (val < 0)
|
||||||
|
@ -885,9 +885,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
|
|||||||
else
|
else
|
||||||
hlimit = np->hop_limit;
|
hlimit = np->hop_limit;
|
||||||
if (hlimit < 0)
|
if (hlimit < 0)
|
||||||
hlimit = dst_metric(dst, RTAX_HOPLIMIT);
|
hlimit = ip6_dst_hoplimit(dst);
|
||||||
if (hlimit < 0)
|
|
||||||
hlimit = ipv6_get_hoplimit(dst->dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tclass < 0) {
|
if (tclass < 0) {
|
||||||
|
@ -1034,15 +1034,17 @@ static int ipv6_get_mtu(struct net_device *dev)
|
|||||||
return mtu;
|
return mtu;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ipv6_get_hoplimit(struct net_device *dev)
|
int ip6_dst_hoplimit(struct dst_entry *dst)
|
||||||
{
|
{
|
||||||
int hoplimit = ipv6_devconf.hop_limit;
|
int hoplimit = dst_metric(dst, RTAX_HOPLIMIT);
|
||||||
struct inet6_dev *idev;
|
if (hoplimit < 0) {
|
||||||
|
struct net_device *dev = dst->dev;
|
||||||
idev = in6_dev_get(dev);
|
struct inet6_dev *idev = in6_dev_get(dev);
|
||||||
if (idev) {
|
if (idev) {
|
||||||
hoplimit = idev->cnf.hop_limit;
|
hoplimit = idev->cnf.hop_limit;
|
||||||
in6_dev_put(idev);
|
in6_dev_put(idev);
|
||||||
|
} else
|
||||||
|
hoplimit = ipv6_devconf.hop_limit;
|
||||||
}
|
}
|
||||||
return hoplimit;
|
return hoplimit;
|
||||||
}
|
}
|
||||||
|
@ -792,9 +792,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
|
|||||||
else
|
else
|
||||||
hlimit = np->hop_limit;
|
hlimit = np->hop_limit;
|
||||||
if (hlimit < 0)
|
if (hlimit < 0)
|
||||||
hlimit = dst_metric(dst, RTAX_HOPLIMIT);
|
hlimit = ip6_dst_hoplimit(dst);
|
||||||
if (hlimit < 0)
|
|
||||||
hlimit = ipv6_get_hoplimit(dst->dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tclass < 0) {
|
if (tclass < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user