On Thu, 10 Aug 2017 13:14:27 -0700
William Tu <u9012...@gmail.com> wrote:

> +
> +             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));

Is erspan_idx == 0 a reserved value?
You should only send erspan_idx to kernel if it is given on command line.

Reply via email to