>> +             if (greinfo[IFLA_GRE_ERSPAN_INDEX])
>> +                     erspan_idx = 
>> rta_getattr_u32(greinfo[IFLA_GRE_ERSPAN_INDEX]);
>>       }
>
> Are you missing a ntohl() here?

>
> It is encoded as htonl() when sending to kernel.
>
>                 addattr32(n, 1024, IFLA_GRE_FWMARK, fwmark);
> +               addattr32(n, 1024, IFLA_GRE_ERSPAN_INDEX, htonl(erspan_idx));
Thanks for the feedbacks, and sorry for my late response.

Now I plan to not translate to network-byte order, but do it inside
the kernel. So kernel expects host order, ip route only sends
host-byte order.

>
> Is erspan_idx == 0 a reserved value?
ERSPAN spec does not say erspan_idx = 0 should be reserved or not. But
I assume at lease people will put some value, so I assume it is
reserved. And only when it is non-zero, then send to kernel.

> You should only send erspan_idx to kernel if it is given on command line.
Yes, I will resubmit next patch.

Regards,
William

Reply via email to