diff mbox

[net-next,v5,2/3] ipv6: reuse rt6_need_strict

Message ID 1395998427-7532-3-git-send-email-wangyufen@huawei.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Wang Yufen March 28, 2014, 9:20 a.m. UTC
From: Wang Yufen <wangyufen@huawei.com>

Move the whole rt6_need_strict as static inline into ip6_route.h, 
so that it can be reused

Signed-off-by: Wang Yufen <wangyufen@huawei.com>
---
 include/net/ip6_route.h | 5 +++++
 net/ipv6/route.c        | 6 ------
 2 files changed, 5 insertions(+), 6 deletions(-)

Comments

Sergei Shtylyov March 28, 2014, 1:40 p.m. UTC | #1
Hello.

On 28-03-2014 13:20, Wangyufen wrote:

> From: Wang Yufen <wangyufen@huawei.com>

> Move the whole rt6_need_strict as static inline into ip6_route.h,
> so that it can be reused

> Signed-off-by: Wang Yufen <wangyufen@huawei.com>
> ---
>   include/net/ip6_route.h | 5 +++++
>   net/ipv6/route.c        | 6 ------
>   2 files changed, 5 insertions(+), 6 deletions(-)

> diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
> index 00e3f12..33e8694 100644
> --- a/include/net/ip6_route.h
> +++ b/include/net/ip6_route.h
> @@ -51,6 +51,11 @@ static inline unsigned int rt6_flags2srcprefs(int flags)
>   	return (flags >> 3) & 7;
>   }
>
> +static inline bool rt6_need_strict(const struct in6_addr *daddr)
> +{
> +	return ipv6_addr_type(daddr) &
> +		IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);

    I don't think removing parens was correct here: & should have more 
priority than |.

> +}
>
>   void ip6_route_input(struct sk_buff *skb);
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index b93ae6a..5015c50 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -374,12 +374,6 @@ static bool rt6_check_expired(const struct rt6_info *rt)
>   	return false;
>   }
>
> -static bool rt6_need_strict(const struct in6_addr *daddr)
> -{
> -	return ipv6_addr_type(daddr) &
> -		(IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
> -}
> -
>   /* Multipath route selection:
>    *   Hash based function using packet header and flowlabel.
>    * Adapted from fib_info_hashfn()

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wang Yufen March 29, 2014, 1:25 a.m. UTC | #2
On 2014/3/28 21:40, Sergei Shtylyov wrote:
> Hello.
> 
> On 28-03-2014 13:20, Wangyufen wrote:
> 
>> From: Wang Yufen <wangyufen@huawei.com>
> 
>> Move the whole rt6_need_strict as static inline into ip6_route.h,
>> so that it can be reused
> 
>> Signed-off-by: Wang Yufen <wangyufen@huawei.com>
>> ---
>>   include/net/ip6_route.h | 5 +++++
>>   net/ipv6/route.c        | 6 ------
>>   2 files changed, 5 insertions(+), 6 deletions(-)
> 
>> diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
>> index 00e3f12..33e8694 100644
>> --- a/include/net/ip6_route.h
>> +++ b/include/net/ip6_route.h
>> @@ -51,6 +51,11 @@ static inline unsigned int rt6_flags2srcprefs(int flags)
>>       return (flags >> 3) & 7;
>>   }
>>
>> +static inline bool rt6_need_strict(const struct in6_addr *daddr)
>> +{
>> +    return ipv6_addr_type(daddr) &
>> +        IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
> 
>    I don't think removing parens was correct here: & should have more priority than |.

Oh, fogive me for my carelessness, there missed a '('
sorry for that, and thanks

> 
>> +}
>>
>>   void ip6_route_input(struct sk_buff *skb);
>>
>> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
>> index b93ae6a..5015c50 100644
>> --- a/net/ipv6/route.c
>> +++ b/net/ipv6/route.c
>> @@ -374,12 +374,6 @@ static bool rt6_check_expired(const struct rt6_info *rt)
>>       return false;
>>   }
>>
>> -static bool rt6_need_strict(const struct in6_addr *daddr)
>> -{
>> -    return ipv6_addr_type(daddr) &
>> -        (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
>> -}
>> -
>>   /* Multipath route selection:
>>    *   Hash based function using packet header and flowlabel.
>>    * Adapted from fib_info_hashfn()
> 
> WBR, Sergei
> 
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 00e3f12..33e8694 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -51,6 +51,11 @@  static inline unsigned int rt6_flags2srcprefs(int flags)
 	return (flags >> 3) & 7;
 }
 
+static inline bool rt6_need_strict(const struct in6_addr *daddr)
+{
+	return ipv6_addr_type(daddr) &
+		IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
+}
 
 void ip6_route_input(struct sk_buff *skb);
 
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index b93ae6a..5015c50 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -374,12 +374,6 @@  static bool rt6_check_expired(const struct rt6_info *rt)
 	return false;
 }
 
-static bool rt6_need_strict(const struct in6_addr *daddr)
-{
-	return ipv6_addr_type(daddr) &
-		(IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
-}
-
 /* Multipath route selection:
  *   Hash based function using packet header and flowlabel.
  * Adapted from fib_info_hashfn()