Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Apr 2001 14:59:14 -0700 (PDT)
From:      Doug Ambrisko <ambrisko@whistle.com>
To:        freebsd-mobile@FreeBSD.ORG
Subject:   Re: Anyone working on Aironet LEAP support? (fwd)
Message-ID:  <200104122159.OAA51580@whistle.com>

next in thread | raw e-mail | index | archive | help
Let's try this again with the trailing 'g' on ".org"

----- Forwarded message from Doug Ambrisko -----
ambrisko writes:
| Brooks Davis writes:
| | On Thu, Apr 12, 2001 at 08:17:44AM -0700, Doug Ambrisko wrote:
| | > That strange thing is the DDB wouldn't give me a back track or anything 
| | > like that.  I did single step through DDB after setting a break point
| | > in an_ioctl and it did die when doing the media ioctl.
| | 
| | You pretty much need to use a static kernel for the debugger to work
| | correctly.  
| 
| Hmm I tried that.

Okay I figured out the problem.  I need to do a little more safety work
but attached is a patch that works.  The issue is that the status rid
keeps getting bigger.  You only allocated the "currently" known size
and did a read of that.  The read was longer and then trashed the stack
which then made debuging difficult.  For now I changed it to use the areq
buffer as most calls use that and then point the status to the areq 
data structure.  This has been confirmed to work as "normal".

The read_record needs to be fixed to really only read the size stored
in the size field to prevent this type of problem and warn if the size 
is to small.

I'll look at doing that.

Doug A.

*** if_an.c~	Thu Apr 12 11:26:19 2001
--- if_an.c	Thu Apr 12 14:09:51 2001
***************
*** 1982,1993 ****
  	struct ifnet		*ifp;
  	struct ifmediareq	*imr;
  {
! 	struct an_ltv_status	status;
  	struct an_softc		*sc = ifp->if_softc;
  
! 	status.an_len = sizeof(status);
! 	status.an_type = AN_RID_STATUS;
! 	if (an_read_record(sc, (struct an_ltv_gen *)&status)) {
  		/* If the status read fails, just lie. */
  		imr->ifm_active = sc->an_ifmedia.ifm_cur->ifm_media;
  		imr->ifm_status = IFM_AVALID|IFM_ACTIVE;
--- 1997,2010 ----
  	struct ifnet		*ifp;
  	struct ifmediareq	*imr;
  {
! 	struct an_req	        areq;
! 	struct an_ltv_status	*status = (struct an_ltv_status *)&areq;
  	struct an_softc		*sc = ifp->if_softc;
  
! 	areq.an_len = sizeof(areq);
! 	areq.an_type = AN_RID_STATUS;
! 
! 	if (an_read_record(sc, (struct an_ltv_gen *)&areq)) {
  		/* If the status read fails, just lie. */
  		imr->ifm_active = sc->an_ifmedia.ifm_cur->ifm_media;
  		imr->ifm_status = IFM_AVALID|IFM_ACTIVE;
***************
*** 1997,2003 ****
  		imr->ifm_active = IFM_IEEE80211|IFM_AUTO;
  		if (sc->an_config.an_opmode == AN_OPMODE_IBSS_ADHOC)
  			imr->ifm_active |= IFM_IEEE80211_ADHOC;
! 		switch(status.an_current_tx_rate) {
  		case AN_RATE_1MBPS:
  			imr->ifm_active |= IFM_IEEE80211_DS1;
  			break;
--- 2014,2020 ----
  		imr->ifm_active = IFM_IEEE80211|IFM_AUTO;
  		if (sc->an_config.an_opmode == AN_OPMODE_IBSS_ADHOC)
  			imr->ifm_active |= IFM_IEEE80211_ADHOC;
! 		switch(status->an_current_tx_rate) {
  		case AN_RATE_1MBPS:
  			imr->ifm_active |= IFM_IEEE80211_DS1;
  			break;
***************
*** 2018,2024 ****
  	imr->ifm_status = IFM_AVALID;
  	if (sc->an_config.an_opmode == AN_OPMODE_IBSS_ADHOC)
  		imr->ifm_status |= IFM_ACTIVE;
! 	else if (status.an_opmode & AN_STATUS_OPMODE_ASSOCIATED)
  			imr->ifm_status |= IFM_ACTIVE;
  }
  
--- 2035,2041 ----
  	imr->ifm_status = IFM_AVALID;
  	if (sc->an_config.an_opmode == AN_OPMODE_IBSS_ADHOC)
  		imr->ifm_status |= IFM_ACTIVE;
! 	else if (status->an_opmode & AN_STATUS_OPMODE_ASSOCIATED)
  			imr->ifm_status |= IFM_ACTIVE;
  }
  

----- End of forwarded message from Doug Ambrisko -----

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104122159.OAA51580>