@@ -45,30 +45,8 @@ MODULE_ALIAS_NFCT_HELPER("pptp");
45
45
46
46
static DEFINE_SPINLOCK (nf_pptp_lock );
47
47
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 );
72
50
73
51
#if defined(DEBUG ) || defined(CONFIG_DYNAMIC_DEBUG )
74
52
/* PptpControlMessageType names */
@@ -111,8 +89,8 @@ EXPORT_SYMBOL(pptp_msg_name);
111
89
static void pptp_expectfn (struct nf_conn * ct ,
112
90
struct nf_conntrack_expect * exp )
113
91
{
92
+ const struct nf_nat_pptp_hook * hook ;
114
93
struct net * net = nf_ct_net (ct );
115
- typeof (nf_nat_pptp_hook_expectfn ) nf_nat_pptp_expectfn ;
116
94
pr_debug ("increasing timeouts\n" );
117
95
118
96
/* increase timeout of GRE data channel conntrack entry */
@@ -122,9 +100,9 @@ static void pptp_expectfn(struct nf_conn *ct,
122
100
/* Can you see how rusty this code is, compared with the pre-2.6.11
123
101
* one? That's what happened to my shiny newnat of 2002 ;( -HW */
124
102
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 );
128
106
else {
129
107
struct nf_conntrack_tuple inv_t ;
130
108
struct nf_conntrack_expect * exp_other ;
@@ -209,9 +187,9 @@ static void pptp_destroy_siblings(struct nf_conn *ct)
209
187
static int exp_gre (struct nf_conn * ct , __be16 callid , __be16 peer_callid )
210
188
{
211
189
struct nf_conntrack_expect * exp_orig , * exp_reply ;
190
+ const struct nf_nat_pptp_hook * hook ;
212
191
enum ip_conntrack_dir dir ;
213
192
int ret = 1 ;
214
- typeof (nf_nat_pptp_hook_exp_gre ) nf_nat_pptp_exp_gre ;
215
193
216
194
exp_orig = nf_ct_expect_alloc (ct );
217
195
if (exp_orig == NULL )
@@ -239,9 +217,9 @@ static int exp_gre(struct nf_conn *ct, __be16 callid, __be16 peer_callid)
239
217
IPPROTO_GRE , & callid , & peer_callid );
240
218
exp_reply -> expectfn = pptp_expectfn ;
241
219
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 );
245
223
if (nf_ct_expect_related (exp_orig , 0 ) != 0 )
246
224
goto out_put_both ;
247
225
if (nf_ct_expect_related (exp_reply , 0 ) != 0 )
@@ -279,9 +257,9 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff,
279
257
enum ip_conntrack_info ctinfo )
280
258
{
281
259
struct nf_ct_pptp_master * info = nfct_help_data (ct );
260
+ const struct nf_nat_pptp_hook * hook ;
282
261
u_int16_t msg ;
283
262
__be16 cid = 0 , pcid = 0 ;
284
- typeof (nf_nat_pptp_hook_inbound ) nf_nat_pptp_inbound ;
285
263
286
264
msg = ntohs (ctlh -> messageType );
287
265
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,
383
361
goto invalid ;
384
362
}
385
363
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 );
390
367
return NF_ACCEPT ;
391
368
392
369
invalid :
@@ -407,9 +384,9 @@ pptp_outbound_pkt(struct sk_buff *skb, unsigned int protoff,
407
384
enum ip_conntrack_info ctinfo )
408
385
{
409
386
struct nf_ct_pptp_master * info = nfct_help_data (ct );
387
+ const struct nf_nat_pptp_hook * hook ;
410
388
u_int16_t msg ;
411
389
__be16 cid = 0 , pcid = 0 ;
412
- typeof (nf_nat_pptp_hook_outbound ) nf_nat_pptp_outbound ;
413
390
414
391
msg = ntohs (ctlh -> messageType );
415
392
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,
479
456
goto invalid ;
480
457
}
481
458
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 );
486
462
return NF_ACCEPT ;
487
463
488
464
invalid :
0 commit comments