diff options
author | sam <sam@FreeBSD.org> | 2009-05-30 19:57:31 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2009-05-30 19:57:31 +0000 |
commit | 26090443666d3ceab2f75d88550efeb67cd0461b (patch) | |
tree | c333e3f9f727e64093b6b58bf38c17a8f6d08c98 /sys/net80211/ieee80211_tdma.c | |
parent | aacbbee3d55ebfb0a2719284de322f8bad257948 (diff) | |
download | FreeBSD-src-26090443666d3ceab2f75d88550efeb67cd0461b.zip FreeBSD-src-26090443666d3ceab2f75d88550efeb67cd0461b.tar.gz |
o assert TDMA_MAXSLOTS is 2 so noone tries to blindly increase it
o add safety belt in vdetach for failed state block allocation
o fix dynamic change to tdma config; ERESTART may not result in
kicking the state machine so we need to explicitly mark the
beacon for update
Sponsored by:
Diffstat (limited to 'sys/net80211/ieee80211_tdma.c')
-rw-r--r-- | sys/net80211/ieee80211_tdma.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sys/net80211/ieee80211_tdma.c b/sys/net80211/ieee80211_tdma.c index 8747b4e..43f32f7 100644 --- a/sys/net80211/ieee80211_tdma.c +++ b/sys/net80211/ieee80211_tdma.c @@ -104,6 +104,11 @@ __FBSDID("$FreeBSD$"); /* XXX probably should set a max */ #define TDMA_BINTVAL_VALID(_bintval) (1 <= (_bintval)) +/* + * This code is not prepared to handle more than 2 slots. + */ +CTASSERT(TDMA_MAXSLOTS == 2); + static void tdma_vdetach(struct ieee80211vap *vap); static int tdma_newstate(struct ieee80211vap *, enum ieee80211_state, int); static void tdma_beacon_miss(struct ieee80211vap *vap); @@ -187,8 +192,13 @@ tdma_vdetach(struct ieee80211vap *vap) { struct ieee80211_tdma_state *ts = vap->iv_tdma; + if (ts == NULL) { + /* NB: should not have touched any ic state */ + return; + } ts->tdma_opdetach(vap); free(vap->iv_tdma, M_80211_VAP); + vap->iv_tdma = NULL; setackpolicy(vap->iv_ic, 0); /* enable ACK's */ } @@ -764,7 +774,7 @@ tdma_ioctl_set80211(struct ieee80211vap *vap, struct ieee80211req *ireq) return EINVAL; if (ireq->i_val != ts->tdma_slot) { ts->tdma_slot = ireq->i_val; - return ERESTART; + goto restart; } break; case IEEE80211_IOC_TDMA_SLOTCNT: @@ -772,7 +782,7 @@ tdma_ioctl_set80211(struct ieee80211vap *vap, struct ieee80211req *ireq) return EINVAL; if (ireq->i_val != ts->tdma_slotcnt) { ts->tdma_slotcnt = ireq->i_val; - return ERESTART; + goto restart; } break; case IEEE80211_IOC_TDMA_SLOTLEN: @@ -786,7 +796,7 @@ tdma_ioctl_set80211(struct ieee80211vap *vap, struct ieee80211req *ireq) return EINVAL; if (ireq->i_val != ts->tdma_slotlen) { ts->tdma_slotlen = ireq->i_val; - return ERESTART; + goto restart; } break; case IEEE80211_IOC_TDMA_BINTERVAL: @@ -794,12 +804,15 @@ tdma_ioctl_set80211(struct ieee80211vap *vap, struct ieee80211req *ireq) return EINVAL; if (ireq->i_val != ts->tdma_bintval) { ts->tdma_bintval = ireq->i_val; - return ERESTART; + goto restart; } break; default: return ENOSYS; } return 0; +restart: + ieee80211_beacon_notify(vap, IEEE80211_BEACON_TDMA); + return ERESTART; } IEEE80211_IOCTL_SET(tdma, tdma_ioctl_set80211); |