Deleted Added
sdiff udiff text old ( 179640 ) new ( 179641 )
full compact
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_node.c 179640 2008-06-07 17:43:41Z sam $");
29
30#include "opt_wlan.h"
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/mbuf.h>
35#include <sys/malloc.h>
36#include <sys/kernel.h>

--- 1440 unchanged lines hidden (view full) ---

1477 }
1478 }
1479 return ni;
1480}
1481
1482static void
1483_ieee80211_free_node(struct ieee80211_node *ni)
1484{
1485 struct ieee80211vap *vap = ni->ni_vap;
1486 struct ieee80211_node_table *nt = ni->ni_table;
1487
1488 IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE,
1489 "%s %p<%s> in %s table\n", __func__, ni,
1490 ether_sprintf(ni->ni_macaddr),
1491 nt != NULL ? nt->nt_name : "<gone>");
1492
1493 if (vap->iv_aid_bitmap != NULL)
1494 IEEE80211_AID_CLR(vap, ni->ni_associd);
1495 if (nt != NULL) {
1496 TAILQ_REMOVE(&nt->nt_node, ni, ni_list);
1497 LIST_REMOVE(ni, ni_hash);
1498 }
1499 vap->iv_ic->ic_node_free(ni);
1500}
1501
1502void
1503#ifdef IEEE80211_DEBUG_REFCNT
1504ieee80211_free_node_debug(struct ieee80211_node *ni, const char *func, int line)
1505#else
1506ieee80211_free_node(struct ieee80211_node *ni)
1507#endif

--- 38 unchanged lines hidden (view full) ---

1546}
1547
1548/*
1549 * Reclaim a unicast key and clear any key cache state.
1550 */
1551int
1552ieee80211_node_delucastkey(struct ieee80211_node *ni)
1553{
1554 struct ieee80211vap *vap = ni->ni_vap;
1555 /* XXX is ni_table safe? */
1556 struct ieee80211_node_table *nt = &ni->ni_ic->ic_sta;
1557 struct ieee80211_node *nikey;
1558 ieee80211_keyix keyix;
1559 int isowned, status;
1560
1561 /*
1562 * NB: We must beware of LOR here; deleting the key
1563 * can cause the crypto layer to block traffic updates
1564 * which can generate a LOR against the node table lock;
1565 * grab it here and stash the key index for our use below.
1566 *
1567 * Must also beware of recursion on the node table lock.
1568 * When called from node_cleanup we may already have
1569 * the node table lock held. Unfortunately there's no
1570 * way to separate out this path so we must do this
1571 * conditionally.
1572 */
1573 isowned = IEEE80211_NODE_IS_LOCKED(nt);
1574 if (!isowned)
1575 IEEE80211_NODE_LOCK(nt);
1576 keyix = ni->ni_ucastkey.wk_rxkeyix;
1577 status = ieee80211_crypto_delkey(vap, &ni->ni_ucastkey);
1578 if (nt->nt_keyixmap != NULL && keyix < nt->nt_keyixmax) {
1579 nikey = nt->nt_keyixmap[keyix];
1580 nt->nt_keyixmap[keyix] = NULL;;
1581 } else
1582 nikey = NULL;
1583 if (!isowned)
1584 IEEE80211_NODE_UNLOCK(nt);
1585
1586 if (nikey != NULL) {
1587 KASSERT(nikey == ni,
1588 ("key map out of sync, ni %p nikey %p", ni, nikey));
1589 IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE,
1590 "%s: delete key map entry %p<%s> refcnt %d\n",
1591 __func__, ni, ether_sprintf(ni->ni_macaddr),
1592 ieee80211_node_refcnt(ni)-1);
1593 ieee80211_free_node(ni);
1594 }
1595 return status;
1596}
1597

--- 885 unchanged lines hidden ---