aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_pptp.h8
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h22
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_pptp.h4
-rw-r--r--net/ipv4/netfilter/ip_conntrack_helper_pptp.c22
-rw-r--r--net/ipv4/netfilter/ip_nat_helper_pptp.c42
-rw-r--r--net/ipv4/netfilter/ip_nat_proto_gre.c2
6 files changed, 50 insertions, 50 deletions
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
index 88f66d3c8765..0d35623f9453 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
@@ -31,8 +31,8 @@ struct ip_ct_pptp_master {
31 /* everything below is going to be per-expectation in newnat, 31 /* everything below is going to be per-expectation in newnat,
32 * since there could be more than one call within one session */ 32 * since there could be more than one call within one session */
33 enum pptp_ctrlcall_state cstate; /* call state */ 33 enum pptp_ctrlcall_state cstate; /* call state */
34 u_int16_t pac_call_id; /* call id of PAC, host byte order */ 34 __be16 pac_call_id; /* call id of PAC, host byte order */
35 u_int16_t pns_call_id; /* call id of PNS, host byte order */ 35 __be16 pns_call_id; /* call id of PNS, host byte order */
36 36
37 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack 37 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack
38 * and therefore imposes a fixed limit on the number of maps */ 38 * and therefore imposes a fixed limit on the number of maps */
@@ -42,8 +42,8 @@ struct ip_ct_pptp_master {
42/* conntrack_expect private member */ 42/* conntrack_expect private member */
43struct ip_ct_pptp_expect { 43struct ip_ct_pptp_expect {
44 enum pptp_ctrlcall_state cstate; /* call state */ 44 enum pptp_ctrlcall_state cstate; /* call state */
45 u_int16_t pac_call_id; /* call id of PAC */ 45 __be16 pac_call_id; /* call id of PAC */
46 u_int16_t pns_call_id; /* call id of PNS */ 46 __be16 pns_call_id; /* call id of PNS */
47}; 47};
48 48
49 49
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
index 8d090ef82f5f..1d853aa873eb 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
@@ -49,18 +49,18 @@ struct gre_hdr {
49#else 49#else
50#error "Adjust your <asm/byteorder.h> defines" 50#error "Adjust your <asm/byteorder.h> defines"
51#endif 51#endif
52 __u16 protocol; 52 __be16 protocol;
53}; 53};
54 54
55/* modified GRE header for PPTP */ 55/* modified GRE header for PPTP */
56struct gre_hdr_pptp { 56struct gre_hdr_pptp {
57 __u8 flags; /* bitfield */ 57 __u8 flags; /* bitfield */
58 __u8 version; /* should be GRE_VERSION_PPTP */ 58 __u8 version; /* should be GRE_VERSION_PPTP */
59 __u16 protocol; /* should be GRE_PROTOCOL_PPTP */ 59 __be16 protocol; /* should be GRE_PROTOCOL_PPTP */
60 __u16 payload_len; /* size of ppp payload, not inc. gre header */ 60 __be16 payload_len; /* size of ppp payload, not inc. gre header */
61 __u16 call_id; /* peer's call_id for this session */ 61 __be16 call_id; /* peer's call_id for this session */
62 __u32 seq; /* sequence number. Present if S==1 */ 62 __be32 seq; /* sequence number. Present if S==1 */
63 __u32 ack; /* seq number of highest packet recieved by */ 63 __be32 ack; /* seq number of highest packet recieved by */
64 /* sender in this session */ 64 /* sender in this session */
65}; 65};
66 66
@@ -92,13 +92,13 @@ void ip_ct_gre_keymap_destroy(struct ip_conntrack *ct);
92 92
93 93
94/* get pointer to gre key, if present */ 94/* get pointer to gre key, if present */
95static inline u_int32_t *gre_key(struct gre_hdr *greh) 95static inline __be32 *gre_key(struct gre_hdr *greh)
96{ 96{
97 if (!greh->key) 97 if (!greh->key)
98 return NULL; 98 return NULL;
99 if (greh->csum || greh->routing) 99 if (greh->csum || greh->routing)
100 return (u_int32_t *) (greh+sizeof(*greh)+4); 100 return (__be32 *) (greh+sizeof(*greh)+4);
101 return (u_int32_t *) (greh+sizeof(*greh)); 101 return (__be32 *) (greh+sizeof(*greh));
102} 102}
103 103
104/* get pointer ot gre csum, if present */ 104/* get pointer ot gre csum, if present */
diff --git a/include/linux/netfilter_ipv4/ip_nat_pptp.h b/include/linux/netfilter_ipv4/ip_nat_pptp.h
index eaf66c2e8f93..36668bf0f373 100644
--- a/include/linux/netfilter_ipv4/ip_nat_pptp.h
+++ b/include/linux/netfilter_ipv4/ip_nat_pptp.h
@@ -4,8 +4,8 @@
4 4
5/* conntrack private data */ 5/* conntrack private data */
6struct ip_nat_pptp { 6struct ip_nat_pptp {
7 u_int16_t pns_call_id; /* NAT'ed PNS call id */ 7 __be16 pns_call_id; /* NAT'ed PNS call id */
8 u_int16_t pac_call_id; /* NAT'ed PAC call id */ 8 __be16 pac_call_id; /* NAT'ed PAC call id */
9}; 9};
10 10
11#endif /* _NAT_PPTP_H */ 11#endif /* _NAT_PPTP_H */
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c
index 6c94dd5d476c..57637ca2b82c 100644
--- a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c
+++ b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c
@@ -201,8 +201,8 @@ static void pptp_destroy_siblings(struct ip_conntrack *ct)
201 /* try original (pns->pac) tuple */ 201 /* try original (pns->pac) tuple */
202 memcpy(&t, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, sizeof(t)); 202 memcpy(&t, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, sizeof(t));
203 t.dst.protonum = IPPROTO_GRE; 203 t.dst.protonum = IPPROTO_GRE;
204 t.src.u.gre.key = htons(ct->help.ct_pptp_info.pns_call_id); 204 t.src.u.gre.key = ct->help.ct_pptp_info.pns_call_id;
205 t.dst.u.gre.key = htons(ct->help.ct_pptp_info.pac_call_id); 205 t.dst.u.gre.key = ct->help.ct_pptp_info.pac_call_id;
206 206
207 if (!destroy_sibling_or_exp(&t)) 207 if (!destroy_sibling_or_exp(&t))
208 DEBUGP("failed to timeout original pns->pac ct/exp\n"); 208 DEBUGP("failed to timeout original pns->pac ct/exp\n");
@@ -210,8 +210,8 @@ static void pptp_destroy_siblings(struct ip_conntrack *ct)
210 /* try reply (pac->pns) tuple */ 210 /* try reply (pac->pns) tuple */
211 memcpy(&t, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, sizeof(t)); 211 memcpy(&t, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, sizeof(t));
212 t.dst.protonum = IPPROTO_GRE; 212 t.dst.protonum = IPPROTO_GRE;
213 t.src.u.gre.key = htons(ct->help.ct_pptp_info.pac_call_id); 213 t.src.u.gre.key = ct->help.ct_pptp_info.pac_call_id;
214 t.dst.u.gre.key = htons(ct->help.ct_pptp_info.pns_call_id); 214 t.dst.u.gre.key = ct->help.ct_pptp_info.pns_call_id;
215 215
216 if (!destroy_sibling_or_exp(&t)) 216 if (!destroy_sibling_or_exp(&t))
217 DEBUGP("failed to timeout reply pac->pns ct/exp\n"); 217 DEBUGP("failed to timeout reply pac->pns ct/exp\n");
@@ -419,9 +419,9 @@ pptp_inbound_pkt(struct sk_buff **pskb,
419 cid = &pptpReq->ocack.callID; 419 cid = &pptpReq->ocack.callID;
420 pcid = &pptpReq->ocack.peersCallID; 420 pcid = &pptpReq->ocack.peersCallID;
421 421
422 info->pac_call_id = ntohs(*cid); 422 info->pac_call_id = *cid;
423 423
424 if (htons(info->pns_call_id) != *pcid) { 424 if (info->pns_call_id != *pcid) {
425 DEBUGP("%s for unknown callid %u\n", 425 DEBUGP("%s for unknown callid %u\n",
426 pptp_msg_name[msg], ntohs(*pcid)); 426 pptp_msg_name[msg], ntohs(*pcid));
427 break; 427 break;
@@ -454,7 +454,7 @@ pptp_inbound_pkt(struct sk_buff **pskb,
454 pcid = &pptpReq->icack.peersCallID; 454 pcid = &pptpReq->icack.peersCallID;
455 DEBUGP("%s, PCID=%X\n", pptp_msg_name[msg], ntohs(*pcid)); 455 DEBUGP("%s, PCID=%X\n", pptp_msg_name[msg], ntohs(*pcid));
456 info->cstate = PPTP_CALL_IN_REQ; 456 info->cstate = PPTP_CALL_IN_REQ;
457 info->pac_call_id = ntohs(*pcid); 457 info->pac_call_id = *pcid;
458 break; 458 break;
459 459
460 case PPTP_IN_CALL_CONNECT: 460 case PPTP_IN_CALL_CONNECT:
@@ -478,7 +478,7 @@ pptp_inbound_pkt(struct sk_buff **pskb,
478 pcid = &pptpReq->iccon.peersCallID; 478 pcid = &pptpReq->iccon.peersCallID;
479 cid = &info->pac_call_id; 479 cid = &info->pac_call_id;
480 480
481 if (info->pns_call_id != ntohs(*pcid)) { 481 if (info->pns_call_id != *pcid) {
482 DEBUGP("%s for unknown CallID %u\n", 482 DEBUGP("%s for unknown CallID %u\n",
483 pptp_msg_name[msg], ntohs(*pcid)); 483 pptp_msg_name[msg], ntohs(*pcid));
484 break; 484 break;
@@ -595,7 +595,7 @@ pptp_outbound_pkt(struct sk_buff **pskb,
595 /* track PNS call id */ 595 /* track PNS call id */
596 cid = &pptpReq->ocreq.callID; 596 cid = &pptpReq->ocreq.callID;
597 DEBUGP("%s, CID=%X\n", pptp_msg_name[msg], ntohs(*cid)); 597 DEBUGP("%s, CID=%X\n", pptp_msg_name[msg], ntohs(*cid));
598 info->pns_call_id = ntohs(*cid); 598 info->pns_call_id = *cid;
599 break; 599 break;
600 case PPTP_IN_CALL_REPLY: 600 case PPTP_IN_CALL_REPLY:
601 if (reqlen < sizeof(_pptpReq.icack)) { 601 if (reqlen < sizeof(_pptpReq.icack)) {
@@ -615,7 +615,7 @@ pptp_outbound_pkt(struct sk_buff **pskb,
615 break; 615 break;
616 } 616 }
617 pcid = &pptpReq->icack.peersCallID; 617 pcid = &pptpReq->icack.peersCallID;
618 if (info->pac_call_id != ntohs(*pcid)) { 618 if (info->pac_call_id != *pcid) {
619 DEBUGP("%s for unknown call %u\n", 619 DEBUGP("%s for unknown call %u\n",
620 pptp_msg_name[msg], ntohs(*pcid)); 620 pptp_msg_name[msg], ntohs(*pcid));
621 break; 621 break;
@@ -623,7 +623,7 @@ pptp_outbound_pkt(struct sk_buff **pskb,
623 DEBUGP("%s, CID=%X\n", pptp_msg_name[msg], ntohs(*pcid)); 623 DEBUGP("%s, CID=%X\n", pptp_msg_name[msg], ntohs(*pcid));
624 /* part two of the three-way handshake */ 624 /* part two of the three-way handshake */
625 info->cstate = PPTP_CALL_IN_REP; 625 info->cstate = PPTP_CALL_IN_REP;
626 info->pns_call_id = ntohs(pptpReq->icack.callID); 626 info->pns_call_id = pptpReq->icack.callID;
627 break; 627 break;
628 628
629 case PPTP_CALL_CLEAR_REQUEST: 629 case PPTP_CALL_CLEAR_REQUEST:
diff --git a/net/ipv4/netfilter/ip_nat_helper_pptp.c b/net/ipv4/netfilter/ip_nat_helper_pptp.c
index 5dde1da1c300..6e8bd6b3431f 100644
--- a/net/ipv4/netfilter/ip_nat_helper_pptp.c
+++ b/net/ipv4/netfilter/ip_nat_helper_pptp.c
@@ -85,19 +85,17 @@ static void pptp_nat_expected(struct ip_conntrack *ct,
85 DEBUGP("we are PNS->PAC\n"); 85 DEBUGP("we are PNS->PAC\n");
86 /* therefore, build tuple for PAC->PNS */ 86 /* therefore, build tuple for PAC->PNS */
87 t.src.ip = master->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip; 87 t.src.ip = master->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip;
88 t.src.u.gre.key = htons(master->help.ct_pptp_info.pac_call_id); 88 t.src.u.gre.key = master->help.ct_pptp_info.pac_call_id;
89 t.dst.ip = master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip; 89 t.dst.ip = master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip;
90 t.dst.u.gre.key = htons(master->help.ct_pptp_info.pns_call_id); 90 t.dst.u.gre.key = master->help.ct_pptp_info.pns_call_id;
91 t.dst.protonum = IPPROTO_GRE; 91 t.dst.protonum = IPPROTO_GRE;
92 } else { 92 } else {
93 DEBUGP("we are PAC->PNS\n"); 93 DEBUGP("we are PAC->PNS\n");
94 /* build tuple for PNS->PAC */ 94 /* build tuple for PNS->PAC */
95 t.src.ip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip; 95 t.src.ip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip;
96 t.src.u.gre.key = 96 t.src.u.gre.key = master->nat.help.nat_pptp_info.pns_call_id;
97 htons(master->nat.help.nat_pptp_info.pns_call_id);
98 t.dst.ip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip; 97 t.dst.ip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip;
99 t.dst.u.gre.key = 98 t.dst.u.gre.key = master->nat.help.nat_pptp_info.pac_call_id;
100 htons(master->nat.help.nat_pptp_info.pac_call_id);
101 t.dst.protonum = IPPROTO_GRE; 99 t.dst.protonum = IPPROTO_GRE;
102 } 100 }
103 101
@@ -149,10 +147,11 @@ pptp_outbound_pkt(struct sk_buff **pskb,
149{ 147{
150 struct ip_ct_pptp_master *ct_pptp_info = &ct->help.ct_pptp_info; 148 struct ip_ct_pptp_master *ct_pptp_info = &ct->help.ct_pptp_info;
151 struct ip_nat_pptp *nat_pptp_info = &ct->nat.help.nat_pptp_info; 149 struct ip_nat_pptp *nat_pptp_info = &ct->nat.help.nat_pptp_info;
152 u_int16_t msg, new_callid; 150 u_int16_t msg;
151 __be16 new_callid;
153 unsigned int cid_off; 152 unsigned int cid_off;
154 153
155 new_callid = htons(ct_pptp_info->pns_call_id); 154 new_callid = ct_pptp_info->pns_call_id;
156 155
157 switch (msg = ntohs(ctlh->messageType)) { 156 switch (msg = ntohs(ctlh->messageType)) {
158 case PPTP_OUT_CALL_REQUEST: 157 case PPTP_OUT_CALL_REQUEST:
@@ -170,7 +169,7 @@ pptp_outbound_pkt(struct sk_buff **pskb,
170 new_callid = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u.tcp.port; 169 new_callid = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u.tcp.port;
171 170
172 /* save new call ID in ct info */ 171 /* save new call ID in ct info */
173 ct_pptp_info->pns_call_id = ntohs(new_callid); 172 ct_pptp_info->pns_call_id = new_callid;
174 break; 173 break;
175 case PPTP_IN_CALL_REPLY: 174 case PPTP_IN_CALL_REPLY:
176 cid_off = offsetof(union pptp_ctrl_union, icreq.callID); 175 cid_off = offsetof(union pptp_ctrl_union, icreq.callID);
@@ -235,14 +234,14 @@ pptp_exp_gre(struct ip_conntrack_expect *expect_orig,
235 234
236 /* alter expectation for PNS->PAC direction */ 235 /* alter expectation for PNS->PAC direction */
237 invert_tuplepr(&inv_t, &expect_orig->tuple); 236 invert_tuplepr(&inv_t, &expect_orig->tuple);
238 expect_orig->saved_proto.gre.key = htons(ct_pptp_info->pns_call_id); 237 expect_orig->saved_proto.gre.key = ct_pptp_info->pns_call_id;
239 expect_orig->tuple.src.u.gre.key = htons(nat_pptp_info->pns_call_id); 238 expect_orig->tuple.src.u.gre.key = nat_pptp_info->pns_call_id;
240 expect_orig->tuple.dst.u.gre.key = htons(ct_pptp_info->pac_call_id); 239 expect_orig->tuple.dst.u.gre.key = ct_pptp_info->pac_call_id;
241 expect_orig->dir = IP_CT_DIR_ORIGINAL; 240 expect_orig->dir = IP_CT_DIR_ORIGINAL;
242 inv_t.src.ip = reply_t->src.ip; 241 inv_t.src.ip = reply_t->src.ip;
243 inv_t.dst.ip = reply_t->dst.ip; 242 inv_t.dst.ip = reply_t->dst.ip;
244 inv_t.src.u.gre.key = htons(nat_pptp_info->pac_call_id); 243 inv_t.src.u.gre.key = nat_pptp_info->pac_call_id;
245 inv_t.dst.u.gre.key = htons(ct_pptp_info->pns_call_id); 244 inv_t.dst.u.gre.key = ct_pptp_info->pns_call_id;
246 245
247 if (!ip_conntrack_expect_related(expect_orig)) { 246 if (!ip_conntrack_expect_related(expect_orig)) {
248 DEBUGP("successfully registered expect\n"); 247 DEBUGP("successfully registered expect\n");
@@ -253,14 +252,14 @@ pptp_exp_gre(struct ip_conntrack_expect *expect_orig,
253 252
254 /* alter expectation for PAC->PNS direction */ 253 /* alter expectation for PAC->PNS direction */
255 invert_tuplepr(&inv_t, &expect_reply->tuple); 254 invert_tuplepr(&inv_t, &expect_reply->tuple);
256 expect_reply->saved_proto.gre.key = htons(nat_pptp_info->pns_call_id); 255 expect_reply->saved_proto.gre.key = nat_pptp_info->pns_call_id;
257 expect_reply->tuple.src.u.gre.key = htons(nat_pptp_info->pac_call_id); 256 expect_reply->tuple.src.u.gre.key = nat_pptp_info->pac_call_id;
258 expect_reply->tuple.dst.u.gre.key = htons(ct_pptp_info->pns_call_id); 257 expect_reply->tuple.dst.u.gre.key = ct_pptp_info->pns_call_id;
259 expect_reply->dir = IP_CT_DIR_REPLY; 258 expect_reply->dir = IP_CT_DIR_REPLY;
260 inv_t.src.ip = orig_t->src.ip; 259 inv_t.src.ip = orig_t->src.ip;
261 inv_t.dst.ip = orig_t->dst.ip; 260 inv_t.dst.ip = orig_t->dst.ip;
262 inv_t.src.u.gre.key = htons(nat_pptp_info->pns_call_id); 261 inv_t.src.u.gre.key = nat_pptp_info->pns_call_id;
263 inv_t.dst.u.gre.key = htons(ct_pptp_info->pac_call_id); 262 inv_t.dst.u.gre.key = ct_pptp_info->pac_call_id;
264 263
265 if (!ip_conntrack_expect_related(expect_reply)) { 264 if (!ip_conntrack_expect_related(expect_reply)) {
266 DEBUGP("successfully registered expect\n"); 265 DEBUGP("successfully registered expect\n");
@@ -297,10 +296,11 @@ pptp_inbound_pkt(struct sk_buff **pskb,
297 union pptp_ctrl_union *pptpReq) 296 union pptp_ctrl_union *pptpReq)
298{ 297{
299 struct ip_nat_pptp *nat_pptp_info = &ct->nat.help.nat_pptp_info; 298 struct ip_nat_pptp *nat_pptp_info = &ct->nat.help.nat_pptp_info;
300 u_int16_t msg, new_cid = 0, new_pcid; 299 u_int16_t msg, new_cid = 0;
300 __be16 new_pcid;
301 unsigned int pcid_off, cid_off = 0; 301 unsigned int pcid_off, cid_off = 0;
302 302
303 new_pcid = htons(nat_pptp_info->pns_call_id); 303 new_pcid = nat_pptp_info->pns_call_id;
304 304
305 switch (msg = ntohs(ctlh->messageType)) { 305 switch (msg = ntohs(ctlh->messageType)) {
306 case PPTP_OUT_CALL_REPLY: 306 case PPTP_OUT_CALL_REPLY:
diff --git a/net/ipv4/netfilter/ip_nat_proto_gre.c b/net/ipv4/netfilter/ip_nat_proto_gre.c
index a5226691f02c..bf91f9312b3c 100644
--- a/net/ipv4/netfilter/ip_nat_proto_gre.c
+++ b/net/ipv4/netfilter/ip_nat_proto_gre.c
@@ -67,7 +67,7 @@ gre_unique_tuple(struct ip_conntrack_tuple *tuple,
67 const struct ip_conntrack *conntrack) 67 const struct ip_conntrack *conntrack)
68{ 68{
69 static u_int16_t key; 69 static u_int16_t key;
70 u_int16_t *keyptr; 70 __be16 *keyptr;
71 unsigned int min, i, range_size; 71 unsigned int min, i, range_size;
72 72
73 if (maniptype == IP_NAT_MANIP_SRC) 73 if (maniptype == IP_NAT_MANIP_SRC)