[NETFILTER]: x_tables: switch hotdrop to bool
[safe/jmp/linux-2.6] / net / netfilter / xt_hashlimit.c
index 269a1e7..cd5cba6 100644 (file)
@@ -208,7 +208,7 @@ static int htable_create(struct xt_hashlimit_info *minfo, int family)
        spin_lock_init(&hinfo->lock);
        hinfo->pde = create_proc_entry(minfo->name, 0,
                                       family == AF_INET ? hashlimit_procdir4 :
-                                                          hashlimit_procdir6);
+                                                          hashlimit_procdir6);
        if (!hinfo->pde) {
                vfree(hinfo);
                return -1;
@@ -216,10 +216,8 @@ static int htable_create(struct xt_hashlimit_info *minfo, int family)
        hinfo->pde->proc_fops = &dl_file_ops;
        hinfo->pde->data = hinfo;
 
-       init_timer(&hinfo->timer);
+       setup_timer(&hinfo->timer, htable_gc, (unsigned long )hinfo);
        hinfo->timer.expires = jiffies + msecs_to_jiffies(hinfo->cfg.gc_interval);
-       hinfo->timer.data = (unsigned long )hinfo;
-       hinfo->timer.function = htable_gc;
        add_timer(&hinfo->timer);
 
        spin_lock_bh(&hashlimit_lock);
@@ -240,7 +238,7 @@ static int select_gc(struct xt_hashlimit_htable *ht, struct dsthash_ent *he)
 }
 
 static void htable_selective_cleanup(struct xt_hashlimit_htable *ht,
-                               int (*select)(struct xt_hashlimit_htable *ht,
+                               int (*select)(struct xt_hashlimit_htable *ht,
                                              struct dsthash_ent *he))
 {
        unsigned int i;
@@ -279,7 +277,7 @@ static void htable_destroy(struct xt_hashlimit_htable *hinfo)
        /* remove proc entry */
        remove_proc_entry(hinfo->pde->name,
                          hinfo->family == AF_INET ? hashlimit_procdir4 :
-                                                    hashlimit_procdir6);
+                                                    hashlimit_procdir6);
        htable_selective_cleanup(hinfo, select_all);
        vfree(hinfo);
 }
@@ -380,22 +378,22 @@ hashlimit_init_dst(struct xt_hashlimit_htable *hinfo, struct dsthash_dst *dst,
        switch (hinfo->family) {
        case AF_INET:
                if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP)
-                       dst->addr.ip.dst = skb->nh.iph->daddr;
+                       dst->addr.ip.dst = ip_hdr(skb)->daddr;
                if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_SIP)
-                       dst->addr.ip.src = skb->nh.iph->saddr;
+                       dst->addr.ip.src = ip_hdr(skb)->saddr;
 
                if (!(hinfo->cfg.mode &
                      (XT_HASHLIMIT_HASH_DPT | XT_HASHLIMIT_HASH_SPT)))
                        return 0;
-               nexthdr = skb->nh.iph->protocol;
+               nexthdr = ip_hdr(skb)->protocol;
                break;
 #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
        case AF_INET6:
                if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP)
-                       memcpy(&dst->addr.ip6.dst, &skb->nh.ipv6h->daddr,
+                       memcpy(&dst->addr.ip6.dst, &ipv6_hdr(skb)->daddr,
                               sizeof(dst->addr.ip6.dst));
                if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_SIP)
-                       memcpy(&dst->addr.ip6.src, &skb->nh.ipv6h->saddr,
+                       memcpy(&dst->addr.ip6.src, &ipv6_hdr(skb)->saddr,
                               sizeof(dst->addr.ip6.src));
 
                if (!(hinfo->cfg.mode &
@@ -442,7 +440,7 @@ hashlimit_match(const struct sk_buff *skb,
                const void *matchinfo,
                int offset,
                unsigned int protoff,
-               int *hotdrop)
+               bool *hotdrop)
 {
        struct xt_hashlimit_info *r =
                ((struct xt_hashlimit_info *)matchinfo)->u.master;
@@ -483,13 +481,13 @@ hashlimit_match(const struct sk_buff *skb,
                return 1;
        }
 
-               spin_unlock_bh(&hinfo->lock);
+       spin_unlock_bh(&hinfo->lock);
 
        /* default case: we're overlimit, thus don't match */
        return 0;
 
 hotdrop:
-       *hotdrop = 1;
+       *hotdrop = true;
        return 0;
 }