1 #ifndef __IP_SET_IPMAP_H
2 #define __IP_SET_IPMAP_H
4 #include <linux/netfilter_ipv4/ip_set.h>
5 #include <linux/netfilter_ipv4/ip_set_bitmaps.h>
7 #define SETTYPE_NAME "ipmap"
10 void *members
; /* the ipmap proper */
11 ip_set_ip_t first_ip
; /* host byte order, included in range */
12 ip_set_ip_t last_ip
; /* host byte order, included in range */
13 ip_set_ip_t netmask
; /* subnet netmask */
14 ip_set_ip_t sizeid
; /* size of set in IPs */
15 ip_set_ip_t hosts
; /* number of hosts in a subnet */
16 u_int32_t size
; /* size of the ipmap proper */
19 struct ip_set_req_ipmap_create
{
25 struct ip_set_req_ipmap
{
29 static inline unsigned int
30 mask_to_bits(ip_set_ip_t mask
)
32 unsigned int bits
= 32;
35 if (mask
== 0xFFFFFFFF)
38 maskaddr
= 0xFFFFFFFE;
39 while (--bits
> 0 && maskaddr
!= mask
)
45 static inline ip_set_ip_t
46 range_to_mask(ip_set_ip_t from
, ip_set_ip_t to
, unsigned int *bits
)
48 ip_set_ip_t mask
= 0xFFFFFFFE;
51 while (--(*bits
) > 0 && mask
&& (to
& mask
) != from
)
57 #endif /* __IP_SET_IPMAP_H */