Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Connection tracking support for PPTP (Point to Point Tunneling Protocol). |
| 3 | * PPTP is a a protocol for creating virtual private networks. |
| 4 | * It is a specification defined by Microsoft and some vendors |
| 5 | * working with Microsoft. PPTP is built on top of a modified |
| 6 | * version of the Internet Generic Routing Encapsulation Protocol. |
| 7 | * GRE is defined in RFC 1701 and RFC 1702. Documentation of |
| 8 | * PPTP can be found in RFC 2637 |
| 9 | * |
| 10 | * (C) 2000-2005 by Harald Welte <laforge@gnumonks.org> |
| 11 | * |
| 12 | * Development of this code funded by Astaro AG (http://www.astaro.com/) |
| 13 | * |
Patrick McHardy | f229f6c | 2013-04-06 15:24:29 +0200 | [diff] [blame] | 14 | * (C) 2006-2012 Patrick McHardy <kaber@trash.net> |
| 15 | * |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 16 | * Limitations: |
| 17 | * - We blindly assume that control connections are always |
| 18 | * established in PNS->PAC direction. This is a violation |
Reese Moore | 3812432 | 2012-11-07 07:05:08 +0000 | [diff] [blame] | 19 | * of RFC 2637 |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 20 | * - We can only support one single call within each session |
| 21 | * TODO: |
| 22 | * - testing of incoming PPTP calls |
| 23 | */ |
| 24 | |
| 25 | #include <linux/module.h> |
| 26 | #include <linux/skbuff.h> |
| 27 | #include <linux/in.h> |
| 28 | #include <linux/tcp.h> |
| 29 | |
| 30 | #include <net/netfilter/nf_conntrack.h> |
| 31 | #include <net/netfilter/nf_conntrack_core.h> |
| 32 | #include <net/netfilter/nf_conntrack_helper.h> |
Patrick McHardy | 5d0aa2c | 2010-02-15 18:13:33 +0100 | [diff] [blame] | 33 | #include <net/netfilter/nf_conntrack_zones.h> |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 34 | #include <linux/netfilter/nf_conntrack_proto_gre.h> |
| 35 | #include <linux/netfilter/nf_conntrack_pptp.h> |
| 36 | |
| 37 | #define NF_CT_PPTP_VERSION "3.1" |
| 38 | |
| 39 | MODULE_LICENSE("GPL"); |
| 40 | MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); |
| 41 | MODULE_DESCRIPTION("Netfilter connection tracking helper module for PPTP"); |
| 42 | MODULE_ALIAS("ip_conntrack_pptp"); |
Pablo Neira Ayuso | 4dc06f9 | 2008-11-17 16:01:42 +0100 | [diff] [blame] | 43 | MODULE_ALIAS_NFCT_HELPER("pptp"); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 44 | |
| 45 | static DEFINE_SPINLOCK(nf_pptp_lock); |
| 46 | |
| 47 | int |
Herbert Xu | 3db05fe | 2007-10-15 00:53:15 -0700 | [diff] [blame] | 48 | (*nf_nat_pptp_hook_outbound)(struct sk_buff *skb, |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 49 | struct nf_conn *ct, enum ip_conntrack_info ctinfo, |
Patrick McHardy | 051966c | 2012-08-26 19:14:04 +0200 | [diff] [blame] | 50 | unsigned int protoff, struct PptpControlHeader *ctlh, |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 51 | union pptp_ctrl_union *pptpReq) __read_mostly; |
| 52 | EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_outbound); |
| 53 | |
| 54 | int |
Herbert Xu | 3db05fe | 2007-10-15 00:53:15 -0700 | [diff] [blame] | 55 | (*nf_nat_pptp_hook_inbound)(struct sk_buff *skb, |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 56 | struct nf_conn *ct, enum ip_conntrack_info ctinfo, |
Patrick McHardy | 051966c | 2012-08-26 19:14:04 +0200 | [diff] [blame] | 57 | unsigned int protoff, struct PptpControlHeader *ctlh, |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 58 | union pptp_ctrl_union *pptpReq) __read_mostly; |
| 59 | EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_inbound); |
| 60 | |
| 61 | void |
| 62 | (*nf_nat_pptp_hook_exp_gre)(struct nf_conntrack_expect *expect_orig, |
| 63 | struct nf_conntrack_expect *expect_reply) |
| 64 | __read_mostly; |
| 65 | EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_exp_gre); |
| 66 | |
| 67 | void |
| 68 | (*nf_nat_pptp_hook_expectfn)(struct nf_conn *ct, |
| 69 | struct nf_conntrack_expect *exp) __read_mostly; |
| 70 | EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_expectfn); |
| 71 | |
Jason Baron | e9d376f | 2009-02-05 11:51:38 -0500 | [diff] [blame] | 72 | #if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG) |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 73 | /* PptpControlMessageType names */ |
Jan Engelhardt | 9ddd0ed | 2008-01-31 04:51:23 -0800 | [diff] [blame] | 74 | const char *const pptp_msg_name[] = { |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 75 | "UNKNOWN_MESSAGE", |
| 76 | "START_SESSION_REQUEST", |
| 77 | "START_SESSION_REPLY", |
| 78 | "STOP_SESSION_REQUEST", |
| 79 | "STOP_SESSION_REPLY", |
| 80 | "ECHO_REQUEST", |
| 81 | "ECHO_REPLY", |
| 82 | "OUT_CALL_REQUEST", |
| 83 | "OUT_CALL_REPLY", |
| 84 | "IN_CALL_REQUEST", |
| 85 | "IN_CALL_REPLY", |
| 86 | "IN_CALL_CONNECT", |
| 87 | "CALL_CLEAR_REQUEST", |
| 88 | "CALL_DISCONNECT_NOTIFY", |
| 89 | "WAN_ERROR_NOTIFY", |
| 90 | "SET_LINK_INFO" |
| 91 | }; |
| 92 | EXPORT_SYMBOL(pptp_msg_name); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 93 | #endif |
| 94 | |
| 95 | #define SECS *HZ |
| 96 | #define MINS * 60 SECS |
| 97 | #define HOURS * 60 MINS |
| 98 | |
| 99 | #define PPTP_GRE_TIMEOUT (10 MINS) |
| 100 | #define PPTP_GRE_STREAM_TIMEOUT (5 HOURS) |
| 101 | |
| 102 | static void pptp_expectfn(struct nf_conn *ct, |
| 103 | struct nf_conntrack_expect *exp) |
| 104 | { |
Alexey Dobriyan | 0e6e75a | 2008-10-08 11:35:10 +0200 | [diff] [blame] | 105 | struct net *net = nf_ct_net(ct); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 106 | typeof(nf_nat_pptp_hook_expectfn) nf_nat_pptp_expectfn; |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 107 | pr_debug("increasing timeouts\n"); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 108 | |
| 109 | /* increase timeout of GRE data channel conntrack entry */ |
| 110 | ct->proto.gre.timeout = PPTP_GRE_TIMEOUT; |
| 111 | ct->proto.gre.stream_timeout = PPTP_GRE_STREAM_TIMEOUT; |
| 112 | |
| 113 | /* Can you see how rusty this code is, compared with the pre-2.6.11 |
| 114 | * one? That's what happened to my shiny newnat of 2002 ;( -HW */ |
| 115 | |
| 116 | rcu_read_lock(); |
| 117 | nf_nat_pptp_expectfn = rcu_dereference(nf_nat_pptp_hook_expectfn); |
Patrick McHardy | 7399072 | 2007-01-26 01:07:59 -0800 | [diff] [blame] | 118 | if (nf_nat_pptp_expectfn && ct->master->status & IPS_NAT_MASK) |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 119 | nf_nat_pptp_expectfn(ct, exp); |
| 120 | else { |
| 121 | struct nf_conntrack_tuple inv_t; |
| 122 | struct nf_conntrack_expect *exp_other; |
| 123 | |
| 124 | /* obviously this tuple inversion only works until you do NAT */ |
| 125 | nf_ct_invert_tuplepr(&inv_t, &exp->tuple); |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 126 | pr_debug("trying to unexpect other dir: "); |
Jan Engelhardt | 3c9fba6 | 2008-04-14 11:15:54 +0200 | [diff] [blame] | 127 | nf_ct_dump_tuple(&inv_t); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 128 | |
Patrick McHardy | 5d0aa2c | 2010-02-15 18:13:33 +0100 | [diff] [blame] | 129 | exp_other = nf_ct_expect_find_get(net, nf_ct_zone(ct), &inv_t); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 130 | if (exp_other) { |
| 131 | /* delete other expectation. */ |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 132 | pr_debug("found\n"); |
Patrick McHardy | 6823645 | 2007-07-07 22:30:49 -0700 | [diff] [blame] | 133 | nf_ct_unexpect_related(exp_other); |
| 134 | nf_ct_expect_put(exp_other); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 135 | } else { |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 136 | pr_debug("not found\n"); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 137 | } |
| 138 | } |
| 139 | rcu_read_unlock(); |
| 140 | } |
| 141 | |
Patrick McHardy | 5d0aa2c | 2010-02-15 18:13:33 +0100 | [diff] [blame] | 142 | static int destroy_sibling_or_exp(struct net *net, struct nf_conn *ct, |
Alexey Dobriyan | 0e6e75a | 2008-10-08 11:35:10 +0200 | [diff] [blame] | 143 | const struct nf_conntrack_tuple *t) |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 144 | { |
Jan Engelhardt | 9ddd0ed | 2008-01-31 04:51:23 -0800 | [diff] [blame] | 145 | const struct nf_conntrack_tuple_hash *h; |
Daniel Borkmann | 308ac91 | 2015-08-08 21:40:01 +0200 | [diff] [blame] | 146 | const struct nf_conntrack_zone *zone; |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 147 | struct nf_conntrack_expect *exp; |
| 148 | struct nf_conn *sibling; |
| 149 | |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 150 | pr_debug("trying to timeout ct or exp for tuple "); |
Jan Engelhardt | 3c9fba6 | 2008-04-14 11:15:54 +0200 | [diff] [blame] | 151 | nf_ct_dump_tuple(t); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 152 | |
Daniel Borkmann | 308ac91 | 2015-08-08 21:40:01 +0200 | [diff] [blame] | 153 | zone = nf_ct_zone(ct); |
Patrick McHardy | 5d0aa2c | 2010-02-15 18:13:33 +0100 | [diff] [blame] | 154 | h = nf_conntrack_find_get(net, zone, t); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 155 | if (h) { |
| 156 | sibling = nf_ct_tuplehash_to_ctrack(h); |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 157 | pr_debug("setting timeout of conntrack %p to 0\n", sibling); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 158 | sibling->proto.gre.timeout = 0; |
| 159 | sibling->proto.gre.stream_timeout = 0; |
| 160 | if (del_timer(&sibling->timeout)) |
| 161 | sibling->timeout.function((unsigned long)sibling); |
| 162 | nf_ct_put(sibling); |
| 163 | return 1; |
| 164 | } else { |
Patrick McHardy | 5d0aa2c | 2010-02-15 18:13:33 +0100 | [diff] [blame] | 165 | exp = nf_ct_expect_find_get(net, zone, t); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 166 | if (exp) { |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 167 | pr_debug("unexpect_related of expect %p\n", exp); |
Patrick McHardy | 6823645 | 2007-07-07 22:30:49 -0700 | [diff] [blame] | 168 | nf_ct_unexpect_related(exp); |
| 169 | nf_ct_expect_put(exp); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 170 | return 1; |
| 171 | } |
| 172 | } |
| 173 | return 0; |
| 174 | } |
| 175 | |
| 176 | /* timeout GRE data connections */ |
| 177 | static void pptp_destroy_siblings(struct nf_conn *ct) |
| 178 | { |
Alexey Dobriyan | 0e6e75a | 2008-10-08 11:35:10 +0200 | [diff] [blame] | 179 | struct net *net = nf_ct_net(ct); |
Pablo Neira Ayuso | 1afc567 | 2012-06-07 12:11:50 +0200 | [diff] [blame] | 180 | const struct nf_ct_pptp_master *ct_pptp_info = nfct_help_data(ct); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 181 | struct nf_conntrack_tuple t; |
| 182 | |
| 183 | nf_ct_gre_keymap_destroy(ct); |
| 184 | |
| 185 | /* try original (pns->pac) tuple */ |
| 186 | memcpy(&t, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, sizeof(t)); |
| 187 | t.dst.protonum = IPPROTO_GRE; |
Pablo Neira Ayuso | 1afc567 | 2012-06-07 12:11:50 +0200 | [diff] [blame] | 188 | t.src.u.gre.key = ct_pptp_info->pns_call_id; |
| 189 | t.dst.u.gre.key = ct_pptp_info->pac_call_id; |
Patrick McHardy | 5d0aa2c | 2010-02-15 18:13:33 +0100 | [diff] [blame] | 190 | if (!destroy_sibling_or_exp(net, ct, &t)) |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 191 | pr_debug("failed to timeout original pns->pac ct/exp\n"); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 192 | |
| 193 | /* try reply (pac->pns) tuple */ |
| 194 | memcpy(&t, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, sizeof(t)); |
| 195 | t.dst.protonum = IPPROTO_GRE; |
Pablo Neira Ayuso | 1afc567 | 2012-06-07 12:11:50 +0200 | [diff] [blame] | 196 | t.src.u.gre.key = ct_pptp_info->pac_call_id; |
| 197 | t.dst.u.gre.key = ct_pptp_info->pns_call_id; |
Patrick McHardy | 5d0aa2c | 2010-02-15 18:13:33 +0100 | [diff] [blame] | 198 | if (!destroy_sibling_or_exp(net, ct, &t)) |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 199 | pr_debug("failed to timeout reply pac->pns ct/exp\n"); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | /* expect GRE connections (PNS->PAC and PAC->PNS direction) */ |
| 203 | static int exp_gre(struct nf_conn *ct, __be16 callid, __be16 peer_callid) |
| 204 | { |
| 205 | struct nf_conntrack_expect *exp_orig, *exp_reply; |
| 206 | enum ip_conntrack_dir dir; |
| 207 | int ret = 1; |
| 208 | typeof(nf_nat_pptp_hook_exp_gre) nf_nat_pptp_exp_gre; |
| 209 | |
Patrick McHardy | 6823645 | 2007-07-07 22:30:49 -0700 | [diff] [blame] | 210 | exp_orig = nf_ct_expect_alloc(ct); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 211 | if (exp_orig == NULL) |
| 212 | goto out; |
| 213 | |
Patrick McHardy | 6823645 | 2007-07-07 22:30:49 -0700 | [diff] [blame] | 214 | exp_reply = nf_ct_expect_alloc(ct); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 215 | if (exp_reply == NULL) |
| 216 | goto out_put_orig; |
| 217 | |
| 218 | /* original direction, PNS->PAC */ |
| 219 | dir = IP_CT_DIR_ORIGINAL; |
Patrick McHardy | 6002f266 | 2008-03-25 20:09:15 -0700 | [diff] [blame] | 220 | nf_ct_expect_init(exp_orig, NF_CT_EXPECT_CLASS_DEFAULT, |
Patrick McHardy | 5e8fbe2 | 2008-04-14 11:15:52 +0200 | [diff] [blame] | 221 | nf_ct_l3num(ct), |
Patrick McHardy | 6823645 | 2007-07-07 22:30:49 -0700 | [diff] [blame] | 222 | &ct->tuplehash[dir].tuple.src.u3, |
| 223 | &ct->tuplehash[dir].tuple.dst.u3, |
| 224 | IPPROTO_GRE, &peer_callid, &callid); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 225 | exp_orig->expectfn = pptp_expectfn; |
| 226 | |
| 227 | /* reply direction, PAC->PNS */ |
| 228 | dir = IP_CT_DIR_REPLY; |
Patrick McHardy | 6002f266 | 2008-03-25 20:09:15 -0700 | [diff] [blame] | 229 | nf_ct_expect_init(exp_reply, NF_CT_EXPECT_CLASS_DEFAULT, |
Patrick McHardy | 5e8fbe2 | 2008-04-14 11:15:52 +0200 | [diff] [blame] | 230 | nf_ct_l3num(ct), |
Patrick McHardy | 6823645 | 2007-07-07 22:30:49 -0700 | [diff] [blame] | 231 | &ct->tuplehash[dir].tuple.src.u3, |
| 232 | &ct->tuplehash[dir].tuple.dst.u3, |
| 233 | IPPROTO_GRE, &callid, &peer_callid); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 234 | exp_reply->expectfn = pptp_expectfn; |
| 235 | |
| 236 | nf_nat_pptp_exp_gre = rcu_dereference(nf_nat_pptp_hook_exp_gre); |
| 237 | if (nf_nat_pptp_exp_gre && ct->status & IPS_NAT_MASK) |
| 238 | nf_nat_pptp_exp_gre(exp_orig, exp_reply); |
Patrick McHardy | 6823645 | 2007-07-07 22:30:49 -0700 | [diff] [blame] | 239 | if (nf_ct_expect_related(exp_orig) != 0) |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 240 | goto out_put_both; |
Patrick McHardy | 6823645 | 2007-07-07 22:30:49 -0700 | [diff] [blame] | 241 | if (nf_ct_expect_related(exp_reply) != 0) |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 242 | goto out_unexpect_orig; |
| 243 | |
| 244 | /* Add GRE keymap entries */ |
| 245 | if (nf_ct_gre_keymap_add(ct, IP_CT_DIR_ORIGINAL, &exp_orig->tuple) != 0) |
| 246 | goto out_unexpect_both; |
| 247 | if (nf_ct_gre_keymap_add(ct, IP_CT_DIR_REPLY, &exp_reply->tuple) != 0) { |
| 248 | nf_ct_gre_keymap_destroy(ct); |
| 249 | goto out_unexpect_both; |
| 250 | } |
| 251 | ret = 0; |
| 252 | |
| 253 | out_put_both: |
Patrick McHardy | 6823645 | 2007-07-07 22:30:49 -0700 | [diff] [blame] | 254 | nf_ct_expect_put(exp_reply); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 255 | out_put_orig: |
Patrick McHardy | 6823645 | 2007-07-07 22:30:49 -0700 | [diff] [blame] | 256 | nf_ct_expect_put(exp_orig); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 257 | out: |
| 258 | return ret; |
| 259 | |
| 260 | out_unexpect_both: |
Patrick McHardy | 6823645 | 2007-07-07 22:30:49 -0700 | [diff] [blame] | 261 | nf_ct_unexpect_related(exp_reply); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 262 | out_unexpect_orig: |
Patrick McHardy | 6823645 | 2007-07-07 22:30:49 -0700 | [diff] [blame] | 263 | nf_ct_unexpect_related(exp_orig); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 264 | goto out_put_both; |
| 265 | } |
| 266 | |
| 267 | static inline int |
Patrick McHardy | 051966c | 2012-08-26 19:14:04 +0200 | [diff] [blame] | 268 | pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff, |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 269 | struct PptpControlHeader *ctlh, |
| 270 | union pptp_ctrl_union *pptpReq, |
| 271 | unsigned int reqlen, |
| 272 | struct nf_conn *ct, |
| 273 | enum ip_conntrack_info ctinfo) |
| 274 | { |
Pablo Neira Ayuso | 1afc567 | 2012-06-07 12:11:50 +0200 | [diff] [blame] | 275 | struct nf_ct_pptp_master *info = nfct_help_data(ct); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 276 | u_int16_t msg; |
| 277 | __be16 cid = 0, pcid = 0; |
| 278 | typeof(nf_nat_pptp_hook_inbound) nf_nat_pptp_inbound; |
| 279 | |
| 280 | msg = ntohs(ctlh->messageType); |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 281 | pr_debug("inbound control message %s\n", pptp_msg_name[msg]); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 282 | |
| 283 | switch (msg) { |
| 284 | case PPTP_START_SESSION_REPLY: |
| 285 | /* server confirms new control session */ |
| 286 | if (info->sstate < PPTP_SESSION_REQUESTED) |
| 287 | goto invalid; |
| 288 | if (pptpReq->srep.resultCode == PPTP_START_OK) |
| 289 | info->sstate = PPTP_SESSION_CONFIRMED; |
| 290 | else |
| 291 | info->sstate = PPTP_SESSION_ERROR; |
| 292 | break; |
| 293 | |
| 294 | case PPTP_STOP_SESSION_REPLY: |
| 295 | /* server confirms end of control session */ |
| 296 | if (info->sstate > PPTP_SESSION_STOPREQ) |
| 297 | goto invalid; |
| 298 | if (pptpReq->strep.resultCode == PPTP_STOP_OK) |
| 299 | info->sstate = PPTP_SESSION_NONE; |
| 300 | else |
| 301 | info->sstate = PPTP_SESSION_ERROR; |
| 302 | break; |
| 303 | |
| 304 | case PPTP_OUT_CALL_REPLY: |
| 305 | /* server accepted call, we now expect GRE frames */ |
| 306 | if (info->sstate != PPTP_SESSION_CONFIRMED) |
| 307 | goto invalid; |
| 308 | if (info->cstate != PPTP_CALL_OUT_REQ && |
| 309 | info->cstate != PPTP_CALL_OUT_CONF) |
| 310 | goto invalid; |
| 311 | |
| 312 | cid = pptpReq->ocack.callID; |
| 313 | pcid = pptpReq->ocack.peersCallID; |
| 314 | if (info->pns_call_id != pcid) |
| 315 | goto invalid; |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 316 | pr_debug("%s, CID=%X, PCID=%X\n", pptp_msg_name[msg], |
| 317 | ntohs(cid), ntohs(pcid)); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 318 | |
| 319 | if (pptpReq->ocack.resultCode == PPTP_OUTCALL_CONNECT) { |
| 320 | info->cstate = PPTP_CALL_OUT_CONF; |
| 321 | info->pac_call_id = cid; |
| 322 | exp_gre(ct, cid, pcid); |
| 323 | } else |
| 324 | info->cstate = PPTP_CALL_NONE; |
| 325 | break; |
| 326 | |
| 327 | case PPTP_IN_CALL_REQUEST: |
| 328 | /* server tells us about incoming call request */ |
| 329 | if (info->sstate != PPTP_SESSION_CONFIRMED) |
| 330 | goto invalid; |
| 331 | |
| 332 | cid = pptpReq->icreq.callID; |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 333 | pr_debug("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid)); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 334 | info->cstate = PPTP_CALL_IN_REQ; |
| 335 | info->pac_call_id = cid; |
| 336 | break; |
| 337 | |
| 338 | case PPTP_IN_CALL_CONNECT: |
| 339 | /* server tells us about incoming call established */ |
| 340 | if (info->sstate != PPTP_SESSION_CONFIRMED) |
| 341 | goto invalid; |
| 342 | if (info->cstate != PPTP_CALL_IN_REP && |
| 343 | info->cstate != PPTP_CALL_IN_CONF) |
| 344 | goto invalid; |
| 345 | |
| 346 | pcid = pptpReq->iccon.peersCallID; |
| 347 | cid = info->pac_call_id; |
| 348 | |
| 349 | if (info->pns_call_id != pcid) |
| 350 | goto invalid; |
| 351 | |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 352 | pr_debug("%s, PCID=%X\n", pptp_msg_name[msg], ntohs(pcid)); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 353 | info->cstate = PPTP_CALL_IN_CONF; |
| 354 | |
| 355 | /* we expect a GRE connection from PAC to PNS */ |
| 356 | exp_gre(ct, cid, pcid); |
| 357 | break; |
| 358 | |
| 359 | case PPTP_CALL_DISCONNECT_NOTIFY: |
| 360 | /* server confirms disconnect */ |
| 361 | cid = pptpReq->disc.callID; |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 362 | pr_debug("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid)); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 363 | info->cstate = PPTP_CALL_NONE; |
| 364 | |
| 365 | /* untrack this call id, unexpect GRE packets */ |
| 366 | pptp_destroy_siblings(ct); |
| 367 | break; |
| 368 | |
| 369 | case PPTP_WAN_ERROR_NOTIFY: |
Sanket Shah | 4c6e420 | 2011-08-30 15:23:03 +0200 | [diff] [blame] | 370 | case PPTP_SET_LINK_INFO: |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 371 | case PPTP_ECHO_REQUEST: |
| 372 | case PPTP_ECHO_REPLY: |
| 373 | /* I don't have to explain these ;) */ |
| 374 | break; |
| 375 | |
| 376 | default: |
| 377 | goto invalid; |
| 378 | } |
| 379 | |
| 380 | nf_nat_pptp_inbound = rcu_dereference(nf_nat_pptp_hook_inbound); |
| 381 | if (nf_nat_pptp_inbound && ct->status & IPS_NAT_MASK) |
Patrick McHardy | 051966c | 2012-08-26 19:14:04 +0200 | [diff] [blame] | 382 | return nf_nat_pptp_inbound(skb, ct, ctinfo, |
| 383 | protoff, ctlh, pptpReq); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 384 | return NF_ACCEPT; |
| 385 | |
| 386 | invalid: |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 387 | pr_debug("invalid %s: type=%d cid=%u pcid=%u " |
| 388 | "cstate=%d sstate=%d pns_cid=%u pac_cid=%u\n", |
| 389 | msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] : pptp_msg_name[0], |
| 390 | msg, ntohs(cid), ntohs(pcid), info->cstate, info->sstate, |
| 391 | ntohs(info->pns_call_id), ntohs(info->pac_call_id)); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 392 | return NF_ACCEPT; |
| 393 | } |
| 394 | |
| 395 | static inline int |
Patrick McHardy | 051966c | 2012-08-26 19:14:04 +0200 | [diff] [blame] | 396 | pptp_outbound_pkt(struct sk_buff *skb, unsigned int protoff, |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 397 | struct PptpControlHeader *ctlh, |
| 398 | union pptp_ctrl_union *pptpReq, |
| 399 | unsigned int reqlen, |
| 400 | struct nf_conn *ct, |
| 401 | enum ip_conntrack_info ctinfo) |
| 402 | { |
Pablo Neira Ayuso | 1afc567 | 2012-06-07 12:11:50 +0200 | [diff] [blame] | 403 | struct nf_ct_pptp_master *info = nfct_help_data(ct); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 404 | u_int16_t msg; |
| 405 | __be16 cid = 0, pcid = 0; |
| 406 | typeof(nf_nat_pptp_hook_outbound) nf_nat_pptp_outbound; |
| 407 | |
| 408 | msg = ntohs(ctlh->messageType); |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 409 | pr_debug("outbound control message %s\n", pptp_msg_name[msg]); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 410 | |
| 411 | switch (msg) { |
| 412 | case PPTP_START_SESSION_REQUEST: |
| 413 | /* client requests for new control session */ |
| 414 | if (info->sstate != PPTP_SESSION_NONE) |
| 415 | goto invalid; |
| 416 | info->sstate = PPTP_SESSION_REQUESTED; |
| 417 | break; |
| 418 | |
| 419 | case PPTP_STOP_SESSION_REQUEST: |
| 420 | /* client requests end of control session */ |
| 421 | info->sstate = PPTP_SESSION_STOPREQ; |
| 422 | break; |
| 423 | |
| 424 | case PPTP_OUT_CALL_REQUEST: |
| 425 | /* client initiating connection to server */ |
| 426 | if (info->sstate != PPTP_SESSION_CONFIRMED) |
| 427 | goto invalid; |
| 428 | info->cstate = PPTP_CALL_OUT_REQ; |
| 429 | /* track PNS call id */ |
| 430 | cid = pptpReq->ocreq.callID; |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 431 | pr_debug("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid)); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 432 | info->pns_call_id = cid; |
| 433 | break; |
| 434 | |
| 435 | case PPTP_IN_CALL_REPLY: |
| 436 | /* client answers incoming call */ |
| 437 | if (info->cstate != PPTP_CALL_IN_REQ && |
| 438 | info->cstate != PPTP_CALL_IN_REP) |
| 439 | goto invalid; |
| 440 | |
| 441 | cid = pptpReq->icack.callID; |
| 442 | pcid = pptpReq->icack.peersCallID; |
| 443 | if (info->pac_call_id != pcid) |
| 444 | goto invalid; |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 445 | pr_debug("%s, CID=%X PCID=%X\n", pptp_msg_name[msg], |
| 446 | ntohs(cid), ntohs(pcid)); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 447 | |
| 448 | if (pptpReq->icack.resultCode == PPTP_INCALL_ACCEPT) { |
| 449 | /* part two of the three-way handshake */ |
| 450 | info->cstate = PPTP_CALL_IN_REP; |
| 451 | info->pns_call_id = cid; |
| 452 | } else |
| 453 | info->cstate = PPTP_CALL_NONE; |
| 454 | break; |
| 455 | |
| 456 | case PPTP_CALL_CLEAR_REQUEST: |
| 457 | /* client requests hangup of call */ |
| 458 | if (info->sstate != PPTP_SESSION_CONFIRMED) |
| 459 | goto invalid; |
| 460 | /* FUTURE: iterate over all calls and check if |
| 461 | * call ID is valid. We don't do this without newnat, |
| 462 | * because we only know about last call */ |
| 463 | info->cstate = PPTP_CALL_CLEAR_REQ; |
| 464 | break; |
| 465 | |
| 466 | case PPTP_SET_LINK_INFO: |
| 467 | case PPTP_ECHO_REQUEST: |
| 468 | case PPTP_ECHO_REPLY: |
| 469 | /* I don't have to explain these ;) */ |
| 470 | break; |
| 471 | |
| 472 | default: |
| 473 | goto invalid; |
| 474 | } |
| 475 | |
| 476 | nf_nat_pptp_outbound = rcu_dereference(nf_nat_pptp_hook_outbound); |
| 477 | if (nf_nat_pptp_outbound && ct->status & IPS_NAT_MASK) |
Patrick McHardy | 051966c | 2012-08-26 19:14:04 +0200 | [diff] [blame] | 478 | return nf_nat_pptp_outbound(skb, ct, ctinfo, |
| 479 | protoff, ctlh, pptpReq); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 480 | return NF_ACCEPT; |
| 481 | |
| 482 | invalid: |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 483 | pr_debug("invalid %s: type=%d cid=%u pcid=%u " |
| 484 | "cstate=%d sstate=%d pns_cid=%u pac_cid=%u\n", |
| 485 | msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] : pptp_msg_name[0], |
| 486 | msg, ntohs(cid), ntohs(pcid), info->cstate, info->sstate, |
| 487 | ntohs(info->pns_call_id), ntohs(info->pac_call_id)); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 488 | return NF_ACCEPT; |
| 489 | } |
| 490 | |
| 491 | static const unsigned int pptp_msg_size[] = { |
| 492 | [PPTP_START_SESSION_REQUEST] = sizeof(struct PptpStartSessionRequest), |
| 493 | [PPTP_START_SESSION_REPLY] = sizeof(struct PptpStartSessionReply), |
| 494 | [PPTP_STOP_SESSION_REQUEST] = sizeof(struct PptpStopSessionRequest), |
| 495 | [PPTP_STOP_SESSION_REPLY] = sizeof(struct PptpStopSessionReply), |
| 496 | [PPTP_OUT_CALL_REQUEST] = sizeof(struct PptpOutCallRequest), |
| 497 | [PPTP_OUT_CALL_REPLY] = sizeof(struct PptpOutCallReply), |
| 498 | [PPTP_IN_CALL_REQUEST] = sizeof(struct PptpInCallRequest), |
| 499 | [PPTP_IN_CALL_REPLY] = sizeof(struct PptpInCallReply), |
| 500 | [PPTP_IN_CALL_CONNECT] = sizeof(struct PptpInCallConnected), |
| 501 | [PPTP_CALL_CLEAR_REQUEST] = sizeof(struct PptpClearCallRequest), |
| 502 | [PPTP_CALL_DISCONNECT_NOTIFY] = sizeof(struct PptpCallDisconnectNotify), |
| 503 | [PPTP_WAN_ERROR_NOTIFY] = sizeof(struct PptpWanErrorNotify), |
| 504 | [PPTP_SET_LINK_INFO] = sizeof(struct PptpSetLinkInfo), |
| 505 | }; |
| 506 | |
| 507 | /* track caller id inside control connection, call expect_related */ |
| 508 | static int |
Herbert Xu | 3db05fe | 2007-10-15 00:53:15 -0700 | [diff] [blame] | 509 | conntrack_pptp_help(struct sk_buff *skb, unsigned int protoff, |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 510 | struct nf_conn *ct, enum ip_conntrack_info ctinfo) |
| 511 | |
| 512 | { |
| 513 | int dir = CTINFO2DIR(ctinfo); |
Pablo Neira Ayuso | 1afc567 | 2012-06-07 12:11:50 +0200 | [diff] [blame] | 514 | const struct nf_ct_pptp_master *info = nfct_help_data(ct); |
Jan Engelhardt | 9ddd0ed | 2008-01-31 04:51:23 -0800 | [diff] [blame] | 515 | const struct tcphdr *tcph; |
| 516 | struct tcphdr _tcph; |
| 517 | const struct pptp_pkt_hdr *pptph; |
| 518 | struct pptp_pkt_hdr _pptph; |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 519 | struct PptpControlHeader _ctlh, *ctlh; |
| 520 | union pptp_ctrl_union _pptpReq, *pptpReq; |
Herbert Xu | 3db05fe | 2007-10-15 00:53:15 -0700 | [diff] [blame] | 521 | unsigned int tcplen = skb->len - protoff; |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 522 | unsigned int datalen, reqlen, nexthdr_off; |
| 523 | int oldsstate, oldcstate; |
| 524 | int ret; |
| 525 | u_int16_t msg; |
| 526 | |
| 527 | /* don't do any tracking before tcp handshake complete */ |
Eric Dumazet | fb04883 | 2011-05-19 15:44:27 +0200 | [diff] [blame] | 528 | if (ctinfo != IP_CT_ESTABLISHED && ctinfo != IP_CT_ESTABLISHED_REPLY) |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 529 | return NF_ACCEPT; |
| 530 | |
| 531 | nexthdr_off = protoff; |
Herbert Xu | 3db05fe | 2007-10-15 00:53:15 -0700 | [diff] [blame] | 532 | tcph = skb_header_pointer(skb, nexthdr_off, sizeof(_tcph), &_tcph); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 533 | BUG_ON(!tcph); |
| 534 | nexthdr_off += tcph->doff * 4; |
YOSHIFUJI Hideaki | 601e68e | 2007-02-12 11:15:49 -0800 | [diff] [blame] | 535 | datalen = tcplen - tcph->doff * 4; |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 536 | |
Herbert Xu | 3db05fe | 2007-10-15 00:53:15 -0700 | [diff] [blame] | 537 | pptph = skb_header_pointer(skb, nexthdr_off, sizeof(_pptph), &_pptph); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 538 | if (!pptph) { |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 539 | pr_debug("no full PPTP header, can't track\n"); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 540 | return NF_ACCEPT; |
| 541 | } |
| 542 | nexthdr_off += sizeof(_pptph); |
| 543 | datalen -= sizeof(_pptph); |
| 544 | |
| 545 | /* if it's not a control message we can't do anything with it */ |
| 546 | if (ntohs(pptph->packetType) != PPTP_PACKET_CONTROL || |
| 547 | ntohl(pptph->magicCookie) != PPTP_MAGIC_COOKIE) { |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 548 | pr_debug("not a control packet\n"); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 549 | return NF_ACCEPT; |
| 550 | } |
| 551 | |
Herbert Xu | 3db05fe | 2007-10-15 00:53:15 -0700 | [diff] [blame] | 552 | ctlh = skb_header_pointer(skb, nexthdr_off, sizeof(_ctlh), &_ctlh); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 553 | if (!ctlh) |
| 554 | return NF_ACCEPT; |
| 555 | nexthdr_off += sizeof(_ctlh); |
| 556 | datalen -= sizeof(_ctlh); |
| 557 | |
| 558 | reqlen = datalen; |
| 559 | msg = ntohs(ctlh->messageType); |
| 560 | if (msg > 0 && msg <= PPTP_MSG_MAX && reqlen < pptp_msg_size[msg]) |
| 561 | return NF_ACCEPT; |
| 562 | if (reqlen > sizeof(*pptpReq)) |
| 563 | reqlen = sizeof(*pptpReq); |
| 564 | |
Herbert Xu | 3db05fe | 2007-10-15 00:53:15 -0700 | [diff] [blame] | 565 | pptpReq = skb_header_pointer(skb, nexthdr_off, reqlen, &_pptpReq); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 566 | if (!pptpReq) |
| 567 | return NF_ACCEPT; |
| 568 | |
| 569 | oldsstate = info->sstate; |
| 570 | oldcstate = info->cstate; |
| 571 | |
| 572 | spin_lock_bh(&nf_pptp_lock); |
| 573 | |
| 574 | /* FIXME: We just blindly assume that the control connection is always |
| 575 | * established from PNS->PAC. However, RFC makes no guarantee */ |
| 576 | if (dir == IP_CT_DIR_ORIGINAL) |
| 577 | /* client -> server (PNS -> PAC) */ |
Patrick McHardy | 051966c | 2012-08-26 19:14:04 +0200 | [diff] [blame] | 578 | ret = pptp_outbound_pkt(skb, protoff, ctlh, pptpReq, reqlen, ct, |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 579 | ctinfo); |
| 580 | else |
| 581 | /* server -> client (PAC -> PNS) */ |
Patrick McHardy | 051966c | 2012-08-26 19:14:04 +0200 | [diff] [blame] | 582 | ret = pptp_inbound_pkt(skb, protoff, ctlh, pptpReq, reqlen, ct, |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 583 | ctinfo); |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 584 | pr_debug("sstate: %d->%d, cstate: %d->%d\n", |
| 585 | oldsstate, info->sstate, oldcstate, info->cstate); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 586 | spin_unlock_bh(&nf_pptp_lock); |
| 587 | |
| 588 | return ret; |
| 589 | } |
| 590 | |
Patrick McHardy | 6002f266 | 2008-03-25 20:09:15 -0700 | [diff] [blame] | 591 | static const struct nf_conntrack_expect_policy pptp_exp_policy = { |
| 592 | .max_expected = 2, |
| 593 | .timeout = 5 * 60, |
| 594 | }; |
| 595 | |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 596 | /* control protocol helper */ |
| 597 | static struct nf_conntrack_helper pptp __read_mostly = { |
| 598 | .name = "pptp", |
| 599 | .me = THIS_MODULE, |
Pablo Neira Ayuso | 1afc567 | 2012-06-07 12:11:50 +0200 | [diff] [blame] | 600 | .data_len = sizeof(struct nf_ct_pptp_master), |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 601 | .tuple.src.l3num = AF_INET, |
Harvey Harrison | 09640e6 | 2009-02-01 00:45:17 -0800 | [diff] [blame] | 602 | .tuple.src.u.tcp.port = cpu_to_be16(PPTP_CONTROL_PORT), |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 603 | .tuple.dst.protonum = IPPROTO_TCP, |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 604 | .help = conntrack_pptp_help, |
| 605 | .destroy = pptp_destroy_siblings, |
Patrick McHardy | 6002f266 | 2008-03-25 20:09:15 -0700 | [diff] [blame] | 606 | .expect_policy = &pptp_exp_policy, |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 607 | }; |
| 608 | |
| 609 | static int __init nf_conntrack_pptp_init(void) |
| 610 | { |
Andrey Vagin | 8142b22 | 2014-03-31 18:14:18 +0400 | [diff] [blame] | 611 | return nf_conntrack_helper_register(&pptp); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 612 | } |
| 613 | |
| 614 | static void __exit nf_conntrack_pptp_fini(void) |
| 615 | { |
| 616 | nf_conntrack_helper_unregister(&pptp); |
Patrick McHardy | f09943f | 2006-12-02 22:09:41 -0800 | [diff] [blame] | 617 | } |
| 618 | |
| 619 | module_init(nf_conntrack_pptp_init); |
| 620 | module_exit(nf_conntrack_pptp_fini); |