netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
To: Hannes Frederic Sowa <hannes@stressinduktion.org>,
	David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next v3 1/4] ipv6: introdcue __ipv6_addr_needs_scope_id and ipv6_iface_scope_id helper functions
Date: Fri, 08 Mar 2013 11:21:10 +0900	[thread overview]
Message-ID: <51394B16.7010108@linux-ipv6.org> (raw)
In-Reply-To: <20130307210529.GA23621@order.stressinduktion.org>

Hannes Frederic Sowa wrote:
> __ipv6_addr_needs_scope_id checks if an ipv6 address needs to supply
> a 'sin6_scope_id != 0'. 'sin6_scope_id != 0' was enforced in case
> of link-local addresses. To support interface-local multicast these
> checks had to be enhanced and are now consolidated into these new helper
> functions.
> 
> v2:
> a) migrated to struct ipv6_addr_props
> 
> v3:
> a) reverted changes for ipv6_addr_props
> b) test for address type instead of comparing scope
> 
> Suggested-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> ---
>  include/net/ipv6.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/net/ipv6.h b/include/net/ipv6.h
> index 64d12e7..e11d304 100644
> --- a/include/net/ipv6.h
> +++ b/include/net/ipv6.h
> @@ -320,6 +320,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 &&
> +		(type & (IPV6_ADDR_LOOPBACK|IPV6_ADDR_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));
> 

Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

      reply	other threads:[~2013-03-08  2:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-07 21:05 [PATCH net-next v3 1/4] ipv6: introdcue __ipv6_addr_needs_scope_id and ipv6_iface_scope_id helper functions Hannes Frederic Sowa
2013-03-08  2:21 ` YOSHIFUJI Hideaki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51394B16.7010108@linux-ipv6.org \
    --to=yoshfuji@linux-ipv6.org \
    --cc=davem@davemloft.net \
    --cc=hannes@stressinduktion.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).