libifconfig: Initial code available, looking for feedback

Ravi Pokala rpokala at mac.com
Mon Apr 11 06:41:56 UTC 2016


-----Original Message-----


>Date: Sat, 09 Apr 2016 13:59:29 +0000
>From: Marie Helene Kvello-Aune <marieheleneka at gmail.com>
>To: freebsd-net at freebsd.org
>Subject: libifconfig: Initial code available, looking for feedback
>Message-ID:
>	<CALXRTbfxxf+bUev8sBoJEOfR41ZsLnB35i+4G_2Bp=j-eVVJQQ at 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@)



More information about the freebsd-net mailing list