Commit f2ad52c9 authored by Holger Eitzenberger's avatar Holger Eitzenberger Committed by David S. Miller

[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: default avatarHolger Eitzenberger <heitzenberger@astaro.com>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 77ff72d5
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
#define IP_NAT_PPTP_VERSION "3.0" #define IP_NAT_PPTP_VERSION "3.0"
#define REQ_CID(req, off) (*(u_int16_t *)((char *)(req) + (off)))
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
MODULE_DESCRIPTION("Netfilter NAT helper module for PPTP"); MODULE_DESCRIPTION("Netfilter NAT helper module for PPTP");
...@@ -198,7 +200,7 @@ pptp_outbound_pkt(struct sk_buff **pskb, ...@@ -198,7 +200,7 @@ pptp_outbound_pkt(struct sk_buff **pskb,
/* only OUT_CALL_REQUEST, IN_CALL_REPLY, CALL_CLEAR_REQUEST pass /* only OUT_CALL_REQUEST, IN_CALL_REPLY, CALL_CLEAR_REQUEST pass
* down to here */ * down to here */
DEBUGP("altering call id from 0x%04x to 0x%04x\n", DEBUGP("altering call id from 0x%04x to 0x%04x\n",
ntohs(*(u_int16_t *)pptpReq + cid_off), ntohs(new_callid)); ntohs(REQ_CID(pptpReq, cid_off)), ntohs(new_callid));
/* mangle packet */ /* mangle packet */
if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo,
...@@ -342,7 +344,7 @@ pptp_inbound_pkt(struct sk_buff **pskb, ...@@ -342,7 +344,7 @@ pptp_inbound_pkt(struct sk_buff **pskb,
/* mangle packet */ /* mangle packet */
DEBUGP("altering peer call id from 0x%04x to 0x%04x\n", DEBUGP("altering peer call id from 0x%04x to 0x%04x\n",
ntohs(*(u_int16_t *)pptpReq + pcid_off), ntohs(new_pcid)); ntohs(REQ_CID(pptpReq, pcid_off)), ntohs(new_pcid));
if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo,
pcid_off + sizeof(struct pptp_pkt_hdr) + pcid_off + sizeof(struct pptp_pkt_hdr) +
...@@ -353,7 +355,7 @@ pptp_inbound_pkt(struct sk_buff **pskb, ...@@ -353,7 +355,7 @@ pptp_inbound_pkt(struct sk_buff **pskb,
if (new_cid) { if (new_cid) {
DEBUGP("altering call id from 0x%04x to 0x%04x\n", DEBUGP("altering call id from 0x%04x to 0x%04x\n",
ntohs(*(u_int16_t *)pptpReq + cid_off), ntohs(new_cid)); ntohs(REQ_CID(pptpReq, cid_off)), ntohs(new_cid));
if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo,
cid_off + sizeof(struct pptp_pkt_hdr) + cid_off + sizeof(struct pptp_pkt_hdr) +
sizeof(struct PptpControlHeader), sizeof(struct PptpControlHeader),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment