netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
To: dav@conectiva.com.br
Cc: netdev@oss.sgi.com
Subject: PATCH: [SKBUFF] introduce skb_link_header_data_offset(skb)
Date: Tue, 05 Oct 2004 17:54:50 -0300	[thread overview]
Message-ID: <41630A1A.5040808@conectiva.com.br> (raw)

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

Hi David,

	Please consider pulling from:

bk://kernel.bkbits.net/acme/sk_buff-2.6

	Now there are 15 outstanding changesets in this tree.

Regards,

- Arnaldo

[-- Attachment #2: skb_link_header_data_offset.patch --]
[-- Type: text/plain, Size: 2600 bytes --]

===================================================================


ChangeSet@1.2044, 2004-10-05 17:51:20-03:00, acme@conectiva.com.br
  [SKBUFF] introduce skb_link_header_data_offset(skb)
  
  Signed-off-by: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  Signed-off-by: David S. Miller <davem@redhat.com>


 include/linux/skbuff.h |    5 +++++
 net/ax25/af_ax25.c     |    4 +++-
 net/packet/af_packet.c |    6 +++---
 3 files changed, 11 insertions(+), 4 deletions(-)


diff -Nru a/include/linux/skbuff.h b/include/linux/skbuff.h
--- a/include/linux/skbuff.h	2004-10-05 17:52:24 -03:00
+++ b/include/linux/skbuff.h	2004-10-05 17:52:24 -03:00
@@ -313,6 +313,11 @@
 	return skb->nh.raw - skb->mac.raw;
 }
 
+static inline int skb_link_header_data_offset(const struct sk_buff *skb)
+{
+	return skb->data - skb->mac.raw;
+}
+
 extern void	       __kfree_skb(struct sk_buff *skb);
 extern struct sk_buff *alloc_skb(unsigned int size, int priority);
 extern void	       kfree_skbmem(struct sk_buff *skb);
diff -Nru a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
--- a/net/ax25/af_ax25.c	2004-10-05 17:52:24 -03:00
+++ b/net/ax25/af_ax25.c	2004-10-05 17:52:24 -03:00
@@ -1632,7 +1632,9 @@
 		ax25_digi digi;
 		ax25_address src;
 
-		ax25_addr_parse(skb->mac.raw+1, skb->data-skb->mac.raw-1, &src, NULL, &digi, NULL, NULL);
+		ax25_addr_parse(skb->mac.raw + 1,
+				skb_link_header_data_offset(skb) - 1,
+				&src, NULL, &digi, NULL, NULL);
 
 		sax->sax25_family = AF_AX25;
 		/* We set this correctly, even though we may not let the
diff -Nru a/net/packet/af_packet.c b/net/packet/af_packet.c
--- a/net/packet/af_packet.c	2004-10-05 17:52:24 -03:00
+++ b/net/packet/af_packet.c	2004-10-05 17:52:24 -03:00
@@ -274,7 +274,7 @@
 
 	spkt = (struct sockaddr_pkt*)skb->cb;
 
-	skb_push(skb, skb->data-skb->mac.raw);
+	skb_push(skb, skb_link_header_data_offset(skb));
 
 	/*
 	 *	The SOCK_PACKET socket receives _all_ frames.
@@ -462,7 +462,7 @@
 		   never delivered to user.
 		 */
 		if (sk->sk_type != SOCK_DGRAM)
-			skb_push(skb, skb->data - skb->mac.raw);
+			skb_push(skb, skb_link_header_data_offset(skb));
 		else if (skb->pkt_type == PACKET_OUTGOING) {
 			/* Special case: outgoing packets have ll header at head */
 			skb_pull(skb, skb->nh.raw - skb->data);
@@ -559,7 +559,7 @@
 
 	if (dev->hard_header) {
 		if (sk->sk_type != SOCK_DGRAM)
-			skb_push(skb, skb->data - skb->mac.raw);
+			skb_push(skb, skb_link_header_data_offset(skb));
 		else if (skb->pkt_type == PACKET_OUTGOING) {
 			/* Special case: outgoing packets have ll header at head */
 			skb_pull(skb, skb->nh.raw - skb->data);


                 reply	other threads:[~2004-10-05 20:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=41630A1A.5040808@conectiva.com.br \
    --to=acme@conectiva.com.br \
    --cc=dav@conectiva.com.br \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).