Skip to contentSkip to conversation

: Handle nonlinear skbs in ip_queue/ip6_queue

PATCH In review Patrick McHardy 1 participant 1 message Nov 15, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/9 : Handle nonlinear skbs in ip_queue/ip6_queue

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.

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/11/13 11:55:57+01:00 [email protected]
# [NETFILTER]: Handle nonlinear skbs in ip_queue/ip6_queue
#
# Signed-off-by: Patrick McHardy <[email protected]>
#

# net/ipv6/netfilter/ip6_queue.c
#   2004/11/13 11:55:50+01:00 [email protected] +4 -1
#   [NETFILTER]: Handle nonlinear skbs in ip_queue/ip6_queue
#   
#   Signed-off-by: Patrick McHardy <[email protected]>
# 
# net/ipv4/netfilter/ip_queue.c
#   2004/11/13 11:55:50+01:00 [email protected] +4 -1
#   [NETFILTER]: Handle nonlinear skbs in ip_queue/ip6_queue
#   
#   Signed-off-by: Patrick McHardy <[email protected]>
# 
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;

net/ipv6/netfilter/ip6_queue.c +4 -1
diff -Nru a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
@@ -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;