/* if bssid != NULL its looking for a beacon frame  */
int attack_check(unsigned char *bssid, char *essid, unsigned char *capa, struct wif *wi)
/* if bssid != NULL its looking for a beacon frame  */
int attack_check(unsigned char *bssid, char *essid, unsigned char *capa, struct wif *wi)
{
    int ap_chan=0, iface_chan=0;
    iface_chan = wi_get_channel(wi);
    if(bssid != NULL)
    {
        ap_chan = wait_for_beacon(bssid, capa, essid);
        if(ap_chan < 0)
        {
            PCT; printf("No such BSSID available.\n");
            return -1;
        }
        if(ap_chan != iface_chan)
        {
            PCT; printf("%s is on channel %d, but the AP uses channel %d\n", wi_get_ifname(wi), iface_chan, ap_chan);
            return -1;
        }
    }
    return 0;
}