From owner-svn-src-stable-8@FreeBSD.ORG Fri Nov 26 18:44:01 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81ADF106566C; Fri, 26 Nov 2010 18:44:01 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F4BE8FC0C; Fri, 26 Nov 2010 18:44:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQIi1td067439; Fri, 26 Nov 2010 18:44:01 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQIi1rh067437; Fri, 26 Nov 2010 18:44:01 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011261844.oAQIi1rh067437@svn.freebsd.org> From: Marius Strobl Date: Fri, 26 Nov 2010 18:44:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215877 - stable/8/sbin/ifconfig X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 18:44:01 -0000 Author: marius Date: Fri Nov 26 18:44:01 2010 New Revision: 215877 URL: http://svn.freebsd.org/changeset/base/215877 Log: MFC: r215259, r215272 - When printing media with more than one media option set aggregate these in a comma delimited list instead of repeating "mediaopt" for each one. This matches how the options of the active media are printed with print_media_word() and brings us in line what NetBSD does. - When setting a media with no sub-type specified also reset the type specific options along with the global ones so these options don't stick when f.e. switching to IFM_AUTO. Modified: stable/8/sbin/ifconfig/ifmedia.c Directory Properties: stable/8/sbin/ifconfig/ (props changed) Modified: stable/8/sbin/ifconfig/ifmedia.c ============================================================================== --- stable/8/sbin/ifconfig/ifmedia.c Fri Nov 26 17:31:02 2010 (r215876) +++ stable/8/sbin/ifconfig/ifmedia.c Fri Nov 26 18:44:01 2010 (r215877) @@ -276,7 +276,7 @@ setmedia(const char *val, int d, int s, IFM_TYPE(ifmr->ifm_ulist[0]) | subtype; if ((ifr.ifr_media & IFM_TMASK) == 0) { - ifr.ifr_media &= ~IFM_GMASK; + ifr.ifr_media &= ~(IFM_GMASK | IFM_OMASK); } ifmr->ifm_current = ifr.ifr_media; @@ -757,7 +757,7 @@ print_media_word_ifconfig(int ifmw) { struct ifmedia_description *desc; struct ifmedia_type_to_subtype *ttos; - int i; + int seen_option = 0, i; /* Find the top-level interface type. */ desc = get_toptype_desc(ifmw); @@ -792,7 +792,10 @@ print_media_word_ifconfig(int ifmw) for (desc = ttos->options[i].desc; desc->ifmt_string != NULL; desc++) { if (ifmw & desc->ifmt_word) { - printf(" mediaopt %s", desc->ifmt_string); + if (seen_option == 0) + printf(" mediaopt "); + printf("%s%s", seen_option++ ? "," : "", + desc->ifmt_string); } } }