cvs commit: src/sbin/ifconfig ifmedia.c

From: Doug Ambrisko <>
Date: Thu, 27 Jan 2005 16:40:13 +0000 (UTC)
ambrisko    2005-01-27 16:40:12 UTC

  FreeBSD src repository

  Modified files:
    sbin/ifconfig        ifmedia.c 
  Change the ifr_media operation to only get its value and only set
  its value once per ifconfig run.  Use Sam's new callback
  operation to set it when everything is done.
  The purpose for this is that if you did something like
          ifconfig bge0 media 100baseTX mediaopt full-duplex
  multiple times it would end up causing the PHY to re-sync
  since it would send the IOCTLs:
          ifconfig bge0 media 100baseTX -mediaopt full-duplex
          ifconfig bge0 media 100baseTX mediaopt full-duplex
  This would cause the PHY to be updated twice even though
  there really wasn't any change since the check in
  sys/net/if_media.c would always fail.
  Caveat is that this doesn't fix the case of:
          ifconfig bge0 media autoselect
  etc. since in sys/net/if_media.c it forces an autoselect to go through
  the entire process in ifmedia_ioctl :-( :
             * If no change, we're done.
             * XXX Automedia may invole software intervention.
             *     Keep going in case the the connected media changed.
             *     Similarly, if best match changed (kernel debugger?).
             if ((IFM_SUBTYPE(newmedia) != IFM_AUTO) &&
                  (newmedia == ifm->ifm_media) &&
                  (match == ifm->ifm_cur))
                       return 0;
  Briefly looked at by:   sam
  Revision  Changes    Path
  1.19      +81 -79    src/sbin/ifconfig/ifmedia.c
Received on Thu Jan 27 2005 - 16:40:16 UTC