Changing Interface Modes
Changing the mode of an existing interface is not possible in MadWifi. Instead, you need to destroy the interface whose mode you want to change and then recreate it in the correct mode:
ifconfig ath0 down wlanconfig ath0 destroy wlanconfig ath0 create wlandev wifi0 wlanmode [sta|adhoc|ap|monitor|wds|ahdemo]
or
wlanconfig ath create wlandev wifi0 wlanmode [sta|adhoc|ap|monitor|wds|ahdemo]
At the second case an ath device will be created where the lowest available integer will be used.
More information on wlanconfig can be found in its man page, wlanconfig 8.