Date: Mon, 25 Jul 2011 17:18:48 +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: r224343 - stable/7/sbin/ifconfig Message-ID: <201107251718.p6PHIm88067083@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marius Date: Mon Jul 25 17:18:47 2011 New Revision: 224343 URL: http://svn.freebsd.org/changeset/base/224343 Log: MFC: r221954 When setting media always and not just in case of switching to IFM_AUTO clear the options of the current media, i.e. only inherit the instance, which matches what NetBSD does. Without this it's really non-intuitive that the following sequence: ifconfig bge0 media 1000baseT mediaopt full-duplex ifconfig bge0 media 100baseTX results in 100baseTX full-duplex to be set or that: ifconfig bge0 media autoselect mediaopt flowcontrol ifconfig bge0 media 1000baseT mediaopt full-duplex tries to set 1000baseT full-duplex with flowcontrol, which isn't suported und thus fails while the following: ifconfig re0 media 1000baseT mediaopt flowcontrol,full-duplex ifconfig re0 media autoselect just switches to autoselection without flowcontrol. 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 Mon Jul 25 17:18:46 2011 (r224342) +++ stable/7/sbin/ifconfig/ifmedia.c Mon Jul 25 17:18:47 2011 (r224343) @@ -263,13 +263,9 @@ setmedia(const char *val, int d, int s, subtype = get_media_subtype(IFM_TYPE(ifmr->ifm_ulist[0]), val); strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - ifr.ifr_media = (ifmr->ifm_current & ~(IFM_NMASK|IFM_TMASK)) | + ifr.ifr_media = (ifmr->ifm_current & IFM_IMASK) | IFM_TYPE(ifmr->ifm_ulist[0]) | subtype; - if ((ifr.ifr_media & IFM_TMASK) == 0) { - ifr.ifr_media &= ~(IFM_GMASK | IFM_OMASK); - } - ifmr->ifm_current = ifr.ifr_media; callback_register(setifmediacallback, (void *)ifmr); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107251718.p6PHIm88067083>