FreeBSD Bugzilla – Attachment 155954 Details for
Bug 199672
[net80211] [patch]: replace some duplicate code with function call + fix a comment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Add node_clear_keyixmap() and use it in the ieee80211_free_node() / node_reclaim()
patch-clear_keyixmap.diff (text/plain), 2.93 KB, created by
Andriy Voskoboinyk
on 2015-04-24 18:36:14 UTC
(
hide
)
Description:
Add node_clear_keyixmap() and use it in the ieee80211_free_node() / node_reclaim()
Filename:
MIME Type:
Creator:
Andriy Voskoboinyk
Created:
2015-04-24 18:36:14 UTC
Size:
2.93 KB
patch
obsolete
>Index: sys/net80211/ieee80211_node.c >=================================================================== >--- sys/net80211/ieee80211_node.c (revision 281839) >+++ sys/net80211/ieee80211_node.c (working copy) >@@ -871,7 +879,7 @@ > void > ieee80211_node_deauth(struct ieee80211_node *ni, int reason) > { >- /* NB: bump the refcnt to be sure temporay nodes are not reclaimed */ >+ /* NB: bump the refcnt to be sure temporary nodes are not reclaimed */ > ieee80211_ref_node(ni); > if (ni->ni_associd != 0) > IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DEAUTH, reason); >@@ -1749,6 +1757,28 @@ > ni->ni_ic->ic_node_free(ni); > } > >+/* >+ * Clear any entry in the unicast key mapping table. >+ */ >+static int >+node_clear_keyixmap(struct ieee80211_node_table *nt, struct ieee80211_node *ni) >+{ >+ ieee80211_keyix keyix; >+ >+ keyix = ni->ni_ucastkey.wk_rxkeyix; >+ if (nt->nt_keyixmap != NULL && keyix < nt->nt_keyixmax && >+ nt->nt_keyixmap[keyix] == ni) { >+ IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, >+ "%s: %p<%s> clear key map entry %u\n", >+ __func__, ni, ether_sprintf(ni->ni_macaddr), keyix); >+ nt->nt_keyixmap[keyix] = NULL; >+ ieee80211_node_decref(ni); >+ return 1; >+ } >+ >+ return 0; >+} >+ > void > #ifdef IEEE80211_DEBUG_REFCNT > ieee80211_free_node_debug(struct ieee80211_node *ni, const char *func, int line) >@@ -1770,24 +1800,9 @@ > * Last reference, reclaim state. > */ > _ieee80211_free_node(ni); >- } else if (ieee80211_node_refcnt(ni) == 1 && >- nt->nt_keyixmap != NULL) { >- ieee80211_keyix keyix; >- /* >- * Check for a last reference in the key mapping table. >- */ >- keyix = ni->ni_ucastkey.wk_rxkeyix; >- if (keyix < nt->nt_keyixmax && >- nt->nt_keyixmap[keyix] == ni) { >- IEEE80211_DPRINTF(ni->ni_vap, >- IEEE80211_MSG_NODE, >- "%s: %p<%s> clear key map entry", __func__, >- ni, ether_sprintf(ni->ni_macaddr)); >- nt->nt_keyixmap[keyix] = NULL; >- ieee80211_node_decref(ni); /* XXX needed? */ >+ } else if (ieee80211_node_refcnt(ni) == 1) >+ if (node_clear_keyixmap(nt, ni)) > _ieee80211_free_node(ni); >- } >- } > IEEE80211_NODE_UNLOCK(nt); > } else { > if (ieee80211_node_dectestref(ni)) >@@ -1855,7 +1870,6 @@ > static void > node_reclaim(struct ieee80211_node_table *nt, struct ieee80211_node *ni) > { >- ieee80211_keyix keyix; > > IEEE80211_NODE_LOCK_ASSERT(nt); > >@@ -1870,15 +1884,7 @@ > * table. We cannot depend on the mapping table entry > * being cleared because the node may not be free'd. > */ >- keyix = ni->ni_ucastkey.wk_rxkeyix; >- if (nt->nt_keyixmap != NULL && keyix < nt->nt_keyixmax && >- nt->nt_keyixmap[keyix] == ni) { >- IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, >- "%s: %p<%s> clear key map entry %u\n", >- __func__, ni, ether_sprintf(ni->ni_macaddr), keyix); >- nt->nt_keyixmap[keyix] = NULL; >- ieee80211_node_decref(ni); /* NB: don't need free */ >- } >+ (void)node_clear_keyixmap(nt, ni); > if (!ieee80211_node_dectestref(ni)) { > /* > * Other references are present, just remove the
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 199672
: 155954