All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira <pablo@eurodev.net>
To: Patrick McHardy <kaber@trash.net>
Cc: Harald Welte <laforge@netfilter.org>,
	Netfilter Development Mailinglist
	<netfilter-devel@lists.netfilter.org>
Subject: Re: [PATCH] ip_queue and fragments
Date: Fri, 06 Aug 2004 18:44:01 +0200	[thread overview]
Message-ID: <4113B551.2030107@eurodev.net> (raw)
In-Reply-To: <41124142.3030600@trash.net>

[-- Attachment #1: Type: text/plain, Size: 376 bytes --]

Hi Patrick,

Patrick McHardy wrote:

> skb_copy_bits always stays inside limits if len is positive, so you can
> do something like this:
>
> if  (copy_range == 0)
>  data_len = ~0UL;
> else
>  data_len = copy_range;
>
> but you have to remove the jump to nlmsg_failure when skb_copy_bits 
> fails.


thanks for your suggestions, I've applied them to my patch.

regards,
Pablo

[-- Attachment #2: ip_queue-fragments.patch --]
[-- Type: text/x-patch, Size: 604 bytes --]

diff -u -r1.1.1.1 ip_queue.c
--- a/net/ipv4/netfilter/ip_queue.c	4 Aug 2004 15:14:39 -0000	1.1.1.1
+++ b/net/ipv4/netfilter/ip_queue.c	6 Aug 2004 16:38:11 -0000
@@ -205,8 +205,8 @@
 		break;
 	
 	case IPQ_COPY_PACKET:
-		if (copy_range == 0 || copy_range > entry->skb->len)
-			data_len = entry->skb->len;
+		if (copy_range == 0)
+			data_len = ~0UL;
 		else
 			data_len = copy_range;
 		
@@ -257,7 +257,7 @@
 	}
 	
 	if (data_len)
-		memcpy(pmsg->payload, entry->skb->data, data_len);
+		skb_copy_bits(entry->skb, 0, pmsg->payload, data_len);
 		
 	nlh->nlmsg_len = skb->tail - old_tail;
 	return skb;

  reply	other threads:[~2004-08-06 16:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-05 13:32 [PATCH] ip_queue and fragments Pablo Neira
2004-08-05 14:16 ` Patrick McHardy
2004-08-06 16:44   ` Pablo Neira [this message]
2004-08-07 19:20     ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4113B551.2030107@eurodev.net \
    --to=pablo@eurodev.net \
    --cc=kaber@trash.net \
    --cc=laforge@netfilter.org \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.