[NETFILTER]: x_tables: remove some unnecessary casts
[safe/jmp/linux-2.6] / net / ipv4 / netfilter / ip_conntrack_helper_pptp.c
index 1175879..8ccfe17 100644 (file)
@@ -172,7 +172,6 @@ static int destroy_sibling_or_exp(const struct ip_conntrack_tuple *t)
                DEBUGP("setting timeout of conntrack %p to 0\n", sibling);
                sibling->proto.gre.timeout = 0;
                sibling->proto.gre.stream_timeout = 0;
-               /* refresh_acct will not modify counters if skb == NULL */
                if (del_timer(&sibling->timeout))
                        sibling->timeout.function((unsigned long)sibling);
                ip_conntrack_put(sibling);
@@ -223,8 +222,8 @@ static void pptp_destroy_siblings(struct ip_conntrack *ct)
 static inline int
 exp_gre(struct ip_conntrack *master,
        u_int32_t seq,
-       u_int16_t callid,
-       u_int16_t peer_callid)
+       __be16 callid,
+       __be16 peer_callid)
 {
        struct ip_conntrack_tuple inv_tuple;
        struct ip_conntrack_tuple exp_tuples[] = {
@@ -263,7 +262,7 @@ exp_gre(struct ip_conntrack *master,
        exp_orig->mask.src.ip = 0xffffffff;
        exp_orig->mask.src.u.all = 0;
        exp_orig->mask.dst.u.all = 0;
-       exp_orig->mask.dst.u.gre.key = 0xffff;
+       exp_orig->mask.dst.u.gre.key = htons(0xffff);
        exp_orig->mask.dst.ip = 0xffffffff;
        exp_orig->mask.dst.protonum = 0xff;
                
@@ -271,14 +270,10 @@ exp_gre(struct ip_conntrack *master,
        exp_orig->expectfn = pptp_expectfn;
        exp_orig->flags = 0;
 
-       exp_orig->dir = IP_CT_DIR_ORIGINAL;
-
        /* both expectations are identical apart from tuple */
        memcpy(exp_reply, exp_orig, sizeof(*exp_reply));
        memcpy(&exp_reply->tuple, &exp_tuples[1], sizeof(exp_reply->tuple));
 
-       exp_reply->dir = !exp_orig->dir;
-
        if (ip_nat_pptp_hook_exp_gre)
                ret = ip_nat_pptp_hook_exp_gre(exp_orig, exp_reply);
        else {
@@ -340,7 +335,8 @@ pptp_inbound_pkt(struct sk_buff **pskb,
        unsigned int reqlen;
        union pptp_ctrl_union _pptpReq, *pptpReq;
        struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info;
-       u_int16_t msg, *cid, *pcid;
+       u_int16_t msg;
+       __be16 *cid, *pcid;
        u_int32_t seq;  
 
        ctlh = skb_header_pointer(*pskb, nexthdr_off, sizeof(_ctlh), &_ctlh);
@@ -473,8 +469,8 @@ pptp_inbound_pkt(struct sk_buff **pskb,
                        DEBUGP("%s but no session\n", pptp_msg_name[msg]);
                        break;
                }
-               if (info->sstate != PPTP_CALL_IN_REP
-                   && info->sstate != PPTP_CALL_IN_CONF) {
+               if (info->cstate != PPTP_CALL_IN_REP
+                   && info->cstate != PPTP_CALL_IN_CONF) {
                        DEBUGP("%s but never sent IN_CALL_REPLY\n",
                                pptp_msg_name[msg]);
                        break;
@@ -551,7 +547,8 @@ pptp_outbound_pkt(struct sk_buff **pskb,
        unsigned int reqlen;
        union pptp_ctrl_union _pptpReq, *pptpReq;
        struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info;
-       u_int16_t msg, *cid, *pcid;
+       u_int16_t msg;
+       __be16 *cid, *pcid;
 
        ctlh = skb_header_pointer(*pskb, nexthdr_off, sizeof(_ctlh), &_ctlh);
        if (!ctlh)
@@ -755,7 +752,7 @@ static struct ip_conntrack_helper pptp = {
                          } 
                 },
        .mask = { .src = { .ip = 0, 
-                          .u = { .tcp = { .port = 0xffff } } 
+                          .u = { .tcp = { .port = __constant_htons(0xffff) } } 
                         }, 
                  .dst = { .ip = 0, 
                           .u = { .all = 0 },
@@ -765,11 +762,11 @@ static struct ip_conntrack_helper pptp = {
        .help = conntrack_pptp_help
 };
 
-extern void __exit ip_ct_proto_gre_fini(void);
+extern void ip_ct_proto_gre_fini(void);
 extern int __init ip_ct_proto_gre_init(void);
 
 /* ip_conntrack_pptp initialization */
-static int __init init(void)
+static int __init ip_conntrack_helper_pptp_init(void)
 {
        int retcode;
  
@@ -789,15 +786,15 @@ static int __init init(void)
        return 0;
 }
 
-static void __exit fini(void)
+static void __exit ip_conntrack_helper_pptp_fini(void)
 {
        ip_conntrack_helper_unregister(&pptp);
        ip_ct_proto_gre_fini();
        printk("ip_conntrack_pptp version %s unloaded\n", IP_CT_PPTP_VERSION);
 }
 
-module_init(init);
-module_exit(fini);
+module_init(ip_conntrack_helper_pptp_init);
+module_exit(ip_conntrack_helper_pptp_fini);
 
 EXPORT_SYMBOL(ip_nat_pptp_hook_outbound);
 EXPORT_SYMBOL(ip_nat_pptp_hook_inbound);