@@ -45,30 +45,8 @@ MODULE_ALIAS_NFCT_HELPER("pptp");
4545
4646static DEFINE_SPINLOCK (nf_pptp_lock );
4747
48- int
49- (* nf_nat_pptp_hook_outbound )(struct sk_buff * skb ,
50- struct nf_conn * ct , enum ip_conntrack_info ctinfo ,
51- unsigned int protoff , struct PptpControlHeader * ctlh ,
52- union pptp_ctrl_union * pptpReq ) __read_mostly ;
53- EXPORT_SYMBOL_GPL (nf_nat_pptp_hook_outbound );
54-
55- int
56- (* nf_nat_pptp_hook_inbound )(struct sk_buff * skb ,
57- struct nf_conn * ct , enum ip_conntrack_info ctinfo ,
58- unsigned int protoff , struct PptpControlHeader * ctlh ,
59- union pptp_ctrl_union * pptpReq ) __read_mostly ;
60- EXPORT_SYMBOL_GPL (nf_nat_pptp_hook_inbound );
61-
62- void
63- (* nf_nat_pptp_hook_exp_gre )(struct nf_conntrack_expect * expect_orig ,
64- struct nf_conntrack_expect * expect_reply )
65- __read_mostly ;
66- EXPORT_SYMBOL_GPL (nf_nat_pptp_hook_exp_gre );
67-
68- void
69- (* nf_nat_pptp_hook_expectfn )(struct nf_conn * ct ,
70- struct nf_conntrack_expect * exp ) __read_mostly ;
71- EXPORT_SYMBOL_GPL (nf_nat_pptp_hook_expectfn );
48+ const struct nf_nat_pptp_hook * nf_nat_pptp_hook ;
49+ EXPORT_SYMBOL_GPL (nf_nat_pptp_hook );
7250
7351#if defined(DEBUG ) || defined(CONFIG_DYNAMIC_DEBUG )
7452/* PptpControlMessageType names */
@@ -111,8 +89,8 @@ EXPORT_SYMBOL(pptp_msg_name);
11189static void pptp_expectfn (struct nf_conn * ct ,
11290 struct nf_conntrack_expect * exp )
11391{
92+ const struct nf_nat_pptp_hook * hook ;
11493 struct net * net = nf_ct_net (ct );
115- typeof (nf_nat_pptp_hook_expectfn ) nf_nat_pptp_expectfn ;
11694 pr_debug ("increasing timeouts\n" );
11795
11896 /* increase timeout of GRE data channel conntrack entry */
@@ -122,9 +100,9 @@ static void pptp_expectfn(struct nf_conn *ct,
122100 /* Can you see how rusty this code is, compared with the pre-2.6.11
123101 * one? That's what happened to my shiny newnat of 2002 ;( -HW */
124102
125- nf_nat_pptp_expectfn = rcu_dereference (nf_nat_pptp_hook_expectfn );
126- if (nf_nat_pptp_expectfn && ct -> master -> status & IPS_NAT_MASK )
127- nf_nat_pptp_expectfn (ct , exp );
103+ hook = rcu_dereference (nf_nat_pptp_hook );
104+ if (hook && ct -> master -> status & IPS_NAT_MASK )
105+ hook -> expectfn (ct , exp );
128106 else {
129107 struct nf_conntrack_tuple inv_t ;
130108 struct nf_conntrack_expect * exp_other ;
@@ -209,9 +187,9 @@ static void pptp_destroy_siblings(struct nf_conn *ct)
209187static int exp_gre (struct nf_conn * ct , __be16 callid , __be16 peer_callid )
210188{
211189 struct nf_conntrack_expect * exp_orig , * exp_reply ;
190+ const struct nf_nat_pptp_hook * hook ;
212191 enum ip_conntrack_dir dir ;
213192 int ret = 1 ;
214- typeof (nf_nat_pptp_hook_exp_gre ) nf_nat_pptp_exp_gre ;
215193
216194 exp_orig = nf_ct_expect_alloc (ct );
217195 if (exp_orig == NULL )
@@ -239,9 +217,9 @@ static int exp_gre(struct nf_conn *ct, __be16 callid, __be16 peer_callid)
239217 IPPROTO_GRE , & callid , & peer_callid );
240218 exp_reply -> expectfn = pptp_expectfn ;
241219
242- nf_nat_pptp_exp_gre = rcu_dereference (nf_nat_pptp_hook_exp_gre );
243- if (nf_nat_pptp_exp_gre && ct -> status & IPS_NAT_MASK )
244- nf_nat_pptp_exp_gre (exp_orig , exp_reply );
220+ hook = rcu_dereference (nf_nat_pptp_hook );
221+ if (hook && ct -> status & IPS_NAT_MASK )
222+ hook -> exp_gre (exp_orig , exp_reply );
245223 if (nf_ct_expect_related (exp_orig , 0 ) != 0 )
246224 goto out_put_both ;
247225 if (nf_ct_expect_related (exp_reply , 0 ) != 0 )
@@ -279,9 +257,9 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff,
279257 enum ip_conntrack_info ctinfo )
280258{
281259 struct nf_ct_pptp_master * info = nfct_help_data (ct );
260+ const struct nf_nat_pptp_hook * hook ;
282261 u_int16_t msg ;
283262 __be16 cid = 0 , pcid = 0 ;
284- typeof (nf_nat_pptp_hook_inbound ) nf_nat_pptp_inbound ;
285263
286264 msg = ntohs (ctlh -> messageType );
287265 pr_debug ("inbound control message %s\n" , pptp_msg_name (msg ));
@@ -383,10 +361,9 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff,
383361 goto invalid ;
384362 }
385363
386- nf_nat_pptp_inbound = rcu_dereference (nf_nat_pptp_hook_inbound );
387- if (nf_nat_pptp_inbound && ct -> status & IPS_NAT_MASK )
388- return nf_nat_pptp_inbound (skb , ct , ctinfo ,
389- protoff , ctlh , pptpReq );
364+ hook = rcu_dereference (nf_nat_pptp_hook );
365+ if (hook && ct -> status & IPS_NAT_MASK )
366+ return hook -> inbound (skb , ct , ctinfo , protoff , ctlh , pptpReq );
390367 return NF_ACCEPT ;
391368
392369invalid :
@@ -407,9 +384,9 @@ pptp_outbound_pkt(struct sk_buff *skb, unsigned int protoff,
407384 enum ip_conntrack_info ctinfo )
408385{
409386 struct nf_ct_pptp_master * info = nfct_help_data (ct );
387+ const struct nf_nat_pptp_hook * hook ;
410388 u_int16_t msg ;
411389 __be16 cid = 0 , pcid = 0 ;
412- typeof (nf_nat_pptp_hook_outbound ) nf_nat_pptp_outbound ;
413390
414391 msg = ntohs (ctlh -> messageType );
415392 pr_debug ("outbound control message %s\n" , pptp_msg_name (msg ));
@@ -479,10 +456,9 @@ pptp_outbound_pkt(struct sk_buff *skb, unsigned int protoff,
479456 goto invalid ;
480457 }
481458
482- nf_nat_pptp_outbound = rcu_dereference (nf_nat_pptp_hook_outbound );
483- if (nf_nat_pptp_outbound && ct -> status & IPS_NAT_MASK )
484- return nf_nat_pptp_outbound (skb , ct , ctinfo ,
485- protoff , ctlh , pptpReq );
459+ hook = rcu_dereference (nf_nat_pptp_hook );
460+ if (hook && ct -> status & IPS_NAT_MASK )
461+ return hook -> outbound (skb , ct , ctinfo , protoff , ctlh , pptpReq );
486462 return NF_ACCEPT ;
487463
488464invalid :
0 commit comments