aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ipv6.h
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-04-28 22:57:34 -0400
committerDavid S. Miller <davem@davemloft.net>2014-04-30 13:31:26 -0400
commit5c98631cca574ac6255885cf372f6bcf9dcfd483 (patch)
tree53e82fe083c0db2aeca000e70872f1d01e0b4146 /include/net/ipv6.h
parenta22adce5f97c172398082bf9a713ccfba6c2364f (diff)
net: ipv6: Introduce ip6_sk_dst_hoplimit.
This replaces 6 identical code snippets with a call to a new static inline function. Signed-off-by: Lorenzo Colitti <lorenzo@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ipv6.h')
-rw-r--r--include/net/ipv6.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index d640925bc454..5b40ad297b8c 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -583,6 +583,11 @@ static inline bool ipv6_addr_orchid(const struct in6_addr *a)
583 return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010); 583 return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010);
584} 584}
585 585
586static inline bool ipv6_addr_is_multicast(const struct in6_addr *addr)
587{
588 return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000);
589}
590
586static inline void ipv6_addr_set_v4mapped(const __be32 addr, 591static inline void ipv6_addr_set_v4mapped(const __be32 addr,
587 struct in6_addr *v4mapped) 592 struct in6_addr *v4mapped)
588{ 593{
@@ -664,6 +669,20 @@ void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt);
664 669
665int ip6_dst_hoplimit(struct dst_entry *dst); 670int ip6_dst_hoplimit(struct dst_entry *dst);
666 671
672static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6,
673 struct dst_entry *dst)
674{
675 int hlimit;
676
677 if (ipv6_addr_is_multicast(&fl6->daddr))
678 hlimit = np->mcast_hops;
679 else
680 hlimit = np->hop_limit;
681 if (hlimit < 0)
682 hlimit = ip6_dst_hoplimit(dst);
683 return hlimit;
684}
685
667/* 686/*
668 * Header manipulation 687 * Header manipulation
669 */ 688 */