]> err.no Git - linux-2.6/blobdiff - net/ipv4/netfilter/nf_nat_pptp.c
[IPV4]: esp_output() misannotations
[linux-2.6] / net / ipv4 / netfilter / nf_nat_pptp.c
index 984ec8308b2eb21766b09dea273fd84b7f97c838..3a1e6d6afc0af3d8d2a7fda4cfc4a9e7bf290994 100644 (file)
@@ -40,11 +40,11 @@ MODULE_ALIAS("ip_nat_pptp");
 static void pptp_nat_expected(struct nf_conn *ct,
                              struct nf_conntrack_expect *exp)
 {
-       struct nf_conn *master = ct->master;
+       const struct nf_conn *master = ct->master;
        struct nf_conntrack_expect *other_exp;
        struct nf_conntrack_tuple t;
-       struct nf_ct_pptp_master *ct_pptp_info;
-       struct nf_nat_pptp *nat_pptp_info;
+       const struct nf_ct_pptp_master *ct_pptp_info;
+       const struct nf_nat_pptp *nat_pptp_info;
        struct nf_nat_range range;
 
        ct_pptp_info = &nfct_help(master)->help.ct_pptp_info;
@@ -93,8 +93,7 @@ static void pptp_nat_expected(struct nf_conn *ct,
                range.flags |= IP_NAT_RANGE_PROTO_SPECIFIED;
                range.min = range.max = exp->saved_proto;
        }
-       /* hook doesn't matter, but it has to do source manip */
-       nf_nat_setup_info(ct, &range, NF_IP_POST_ROUTING);
+       nf_nat_setup_info(ct, &range, IP_NAT_MANIP_SRC);
 
        /* For DST manip, map port here to where it's expected. */
        range.flags = IP_NAT_RANGE_MAP_IPS;
@@ -104,13 +103,12 @@ static void pptp_nat_expected(struct nf_conn *ct,
                range.flags |= IP_NAT_RANGE_PROTO_SPECIFIED;
                range.min = range.max = exp->saved_proto;
        }
-       /* hook doesn't matter, but it has to do destination manip */
-       nf_nat_setup_info(ct, &range, NF_IP_PRE_ROUTING);
+       nf_nat_setup_info(ct, &range, IP_NAT_MANIP_DST);
 }
 
 /* outbound packets == from PNS to PAC */
 static int
-pptp_outbound_pkt(struct sk_buff **pskb,
+pptp_outbound_pkt(struct sk_buff *skb,
                  struct nf_conn *ct,
                  enum ip_conntrack_info ctinfo,
                  struct PptpControlHeader *ctlh,
@@ -175,7 +173,7 @@ pptp_outbound_pkt(struct sk_buff **pskb,
                 ntohs(REQ_CID(pptpReq, cid_off)), ntohs(new_callid));
 
        /* mangle packet */
-       if (nf_nat_mangle_tcp_packet(pskb, ct, ctinfo,
+       if (nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
                                     cid_off + sizeof(struct pptp_pkt_hdr) +
                                     sizeof(struct PptpControlHeader),
                                     sizeof(new_callid), (char *)&new_callid,
@@ -188,7 +186,7 @@ static void
 pptp_exp_gre(struct nf_conntrack_expect *expect_orig,
             struct nf_conntrack_expect *expect_reply)
 {
-       struct nf_conn *ct = expect_orig->master;
+       const struct nf_conn *ct = expect_orig->master;
        struct nf_ct_pptp_master *ct_pptp_info;
        struct nf_nat_pptp *nat_pptp_info;
 
@@ -213,13 +211,13 @@ pptp_exp_gre(struct nf_conntrack_expect *expect_orig,
 
 /* inbound packets == from PAC to PNS */
 static int
-pptp_inbound_pkt(struct sk_buff **pskb,
+pptp_inbound_pkt(struct sk_buff *skb,
                 struct nf_conn *ct,
                 enum ip_conntrack_info ctinfo,
                 struct PptpControlHeader *ctlh,
                 union pptp_ctrl_union *pptpReq)
 {
-       struct nf_nat_pptp *nat_pptp_info;
+       const struct nf_nat_pptp *nat_pptp_info;
        u_int16_t msg;
        __be16 new_pcid;
        unsigned int pcid_off;
@@ -268,7 +266,7 @@ pptp_inbound_pkt(struct sk_buff **pskb,
        pr_debug("altering peer call id from 0x%04x to 0x%04x\n",
                 ntohs(REQ_CID(pptpReq, pcid_off)), ntohs(new_pcid));
 
-       if (nf_nat_mangle_tcp_packet(pskb, ct, ctinfo,
+       if (nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
                                     pcid_off + sizeof(struct pptp_pkt_hdr) +
                                     sizeof(struct PptpControlHeader),
                                     sizeof(new_pcid), (char *)&new_pcid,
@@ -281,16 +279,16 @@ static int __init nf_nat_helper_pptp_init(void)
 {
        nf_nat_need_gre();
 
-       BUG_ON(rcu_dereference(nf_nat_pptp_hook_outbound));
+       BUG_ON(nf_nat_pptp_hook_outbound != NULL);
        rcu_assign_pointer(nf_nat_pptp_hook_outbound, pptp_outbound_pkt);
 
-       BUG_ON(rcu_dereference(nf_nat_pptp_hook_inbound));
+       BUG_ON(nf_nat_pptp_hook_inbound != NULL);
        rcu_assign_pointer(nf_nat_pptp_hook_inbound, pptp_inbound_pkt);
 
-       BUG_ON(rcu_dereference(nf_nat_pptp_hook_exp_gre));
+       BUG_ON(nf_nat_pptp_hook_exp_gre != NULL);
        rcu_assign_pointer(nf_nat_pptp_hook_exp_gre, pptp_exp_gre);
 
-       BUG_ON(rcu_dereference(nf_nat_pptp_hook_expectfn));
+       BUG_ON(nf_nat_pptp_hook_expectfn != NULL);
        rcu_assign_pointer(nf_nat_pptp_hook_expectfn, pptp_nat_expected);
        return 0;
 }