All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6 4/9]: Handle nonlinear skbs in ip_queue/ip6_queue
@ 2004-11-15 21:44 Patrick McHardy
  0 siblings, 0 replies; only message in thread
From: Patrick McHardy @ 2004-11-15 21:44 UTC (permalink / raw)
  To: David S. Miller; +Cc: Netfilter Development Mailinglist

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

Handle nonlinear skbs in ip_queue/ip6_queue. This, in addition to Yasuyuki's
patches, is the last change necessary to remove skb_linearize from 
ip6_tables.



[-- Attachment #2: 04.diff --]
[-- Type: text/x-patch, Size: 1942 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/11/13 11:55:57+01:00 kaber@coreworks.de 
#   [NETFILTER]: Handle nonlinear skbs in ip_queue/ip6_queue
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/ipv6/netfilter/ip6_queue.c
#   2004/11/13 11:55:50+01:00 kaber@coreworks.de +4 -1
#   [NETFILTER]: Handle nonlinear skbs in ip_queue/ip6_queue
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/ipv4/netfilter/ip_queue.c
#   2004/11/13 11:55:50+01:00 kaber@coreworks.de +4 -1
#   [NETFILTER]: Handle nonlinear skbs in ip_queue/ip6_queue
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
diff -Nru a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
--- a/net/ipv4/netfilter/ip_queue.c	2004-11-15 22:07:01 +01:00
+++ b/net/ipv4/netfilter/ip_queue.c	2004-11-15 22:07:01 +01:00
@@ -257,7 +257,8 @@
 	}
 	
 	if (data_len)
-		memcpy(pmsg->payload, entry->skb->data, data_len);
+		if (skb_copy_bits(entry->skb, 0, pmsg->payload, data_len))
+			BUG();
 		
 	nlh->nlmsg_len = skb->tail - old_tail;
 	return skb;
@@ -362,6 +363,8 @@
 		}
 		skb_put(e->skb, diff);
 	}
+	if (!skb_ip_make_writable(&e->skb, v->data_len))
+		return -ENOMEM;
 	memcpy(e->skb->data, v->payload, v->data_len);
 	e->skb->nfcache |= NFC_ALTERED;
 
diff -Nru a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
--- a/net/ipv6/netfilter/ip6_queue.c	2004-11-15 22:07:01 +01:00
+++ b/net/ipv6/netfilter/ip6_queue.c	2004-11-15 22:07:01 +01:00
@@ -262,7 +262,8 @@
 	}
 	
 	if (data_len)
-		memcpy(pmsg->payload, entry->skb->data, data_len);
+		if (skb_copy_bits(entry->skb, 0, pmsg->payload, data_len))
+			BUG();
 		
 	nlh->nlmsg_len = skb->tail - old_tail;
 	return skb;
@@ -366,6 +367,8 @@
 		}
 		skb_put(e->skb, diff);
 	}
+	if (!skb_ip_make_writable(&e->skb, v->data_len))
+		return -ENOMEM;
 	memcpy(e->skb->data, v->payload, v->data_len);
 	e->skb->nfcache |= NFC_ALTERED;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-11-15 21:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-15 21:44 [PATCH 2.6 4/9]: Handle nonlinear skbs in ip_queue/ip6_queue Patrick McHardy

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.