Hi Jukka,

On Mon, Feb 14, 2011 at 10:24:23AM +0200, Jukka Rissanen wrote:
> This is described in RFC 3041 and RFC 4941
It makes sense to me. I have some comments though:

> +static void set_ipv6_privacy(gchar *ifname, int value)
> +{
> +     gchar *path;
> +     FILE *f;
> +
> +     if (ifname == NULL)
> +             path = g_strdup("/proc/sys/net/ipv6/conf/all/use_tempaddr");
> +     else
> +             path = g_strdup_printf(
> +                     "/proc/sys/net/ipv6/conf/%s/use_tempaddr", ifname);
If ifname is NULL, we shouldn't set the system wide value. We shouldn't do
anything.
And I realize we have the same issue with set_ipv6_state().


> +     if (path == NULL)
> +             return;
> +
> +     f = fopen(path, "r+");
> +
> +     g_free(path);
> +
> +     if (f == NULL)
> +             return;
> +
> +     if (value <= 0)
> +             fprintf(f, "0");
> +     else if (value > 1)
> +             /* Value > 1 means to enable Privacy Extensions and prefer
> +              * temporary addresses over public addresses
> +              */
> +             fprintf(f, "2");
> +     else
> +             /* Value == 1 means to enable Privacy Extensions, but prefer
> +              * public addresses over temporary addresses.
> +              */
> +             fprintf(f, "1");
Here I'd prefer if we do a < 3 and >= 0 check at the beginning of the
function. If the check fails, we reset value to 0, and then just do a
fprintf(f, value) at the end of the function.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to