Beispiel #1
0
/*
 * Activate a vap.  State should have been prepared with a
 * call to ieee80211_vap_setup and by the driver.  On return
 * from this call the vap is ready for use.
 */
int
ieee80211_vap_attach(struct ieee80211vap *vap,
	ifm_change_cb_t media_change, ifm_stat_cb_t media_stat)
{
	struct ifnet *ifp = vap->iv_ifp;
	struct ieee80211com *ic = vap->iv_ic;
	struct ifmediareq imr;
	int maxrate;

	IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE,
	    "%s: %s parent %s flags 0x%x flags_ext 0x%x\n",
	    __func__, ieee80211_opmode_name[vap->iv_opmode],
	    ic->ic_ifp->if_xname, vap->iv_flags, vap->iv_flags_ext);

	/*
	 * Do late attach work that cannot happen until after
	 * the driver has had a chance to override defaults.
	 */
	ieee80211_node_latevattach(vap);
	ieee80211_power_latevattach(vap);

	maxrate = ieee80211_media_setup(ic, &vap->iv_media, vap->iv_caps,
	    vap->iv_opmode == IEEE80211_M_STA, media_change, media_stat);
	ieee80211_media_status(ifp, &imr);
	/* NB: strip explicit mode; we're actually in autoselect */
	ifmedia_set(&vap->iv_media,
	    imr.ifm_active &~ (IFM_MMASK | IFM_IEEE80211_TURBO));
	if (maxrate)
		ifp->if_baudrate = IF_Mbps(maxrate);

	ether_ifattach(ifp, vap->iv_myaddr, &wlan_global_serializer);
	if (vap->iv_opmode == IEEE80211_M_MONITOR) {
		/* NB: disallow transmit */
#ifdef __FreeBSD__
		ifp->if_transmit = null_transmit;
#endif
		ifp->if_output = null_output;
	} else {
		/* hook output method setup by ether_ifattach */
		vap->iv_output = ifp->if_output;
		ifp->if_output = ieee80211_output;
	}
	/* NB: if_mtu set by ether_ifattach to ETHERMTU */

	TAILQ_INSERT_TAIL(&ic->ic_vaps, vap, iv_next);
	ieee80211_syncflag_locked(ic, IEEE80211_F_WME);
#ifdef IEEE80211_SUPPORT_SUPERG
	ieee80211_syncflag_locked(ic, IEEE80211_F_TURBOP);
#endif
	ieee80211_syncflag_locked(ic, IEEE80211_F_PCF);
	ieee80211_syncflag_locked(ic, IEEE80211_F_BURST);
	ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_HT);
	ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_USEHT40);
	ieee80211_syncifflag_locked(ic, IFF_PROMISC);
	ieee80211_syncifflag_locked(ic, IFF_ALLMULTI);

	return 1;
}
Beispiel #2
0
int
ieee80211_vap_attach(struct ieee80211vap *vap)
{
    int ret;

    IEEE80211_ADD_VAP_TARGET(vap);

    /*
     * XXX: It looks like we always need a bss node around
     * for transmit before association (e.g., probe request
     * in scan operation). When we actually join a BSS, we'll
     * create a new node and free the old one.
     */
    ret = ieee80211_node_latevattach(vap);

    if (ret == 0) {
        IEEE80211_UPDATE_TARGET_IC(vap->iv_bss);
    }

    /*
     * If IQUE is NOT enabled at compiling, ieee80211_me_attach attaches
     * the empty op table to vap->iv_me_ops;
     * If IQUE is enabled, the initialization is done by the following 
     * function, and the op table is correctly attached.
     */
    if(ret == 0){
        ieee80211_ique_attach(ret,vap);
    }
    if(ret == 0)
    {
        ieee80211_nawds_attach(vap);
        ieee80211_aow_ie_attach(vap);
        vap->iv_vap_ath_info_handle = ieee80211_vap_ath_info_attach(vap);
        ieee80211_quiet_vattach(vap);
    }
    return ret;
}
Beispiel #3
0
int
ieee80211_vap_attach(struct ieee80211vap *vap)
{
    int ret;

    IEEE80211_ADD_VAP_TARGET(vap);

    /*
     * XXX: It looks like we always need a bss node around
     * for transmit before association (e.g., probe request
     * in scan operation). When we actually join a BSS, we'll
     * create a new node and free the old one.
     */
    ret = ieee80211_node_latevattach(vap);

    if (ret == 0) {
        IEEE80211_UPDATE_TARGET_IC(vap->iv_bss);
    }

    /*
     * If IQUE is NOT enabled at compiling, ieee80211_me_attach attaches
     * the empty op table to vap->iv_me_ops;
     * If IQUE is enabled, the initialization is done by the following
     * function, and the op table is correctly attached.
     */
    ieee80211_ique_attach(vap);
    ieee80211_nawds_attach(vap);

    vap->iv_vap_ath_info_handle = ieee80211_vap_ath_info_attach(vap);

    /*ljy--add begin for ac roaming eap at splitmac on 2013-1-15*/
    vap->iv_eap = 0;
    /*ljy--add end*/

    /*zhaoyang1 transplant from 717*/
#if 0
    /*Begin:Added by duanmingzhe for traffic limit*/
    vap_setup_timer(vap);
    /*End:Added by duanmingzhe for traffic limit*/
#endif
    /*Begin:Added by duanmingzhe for auto-transmit*/
    vap->iv_transmit_switch = 0;
    vap->iv_transmit_rate = 300000;
    /*End:Added by duanmingzhe for auto-transmit*/

    /*pengruofeng--add begin to develop the policy of mac binding 2011-5-31*/
    vap->vap_dhcp_enable = 0;
    vap->vap_ip_auto_learning = 0;
    vap->vap_pppoe_enable = 0;
    /*pengruofeng --add end 2011-5-31*/

    /*pengruofeng--add begin for user isolation 2011-5-31*/
    vap->iv_switch = 0;
    /*pengruofeng--add end 2011-5-31*/

    /*pengruofeng add for spoofing attack of data frame 2011-5-31*/
    vap->iv_seq_detect_num = 5;
    /*pengruofeng -- add end 2011-5-31*/
    /*zhaoyang1 transplant end*/

    /* add by [email protected]. Control the sending freq of deauth frames, 2013-12-12 */
    vap->iv_deauth_timestamp = 0;
    vap->iv_deauth_send_interval = HZ;  /* 1 second as default */
    /* add by [email protected] end */

    return ret;
}