Exemplo n.º 1
0
void
wlan_setup_node(struct ieee80211_node_table *nt, bss_t *ni,
                const A_UINT8 *macaddr)
{
    int hash;
    A_UINT32 timeoutValue = 0;

    A_MEMCPY(ni->ni_macaddr, macaddr, IEEE80211_ADDR_LEN);
    hash = IEEE80211_NODE_HASH (macaddr);
    ieee80211_node_initref (ni);     /* mark referenced */

    timeoutValue = nt->nt_nodeAge;

    //ni->ni_tstamp = A_GET_MS (0);  //-builder:nodeage
    ni->ni_tstamp = A_GET_MS(timeoutValue);  //+builder:nodeage

    ni->ni_actcnt = WLAN_NODE_INACT_CNT;

    IEEE80211_NODE_LOCK_BH(nt);

    /* Insert at the end of the node list */
    ni->ni_list_next = NULL;
    ni->ni_list_prev = nt->nt_node_last;
    if(nt->nt_node_last != NULL)
    {
        nt->nt_node_last->ni_list_next = ni;
    }
    nt->nt_node_last = ni;
    if(nt->nt_node_first == NULL)
    {
        nt->nt_node_first = ni;
    }

    /* Insert into the hash list i.e. the bucket */
    if((ni->ni_hash_next = nt->nt_hash[hash]) != NULL)
    {
        nt->nt_hash[hash]->ni_hash_prev = ni;
    }
    ni->ni_hash_prev = NULL;
    nt->nt_hash[hash] = ni;

    if (!nt->isTimerArmed) {
        A_TIMEOUT_MS(&nt->nt_inact_timer, timeoutValue, 0);
        nt->isTimerArmed = TRUE;
    }

    IEEE80211_NODE_UNLOCK_BH(nt);
}
Exemplo n.º 2
0
/*
 * Reclaim a node.  If this is the last reference count then
 * do the normal free work.  Otherwise remove it from the node
 * table and mark it gone by clearing the back-reference.
 */
void
wlan_node_reclaim(struct ieee80211_node_table *nt, bss_t *ni)
{
    IEEE80211_NODE_LOCK(nt);

    if (ieee80211_node_dectestref(ni))
    {
        if(ni->ni_list_prev == NULL)
        {
            /* First in list so fix the list head */
            nt->nt_node_first = ni->ni_list_next;
        }
        else
        {
            ni->ni_list_prev->ni_list_next = ni->ni_list_next;
        }

        if(ni->ni_list_next == NULL)
        {
            /* Last in list so fix list tail */
            nt->nt_node_last = ni->ni_list_prev;
        }
        else
        {
            ni->ni_list_next->ni_list_prev = ni->ni_list_prev;
        }

        if(ni->ni_hash_prev == NULL)
        {
            /* First in list so fix the list head */
            int hash;
            hash = IEEE80211_NODE_HASH(ni->ni_macaddr);
            nt->nt_hash[hash] = ni->ni_hash_next;
        }
        else
        {
            ni->ni_hash_prev->ni_hash_next = ni->ni_hash_next;
        }

        if(ni->ni_hash_next != NULL)
        {
            ni->ni_hash_next->ni_hash_prev = ni->ni_hash_prev;
        }
        wlan_node_free(ni);
    }
    IEEE80211_NODE_UNLOCK(nt);
}
Exemplo n.º 3
0
static bss_t *
_ieee80211_find_node(struct ieee80211_node_table *nt,
    const A_UINT8 *macaddr)
{
    bss_t *ni = NULL;
    int hash = 0;

    IEEE80211_NODE_LOCK_ASSERT(nt);

    hash = IEEE80211_NODE_HASH(macaddr);

    if (hash >= IEEE80211_NODE_HASHSIZE)
    {
        // overflow????
        return NULL;
    }

    if (hash < 0)
    {
        // underflow????
        return NULL;
    }

    if (NULL == nt)
    {
        return NULL;
    }

    if (NULL == nt->nt_hash)
    {
        return NULL;
    }

    if (NULL == nt->nt_hash[hash])
    {
        return NULL;
    }

    for(ni = nt->nt_hash[hash]; ni; ni = ni->ni_hash_next) {
        if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) {
            ieee80211_node_incref(ni);  /* mark referenced */
            return ni;
        }
    }
    return NULL;
}
Exemplo n.º 4
0
static bss_t *
_ieee80211_find_node(struct ieee80211_node_table *nt,
    const A_UINT8 *macaddr)
{
    bss_t *ni;
    int hash;

    IEEE80211_NODE_LOCK_ASSERT(nt);

    hash = IEEE80211_NODE_HASH(macaddr);
    for(ni = nt->nt_hash[hash]; ni; ni = ni->ni_hash_next) {
        if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) {
            ieee80211_node_incref(ni);  /* mark referenced */
            return ni;
        }
    }
    return NULL;
}
Exemplo n.º 5
0
void
wlan_node_remove_core (struct ieee80211_node_table *nt, bss_t *ni)
{
    if(ni->ni_list_prev == NULL)
    {
        /* First in list so fix the list head */
        nt->nt_node_first = ni->ni_list_next;
    }
    else
    {
        ni->ni_list_prev->ni_list_next = ni->ni_list_next;
    }

    if(ni->ni_list_next == NULL)
    {
        /* Last in list so fix list tail */
        nt->nt_node_last = ni->ni_list_prev;
    }
    else
    {
        ni->ni_list_next->ni_list_prev = ni->ni_list_prev;
    }

    if(ni->ni_hash_prev == NULL)
    {
        /* First in list so fix the list head */
        int hash;
        hash = IEEE80211_NODE_HASH(ni->ni_macaddr);
        nt->nt_hash[hash] = ni->ni_hash_next;
    }
    else
    {
        ni->ni_hash_prev->ni_hash_next = ni->ni_hash_next;
    }

    if(ni->ni_hash_next != NULL)
    {
        ni->ni_hash_next->ni_hash_prev = ni->ni_hash_prev;
    }
}
Exemplo n.º 6
0
void
wlan_setup_node(struct ieee80211_node_table *nt, bss_t *ni,
                const A_UINT8 *macaddr)
{
    int hash;

    A_MEMCPY(ni->ni_macaddr, macaddr, IEEE80211_ADDR_LEN);
    hash = IEEE80211_NODE_HASH (macaddr);
    ieee80211_node_initref (ni);     /* mark referenced */

    wlan_node_update_timestamp(nt, ni);

    IEEE80211_NODE_LOCK_BH(nt);

    /* Insert at the end of the node list */
    ni->ni_list_next = NULL;
    ni->ni_list_prev = nt->nt_node_last;
    if(nt->nt_node_last != NULL)
    {
        nt->nt_node_last->ni_list_next = ni;
    }
    nt->nt_node_last = ni;
    if(nt->nt_node_first == NULL)
    {
        nt->nt_node_first = ni;
    }

    /* Insert into the hash list i.e. the bucket */
    if((ni->ni_hash_next = nt->nt_hash[hash]) != NULL)
    {
        nt->nt_hash[hash]->ni_hash_prev = ni;
    }
    ni->ni_hash_prev = NULL;
    nt->nt_hash[hash] = ni;

    IEEE80211_NODE_UNLOCK_BH(nt);
}
Exemplo n.º 7
0
void
wlan_setup_node(struct ieee80211_node_table *nt, bss_t *ni,
                const A_UINT8 *macaddr)
{
    A_INT32 hash;

    A_MEMCPY(ni->ni_macaddr, macaddr, IEEE80211_ADDR_LEN);
    hash = IEEE80211_NODE_HASH(macaddr);
    ieee80211_node_initref(ni);     /* mark referenced */

    ni->ni_tstamp = A_MS_TICKGET() + WLAN_NODE_INACT_TIMEOUT_MSEC;
    IEEE80211_NODE_LOCK(nt);

    /* Insert at the end of the node list */
    ni->ni_list_next = NULL;
    ni->ni_list_prev = nt->nt_node_last;
    if(nt->nt_node_last != NULL)
    {
        nt->nt_node_last->ni_list_next = ni;
    }
    nt->nt_node_last = ni;
    if(nt->nt_node_first == NULL)
    {
        nt->nt_node_first = ni;
    }
 
    /* Insert into the hash list i.e. the bucket */
    if((ni->ni_hash_next = nt->nt_hash[hash]) != NULL)
    {
        nt->nt_hash[hash]->ni_hash_prev = ni;
    }
    ni->ni_hash_prev = NULL;
    nt->nt_hash[hash] = ni;

    IEEE80211_NODE_UNLOCK(nt);
}