mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
net/l2filter : Move 'L2FILTER_LISTSIZE' to 'CONFIG_'
This commit is contained in:
parent
0d52f81935
commit
caab4cd8c5
@ -288,7 +288,7 @@ struct netdev {
|
||||
netdev_t *lower; /**< ptr to the lower netdev layer */
|
||||
#endif
|
||||
#ifdef MODULE_L2FILTER
|
||||
l2filter_t filter[L2FILTER_LISTSIZE]; /**< link layer address filters */
|
||||
l2filter_t filter[CONFIG_L2FILTER_LISTSIZE]; /**< link layer address filters */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -50,8 +50,8 @@ extern "C" {
|
||||
/**
|
||||
* @brief Number of slots in each filter list (filter entries per device)
|
||||
*/
|
||||
#ifndef L2FILTER_LISTSIZE
|
||||
#define L2FILTER_LISTSIZE (8U)
|
||||
#ifndef CONFIG_L2FILTER_LISTSIZE
|
||||
#define CONFIG_L2FILTER_LISTSIZE (8U)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,7 @@ void l2filter_init(l2filter_t *list)
|
||||
{
|
||||
assert(list);
|
||||
|
||||
for (unsigned i = 0; i < L2FILTER_LISTSIZE; i++) {
|
||||
for (unsigned i = 0; i < CONFIG_L2FILTER_LISTSIZE; i++) {
|
||||
list[i].addr_len = 0;
|
||||
}
|
||||
}
|
||||
@ -48,7 +48,7 @@ int l2filter_add(l2filter_t *list, const void *addr, size_t addr_len)
|
||||
|
||||
int res = -ENOMEM;
|
||||
|
||||
for (unsigned i = 0; i < L2FILTER_LISTSIZE; i++) {
|
||||
for (unsigned i = 0; i < CONFIG_L2FILTER_LISTSIZE; i++) {
|
||||
if (list[i].addr_len == 0) {
|
||||
list[i].addr_len = addr_len;
|
||||
memcpy(list[i].addr, addr, addr_len);
|
||||
@ -66,7 +66,7 @@ int l2filter_rm(l2filter_t *list, const void *addr, size_t addr_len)
|
||||
|
||||
int res = -ENOENT;
|
||||
|
||||
for (unsigned i = 0; i < L2FILTER_LISTSIZE; i++) {
|
||||
for (unsigned i = 0; i < CONFIG_L2FILTER_LISTSIZE; i++) {
|
||||
if (match(&list[i], addr, addr_len)) {
|
||||
list[i].addr_len = 0;
|
||||
res = 0;
|
||||
@ -83,7 +83,7 @@ bool l2filter_pass(const l2filter_t *list, const void *addr, size_t addr_len)
|
||||
|
||||
#ifdef MODULE_L2FILTER_WHITELIST
|
||||
bool res = false;
|
||||
for (unsigned i = 0; i < L2FILTER_LISTSIZE; i++) {
|
||||
for (unsigned i = 0; i < CONFIG_L2FILTER_LISTSIZE; i++) {
|
||||
if (match(&list[i], addr, addr_len)) {
|
||||
DEBUG("[l2filter] whitelist: address match -> packet passes\n");
|
||||
res = true;
|
||||
@ -93,7 +93,7 @@ bool l2filter_pass(const l2filter_t *list, const void *addr, size_t addr_len)
|
||||
DEBUG("[l2filter] whitelist: no match -> packet dropped\n");
|
||||
#else
|
||||
bool res = true;
|
||||
for (unsigned i = 0; i < L2FILTER_LISTSIZE; i++) {
|
||||
for (unsigned i = 0; i < CONFIG_L2FILTER_LISTSIZE; i++) {
|
||||
if (match(&list[i], addr, addr_len)) {
|
||||
DEBUG("[l2filter] blacklist: address match -> packet dropped\n");
|
||||
res = false;
|
||||
|
@ -784,7 +784,7 @@ static void _netif_list(netif_t *iface)
|
||||
puts("\n Black-listed link layer addresses:");
|
||||
#endif
|
||||
int count = 0;
|
||||
for (unsigned i = 0; i < L2FILTER_LISTSIZE; i++) {
|
||||
for (unsigned i = 0; i < CONFIG_L2FILTER_LISTSIZE; i++) {
|
||||
if (filter[i].addr_len > 0) {
|
||||
char hwaddr_str[filter[i].addr_len * 3];
|
||||
gnrc_netif_addr_to_str(filter[i].addr, filter[i].addr_len,
|
||||
|
Loading…
Reference in New Issue
Block a user