]> err.no Git - linux-2.6/blobdiff - net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
Merge branch 'linus' into x86/irq
[linux-2.6] / net / ipv6 / netfilter / nf_conntrack_proto_icmpv6.c
index da924c6b5f065676f526d723aa5501191ead8862..ee713b03e9ec81f252dc0b45a499a2769583ba55 100644 (file)
 
 static unsigned long nf_ct_icmpv6_timeout __read_mostly = 30*HZ;
 
-static int icmpv6_pkt_to_tuple(const struct sk_buff *skb,
-                              unsigned int dataoff,
-                              struct nf_conntrack_tuple *tuple)
+static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb,
+                               unsigned int dataoff,
+                               struct nf_conntrack_tuple *tuple)
 {
-       struct icmp6hdr _hdr, *hp;
+       const struct icmp6hdr *hp;
+       struct icmp6hdr _hdr;
 
        hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr);
        if (hp == NULL)
-               return 0;
+               return false;
        tuple->dst.u.icmp.type = hp->icmp6_type;
        tuple->src.u.icmp.id = hp->icmp6_identifier;
        tuple->dst.u.icmp.code = hp->icmp6_code;
 
-       return 1;
+       return true;
 }
 
 /* Add 1; spaces filled with 0. */
-static u_int8_t invmap[] = {
+static const u_int8_t invmap[] = {
        [ICMPV6_ECHO_REQUEST - 128]     = ICMPV6_ECHO_REPLY + 1,
        [ICMPV6_ECHO_REPLY - 128]       = ICMPV6_ECHO_REQUEST + 1,
        [ICMPV6_NI_QUERY - 128]         = ICMPV6_NI_QUERY + 1,
        [ICMPV6_NI_REPLY - 128]         = ICMPV6_NI_REPLY +1
 };
 
-static int icmpv6_invert_tuple(struct nf_conntrack_tuple *tuple,
-                              const struct nf_conntrack_tuple *orig)
+static bool icmpv6_invert_tuple(struct nf_conntrack_tuple *tuple,
+                               const struct nf_conntrack_tuple *orig)
 {
        int type = orig->dst.u.icmp.type - 128;
        if (type < 0 || type >= sizeof(invmap) || !invmap[type])
-               return 0;
+               return false;
 
        tuple->src.u.icmp.id   = orig->src.u.icmp.id;
        tuple->dst.u.icmp.type = invmap[type] - 1;
        tuple->dst.u.icmp.code = orig->dst.u.icmp.code;
-       return 1;
+       return true;
 }
 
 /* Print out the per-protocol part of the tuple. */
@@ -101,25 +102,24 @@ static int icmpv6_packet(struct nf_conn *ct,
 }
 
 /* Called when a new connection for this protocol found. */
-static int icmpv6_new(struct nf_conn *conntrack,
-                     const struct sk_buff *skb,
-                     unsigned int dataoff)
+static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb,
+                      unsigned int dataoff)
 {
-       static u_int8_t valid_new[] = {
+       static const u_int8_t valid_new[] = {
                [ICMPV6_ECHO_REQUEST - 128] = 1,
                [ICMPV6_NI_QUERY - 128] = 1
        };
-       int type = conntrack->tuplehash[0].tuple.dst.u.icmp.type - 128;
+       int type = ct->tuplehash[0].tuple.dst.u.icmp.type - 128;
 
        if (type < 0 || type >= sizeof(valid_new) || !valid_new[type]) {
                /* Can't create a new ICMPv6 `conn' with this. */
                pr_debug("icmpv6: can't create new conn with type %u\n",
                         type + 128);
-               NF_CT_DUMP_TUPLE(&conntrack->tuplehash[0].tuple);
-               return 0;
+               nf_ct_dump_tuple_ipv6(&ct->tuplehash[0].tuple);
+               return false;
        }
-       atomic_set(&conntrack->proto.icmp.count, 0);
-       return 1;
+       atomic_set(&ct->proto.icmp.count, 0);
+       return true;
 }
 
 static int
@@ -129,8 +129,8 @@ icmpv6_error_message(struct sk_buff *skb,
                     unsigned int hooknum)
 {
        struct nf_conntrack_tuple intuple, origtuple;
-       struct nf_conntrack_tuple_hash *h;
-       struct nf_conntrack_l4proto *inproto;
+       const struct nf_conntrack_tuple_hash *h;
+       const struct nf_conntrack_l4proto *inproto;
 
        NF_CT_ASSERT(skb->nfct == NULL);
 
@@ -176,7 +176,8 @@ static int
 icmpv6_error(struct sk_buff *skb, unsigned int dataoff,
             enum ip_conntrack_info *ctinfo, int pf, unsigned int hooknum)
 {
-       struct icmp6hdr _ih, *icmp6h;
+       const struct icmp6hdr *icmp6h;
+       struct icmp6hdr _ih;
 
        icmp6h = skb_header_pointer(skb, dataoff, sizeof(_ih), &_ih);
        if (icmp6h == NULL) {