Commit c07bc1ff authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NETFILTER]: Fix return value confusion in PPTP NAT helper

ip_nat_mangle_tcp_packet doesn't return NF_* values but 0/1 for
failure/success.
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 03b9feca
...@@ -299,8 +299,6 @@ pptp_inbound_pkt(struct sk_buff **pskb, ...@@ -299,8 +299,6 @@ pptp_inbound_pkt(struct sk_buff **pskb,
u_int16_t msg, new_cid = 0, new_pcid; u_int16_t msg, new_cid = 0, new_pcid;
unsigned int pcid_off, cid_off = 0; unsigned int pcid_off, cid_off = 0;
int ret = NF_ACCEPT, rv;
new_pcid = htons(nat_pptp_info->pns_call_id); new_pcid = htons(nat_pptp_info->pns_call_id);
switch (msg = ntohs(ctlh->messageType)) { switch (msg = ntohs(ctlh->messageType)) {
...@@ -346,31 +344,23 @@ pptp_inbound_pkt(struct sk_buff **pskb, ...@@ -346,31 +344,23 @@ pptp_inbound_pkt(struct sk_buff **pskb,
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(*(u_int16_t *)pptpReq + pcid_off), ntohs(new_pcid));
rv = 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) +
sizeof(struct PptpControlHeader), sizeof(struct PptpControlHeader),
sizeof(new_pcid), (char *)&new_pcid, sizeof(new_pcid), (char *)&new_pcid,
sizeof(new_pcid)); sizeof(new_pcid)) == 0)
if (rv != NF_ACCEPT) return NF_DROP;
return rv;
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(*(u_int16_t *)pptpReq + cid_off), ntohs(new_cid));
rv = 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),
sizeof(new_cid), (char *)&new_cid, sizeof(new_cid), (char *)&new_cid,
sizeof(new_cid)); sizeof(new_cid)) == 0)
if (rv != NF_ACCEPT) return NF_DROP;
return rv;
} }
/* check for earlier return value of 'switch' above */
if (ret != NF_ACCEPT)
return ret;
/* great, at least we don't need to resize packets */
return NF_ACCEPT; return NF_ACCEPT;
} }
......
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