Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
[sfrench/cifs-2.6.git] / net / netfilter / nf_conntrack_proto_gre.c
index 339c397d1b5facb318419deeeb6fb2e1e876de62..e10024a1b6662e971ac565639d10c1bd16a85793 100644 (file)
 #define GRE_TIMEOUT            (30 * HZ)
 #define GRE_STREAM_TIMEOUT     (180 * HZ)
 
-#if 0
-#define DEBUGP(format, args...)        printk(KERN_DEBUG "%s:%s: " format, __FILE__, __FUNCTION__, ## args)
-#else
-#define DEBUGP(x, args...)
-#endif
-
 static DEFINE_RWLOCK(nf_ct_gre_lock);
 static LIST_HEAD(gre_keymap_list);
 
@@ -87,7 +81,7 @@ static __be16 gre_keymap_lookup(struct nf_conntrack_tuple *t)
        }
        read_unlock_bh(&nf_ct_gre_lock);
 
-       DEBUGP("lookup src key 0x%x for ", key);
+       pr_debug("lookup src key 0x%x for ", key);
        NF_CT_DUMP_TUPLE(t);
 
        return key;
@@ -107,8 +101,8 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
                        if (gre_key_cmpfn(km, t) && km == *kmp)
                                return 0;
                }
-               DEBUGP("trying to override keymap_%s for ct %p\n",
-                       dir == IP_CT_DIR_REPLY ? "reply" : "orig", ct);
+               pr_debug("trying to override keymap_%s for ct %p\n",
+                        dir == IP_CT_DIR_REPLY ? "reply" : "orig", ct);
                return -EEXIST;
        }
 
@@ -118,7 +112,7 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
        memcpy(&km->tuple, t, sizeof(*t));
        *kmp = km;
 
-       DEBUGP("adding new entry %p: ", km);
+       pr_debug("adding new entry %p: ", km);
        NF_CT_DUMP_TUPLE(&km->tuple);
 
        write_lock_bh(&nf_ct_gre_lock);
@@ -135,13 +129,13 @@ void nf_ct_gre_keymap_destroy(struct nf_conn *ct)
        struct nf_conn_help *help = nfct_help(ct);
        enum ip_conntrack_dir dir;
 
-       DEBUGP("entering for ct %p\n", ct);
+       pr_debug("entering for ct %p\n", ct);
 
        write_lock_bh(&nf_ct_gre_lock);
        for (dir = IP_CT_DIR_ORIGINAL; dir < IP_CT_DIR_MAX; dir++) {
                if (help->help.ct_pptp_info.keymap[dir]) {
-                       DEBUGP("removing %p from list\n",
-                               help->help.ct_pptp_info.keymap[dir]);
+                       pr_debug("removing %p from list\n",
+                                help->help.ct_pptp_info.keymap[dir]);
                        list_del(&help->help.ct_pptp_info.keymap[dir]->list);
                        kfree(help->help.ct_pptp_info.keymap[dir]);
                        help->help.ct_pptp_info.keymap[dir] = NULL;
@@ -167,9 +161,11 @@ static int gre_pkt_to_tuple(const struct sk_buff *skb,
                           unsigned int dataoff,
                           struct nf_conntrack_tuple *tuple)
 {
-       struct gre_hdr_pptp _pgrehdr, *pgrehdr;
+       const struct gre_hdr_pptp *pgrehdr;
+       struct gre_hdr_pptp _pgrehdr;
        __be16 srckey;
-       struct gre_hdr _grehdr, *grehdr;
+       const struct gre_hdr *grehdr;
+       struct gre_hdr _grehdr;
 
        /* first only delinearize old RFC1701 GRE header */
        grehdr = skb_header_pointer(skb, dataoff, sizeof(_grehdr), &_grehdr);
@@ -186,7 +182,7 @@ static int gre_pkt_to_tuple(const struct sk_buff *skb,
                return 1;
 
        if (ntohs(grehdr->protocol) != GRE_PROTOCOL_PPTP) {
-               DEBUGP("GRE_VERSION_PPTP but unknown proto\n");
+               pr_debug("GRE_VERSION_PPTP but unknown proto\n");
                return 0;
        }
 
@@ -242,7 +238,7 @@ static int gre_packet(struct nf_conn *ct,
 static int gre_new(struct nf_conn *ct, const struct sk_buff *skb,
                   unsigned int dataoff)
 {
-       DEBUGP(": ");
+       pr_debug(": ");
        NF_CT_DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
 
        /* initialize to sane value.  Ideally a conntrack helper
@@ -258,16 +254,16 @@ static int gre_new(struct nf_conn *ct, const struct sk_buff *skb,
 static void gre_destroy(struct nf_conn *ct)
 {
        struct nf_conn *master = ct->master;
-       DEBUGP(" entering\n");
+       pr_debug(" entering\n");
 
        if (!master)
-               DEBUGP("no master !?!\n");
+               pr_debug("no master !?!\n");
        else
                nf_ct_gre_keymap_destroy(master);
 }
 
 /* protocol helper struct */
-static struct nf_conntrack_l4proto nf_conntrack_l4proto_gre4 = {
+static struct nf_conntrack_l4proto nf_conntrack_l4proto_gre4 __read_mostly = {
        .l3proto         = AF_INET,
        .l4proto         = IPPROTO_GRE,
        .name            = "gre",
@@ -280,8 +276,9 @@ static struct nf_conntrack_l4proto nf_conntrack_l4proto_gre4 = {
        .destroy         = gre_destroy,
        .me              = THIS_MODULE,
 #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
-       .tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
-       .nfattr_to_tuple = nf_ct_port_nfattr_to_tuple,
+       .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr,
+       .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,
+       .nla_policy      = nf_ct_port_nla_policy,
 #endif
 };