On 14.06.2016 08:02, Julian Anastasov wrote:
> 
>       Hello,
> 
> On Mon, 13 Jun 2016, Hannes Frederic Sowa wrote:
> 
>> -    flowi4_init_output(fl4, oif, sk->sk_mark, tos, RT_SCOPE_UNIVERSE,
>> -                       protocol, flow_flags, dst, src, dport, sport);
>> +    fl4->flowi4_oif = oif;
>> +    fl4->flowi4_iif = LOOPBACK_IFINDEX;
>> +    fl4->flowi4_mark = sk->sk_mark;
>> +    fl4->flowi4_tos = tos;
>> +    fl4->flowi4_scope = RT_SCOPE_UNIVERSE;
>> +    fl4->flowi4_proto = protocol;
>> +    fl4->flowi4_flags = flow_flags;
>> +    fl4->flowi4_secid = 0;
>> +    fl4->flowi4_tun_key.tun_id = 0;
>> +    fl4->daddr = dst;
>> +    fl4->saddr = src;
>> +    fl4->fl4_dport = dport;
>> +    fl4->fl4_sport = sport;
> 
>       The way you initialize the fields adds new risks
> when new field is added, it is difficult to track all such
> places. If they are missed, the lookup will use random
> value for the new field. I'm not sure what will compile,
> may be something likes this?:
> 
>       *fl4 = (struct flowi4) {
>               .flowi4_oif = oif,
>               ...
>       };

Yes, this is probably the better way to go, I adapted my patch accordingly.

Thanks,


Reply via email to