if (local->iw_mode == IW_MODE_ADHOC && *mode == IW_MODE_MASTER) { 
if ((local->iw_mode == IW_MODE_ADHOC || local->iw_mode == IW_MODE_MONITOR) && *mode == IW_MODE_MASTER) { 
static int prism2_ioctl_siwmode(struct net_device *dev,				struct iw_request_info *info,				__u32 *mode, char *extra){	struct hostap_interface *iface;	local_info_t *local;	int double_reset = 0;	iface = netdev_priv(dev);	local = iface->local;	if (*mode != IW_MODE_ADHOC && *mode != IW_MODE_INFRA &&	    *mode != IW_MODE_MASTER && *mode != IW_MODE_REPEAT &&	    *mode != IW_MODE_MONITOR)		return -EOPNOTSUPP;#ifdef PRISM2_NO_STATION_MODES	if (*mode == IW_MODE_ADHOC || *mode == IW_MODE_INFRA)		return -EOPNOTSUPP;#endif /* PRISM2_NO_STATION_MODES */	if (*mode == local->iw_mode)		return 0;	if (*mode == IW_MODE_MASTER && local->essid[0] == '\0') {		printk(KERN_WARNING "%s: empty SSID not allowed in Master "		       "mode\n", dev->name);		return -EINVAL;	}	if (local->iw_mode == IW_MODE_MONITOR)		hostap_monitor_mode_disable(local);	if (local->iw_mode == IW_MODE_ADHOC && *mode == IW_MODE_MASTER) {		/* There seems to be a firmware bug in at least STA f/w v1.5.6		 * that leaves beacon frames to use IBSS type when moving from		 * IBSS to Host AP mode. Doing double Port0 reset seems to be		 * enough to workaround this. */		double_reset = 1;	}	printk(KERN_DEBUG "prism2: %s: operating mode changed "	       "%d -> %d\n", dev->name, local->iw_mode, *mode);	local->iw_mode = *mode;	if (local->iw_mode == IW_MODE_MONITOR)		hostap_monitor_mode_enable(local);	else if (local->iw_mode == IW_MODE_MASTER && !local->host_encrypt &&		 !local->fw_encrypt_ok) {		printk(KERN_DEBUG "%s: defaulting to host-based encryption as "		       "a workaround for firmware bug in Host AP mode WEP\n",		       dev->name);		local->host_encrypt = 1;	}	if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE,			    hostap_get_porttype(local)))		return -EOPNOTSUPP;	if (local->func->reset_port(dev))		return -EINVAL;	if (double_reset && local->func->reset_port(dev))		return -EINVAL;	if (local->iw_mode != IW_MODE_INFRA && local->iw_mode != IW_MODE_ADHOC)	{		/* netif_carrier is used only in client modes for now, so make		 * sure carrier is on when moving to non-client modes. */		netif_carrier_on(local->dev);		netif_carrier_on(local->ddev);	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/f3b10e1636dec053f4874d593e3de5d46da48a5f/hostap_ioctl.c/buggy/drivers/net/wireless/hostap/hostap_ioctl.c