gluon-ebtables-limit-arp: fix c indentation

This commit is contained in:
Jan-Niklas Burfeind 2023-01-03 15:55:58 +01:00
parent d7f869ad6d
commit 6ff3217903
5 changed files with 720 additions and 722 deletions

View File

@ -10,7 +10,7 @@
#include "lookup3.h" #include "lookup3.h"
static struct addr_list *addr_node_alloc(void *addr, static struct addr_list *addr_node_alloc(void *addr,
struct addr_store *store) struct addr_store *store)
{ {
struct addr_list *node; struct addr_list *node;
size_t addr_len = store->addr_len; size_t addr_len = store->addr_len;
@ -27,8 +27,8 @@ static struct addr_list *addr_node_alloc(void *addr,
} }
static struct addr_list *addr_list_search(void *addr, static struct addr_list *addr_list_search(void *addr,
size_t addr_len, size_t addr_len,
struct addr_list *list) struct addr_list *list)
{ {
struct addr_list *node = list; struct addr_list *node = list;
struct addr_list *ret = NULL; struct addr_list *ret = NULL;
@ -73,7 +73,7 @@ int addr_store_add(void *addr, struct addr_store *store)
{ {
struct addr_list **bucket = addr_store_get_bucket(addr, store); struct addr_list **bucket = addr_store_get_bucket(addr, store);
struct addr_list *node = addr_list_search(addr, store->addr_len, struct addr_list *node = addr_list_search(addr, store->addr_len,
*bucket); *bucket);
if (node) { if (node) {
node->tic = clock; node->tic = clock;
@ -91,9 +91,9 @@ int addr_store_add(void *addr, struct addr_store *store)
} }
int addr_store_init(size_t addr_len, int addr_store_init(size_t addr_len,
void (*destructor)(struct addr_list *), void (*destructor)(struct addr_list *),
char *(*ntoa)(void *), char *(*ntoa)(void *),
struct addr_store *store) struct addr_store *store)
{ {
int i; int i;

View File

@ -20,9 +20,9 @@ struct addr_store {
}; };
int addr_store_init(size_t addr_len, int addr_store_init(size_t addr_len,
void (*destructor)(struct addr_list *), void (*destructor)(struct addr_list *),
char *(*ntoa)(void *), char *(*ntoa)(void *),
struct addr_store *store); struct addr_store *store);
int addr_store_add(void *addr, struct addr_store *store); int addr_store_add(void *addr, struct addr_store *store);
void addr_store_cleanup(struct addr_store *store); void addr_store_cleanup(struct addr_store *store);

View File

@ -39,8 +39,8 @@ static void ebt_ip_call(char *mod, struct in_addr ip)
int ret; int ret;
snprintf(str, sizeof(str), snprintf(str, sizeof(str),
EBTABLES " %s ARP_LIMIT_DATCHECK -p ARP --arp-ip-dst %s -j mark --mark-or 0x2 --mark-target RETURN", EBTABLES " %s ARP_LIMIT_DATCHECK -p ARP --arp-ip-dst %s -j mark --mark-or 0x2 --mark-target RETURN",
mod, inet_ntoa(ip)); mod, inet_ntoa(ip));
ret = system(str); ret = system(str);
if (ret) if (ret)
@ -62,8 +62,8 @@ static void ebt_mac_limit_call(char *mod, struct mac_addr *mac)
int ret; int ret;
snprintf(str, sizeof(str), snprintf(str, sizeof(str),
EBTABLES " %s ARP_LIMIT_TLCHECK --source %s --limit 6/min --limit-burst 50 -j RETURN", EBTABLES " %s ARP_LIMIT_TLCHECK --source %s --limit 6/min --limit-burst 50 -j RETURN",
mod, mac_ntoa(mac)); mod, mac_ntoa(mac));
ret = system(str); ret = system(str);
if (ret) if (ret)
@ -78,8 +78,8 @@ static void ebt_mac_ret_call(char *mod, struct mac_addr *mac, int add)
int ret; int ret;
snprintf(str, sizeof(str), snprintf(str, sizeof(str),
EBTABLES " %s ARP_LIMIT_TLCHECK %s --source %s -j DROP", EBTABLES " %s ARP_LIMIT_TLCHECK %s --source %s -j DROP",
mod, add ? "2" : "", mac_ntoa(mac)); mod, add ? "2" : "", mac_ntoa(mac));
ret = system(str); ret = system(str);
if (ret) if (ret)

File diff suppressed because it is too large Load Diff

View File

@ -21,8 +21,8 @@ int mac_aton(const char *cp, struct mac_addr *mac)
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
ret = sscanf(cp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", ret = sscanf(cp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
&m.storage[0], &m.storage[1], &m.storage[2], &m.storage[0], &m.storage[1], &m.storage[2],
&m.storage[3], &m.storage[4], &m.storage[5]); &m.storage[3], &m.storage[4], &m.storage[5]);
if (ret != ETH_ALEN) if (ret != ETH_ALEN)
return 0; return 0;
@ -36,8 +36,8 @@ char *mac_ntoa(struct mac_addr *mac)
unsigned char *m = mac->storage; unsigned char *m = mac->storage;
snprintf(mntoa_buf, sizeof(mntoa_buf), snprintf(mntoa_buf, sizeof(mntoa_buf),
"%02x:%02x:%02x:%02x:%02x:%02x", "%02x:%02x:%02x:%02x:%02x:%02x",
m[0], m[1], m[2], m[3], m[4], m[5]); m[0], m[1], m[2], m[3], m[4], m[5]);
return mntoa_buf; return mntoa_buf;
} }