ipv6: introdcue __ipv6_addr_needs_scope_id and ipv6_iface_scope_id helper functions
Subsystems (3)
PATCH 1/3 ipv6: introdcue __ipv6_addr_needs_scope_id and ipv6_iface_scope_id helper functions
Suggested-by YOSHIFUJI Hideaki <[email protected]>
Cc YOSHIFUJI Hideaki <[email protected]>
Signed-off-by Hannes Frederic Sowa <[email protected]>
--- include/net/ipv6.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
include/net/ipv6.h +12 -0
@@ -319,6 +319,18 @@ static inline int ipv6_addr_src_scope(const struct in6_addr *addr)return __ipv6_addr_src_scope (__ipv6_addr_type (addr)); } +static inline bool __ipv6_addr_needs_scope_id (int type) +{ +return type &IPV6_ADDR_LINKLOCAL || + (type &IPV6_ADDR_MULTICAST && +__ipv6_addr_src_scope (type) <=IPV6_ADDR_SCOPE_LINKLOCAL ); +} + +static inline __u32 ipv6_iface_scope_id (const struct in6_addr *addr,int iface) +{ +return __ipv6_addr_needs_scope_id (__ipv6_addr_type (addr)) ? iface :0 ; +} +static inline int ipv6_addr_cmp (const struct in6_addr *a1,const struct in6_addr *a2) {return memcmp (a1, a2,sizeof (struct in6_addr ));
Signature · 1 line
1.8.1.2