Commit 43ef29c9 authored by Sergey Popovich's avatar Sergey Popovich Committed by Pablo Neira Ayuso

netfilter: ipset: Preprocessor directices cleanup

 * Undefine mtype_data_reset_elem before defining.

 * Remove duplicated mtype_gc_init undefine, move
   mtype_gc_init define closer to mtype_gc define.

 * Use htype instead of HTYPE in IPSET_TOKEN(HTYPE, _create)().

 * Remove PF definition from sets: no more used.
Signed-off-by: default avatarSergey Popovich <popovich_sergei@mail.ua>
Signed-off-by: default avatarJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 2b67d6e0
...@@ -180,6 +180,7 @@ hbucket_elem_add(struct hbucket *n, u8 ahash_max, size_t dsize) ...@@ -180,6 +180,7 @@ hbucket_elem_add(struct hbucket *n, u8 ahash_max, size_t dsize)
#undef mtype_data_equal #undef mtype_data_equal
#undef mtype_do_data_match #undef mtype_do_data_match
#undef mtype_data_set_flags #undef mtype_data_set_flags
#undef mtype_data_reset_elem
#undef mtype_data_reset_flags #undef mtype_data_reset_flags
#undef mtype_data_netmask #undef mtype_data_netmask
#undef mtype_data_list #undef mtype_data_list
...@@ -193,7 +194,6 @@ hbucket_elem_add(struct hbucket *n, u8 ahash_max, size_t dsize) ...@@ -193,7 +194,6 @@ hbucket_elem_add(struct hbucket *n, u8 ahash_max, size_t dsize)
#undef mtype_ahash_memsize #undef mtype_ahash_memsize
#undef mtype_flush #undef mtype_flush
#undef mtype_destroy #undef mtype_destroy
#undef mtype_gc_init
#undef mtype_same_set #undef mtype_same_set
#undef mtype_kadt #undef mtype_kadt
#undef mtype_uadt #undef mtype_uadt
...@@ -227,6 +227,7 @@ hbucket_elem_add(struct hbucket *n, u8 ahash_max, size_t dsize) ...@@ -227,6 +227,7 @@ hbucket_elem_add(struct hbucket *n, u8 ahash_max, size_t dsize)
#define mtype_data_list IPSET_TOKEN(MTYPE, _data_list) #define mtype_data_list IPSET_TOKEN(MTYPE, _data_list)
#define mtype_data_next IPSET_TOKEN(MTYPE, _data_next) #define mtype_data_next IPSET_TOKEN(MTYPE, _data_next)
#define mtype_elem IPSET_TOKEN(MTYPE, _elem) #define mtype_elem IPSET_TOKEN(MTYPE, _elem)
#define mtype_ahash_destroy IPSET_TOKEN(MTYPE, _ahash_destroy) #define mtype_ahash_destroy IPSET_TOKEN(MTYPE, _ahash_destroy)
#define mtype_ext_cleanup IPSET_TOKEN(MTYPE, _ext_cleanup) #define mtype_ext_cleanup IPSET_TOKEN(MTYPE, _ext_cleanup)
#define mtype_add_cidr IPSET_TOKEN(MTYPE, _add_cidr) #define mtype_add_cidr IPSET_TOKEN(MTYPE, _add_cidr)
...@@ -234,7 +235,6 @@ hbucket_elem_add(struct hbucket *n, u8 ahash_max, size_t dsize) ...@@ -234,7 +235,6 @@ hbucket_elem_add(struct hbucket *n, u8 ahash_max, size_t dsize)
#define mtype_ahash_memsize IPSET_TOKEN(MTYPE, _ahash_memsize) #define mtype_ahash_memsize IPSET_TOKEN(MTYPE, _ahash_memsize)
#define mtype_flush IPSET_TOKEN(MTYPE, _flush) #define mtype_flush IPSET_TOKEN(MTYPE, _flush)
#define mtype_destroy IPSET_TOKEN(MTYPE, _destroy) #define mtype_destroy IPSET_TOKEN(MTYPE, _destroy)
#define mtype_gc_init IPSET_TOKEN(MTYPE, _gc_init)
#define mtype_same_set IPSET_TOKEN(MTYPE, _same_set) #define mtype_same_set IPSET_TOKEN(MTYPE, _same_set)
#define mtype_kadt IPSET_TOKEN(MTYPE, _kadt) #define mtype_kadt IPSET_TOKEN(MTYPE, _kadt)
#define mtype_uadt IPSET_TOKEN(MTYPE, _uadt) #define mtype_uadt IPSET_TOKEN(MTYPE, _uadt)
...@@ -249,6 +249,7 @@ hbucket_elem_add(struct hbucket *n, u8 ahash_max, size_t dsize) ...@@ -249,6 +249,7 @@ hbucket_elem_add(struct hbucket *n, u8 ahash_max, size_t dsize)
#define mtype_head IPSET_TOKEN(MTYPE, _head) #define mtype_head IPSET_TOKEN(MTYPE, _head)
#define mtype_list IPSET_TOKEN(MTYPE, _list) #define mtype_list IPSET_TOKEN(MTYPE, _list)
#define mtype_gc IPSET_TOKEN(MTYPE, _gc) #define mtype_gc IPSET_TOKEN(MTYPE, _gc)
#define mtype_gc_init IPSET_TOKEN(MTYPE, _gc_init)
#define mtype_variant IPSET_TOKEN(MTYPE, _variant) #define mtype_variant IPSET_TOKEN(MTYPE, _variant)
#define mtype_data_match IPSET_TOKEN(MTYPE, _data_match) #define mtype_data_match IPSET_TOKEN(MTYPE, _data_match)
...@@ -1045,7 +1046,7 @@ IPSET_TOKEN(HTYPE, _create)(struct net *net, struct ip_set *set, ...@@ -1045,7 +1046,7 @@ IPSET_TOKEN(HTYPE, _create)(struct net *net, struct ip_set *set,
u8 netmask; u8 netmask;
#endif #endif
size_t hsize; size_t hsize;
struct HTYPE *h; struct htype *h;
struct htable *t; struct htable *t;
#ifndef IP_SET_PROTO_UNDEF #ifndef IP_SET_PROTO_UNDEF
......
...@@ -74,7 +74,6 @@ hash_ip4_data_next(struct hash_ip4_elem *next, const struct hash_ip4_elem *e) ...@@ -74,7 +74,6 @@ hash_ip4_data_next(struct hash_ip4_elem *next, const struct hash_ip4_elem *e)
} }
#define MTYPE hash_ip4 #define MTYPE hash_ip4
#define PF 4
#define HOST_MASK 32 #define HOST_MASK 32
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
...@@ -208,12 +207,10 @@ hash_ip6_data_next(struct hash_ip4_elem *next, const struct hash_ip6_elem *e) ...@@ -208,12 +207,10 @@ hash_ip6_data_next(struct hash_ip4_elem *next, const struct hash_ip6_elem *e)
} }
#undef MTYPE #undef MTYPE
#undef PF
#undef HOST_MASK #undef HOST_MASK
#undef HKEY_DATALEN #undef HKEY_DATALEN
#define MTYPE hash_ip6 #define MTYPE hash_ip6
#define PF 6
#define HOST_MASK 128 #define HOST_MASK 128
#define IP_SET_EMIT_CREATE #define IP_SET_EMIT_CREATE
......
...@@ -77,7 +77,6 @@ hash_ipmark4_data_next(struct hash_ipmark4_elem *next, ...@@ -77,7 +77,6 @@ hash_ipmark4_data_next(struct hash_ipmark4_elem *next,
} }
#define MTYPE hash_ipmark4 #define MTYPE hash_ipmark4
#define PF 4
#define HOST_MASK 32 #define HOST_MASK 32
#define HKEY_DATALEN sizeof(struct hash_ipmark4_elem) #define HKEY_DATALEN sizeof(struct hash_ipmark4_elem)
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
...@@ -204,12 +203,10 @@ hash_ipmark6_data_next(struct hash_ipmark4_elem *next, ...@@ -204,12 +203,10 @@ hash_ipmark6_data_next(struct hash_ipmark4_elem *next,
} }
#undef MTYPE #undef MTYPE
#undef PF
#undef HOST_MASK #undef HOST_MASK
#undef HKEY_DATALEN #undef HKEY_DATALEN
#define MTYPE hash_ipmark6 #define MTYPE hash_ipmark6
#define PF 6
#define HOST_MASK 128 #define HOST_MASK 128
#define HKEY_DATALEN sizeof(struct hash_ipmark6_elem) #define HKEY_DATALEN sizeof(struct hash_ipmark6_elem)
#define IP_SET_EMIT_CREATE #define IP_SET_EMIT_CREATE
......
...@@ -84,7 +84,6 @@ hash_ipport4_data_next(struct hash_ipport4_elem *next, ...@@ -84,7 +84,6 @@ hash_ipport4_data_next(struct hash_ipport4_elem *next,
} }
#define MTYPE hash_ipport4 #define MTYPE hash_ipport4
#define PF 4
#define HOST_MASK 32 #define HOST_MASK 32
#define HKEY_DATALEN sizeof(struct hash_ipport4_elem) #define HKEY_DATALEN sizeof(struct hash_ipport4_elem)
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
...@@ -245,12 +244,10 @@ hash_ipport6_data_next(struct hash_ipport4_elem *next, ...@@ -245,12 +244,10 @@ hash_ipport6_data_next(struct hash_ipport4_elem *next,
} }
#undef MTYPE #undef MTYPE
#undef PF
#undef HOST_MASK #undef HOST_MASK
#undef HKEY_DATALEN #undef HKEY_DATALEN
#define MTYPE hash_ipport6 #define MTYPE hash_ipport6
#define PF 6
#define HOST_MASK 128 #define HOST_MASK 128
#define HKEY_DATALEN sizeof(struct hash_ipport6_elem) #define HKEY_DATALEN sizeof(struct hash_ipport6_elem)
#define IP_SET_EMIT_CREATE #define IP_SET_EMIT_CREATE
......
...@@ -86,7 +86,6 @@ hash_ipportip4_data_next(struct hash_ipportip4_elem *next, ...@@ -86,7 +86,6 @@ hash_ipportip4_data_next(struct hash_ipportip4_elem *next,
/* Common functions */ /* Common functions */
#define MTYPE hash_ipportip4 #define MTYPE hash_ipportip4
#define PF 4
#define HOST_MASK 32 #define HOST_MASK 32
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
...@@ -254,11 +253,9 @@ hash_ipportip6_data_next(struct hash_ipportip4_elem *next, ...@@ -254,11 +253,9 @@ hash_ipportip6_data_next(struct hash_ipportip4_elem *next,
} }
#undef MTYPE #undef MTYPE
#undef PF
#undef HOST_MASK #undef HOST_MASK
#define MTYPE hash_ipportip6 #define MTYPE hash_ipportip6
#define PF 6
#define HOST_MASK 128 #define HOST_MASK 128
#define IP_SET_EMIT_CREATE #define IP_SET_EMIT_CREATE
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
......
...@@ -130,7 +130,6 @@ hash_ipportnet4_data_next(struct hash_ipportnet4_elem *next, ...@@ -130,7 +130,6 @@ hash_ipportnet4_data_next(struct hash_ipportnet4_elem *next,
} }
#define MTYPE hash_ipportnet4 #define MTYPE hash_ipportnet4
#define PF 4
#define HOST_MASK 32 #define HOST_MASK 32
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
...@@ -381,11 +380,9 @@ hash_ipportnet6_data_next(struct hash_ipportnet4_elem *next, ...@@ -381,11 +380,9 @@ hash_ipportnet6_data_next(struct hash_ipportnet4_elem *next,
} }
#undef MTYPE #undef MTYPE
#undef PF
#undef HOST_MASK #undef HOST_MASK
#define MTYPE hash_ipportnet6 #define MTYPE hash_ipportnet6
#define PF 6
#define HOST_MASK 128 #define HOST_MASK 128
#define IP_SET_EMIT_CREATE #define IP_SET_EMIT_CREATE
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
......
...@@ -62,7 +62,6 @@ hash_mac4_data_next(struct hash_mac4_elem *next, ...@@ -62,7 +62,6 @@ hash_mac4_data_next(struct hash_mac4_elem *next,
} }
#define MTYPE hash_mac4 #define MTYPE hash_mac4
#define PF 4
#define HOST_MASK 32 #define HOST_MASK 32
#define IP_SET_EMIT_CREATE #define IP_SET_EMIT_CREATE
#define IP_SET_PROTO_UNDEF #define IP_SET_PROTO_UNDEF
......
...@@ -109,7 +109,6 @@ hash_net4_data_next(struct hash_net4_elem *next, ...@@ -109,7 +109,6 @@ hash_net4_data_next(struct hash_net4_elem *next,
} }
#define MTYPE hash_net4 #define MTYPE hash_net4
#define PF 4
#define HOST_MASK 32 #define HOST_MASK 32
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
...@@ -277,11 +276,9 @@ hash_net6_data_next(struct hash_net4_elem *next, ...@@ -277,11 +276,9 @@ hash_net6_data_next(struct hash_net4_elem *next,
} }
#undef MTYPE #undef MTYPE
#undef PF
#undef HOST_MASK #undef HOST_MASK
#define MTYPE hash_net6 #define MTYPE hash_net6
#define PF 6
#define HOST_MASK 128 #define HOST_MASK 128
#define IP_SET_EMIT_CREATE #define IP_SET_EMIT_CREATE
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
......
...@@ -207,7 +207,6 @@ hash_netiface4_data_next(struct hash_netiface4_elem *next, ...@@ -207,7 +207,6 @@ hash_netiface4_data_next(struct hash_netiface4_elem *next,
} }
#define MTYPE hash_netiface4 #define MTYPE hash_netiface4
#define PF 4
#define HOST_MASK 32 #define HOST_MASK 32
#define HKEY_DATALEN sizeof(struct hash_netiface4_elem_hashed) #define HKEY_DATALEN sizeof(struct hash_netiface4_elem_hashed)
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
...@@ -457,12 +456,10 @@ hash_netiface6_data_next(struct hash_netiface4_elem *next, ...@@ -457,12 +456,10 @@ hash_netiface6_data_next(struct hash_netiface4_elem *next,
} }
#undef MTYPE #undef MTYPE
#undef PF
#undef HOST_MASK #undef HOST_MASK
#undef HKEY_DATALEN #undef HKEY_DATALEN
#define MTYPE hash_netiface6 #define MTYPE hash_netiface6
#define PF 6
#define HOST_MASK 128 #define HOST_MASK 128
#define HKEY_DATALEN sizeof(struct hash_netiface6_elem_hashed) #define HKEY_DATALEN sizeof(struct hash_netiface6_elem_hashed)
#define IP_SET_EMIT_CREATE #define IP_SET_EMIT_CREATE
......
...@@ -128,7 +128,6 @@ hash_netnet4_data_next(struct hash_netnet4_elem *next, ...@@ -128,7 +128,6 @@ hash_netnet4_data_next(struct hash_netnet4_elem *next,
} }
#define MTYPE hash_netnet4 #define MTYPE hash_netnet4
#define PF 4
#define HOST_MASK 32 #define HOST_MASK 32
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
...@@ -354,11 +353,9 @@ hash_netnet6_data_next(struct hash_netnet4_elem *next, ...@@ -354,11 +353,9 @@ hash_netnet6_data_next(struct hash_netnet4_elem *next,
} }
#undef MTYPE #undef MTYPE
#undef PF
#undef HOST_MASK #undef HOST_MASK
#define MTYPE hash_netnet6 #define MTYPE hash_netnet6
#define PF 6
#define HOST_MASK 128 #define HOST_MASK 128
#define IP_SET_EMIT_CREATE #define IP_SET_EMIT_CREATE
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
......
...@@ -125,7 +125,6 @@ hash_netport4_data_next(struct hash_netport4_elem *next, ...@@ -125,7 +125,6 @@ hash_netport4_data_next(struct hash_netport4_elem *next,
} }
#define MTYPE hash_netport4 #define MTYPE hash_netport4
#define PF 4
#define HOST_MASK 32 #define HOST_MASK 32
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
...@@ -340,11 +339,9 @@ hash_netport6_data_next(struct hash_netport4_elem *next, ...@@ -340,11 +339,9 @@ hash_netport6_data_next(struct hash_netport4_elem *next,
} }
#undef MTYPE #undef MTYPE
#undef PF
#undef HOST_MASK #undef HOST_MASK
#define MTYPE hash_netport6 #define MTYPE hash_netport6
#define PF 6
#define HOST_MASK 128 #define HOST_MASK 128
#define IP_SET_EMIT_CREATE #define IP_SET_EMIT_CREATE
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
......
...@@ -139,7 +139,6 @@ hash_netportnet4_data_next(struct hash_netportnet4_elem *next, ...@@ -139,7 +139,6 @@ hash_netportnet4_data_next(struct hash_netportnet4_elem *next,
} }
#define MTYPE hash_netportnet4 #define MTYPE hash_netportnet4
#define PF 4
#define HOST_MASK 32 #define HOST_MASK 32
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
...@@ -411,11 +410,9 @@ hash_netportnet6_data_next(struct hash_netportnet4_elem *next, ...@@ -411,11 +410,9 @@ hash_netportnet6_data_next(struct hash_netportnet4_elem *next,
} }
#undef MTYPE #undef MTYPE
#undef PF
#undef HOST_MASK #undef HOST_MASK
#define MTYPE hash_netportnet6 #define MTYPE hash_netportnet6
#define PF 6
#define HOST_MASK 128 #define HOST_MASK 128
#define IP_SET_EMIT_CREATE #define IP_SET_EMIT_CREATE
#include "ip_set_hash_gen.h" #include "ip_set_hash_gen.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment