gluon-ebtables-limit-arp: fix c indentation
This commit is contained in:
parent
d7f869ad6d
commit
6ff3217903
@ -10,7 +10,7 @@
|
||||
#include "lookup3.h"
|
||||
|
||||
static struct addr_list *addr_node_alloc(void *addr,
|
||||
struct addr_store *store)
|
||||
struct addr_store *store)
|
||||
{
|
||||
struct addr_list *node;
|
||||
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,
|
||||
size_t addr_len,
|
||||
struct addr_list *list)
|
||||
size_t addr_len,
|
||||
struct addr_list *list)
|
||||
{
|
||||
struct addr_list *node = list;
|
||||
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 *node = addr_list_search(addr, store->addr_len,
|
||||
*bucket);
|
||||
*bucket);
|
||||
|
||||
if (node) {
|
||||
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,
|
||||
void (*destructor)(struct addr_list *),
|
||||
char *(*ntoa)(void *),
|
||||
struct addr_store *store)
|
||||
void (*destructor)(struct addr_list *),
|
||||
char *(*ntoa)(void *),
|
||||
struct addr_store *store)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -20,9 +20,9 @@ struct addr_store {
|
||||
};
|
||||
|
||||
int addr_store_init(size_t addr_len,
|
||||
void (*destructor)(struct addr_list *),
|
||||
char *(*ntoa)(void *),
|
||||
struct addr_store *store);
|
||||
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);
|
||||
|
||||
|
@ -39,8 +39,8 @@ static void ebt_ip_call(char *mod, struct in_addr ip)
|
||||
int ret;
|
||||
|
||||
snprintf(str, sizeof(str),
|
||||
EBTABLES " %s ARP_LIMIT_DATCHECK -p ARP --arp-ip-dst %s -j mark --mark-or 0x2 --mark-target RETURN",
|
||||
mod, inet_ntoa(ip));
|
||||
EBTABLES " %s ARP_LIMIT_DATCHECK -p ARP --arp-ip-dst %s -j mark --mark-or 0x2 --mark-target RETURN",
|
||||
mod, inet_ntoa(ip));
|
||||
|
||||
ret = system(str);
|
||||
if (ret)
|
||||
@ -62,8 +62,8 @@ static void ebt_mac_limit_call(char *mod, struct mac_addr *mac)
|
||||
int ret;
|
||||
|
||||
snprintf(str, sizeof(str),
|
||||
EBTABLES " %s ARP_LIMIT_TLCHECK --source %s --limit 6/min --limit-burst 50 -j RETURN",
|
||||
mod, mac_ntoa(mac));
|
||||
EBTABLES " %s ARP_LIMIT_TLCHECK --source %s --limit 6/min --limit-burst 50 -j RETURN",
|
||||
mod, mac_ntoa(mac));
|
||||
|
||||
ret = system(str);
|
||||
if (ret)
|
||||
@ -78,8 +78,8 @@ static void ebt_mac_ret_call(char *mod, struct mac_addr *mac, int add)
|
||||
int ret;
|
||||
|
||||
snprintf(str, sizeof(str),
|
||||
EBTABLES " %s ARP_LIMIT_TLCHECK %s --source %s -j DROP",
|
||||
mod, add ? "2" : "", mac_ntoa(mac));
|
||||
EBTABLES " %s ARP_LIMIT_TLCHECK %s --source %s -j DROP",
|
||||
mod, add ? "2" : "", mac_ntoa(mac));
|
||||
|
||||
ret = system(str);
|
||||
if (ret)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -21,8 +21,8 @@ int mac_aton(const char *cp, struct mac_addr *mac)
|
||||
memset(&m, 0, sizeof(m));
|
||||
|
||||
ret = sscanf(cp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
|
||||
&m.storage[0], &m.storage[1], &m.storage[2],
|
||||
&m.storage[3], &m.storage[4], &m.storage[5]);
|
||||
&m.storage[0], &m.storage[1], &m.storage[2],
|
||||
&m.storage[3], &m.storage[4], &m.storage[5]);
|
||||
|
||||
if (ret != ETH_ALEN)
|
||||
return 0;
|
||||
@ -36,8 +36,8 @@ char *mac_ntoa(struct mac_addr *mac)
|
||||
unsigned char *m = mac->storage;
|
||||
|
||||
snprintf(mntoa_buf, sizeof(mntoa_buf),
|
||||
"%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
m[0], m[1], m[2], m[3], m[4], m[5]);
|
||||
"%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
m[0], m[1], m[2], m[3], m[4], m[5]);
|
||||
|
||||
return mntoa_buf;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user