Re: [PATCH net v2 2/4] ipv6: fix source address selection with route leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 07/07/2024 à 18:58, David Ahern a écrit :
> On 7/5/24 8:52 AM, Nicolas Dichtel wrote:
>> diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
>> index a18ed24fed94..a7c27f0c6bce 100644
>> --- a/include/net/ip6_route.h
>> +++ b/include/net/ip6_route.h
>> @@ -127,18 +127,23 @@ void rt6_age_exceptions(struct fib6_info *f6i, struct fib6_gc_args *gc_args,
>>  
>>  static inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i,
>>  				      const struct in6_addr *daddr,
>> -				      unsigned int prefs,
>> +				      unsigned int prefs, int l3mdev_index,
>>  				      struct in6_addr *saddr)
>>  {
>> +	struct net_device *l3mdev;
>> +	struct net_device *dev;
>> +	bool same_vrf;
>>  	int err = 0;
>>  
>> -	if (f6i && f6i->fib6_prefsrc.plen) {
>> +	rcu_read_lock();
>> +	l3mdev = dev_get_by_index_rcu(net, l3mdev_index);
>> +	dev = f6i ? fib6_info_nh_dev(f6i) : NULL;
>> +	same_vrf = l3mdev == NULL || l3mdev_master_dev_rcu(dev) == l3mdev;
> 
> !l3mdev; checkpatch should complain
No. I was unaware of this preference, is there a rule written somewhere about this?

$ git grep '(![a-zA-Z])' net/ipv6/ | wc -l
43
$ git grep '== NULL' net/ipv6/ | wc -l
44

It seems both are used.


Regards,
Nicolas




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux