From owner-svn-src-head@freebsd.org Mon Nov 30 06:34:18 2015 Return-Path: Delivered-To: svn-src-head@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 1E256A31C18; Mon, 30 Nov 2015 06:34:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC1B31C15; Mon, 30 Nov 2015 06:34:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAU6YHRt099455; Mon, 30 Nov 2015 06:34:17 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAU6YHHY099453; Mon, 30 Nov 2015 06:34:17 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201511300634.tAU6YHHY099453@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 30 Nov 2015 06:34:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291470 - head/sbin/ifconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2015 06:34:18 -0000 Author: adrian Date: Mon Nov 30 06:34:16 2015 New Revision: 291470 URL: https://svnweb.freebsd.org/changeset/base/291470 Log: Convert ifconfig to use lib80211. * remove regdomain.[ch] - it's now part of lib80211. * convert ifieee80211.c to use the ioctl routines in lib80211 and implement the "error? exit" wrapper behaviour the callers expect. Deleted: head/sbin/ifconfig/regdomain.c head/sbin/ifconfig/regdomain.h Modified: head/sbin/ifconfig/Makefile head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/Makefile ============================================================================== --- head/sbin/ifconfig/Makefile Mon Nov 30 06:26:59 2015 (r291469) +++ head/sbin/ifconfig/Makefile Mon Nov 30 06:34:16 2015 (r291470) @@ -37,8 +37,8 @@ SRCS+= ifgif.c # GIF reversed header w SRCS+= sfp.c # SFP/SFP+ information LIBADD+= m -SRCS+= ifieee80211.c regdomain.c # SIOC[GS]IEEE80211 support -LIBADD+= bsdxml sbuf +SRCS+= ifieee80211.c # SIOC[GS]IEEE80211 support +LIBADD+= bsdxml sbuf 80211 SRCS+= carp.c # SIOC[GS]VH support SRCS+= ifgroup.c # ... Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Mon Nov 30 06:26:59 2015 (r291469) +++ head/sbin/ifconfig/ifieee80211.c Mon Nov 30 06:34:16 2015 (r291470) @@ -90,7 +90,9 @@ #include /* NB: for offsetof */ #include "ifconfig.h" -#include "regdomain.h" + +#include +#include #ifndef IEEE80211_FIXED_RATE_NONE #define IEEE80211_FIXED_RATE_NONE 0xff @@ -4886,60 +4888,31 @@ end: static int get80211(int s, int type, void *data, int len) { - struct ieee80211req ireq; - (void) memset(&ireq, 0, sizeof(ireq)); - (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name)); - ireq.i_type = type; - ireq.i_data = data; - ireq.i_len = len; - return ioctl(s, SIOCG80211, &ireq); + return (lib80211_get80211(s, name, type, data, len)); } static int get80211len(int s, int type, void *data, int len, int *plen) { - struct ieee80211req ireq; - (void) memset(&ireq, 0, sizeof(ireq)); - (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name)); - ireq.i_type = type; - ireq.i_len = len; - assert(ireq.i_len == len); /* NB: check for 16-bit truncation */ - ireq.i_data = data; - if (ioctl(s, SIOCG80211, &ireq) < 0) - return -1; - *plen = ireq.i_len; - return 0; + return (lib80211_get80211len(s, name, type, data, len, plen)); } static int get80211val(int s, int type, int *val) { - struct ieee80211req ireq; - (void) memset(&ireq, 0, sizeof(ireq)); - (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name)); - ireq.i_type = type; - if (ioctl(s, SIOCG80211, &ireq) < 0) - return -1; - *val = ireq.i_val; - return 0; + return (lib80211_get80211val(s, name, type, val)); } static void set80211(int s, int type, int val, int len, void *data) { - struct ieee80211req ireq; + int ret; - (void) memset(&ireq, 0, sizeof(ireq)); - (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name)); - ireq.i_type = type; - ireq.i_val = val; - ireq.i_len = len; - assert(ireq.i_len == len); /* NB: check for 16-bit truncation */ - ireq.i_data = data; - if (ioctl(s, SIOCS80211, &ireq) < 0) + ret = lib80211_set80211(s, name, type, val, len, data); + if (ret < 0) err(1, "SIOCS80211"); }