[ovs-dev] [PATCH 1/7] lisp: Use IP addresses rather than flow on hash failure.

Jesse Gross jesse at nicira.com
Wed Jun 11 18:05:19 UTC 2014


On Wed, Jun 11, 2014 at 1:50 AM, Thomas Graf <tgraf at suug.ch> wrote:
> On 06/10/14 at 04:47pm, Jesse Gross wrote:
>> diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c
>> index a1e2b2b..af9a71e 100644
>> --- a/datapath/vport-lisp.c
>> +++ b/datapath/vport-lisp.c
>> @@ -173,8 +173,12 @@ static u16 get_src_port(struct net *net, struct sk_buff *skb)
>>       if (!hash) {
>>               struct sw_flow_key *pkt_key = OVS_CB(skb)->pkt_key;
>>
>> -             hash = jhash2((const u32 *)pkt_key,
>> -                         sizeof(*pkt_key) / sizeof(u32), 0);
>> +             if (skb->protocol == htons(ETH_P_IP))
>> +                     hash = jhash2((const u32 *)&pkt_key->ipv4.addr,
>> +                                sizeof(pkt_key->ipv4.addr) / sizeof(u32), 0);
>> +             else
>> +                     hash = jhash2((const u32 *)&pkt_key->ipv6.addr,
>> +                                sizeof(pkt_key->ipv6.addr) / sizeof(u32), 0);
>
> Perhaps check for ETH_P_IPV6 and WARN() on the else branch? OTOH,
> unlikely that is ever to happen ;-)

I agree it's unlikely to ever happen but it doesn't cost anything, so
it's probably not a bad idea.

> Acked-by: Thomas Graf <tgraf at suug.ch>

Thanks for all the reviews!



More information about the dev mailing list