84a6f65f02
This package adds filters to limit the amount of ARP Requests devices are allowed to send into the mesh. The limits are 6 packets per minute per client device, by MAC address, and 1 per second per node in total. A burst of up to 50 ARP Requests is allowed until the rate-limiting takes effect (see --limit-burst in the ebtables manpage). Furthermore, ARP Requests with a target IP already present in the batman-adv DAT Cache are excluded from the rate-limiting, both regarding counting and filtering, as batman-adv will respond locally with no burden for the mesh. Therefore, this limiter should not affect popular target IPs, like gateways. However it should mitigate the problem of curious people or smart devices scanning the whole IP range. Which could create a significant amount of overhead for all participants so far. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
34 lines
738 B
C
34 lines
738 B
C
/*
|
|
* Copyright (c) 2017 Linus Lüssing <linus.luessing@c0d3.blue>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
* License-Filename: LICENSE
|
|
*/
|
|
|
|
#ifndef _ADDR_STORE_H_
|
|
#define _ADDR_STORE_H_
|
|
|
|
#define ADDR_STORE_NUM_BUCKETS 32
|
|
|
|
struct addr_list {
|
|
struct addr_list *next;
|
|
int tic;
|
|
char addr[0];
|
|
};
|
|
|
|
struct addr_store {
|
|
struct addr_list *buckets[ADDR_STORE_NUM_BUCKETS];
|
|
size_t addr_len;
|
|
void (*destructor)(struct addr_list *);
|
|
char *(*ntoa)(void *);
|
|
};
|
|
|
|
int addr_store_init(size_t addr_len,
|
|
void (*destructor)(struct addr_list *),
|
|
char *(*ntoa)(void *),
|
|
struct addr_store *store);
|
|
int addr_store_add(void *addr, struct addr_store *store);
|
|
void addr_store_cleanup(struct addr_store *store);
|
|
|
|
#endif /* _ADDR_STORE_H_ */
|