45#include <sys/kernel.h>
47#include <sys/malloc.h>
49#include <sys/module.h>
52#include <sys/socket.h>
55#include <net/if_media.h>
56#include <net/ethernet.h>
73#define ACL_HASHSIZE 32
76 TAILQ_ENTRY(
acl) acl_list;
77 LIST_ENTRY(
acl) acl_hash;
84 TAILQ_HEAD(,
acl) as_list;
90#define ACL_HASH(addr) \
91 (((const uint8_t *)(addr))[IEEE80211_ADDR_LEN - 1] % ACL_HASHSIZE)
110 TAILQ_INIT(&as->as_list);
123 KASSERT(
nrefs > 0, (
"imbalanced attach/detach"));
132static __inline
struct acl *
139 LIST_FOREACH(
acl, &as->as_hash[hash], acl_hash) {
151 TAILQ_REMOVE(&as->as_list,
acl, acl_list);
152 LIST_REMOVE(
acl, acl_hash);
185 "ACL: add %s failed, no memory\n", ether_sprintf(
mac));
192 LIST_FOREACH(
acl, &as->as_hash[hash], acl_hash) {
197 "ACL: add %s failed, already present\n",
203 TAILQ_INSERT_TAIL(&as->as_list,
new, acl_list);
204 LIST_INSERT_HEAD(&as->as_hash[hash],
new, acl_hash);
209 "ACL: add %s\n", ether_sprintf(
mac));
226 "ACL: remove %s%s\n", ether_sprintf(
mac),
227 acl == NULL ?
", not present" :
"");
229 return (
acl == NULL ? ENOENT : 0);
241 while ((
acl = TAILQ_FIRST(&as->as_list)) != NULL)
254 "ACL: set policy to %u\n", policy);
299 switch (ireq->
i_val) {
305 if (ireq->
i_len == 0) {
315 TAILQ_FOREACH(
acl, &as->as_list, acl_list) {
320 if (ireq->
i_len >= space) {
321 error = copyout(ap, ireq->
i_data, space);
static LIST_HEAD(ieee80211com)
#define IEEE80211_ADDR_LEN
static int acl_getioctl(struct ieee80211vap *vap, struct ieee80211req *ireq)
static int acl_add(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN])
static __inline struct acl * _find_acl(struct aclstate *as, const uint8_t *macaddr)
static int acl_attach(struct ieee80211vap *vap)
IEEE80211_ACL_MODULE(wlan_acl, mac, 1)
static MALLOC_DEFINE(M_80211_ACL, "acl", "802.11 station acl")
static void acl_detach(struct ieee80211vap *vap)
static void _acl_free(struct aclstate *as, struct acl *acl)
static const struct ieee80211_aclator mac
static int acl_getpolicy(struct ieee80211vap *vap)
static int acl_free_all(struct ieee80211vap *)
static int acl_check(struct ieee80211vap *vap, const struct ieee80211_frame *wh)
static int acl_remove(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN])
static int acl_setpolicy(struct ieee80211vap *vap, int policy)
static int acl_setioctl(struct ieee80211vap *vap, struct ieee80211req *ireq)
#define ACL_LOCK_DESTROY(_as)
#define IEEE80211_M_NOWAIT
#define ACL_LOCK_INIT(_as, _name)
#define ACL_LOCK_ASSERT(_as)
@ IEEE80211_MACCMD_POLICY
@ IEEE80211_MACCMD_POLICY_DENY
@ IEEE80211_MACCMD_POLICY_ALLOW
@ IEEE80211_MACCMD_POLICY_RADIUS
@ IEEE80211_MACCMD_POLICY_OPEN
static const struct ieee80211_aclator * acl
#define IEEE80211_ADDR_COPY(dst, src)
#define IEEE80211_MSG_ACL
#define IEEE80211_ADDR_EQ(a1, a2)
#define IEEE80211_DPRINTF(_vap, _m, _fmt,...)
uint8_t i_addr2[IEEE80211_ADDR_LEN]
uint8_t ml_macaddr[IEEE80211_ADDR_LEN]