From owner-freebsd-net@freebsd.org Mon Apr 11 06:41:56 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 916D9B0B54F for ; Mon, 11 Apr 2016 06:41:56 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp002.me.com (mr11p00im-asmtp002.me.com [17.110.69.253]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8001815FF for ; Mon, 11 Apr 2016 06:41:56 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from [192.168.1.4] (c-50-174-208-73.hsd1.ca.comcast.net [50.174.208.73]) by mr11p00im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.36.0 64bit (built Sep 8 2015)) with ESMTPSA id <0O5G00271ILVY020@mr11p00im-asmtp002.me.com> for freebsd-net@freebsd.org; Mon, 11 Apr 2016 06:41:56 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-04-11_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1604110102 User-Agent: Microsoft-MacOutlook/0.0.0.160212 Date: Sun, 10 Apr 2016 23:41:54 -0700 Subject: Re: libifconfig: Initial code available, looking for feedback From: Ravi Pokala Sender: "Pokala, Ravi" To: "freebsd-net@freebsd.org" Message-id: <25165EFB-4D17-476D-86C6-D99C3E97F227@panasas.com> Thread-topic: libifconfig: Initial code available, looking for feedback MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Apr 2016 06:41:56 -0000 -----Original Message----- >Date: Sat, 09 Apr 2016 13:59:29 +0000 >From: Marie Helene Kvello-Aune >To: freebsd-net@freebsd.org >Subject: libifconfig: Initial code available, looking for feedback >Message-ID: > >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@)