diff options
author | Holger Eitzenberger <heitzenberger@astaro.com> | 2006-03-20 20:58:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-20 20:58:21 -0500 |
commit | f2ad52c9da2229d7f038d02139d21478b33b76b4 (patch) | |
tree | 8faeeb5dbd332e9bae28d12d6e54945d587db0fa /net/ipv4 | |
parent | 77ff72d528d5b9d30a47f42f364ba34d931f9da3 (diff) |
[NETFILTER]: Fix CID offset bug in PPTP NAT helper debug message
The recent (kernel 2.6.15.1) fix for PPTP NAT helper introduced a
bug - which only appears if DEBUGP is enabled though.
The calculation of the CID offset into a PPTP request struct is
not correct, so that at least not the correct CID is displayed
if DEBUGP is enabled.
This patch corrects CID offset calculation and introduces a #define
for that.
Signed-off-by: Holger Eitzenberger <heitzenberger@astaro.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/ip_nat_helper_pptp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv4/netfilter/ip_nat_helper_pptp.c b/net/ipv4/netfilter/ip_nat_helper_pptp.c index ac004895781a..b9c016c063b8 100644 --- a/net/ipv4/netfilter/ip_nat_helper_pptp.c +++ b/net/ipv4/netfilter/ip_nat_helper_pptp.c | |||
@@ -52,6 +52,8 @@ | |||
52 | 52 | ||
53 | #define IP_NAT_PPTP_VERSION "3.0" | 53 | #define IP_NAT_PPTP_VERSION "3.0" |
54 | 54 | ||
55 | #define REQ_CID(req, off) (*(u_int16_t *)((char *)(req) + (off))) | ||
56 | |||
55 | MODULE_LICENSE("GPL"); | 57 | MODULE_LICENSE("GPL"); |
56 | MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); | 58 | MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); |
57 | MODULE_DESCRIPTION("Netfilter NAT helper module for PPTP"); | 59 | MODULE_DESCRIPTION("Netfilter NAT helper module for PPTP"); |
@@ -198,7 +200,7 @@ pptp_outbound_pkt(struct sk_buff **pskb, | |||
198 | /* only OUT_CALL_REQUEST, IN_CALL_REPLY, CALL_CLEAR_REQUEST pass | 200 | /* only OUT_CALL_REQUEST, IN_CALL_REPLY, CALL_CLEAR_REQUEST pass |
199 | * down to here */ | 201 | * down to here */ |
200 | DEBUGP("altering call id from 0x%04x to 0x%04x\n", | 202 | DEBUGP("altering call id from 0x%04x to 0x%04x\n", |
201 | ntohs(*(u_int16_t *)pptpReq + cid_off), ntohs(new_callid)); | 203 | ntohs(REQ_CID(pptpReq, cid_off)), ntohs(new_callid)); |
202 | 204 | ||
203 | /* mangle packet */ | 205 | /* mangle packet */ |
204 | if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, | 206 | if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, |
@@ -342,7 +344,7 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
342 | 344 | ||
343 | /* mangle packet */ | 345 | /* mangle packet */ |
344 | DEBUGP("altering peer call id from 0x%04x to 0x%04x\n", | 346 | DEBUGP("altering peer call id from 0x%04x to 0x%04x\n", |
345 | ntohs(*(u_int16_t *)pptpReq + pcid_off), ntohs(new_pcid)); | 347 | ntohs(REQ_CID(pptpReq, pcid_off)), ntohs(new_pcid)); |
346 | 348 | ||
347 | if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, | 349 | if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, |
348 | pcid_off + sizeof(struct pptp_pkt_hdr) + | 350 | pcid_off + sizeof(struct pptp_pkt_hdr) + |
@@ -353,7 +355,7 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
353 | 355 | ||
354 | if (new_cid) { | 356 | if (new_cid) { |
355 | DEBUGP("altering call id from 0x%04x to 0x%04x\n", | 357 | DEBUGP("altering call id from 0x%04x to 0x%04x\n", |
356 | ntohs(*(u_int16_t *)pptpReq + cid_off), ntohs(new_cid)); | 358 | ntohs(REQ_CID(pptpReq, cid_off)), ntohs(new_cid)); |
357 | if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, | 359 | if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, |
358 | cid_off + sizeof(struct pptp_pkt_hdr) + | 360 | cid_off + sizeof(struct pptp_pkt_hdr) + |
359 | sizeof(struct PptpControlHeader), | 361 | sizeof(struct PptpControlHeader), |