summaryrefslogtreecommitdiffstats
path: root/kernel/include
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/include')
-rw-r--r--kernel/include/linux/netfilter/ip_set.h28
-rw-r--r--kernel/include/linux/netfilter/ip_set_bitmap.h6
-rw-r--r--kernel/include/linux/netfilter/ip_set_chash.h58
-rw-r--r--kernel/include/linux/netfilter/ip_set_getport.h22
-rw-r--r--kernel/include/linux/netfilter/ip_set_hash.h2
-rw-r--r--kernel/include/linux/netfilter/ip_set_list.h2
-rw-r--r--kernel/include/linux/netfilter/ip_set_slist.h24
-rw-r--r--kernel/include/linux/netfilter/ip_set_timeout.h20
-rw-r--r--kernel/include/net/pfxlen.h2
9 files changed, 82 insertions, 82 deletions
diff --git a/kernel/include/linux/netfilter/ip_set.h b/kernel/include/linux/netfilter/ip_set.h
index 5377cdc..07ff5a3 100644
--- a/kernel/include/linux/netfilter/ip_set.h
+++ b/kernel/include/linux/netfilter/ip_set.h
@@ -8,7 +8,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.
*/
/* The protocol version */
@@ -37,7 +37,7 @@ enum ipset_cmd {
IPSET_MSG_MAX, /* Netlink message commands */
/* Commands in userspace: */
- IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 15: Enter restore mode */
+ IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 15: Enter restore mode */
IPSET_CMD_HELP, /* 16: Get help */
IPSET_CMD_VERSION, /* 17: Get program version */
IPSET_CMD_QUIT, /* 18: Quit from interactive mode */
@@ -93,7 +93,7 @@ enum {
IPSET_ATTR_ELEMENTS,
IPSET_ATTR_REFERENCES,
IPSET_ATTR_MEMSIZE,
-
+
__IPSET_ATTR_CREATE_MAX,
};
#define IPSET_ATTR_CREATE_MAX (__IPSET_ATTR_CREATE_MAX - 1)
@@ -323,20 +323,20 @@ static inline void *
ip_set_alloc(size_t size, gfp_t gfp_mask)
{
void *members = NULL;
-
+
if (size < KMALLOC_MAX_SIZE)
members = kzalloc(size, gfp_mask | __GFP_NOWARN);
-
+
if (members) {
pr_debug("%p: allocated with kmalloc", members);
return members;
}
-
+
members = __vmalloc(size, gfp_mask | __GFP_ZERO, PAGE_KERNEL);
if (!members)
return NULL;
pr_debug("%p: allocated with vmalloc", members);
-
+
return members;
}
@@ -363,7 +363,7 @@ static inline u32
ip_set_get_h32(const struct nlattr *attr)
{
u32 value = nla_get_u32(attr);
-
+
return attr->nla_type & NLA_F_NET_BYTEORDER ? ntohl(value) : value;
}
@@ -371,7 +371,7 @@ static inline u16
ip_set_get_h16(const struct nlattr *attr)
{
u16 value = nla_get_u16(attr);
-
+
return attr->nla_type & NLA_F_NET_BYTEORDER ? ntohs(value) : value;
}
@@ -379,7 +379,7 @@ static inline u32
ip_set_get_n32(const struct nlattr *attr)
{
u32 value = nla_get_u32(attr);
-
+
return attr->nla_type & NLA_F_NET_BYTEORDER ? value : htonl(value);
}
@@ -387,7 +387,7 @@ static inline u16
ip_set_get_n16(const struct nlattr *attr)
{
u16 value = nla_get_u16(attr);
-
+
return attr->nla_type & NLA_F_NET_BYTEORDER ? value : htons(value);
}
@@ -412,7 +412,7 @@ ip_set_get_ipaddr4(struct nlattr *attr[], int type, u32 *ipaddr)
return -IPSET_ERR_PROTOCOL;
if (!tb[IPSET_ATTR_IPADDR_IPV4])
return -IPSET_ERR_IPADDR_IPV4;
-
+
*ipaddr = ip_set_get_n32(tb[IPSET_ATTR_IPADDR_IPV4]);
return 0;
}
@@ -438,7 +438,7 @@ ip_set_get_ipaddr6(struct nlattr *attr[], int type, union nf_inet_addr *ipaddr)
}
#define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED)
-#define ipset_nest_end(skb, start) nla_nest_end(skb, start)
+#define ipset_nest_end(skb, start) nla_nest_end(skb, start)
#define NLA_PUT_NET32(skb, type, value) \
NLA_PUT_BE32(skb, type | NLA_F_NET_BYTEORDER, value)
@@ -489,7 +489,7 @@ ip6addrptr(const struct sk_buff *skb, bool src, struct in6_addr *addr)
/* Interface to iptables/ip6tables */
-#define SO_IP_SET 83
+#define SO_IP_SET 83
union ip_set_name_index {
char name[IPSET_MAXNAMELEN];
diff --git a/kernel/include/linux/netfilter/ip_set_bitmap.h b/kernel/include/linux/netfilter/ip_set_bitmap.h
index f3bff2c..61a9e87 100644
--- a/kernel/include/linux/netfilter/ip_set_bitmap.h
+++ b/kernel/include/linux/netfilter/ip_set_bitmap.h
@@ -18,14 +18,14 @@ static inline u32
range_to_mask(u32 from, u32 to, u8 *bits)
{
u32 mask = 0xFFFFFFFE;
-
+
*bits = 32;
while (--(*bits) > 0 && mask && (to & mask) != from)
mask <<= 1;
-
+
return mask;
}
#endif /* __KERNEL__ */
-
+
#endif /* __IP_SET_BITMAP_H */
diff --git a/kernel/include/linux/netfilter/ip_set_chash.h b/kernel/include/linux/netfilter/ip_set_chash.h
index f223275..138e94d 100644
--- a/kernel/include/linux/netfilter/ip_set_chash.h
+++ b/kernel/include/linux/netfilter/ip_set_chash.h
@@ -11,7 +11,7 @@
* the timeout field must be the last one in the data structure - that field
* is ignored when computing the hash key.
*/
-
+
/* Number of elements to store in an array block */
#define CHASH_DEFAULT_ARRAY_SIZE 4
/* Number of arrays: max ARRAY_SIZE * CHAIN_LIMIT "long" chains */
@@ -75,7 +75,7 @@ add_cidr(struct chash *h, u8 cidr, u8 host_mask)
if (h->nets[cidr-1].nets > 1)
return;
-
+
/* New cidr size */
for (i = 0; i < host_mask && h->nets[i].cidr; i++) {
/* Add in increasing prefix order, so larger cidr first */
@@ -113,7 +113,7 @@ chash_destroy(struct htable *ht)
{
struct slist *n, *tmp;
u32 i;
-
+
for (i = 0; i < jhash_size(ht->htable_bits); i++)
slist_for_each_safe(n, tmp, &ht->htable[i])
/* FIXME: use slab cache */
@@ -134,12 +134,12 @@ chash_memsize(const struct chash *h, size_t dsize, u8 host_mask)
+ sizeof(struct chash_nets) * host_mask
#endif
+ jhash_size(ht->htable_bits) * sizeof(struct slist);
-
+
for (i = 0; i < jhash_size(ht->htable_bits); i++)
slist_for_each(n, &ht->htable[i])
memsize += sizeof(struct slist)
+ h->array_size * dsize;
-
+
return memsize;
}
@@ -151,7 +151,7 @@ ip_set_hash_flush(struct ip_set *set)
struct htable *ht = h->table;
struct slist *n, *tmp;
u32 i;
-
+
for (i = 0; i < jhash_size(ht->htable_bits); i++) {
slist_for_each_safe(n, tmp, &ht->htable[i])
/* FIXME: slab cache */
@@ -176,7 +176,7 @@ ip_set_hash_destroy(struct ip_set *set)
chash_destroy(h->table);
kfree(h);
-
+
set->data = NULL;
}
@@ -241,7 +241,7 @@ ip_set_hash_destroy(struct ip_set *set)
/* Get the ith element from the array block n */
#define chash_data(n, i) \
-(struct type_pf_elem *)((char *)(n) + sizeof(struct slist) \
+(struct type_pf_elem *)((char *)(n) + sizeof(struct slist) \
+ (i)*sizeof(struct type_pf_elem))
/* Add an element to the hash table when resizing the set:
@@ -298,7 +298,7 @@ type_pf_chash_del_elem(struct chash *h, struct slist *prev,
for (prev = n, tmp = n->next;
tmp->next != NULL;
prev = tmp, tmp = tmp->next)
- /* Find last array */;
+ /* Find last array */;
j = 0;
} else {
/* Already at last array */
@@ -310,9 +310,9 @@ type_pf_chash_del_elem(struct chash *h, struct slist *prev,
if (type_pf_data_isnull(chash_data(tmp, j + 1)))
break;
- if (!(tmp == n && i == j)) {
+ if (!(tmp == n && i == j))
type_pf_data_swap(data, chash_data(tmp, j));
- }
+
#ifdef IP_SET_HASH_WITH_NETS
del_cidr(h, data->cidr, HOST_MASK);
#endif
@@ -377,12 +377,12 @@ next_slot:
h->table = ht;
read_unlock_bh(&set->lock);
-
+
/* Give time to other users of the set */
synchronize_net();
chash_destroy(orig);
-
+
return 0;
}
@@ -540,7 +540,7 @@ type_pf_head(struct ip_set *set, struct sk_buff *skb)
const struct chash *h = set->data;
struct nlattr *nested;
size_t memsize;
-
+
read_lock_bh(&set->lock);
memsize = chash_memsize(h, with_timeout(h->timeout)
? sizeof(struct type_pf_telem)
@@ -564,7 +564,7 @@ type_pf_head(struct ip_set *set, struct sk_buff *skb)
if (with_timeout(h->timeout))
NLA_PUT_NET32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout));
ipset_nest_end(skb, nested);
-
+
return 0;
nla_put_failure:
return -EFAULT;
@@ -615,7 +615,7 @@ type_pf_list(struct ip_set *set,
ipset_nest_end(skb, atd);
/* Set listing finished */
cb->args[2] = 0;
-
+
return 0;
nla_put_failure:
@@ -709,8 +709,8 @@ type_pf_chash_treadd(struct chash *h, struct htable *ht,
for (i = 0; i < h->array_size; i++) {
data = chash_tdata(n, i);
if (type_pf_data_isnull(data)) {
- tmp = n;
- goto found;
+ tmp = n;
+ goto found;
}
}
j++;
@@ -734,7 +734,7 @@ found:
static void
type_pf_chash_del_telem(struct chash *h, struct slist *prev,
- struct slist *n, int i)
+ struct slist *n, int i)
{
struct type_pf_elem *d, *data = chash_tdata(n, i);
struct slist *tmp;
@@ -745,7 +745,7 @@ type_pf_chash_del_telem(struct chash *h, struct slist *prev,
for (prev = n, tmp = n->next;
tmp->next != NULL;
prev = tmp, tmp = tmp->next)
- /* Find last array */;
+ /* Find last array */;
j = 0;
} else {
/* Already at last array */
@@ -783,7 +783,7 @@ type_pf_chash_expire(struct chash *h)
struct type_pf_elem *data;
u32 i;
int j;
-
+
for (i = 0; i < jhash_size(ht->htable_bits); i++)
slist_for_each_prev(prev, n, &ht->htable[i])
for (j = 0; j < h->array_size; j++) {
@@ -862,14 +862,14 @@ next_slot:
synchronize_net();
chash_destroy(orig);
-
+
return 0;
}
static int
type_pf_chash_tadd(struct ip_set *set, void *value,
gfp_t gfp_flags, u32 timeout)
-{
+{
struct chash *h = set->data;
const struct type_pf_elem *d = value;
struct slist *n, *prev;
@@ -891,8 +891,8 @@ type_pf_chash_tadd(struct ip_set *set, void *value,
data = chash_tdata(n, i);
if (type_pf_data_isnull(data)
|| type_pf_data_expired(data)) {
- tmp = n;
- goto found;
+ tmp = n;
+ goto found;
}
if (type_pf_data_equal(data, d))
return -IPSET_ERR_EXIST;
@@ -912,7 +912,7 @@ type_pf_chash_tadd(struct ip_set *set, void *value,
}
found:
if (type_pf_data_isnull(data))
- h->elements++;
+ h->elements++;
#ifdef IP_SET_HASH_WITH_NETS
else
del_cidr(h, data->cidr, HOST_MASK);
@@ -943,7 +943,7 @@ type_pf_chash_tdel(struct ip_set *set, void *value,
return -IPSET_ERR_EXIST;
if (type_pf_data_equal(data, d)) {
if (type_pf_data_expired(data))
- ret = -IPSET_ERR_EXIST;
+ ret = -IPSET_ERR_EXIST;
type_pf_chash_del_telem(h, prev, n, i);
return ret;
}
@@ -1058,7 +1058,7 @@ type_pf_tlist(struct ip_set *set,
ipset_nest_end(skb, atd);
/* Set listing finished */
cb->args[2] = 0;
-
+
return 0;
nla_put_failure:
@@ -1107,7 +1107,7 @@ static inline void
type_pf_gc_init(struct ip_set *set)
{
struct chash *h = set->data;
-
+
init_timer(&h->gc);
h->gc.data = (unsigned long) set;
h->gc.function = type_pf_gc;
diff --git a/kernel/include/linux/netfilter/ip_set_getport.h b/kernel/include/linux/netfilter/ip_set_getport.h
index e4d469d..1597fa9 100644
--- a/kernel/include/linux/netfilter/ip_set_getport.h
+++ b/kernel/include/linux/netfilter/ip_set_getport.h
@@ -18,14 +18,14 @@ get_port(const struct sk_buff *skb, int protocol, unsigned int protooff,
case IPPROTO_TCP: {
struct tcphdr _tcph;
const struct tcphdr *th;
-
+
th = skb_header_pointer(skb, protooff, sizeof(_tcph), &_tcph);
if (th == NULL)
/* No choice either */
return false;
-
- *port = src ? th->source : th->dest;
- break;
+
+ *port = src ? th->source : th->dest;
+ break;
}
case IPPROTO_UDP: {
struct udphdr _udph;
@@ -35,29 +35,29 @@ get_port(const struct sk_buff *skb, int protocol, unsigned int protooff,
if (uh == NULL)
/* No choice either */
return false;
-
- *port = src ? uh->source : uh->dest;
- break;
+
+ *port = src ? uh->source : uh->dest;
+ break;
}
case IPPROTO_ICMP: {
struct icmphdr _icmph;
const struct icmphdr *ic;
-
+
ic = skb_header_pointer(skb, protooff, sizeof(_icmph), &_icmph);
if (ic == NULL)
return false;
-
+
*port = (ic->type << 8) & ic->code;
break;
}
case IPPROTO_ICMPV6: {
struct icmp6hdr _icmph;
const struct icmp6hdr *ic;
-
+
ic = skb_header_pointer(skb, protooff, sizeof(_icmph), &_icmph);
if (ic == NULL)
return false;
-
+
*port = (ic->icmp6_type << 8) & ic->icmp6_code;
break;
}
diff --git a/kernel/include/linux/netfilter/ip_set_hash.h b/kernel/include/linux/netfilter/ip_set_hash.h
index e149a2b..b86f15c 100644
--- a/kernel/include/linux/netfilter/ip_set_hash.h
+++ b/kernel/include/linux/netfilter/ip_set_hash.h
@@ -22,5 +22,5 @@ enum {
#define IPSET_DEFAULT_RESIZE 100
#endif /* __KERNEL__ */
-
+
#endif /* __IP_SET_HASH_H */
diff --git a/kernel/include/linux/netfilter/ip_set_list.h b/kernel/include/linux/netfilter/ip_set_list.h
index 9988570..40a63f3 100644
--- a/kernel/include/linux/netfilter/ip_set_list.h
+++ b/kernel/include/linux/netfilter/ip_set_list.h
@@ -23,5 +23,5 @@ enum {
#define IP_SET_LIST_MIN_SIZE 4
#endif /* __KERNEL__ */
-
+
#endif /* __IP_SET_LIST_H */
diff --git a/kernel/include/linux/netfilter/ip_set_slist.h b/kernel/include/linux/netfilter/ip_set_slist.h
index 3e8d8b0..e472e43 100644
--- a/kernel/include/linux/netfilter/ip_set_slist.h
+++ b/kernel/include/linux/netfilter/ip_set_slist.h
@@ -7,7 +7,7 @@
/*
* Single linked lists with a single pointer.
- * Mostly useful for hash tables where the two pointer list head
+ * Mostly useful for hash tables where the two pointer list head
* and list node is too wasteful.
*/
@@ -18,7 +18,7 @@ struct slist {
#define SLIST(name) struct slist name = { .next = NULL }
#define INIT_SLIST(ptr) ((ptr)->next = NULL)
-#define slist_entry(ptr, type, member) container_of(ptr,type,member)
+#define slist_entry(ptr, type, member) container_of(ptr, type, member)
#define slist_for_each(pos, head) \
for (pos = (head)->next; pos && ({ prefetch(pos->next); 1; }); \
@@ -42,8 +42,8 @@ struct slist {
*/
#define slist_for_each_entry(tpos, pos, head, member) \
for (pos = (head)->next; \
- pos && ({ prefetch(pos->next); 1;}) && \
- ({ tpos = slist_entry(pos, typeof(*tpos), member); 1;}); \
+ pos && ({ prefetch(pos->next); 1; }) && \
+ ({ tpos = slist_entry(pos, typeof(*tpos), member); 1; });\
pos = pos->next)
/**
@@ -55,8 +55,8 @@ struct slist {
*/
#define slist_for_each_entry_continue(tpos, pos, member) \
for (pos = (pos)->next; \
- pos && ({ prefetch(pos->next); 1;}) && \
- ({ tpos = slist_entry(pos, typeof(*tpos), member); 1;}); \
+ pos && ({ prefetch(pos->next); 1; }) && \
+ ({ tpos = slist_entry(pos, typeof(*tpos), member); 1; });\
pos = pos->next)
/**
@@ -67,8 +67,8 @@ struct slist {
* @member: the name of the slist within the struct.
*/
#define slist_for_each_entry_from(tpos, pos, member) \
- for (; pos && ({ prefetch(pos->next); 1;}) && \
- ({ tpos = slist_entry(pos, typeof(*tpos), member); 1;}); \
+ for (; pos && ({ prefetch(pos->next); 1; }) && \
+ ({ tpos = slist_entry(pos, typeof(*tpos), member); 1; });\
pos = pos->next)
/**
@@ -80,10 +80,10 @@ struct slist {
* @head: the head for your list.
* @member: the name of the slist within the struct.
*/
-#define slist_for_each_entry_safe(tpos, pos, n, head, member) \
- for (pos = (head)->next; \
- pos && ({ n = pos->next; 1; }) && \
- ({ tpos = slist_entry(pos, typeof(*tpos), member); 1;}); \
+#define slist_for_each_entry_safe(tpos, pos, n, head, member) \
+ for (pos = (head)->next; \
+ pos && ({ n = pos->next; 1; }) && \
+ ({ tpos = slist_entry(pos, typeof(*tpos), member); 1; });\
pos = n)
#endif /* _IP_SET_SLIST_H */
diff --git a/kernel/include/linux/netfilter/ip_set_timeout.h b/kernel/include/linux/netfilter/ip_set_timeout.h
index b917480..519d84f 100644
--- a/kernel/include/linux/netfilter/ip_set_timeout.h
+++ b/kernel/include/linux/netfilter/ip_set_timeout.h
@@ -5,7 +5,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.
*/
#ifdef __KERNEL__
@@ -38,14 +38,14 @@ ip_set_timeout_uget(struct nlattr *tb)
/* Bitmap entry is unset */
#define IPSET_ELEM_UNSET 0
/* Bitmap entry is set with no timeout value */
-#define IPSET_ELEM_PERMANENT UINT_MAX/2
+#define IPSET_ELEM_PERMANENT (UINT_MAX/2)
static inline bool
ip_set_timeout_test(unsigned long timeout)
{
return timeout != IPSET_ELEM_UNSET
- && (timeout == IPSET_ELEM_PERMANENT
- || time_after(timeout, jiffies));
+ && (timeout == IPSET_ELEM_PERMANENT
+ || time_after(timeout, jiffies));
}
static inline bool
@@ -60,15 +60,15 @@ static inline unsigned long
ip_set_timeout_set(u32 timeout)
{
unsigned long t;
-
+
if (!timeout)
return IPSET_ELEM_PERMANENT;
-
+
t = timeout * HZ + jiffies;
if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT)
/* Bingo! */
t++;
-
+
return t;
}
@@ -103,15 +103,15 @@ static inline unsigned long
ip_set_timeout_set(u32 timeout)
{
unsigned long t;
-
+
if (!timeout)
return IPSET_ELEM_PERMANENT;
-
+
t = timeout * HZ + jiffies;
if (t == IPSET_ELEM_PERMANENT)
/* Bingo! :-) */
t++;
-
+
return t;
}
diff --git a/kernel/include/net/pfxlen.h b/kernel/include/net/pfxlen.h
index 8183e17..6935145 100644
--- a/kernel/include/net/pfxlen.h
+++ b/kernel/include/net/pfxlen.h
@@ -8,7 +8,7 @@
{.ip6 = { \
__constant_htonl(a), __constant_htonl(b), \
__constant_htonl(c), __constant_htonl(d), \
- }}
+ } }
/*
* This table works for both IPv4 and IPv6;