Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Apr 2016 23:41:54 -0700
From:      Ravi Pokala <rpokala@mac.com>
To:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject:   Re: libifconfig: Initial code available, looking for feedback
Message-ID:  <25165EFB-4D17-476D-86C6-D99C3E97F227@panasas.com>

next in thread | raw e-mail | index | archive | help
-----Original Message-----


>Date: Sat, 09 Apr 2016 13:59:29 +0000
>From: Marie Helene Kvello-Aune <marieheleneka@gmail.com>
>To: freebsd-net@freebsd.org
>Subject: libifconfig: Initial code available, looking for feedback
>Message-ID:
>	<CALXRTbfxxf+bUev8sBoJEOfR41ZsLnB35i+4G_2Bp=j-eVVJQQ@mail.gmail.com>
>Content-Type: text/plain; charset=UTF-8
>
>Hey!
>
>Please see previous thread[1] for context on what libifconfig is.
>
>I've just pushed an initial version of libifconfig to the github
>repository[2]. I would appreciate feedback, in particular on the API design
>and usage, and especially on how it communicates error state to the
>application.

Hi,

I'm definitely not a networking person, but I have some comments:

libifconfig.h

    #pragma once - I'm not sure if that's supported in every compiler used in the base system; I'd stick with a traditional guard macro.

    struct errstate::ioctl_request - should be unsigned long to match type of ioctl() argument.

libifconfig.c

    libifconfig_ioctlwrap_ret() - the value of "rcode" which is passed in is always the return value of ioctl(), which always returns 0 or -1; I'm pretty sure you want to set ioctl_err to "errno", not "rcode".

    libifconfig_ioctlwrap() / libifconfig_ioctlwrap_caddr() - it's not clear why you're using one versus the other.

    libifconfig_get_description() - the case of the ioctl failing is not handled.

libifconfig_socketcache.h

    Needs a guard macro to prevent multiple inclusion.

libifconfig_socketcache.c

    libifconfig_socket() - similar to libifconfig_ioctlwrap_ret(), the value of "errno" is lost.

Thanks,

Ravi (rpokala@)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?25165EFB-4D17-476D-86C6-D99C3E97F227>