All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: "David S. Miller" <davem@redhat.com>
Cc: netdev@oss.sgi.com
Subject: [RFT] remove skb_linearize from igmp.c
Date: Mon, 23 Jun 2003 12:03:42 -0700	[thread overview]
Message-ID: <20030623120342.470cf504.shemminger@osdl.org> (raw)

This patch gets rid of the deprecated skb_linearize call in IGMP by
using pskb_may_pull like ip_input does.

Could someone who actually receives IGMP packets test this?

diff -Nru a/net/ipv4/igmp.c b/net/ipv4/igmp.c
--- a/net/ipv4/igmp.c	Mon Jun 23 11:59:56 2003
+++ b/net/ipv4/igmp.c	Mon Jun 23 11:59:56 2003
@@ -838,28 +838,19 @@
 int igmp_rcv(struct sk_buff *skb)
 {
 	/* This basically follows the spec line by line -- see RFC1112 */
-	struct igmphdr *ih = skb->h.igmph;
+	struct igmphdr *ih;
 	struct in_device *in_dev = in_dev_get(skb->dev);
 	int len = skb->len;
 
-	if (in_dev==NULL) {
-		kfree_skb(skb);
-		return 0;
-	}
-
-	if (skb_is_nonlinear(skb)) {
-		if (skb_linearize(skb, GFP_ATOMIC) != 0) {
-			kfree_skb(skb);
-			return -ENOMEM;
-		}
-		ih = skb->h.igmph;
-	}
+	if (in_dev==NULL) 
+		goto out;
 
-	if (len < sizeof(struct igmphdr) || ip_compute_csum((void *)ih, len)) {
-		in_dev_put(in_dev);
-		kfree_skb(skb);
-		return 0;
-	}
+	if (!pskb_may_pull(skb, sizeof(struct igmphdr)))
+		goto drop;
+	
+	ih = skb->h.igmph;
+	if (ip_compute_csum((void *)ih, len)) 
+		goto drop;
 
 	switch (ih->type) {
 	case IGMP_HOST_MEMBERSHIP_QUERY:
@@ -887,7 +878,9 @@
 	default:
 		NETDEBUG(printk(KERN_DEBUG "New IGMP type=%d, why we do not know about it?\n", ih->type));
 	}
+ drop:
 	in_dev_put(in_dev);
+ out:
 	kfree_skb(skb);
 	return 0;
 }

             reply	other threads:[~2003-06-23 19:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-23 19:03 Stephen Hemminger [this message]
2003-06-23 19:02 ` [RFT] remove skb_linearize from igmp.c David S. Miller
2003-06-23 19:41   ` Stephen Hemminger
2003-06-23 20:17     ` David S. Miller

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=20030623120342.470cf504.shemminger@osdl.org \
    --to=shemminger@osdl.org \
    --cc=davem@redhat.com \
    --cc=netdev@oss.sgi.com \
    /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.