Date: Thu, 25 Nov 2010 18:33:44 +0000 (UTC) From: Marius Strobl <marius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r215828 - stable/7/sbin/ifconfig Message-ID: <201011251833.oAPIXiHN013795@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marius Date: Thu Nov 25 18:33:44 2010 New Revision: 215828 URL: http://svn.freebsd.org/changeset/base/215828 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/7/sbin/ifconfig/ifmedia.c Directory Properties: stable/7/sbin/ifconfig/ (props changed) Modified: stable/7/sbin/ifconfig/ifmedia.c ============================================================================== --- stable/7/sbin/ifconfig/ifmedia.c Thu Nov 25 18:32:02 2010 (r215827) +++ stable/7/sbin/ifconfig/ifmedia.c Thu Nov 25 18:33:44 2010 (r215828) @@ -267,7 +267,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; @@ -748,7 +748,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); @@ -783,7 +783,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); } } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011251833.oAPIXiHN013795>