diff options
author | Patrick McHardy <kaber@trash.net> | 2006-01-09 19:44:18 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-01-10 15:54:33 -0500 |
commit | c07bc1ffbdc14312b214b56fa39f4a4ab1406b8e (patch) | |
tree | bebe88286e6822d41128cc6347d5cb9011d97a7c | |
parent | 03b9feca89366952ae5dfe4ad8107b1ece50b710 (diff) |
[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: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/netfilter/ip_nat_helper_pptp.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/net/ipv4/netfilter/ip_nat_helper_pptp.c b/net/ipv4/netfilter/ip_nat_helper_pptp.c index 50960cb681f8..ac004895781a 100644 --- a/net/ipv4/netfilter/ip_nat_helper_pptp.c +++ b/net/ipv4/netfilter/ip_nat_helper_pptp.c | |||
@@ -299,8 +299,6 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
299 | u_int16_t msg, new_cid = 0, new_pcid; | 299 | u_int16_t msg, new_cid = 0, new_pcid; |
300 | unsigned int pcid_off, cid_off = 0; | 300 | unsigned int pcid_off, cid_off = 0; |
301 | 301 | ||
302 | int ret = NF_ACCEPT, rv; | ||
303 | |||
304 | new_pcid = htons(nat_pptp_info->pns_call_id); | 302 | new_pcid = htons(nat_pptp_info->pns_call_id); |
305 | 303 | ||
306 | switch (msg = ntohs(ctlh->messageType)) { | 304 | switch (msg = ntohs(ctlh->messageType)) { |
@@ -345,32 +343,24 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
345 | /* mangle packet */ | 343 | /* mangle packet */ |
346 | DEBUGP("altering peer call id from 0x%04x to 0x%04x\n", | 344 | DEBUGP("altering peer call id from 0x%04x to 0x%04x\n", |
347 | ntohs(*(u_int16_t *)pptpReq + pcid_off), ntohs(new_pcid)); | 345 | ntohs(*(u_int16_t *)pptpReq + pcid_off), ntohs(new_pcid)); |
348 | 346 | ||
349 | rv = ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, | 347 | if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, |
350 | pcid_off + sizeof(struct pptp_pkt_hdr) + | 348 | pcid_off + sizeof(struct pptp_pkt_hdr) + |
351 | sizeof(struct PptpControlHeader), | 349 | sizeof(struct PptpControlHeader), |
352 | sizeof(new_pcid), (char *)&new_pcid, | 350 | sizeof(new_pcid), (char *)&new_pcid, |
353 | sizeof(new_pcid)); | 351 | sizeof(new_pcid)) == 0) |
354 | if (rv != NF_ACCEPT) | 352 | return NF_DROP; |
355 | return rv; | ||
356 | 353 | ||
357 | if (new_cid) { | 354 | if (new_cid) { |
358 | DEBUGP("altering call id from 0x%04x to 0x%04x\n", | 355 | DEBUGP("altering call id from 0x%04x to 0x%04x\n", |
359 | ntohs(*(u_int16_t *)pptpReq + cid_off), ntohs(new_cid)); | 356 | ntohs(*(u_int16_t *)pptpReq + cid_off), ntohs(new_cid)); |
360 | rv = ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, | 357 | if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, |
361 | cid_off + sizeof(struct pptp_pkt_hdr) + | 358 | cid_off + sizeof(struct pptp_pkt_hdr) + |
362 | sizeof(struct PptpControlHeader), | 359 | sizeof(struct PptpControlHeader), |
363 | sizeof(new_cid), (char *)&new_cid, | 360 | sizeof(new_cid), (char *)&new_cid, |
364 | sizeof(new_cid)); | 361 | sizeof(new_cid)) == 0) |
365 | if (rv != NF_ACCEPT) | 362 | return NF_DROP; |
366 | return rv; | ||
367 | } | 363 | } |
368 | |||
369 | /* check for earlier return value of 'switch' above */ | ||
370 | if (ret != NF_ACCEPT) | ||
371 | return ret; | ||
372 | |||
373 | /* great, at least we don't need to resize packets */ | ||
374 | return NF_ACCEPT; | 364 | return NF_ACCEPT; |
375 | } | 365 | } |
376 | 366 | ||