struct list_head list;
struct geoip_subnet *subnets;
atomic_t ref;
- u_int32_t count;
- u_int16_t cc;
+ unsigned int count;
+ unsigned short cc;
};
static LIST_HEAD(geoip_head);
synchronize_rcu();
vfree(p->subnets);
kfree(p);
- return;
}
-static struct geoip_country_kernel *find_node(u_int16_t cc)
+static struct geoip_country_kernel *find_node(unsigned short cc)
{
struct geoip_country_kernel *p;
spin_lock(&geoip_lock);
const struct xt_geoip_match_info *info = matchinfo;
const struct geoip_country_kernel *node;
const struct iphdr *iph = ip_hdr(skb);
- uint32_t ip, i;
+ unsigned int i;
+ uint32_t ip;
if (info->flags & XT_GEOIP_SRC)
ip = ntohl(iph->saddr);
if (geoip_bsearch(node->subnets, ip, 0, node->count)) {
rcu_read_unlock();
- return (info->flags & XT_GEOIP_INV) ? 0 : 1;
+ return !(info->flags & XT_GEOIP_INV);
}
}
rcu_read_unlock();
- return (info->flags & XT_GEOIP_INV) ? 1 : 0;
+ return info->flags & XT_GEOIP_INV;
}
static bool xt_geoip_mt_checkentry(const char *table, const void *entry,
{
struct xt_geoip_match_info *info = matchinfo;
struct geoip_country_kernel *node;
- u_int8_t i;
+ unsigned int i;
for (i = 0; i < info->count; i++) {
node = find_node(info->cc[i]);
printk(KERN_ERR
"xt_geoip: unable to load '%c%c' into memory\n",
COUNTRY(info->cc[i]));
- return 0;
+ return false;
}
/* Overwrite the now-useless pointer info->mem[i] with
info->mem[i].kernel = node;
}
- return 1;
+ return true;
}
static void xt_geoip_mt_destroy(const struct xt_match *match, void *matchinfo)
{
struct xt_geoip_match_info *info = matchinfo;
struct geoip_country_kernel *node;
- u_int8_t i;
+ unsigned int i;
/* This entry has been removed from the table so
* decrease the refcount of all countries it is
printk(KERN_ERR
"xt_geoip: What happened peejix ? What happened acidfu ?\n"
"xt_geoip: please report this bug to the maintainers\n");
- return;
}
static struct xt_match xt_geoip_match __read_mostly = {
#define XT_GEOIP_MAX 15 /* Maximum of countries */
+/* Yup, an address range will be passed in with host-order */
struct geoip_subnet {
- u_int32_t begin;
- u_int32_t end;
+ __u32 begin;
+ __u32 end;
};
struct geoip_country_user {
aligned_u64 subnets;
- u_int32_t count;
- u_int16_t cc;
+ __u32 count;
+ __u16 cc;
};
struct geoip_country_kernel;
};
struct xt_geoip_match_info {
- u_int8_t flags;
- u_int8_t count;
- u_int16_t cc[XT_GEOIP_MAX];
+ __u8 flags;
+ __u8 count;
+ __u16 cc[XT_GEOIP_MAX];
/* Used internally by the kernel */
union geoip_country_group mem[XT_GEOIP_MAX];