lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 24 Jul 2013 09:30:26 +0800
From:	Fan Du <fan.du@...driver.com>
To:	<nicolas.dichtel@...nd.com>
CC:	<davem@...emloft.net>, <yoshfuji@...ux-ipv6.org>,
	<jmorris@...ei.org>, <steffen.klassert@...unet.com>,
	<netdev@...r.kernel.org>
Subject: Re: [RFC PATCH net-next V2] net: split rt_genid for ipv4 and ipv6



On 2013年07月24日 05:51, Nicolas Dichtel wrote:
> Le 23/07/2013 03:37, Fan Du a écrit :
>> Current net name space has only one genid for both IPv4 and IPv6, it has below drawbacks:
>>
>> - Add/delete an IPv4 address will invalidate all IPv6 routing table entries.
>> - Insert/remove XFRM policy will also invalidate both IPv4/IPv6 routing table entries
>> even when the policy is only applied for one address family.
>>
>> Thus, this patch attempt to split one genid for two to cater for IPv4 and IPv6 separately
>> in a fine granularity.
>>
>> Signed-off-by: Fan Du <fan.du@...driver.com>
>>
>> V2:
>> -Fix compile issue when IPv6 not enabled
>> -Put genid into struct netns_ipv4/ipv6
>> ---
>> include/net/net_namespace.h | 39 ++++++++++++++++++++++++++++++++++-----
>> include/net/netns/ipv4.h | 1 +
>> include/net/netns/ipv6.h | 1 +
>> net/ipv4/route.c | 16 ++++++++--------
>> net/ipv6/af_inet6.c | 1 +
>> net/ipv6/route.c | 4 ++--
>> net/xfrm/xfrm_policy.c | 8 +++++++-
>> 7 files changed, 54 insertions(+), 16 deletions(-)
>>
>> diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
>> index 84e37b1..763e63f 100644
>> --- a/include/net/net_namespace.h
>> +++ b/include/net/net_namespace.h
>> @@ -119,7 +119,6 @@ struct net {
>> struct netns_ipvs *ipvs;
>> #endif
>> struct sock *diag_nlsk;
>> - atomic_t rt_genid;
>> atomic_t fnhe_genid;
>> };
>>
>> @@ -333,14 +332,44 @@ static inline void unregister_net_sysctl_table(struct ctl_table_header *header)
>> }
>> #endif
>>
>> -static inline int rt_genid(struct net *net)
>> +static inline int rt_genid_ipv4(struct net *net)
>> {
>> - return atomic_read(&net->rt_genid);
>> + return atomic_read(&net->ipv4.rt_genid_ipv4);
>> }
>>
>> -static inline void rt_genid_bump(struct net *net)
>> +static inline void rt_genid_bump_ipv4(struct net *net)
>> {
>> - atomic_inc(&net->rt_genid);
>> + atomic_inc(&net->ipv4.rt_genid_ipv4);
>> +}
>> +
>> +#if IS_ENABLED(CONFIG_IPV6)
>> +static inline int rt_genid_ipv6(struct net *net)
>> +{
>> + return atomic_read(&net->ipv6.rt_genid_ipv6);
>> +}
>> +
>> +static inline void rt_genid_bump_ipv6(struct net *net)
>> +{
>> + atomic_inc(&net->ipv6.rt_genid_ipv6);
>> +}
>> +#else
>> +static inline int rt_genid_ipv6(struct net *net)
>> +{
>> + return 0;
>> +}
>> +
>> +static inline void rt_genid_bump_ipv6(struct net *net)
>> +{
>> +}
>> +#endif
>> +
>> +/* For callers who don't really care about whether it's IPv4 or IPv6 */
>> +static inline void rt_genid_bump_all(struct net *net)
>> +{
>> + atomic_inc(&net->ipv4.rt_genid_ipv4);
>> +#if IS_ENABLED(CONFIG_IPV6)
>> + atomic_inc(&net->ipv6.rt_genid_ipv6);
>> +#endif
>> }
>>
>> static inline int fnhe_genid(struct net *net)
>> diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
>> index 2ba9de8..d87af01 100644
>> --- a/include/net/netns/ipv4.h
>> +++ b/include/net/netns/ipv4.h
>> @@ -77,5 +77,6 @@ struct netns_ipv4 {
>> struct fib_rules_ops *mr_rules_ops;
>> #endif
>> #endif
>> + atomic_t rt_genid_ipv4;
> Just nitpiking: maybe _ipv4 is redundant? It's already in 'struct netns_ipv4'.
> Same for IPv6.
>
Hallo Nicolas

That's not nitpicking at all :), will chop _ipv4/6 off in next version.
Thanks for your comments.

-- 
浮沉随浪只记今朝笑

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ