Skip to contentSkip to conversation

: netfilter: Use frag list abstraction interfaces.

PATCH In review David Miller 2 participants 3 messages Jun 9, 2009 – Jun 10, 2009

Subsystems (3)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 11/15 : netfilter: Use frag list abstraction interfaces.

---
 net/ipv4/netfilter/nf_nat_proto_sctp.c  |    5 +++--
 net/ipv6/netfilter/nf_conntrack_reasm.c |    4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)
net/ipv4/netfilter/nf_nat_proto_sctp.c +3 -2
index 65e470b..6983e41 100644
@@ -33,6 +33,7 @@ sctp_manip_pkt(struct sk_buff *skb,
 	       enum nf_nat_manip_type maniptype)
 {
 	const struct iphdr *iph = (struct iphdr *)(skb->data + iphdroff);
+	struct sk_buff *frag;
 	sctp_sctphdr_t *hdr;
 	unsigned int hdroff = iphdroff + iph->ihl*4;
 	__be32 oldip, newip;
@@ -57,8 +58,8 @@ sctp_manip_pkt(struct sk_buff *skb,
 	}
 
 	crc32 = sctp_start_cksum((u8 *)hdr, skb_headlen(skb) - hdroff);
-	for (skb = skb_shinfo(skb)->frag_list; skb; skb = skb->next)
-		crc32 = sctp_update_cksum((u8 *)skb->data, skb_headlen(skb),
+	skb_walk_frags(skb, frag);
+		crc32 = sctp_update_cksum((u8 *)frag->data, skb_headlen(frag),
 					  crc32);
 	crc32 = sctp_end_cksum(crc32);
 	hdr->checksum = crc32;
net/ipv6/netfilter/nf_conntrack_reasm.c +2 -2
index 058a5e4..f3aba25 100644
@@ -409,7 +409,7 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
 	/* If the first fragment is fragmented itself, we split
 	 * it to two chunks: the first with data and paged part
 	 * and the second, holding only fragments. */
-	if (skb_shinfo(head)->frag_list) {
+	if (skb_has_frags(head)) {
 		struct sk_buff *clone;
 		int i, plen = 0;
 
@@ -420,7 +420,7 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
 		clone->next = head->next;
 		head->next = clone;
 		skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list;
-		skb_shinfo(head)->frag_list = NULL;
+		skb_frag_list_init(head);
 		for (i=0; i<skb_shinfo(head)->nr_frags; i++)
 			plen += skb_shinfo(head)->frags[i].size;
 		clone->len = clone->data_len = head->data_len - plen;
Signature · 1 line
1.6.3.2
#1 lore raw

net/ipv4/netfilter/nf_nat_proto_sctp.c sctp_manip_pkt(struct sk_buff *skb, · line 61

Quoted 10 lines · David Miller
net/ipv4/netfilter/nf_nat_proto_sctp.c +1 -2
@@ -57,8 +58,8 @@ sctp_manip_pkt(struct sk_buff *skb,
 	}
 
 	crc32 = sctp_start_cksum((u8 *)hdr, skb_headlen(skb) - hdroff);
-	for (skb = skb_shinfo(skb)->frag_list; skb; skb = skb->next)
-		crc32 = sctp_update_cksum((u8 *)skb->data, skb_headlen(skb),
+	skb_walk_frags(skb, frag);

Think there is a semi-colon too much here, as skb_walk_frags expand to a for-loop statement, Right?

net/ipv4/netfilter/nf_nat_proto_sctp.c sctp_manip_pkt(struct sk_buff *skb, · line 65

Quoted 4 lines
net/ipv4/netfilter/nf_nat_proto_sctp.c +1 -0
+		crc32 = sctp_update_cksum((u8 *)frag->data, skb_headlen(frag),
 					  crc32);
 	crc32 = sctp_end_cksum(crc32);
 	hdr->checksum = crc32;

Cheers,
Jesper Brouer

--
-------------------------------------------------------------------
MSc. Master of Computer Science
Dept. of Computer Science, University of Copenhagen Author of http://www.adsl-optimizer.dk
-------------------------------------------------------------------

author maintainer
#2 lore raw

From: Jesper Dangaard Brouer <[email protected]>
Date: Tue, 9 Jun 2009 22:23:52 +0200 (CEST)

Quoted 9 lines · David Miller
Quoted 7 lines
net/ipv4/netfilter/nf_nat_proto_sctp.c +0 -0
@@ -57,8 +58,8 @@ sctp_manip_pkt(struct sk_buff *skb,
 	}
 
Quoted 7 lines

net/ipv4/netfilter/nf_nat_proto_sctp.c sctp_manip_pkt(struct sk_buff *skb, · line 61

Quoted 4 lines
net/ipv4/netfilter/nf_nat_proto_sctp.c +1 -2
 	crc32 = sctp_start_cksum((u8 *)hdr, skb_headlen(skb) - hdroff);
-	for (skb = skb_shinfo(skb)->frag_list; skb; skb = skb->next)
-		crc32 = sctp_update_cksum((u8 *)skb->data, skb_headlen(skb),
+	skb_walk_frags(skb, frag);

Think there is a semi-colon too much here, as skb_walk_frags expand to a for-loop statement, Right?

Fixed, thanks!