Skip to contentSkip to conversation

PATCH: [SKBUFF] Introduce skb_set_link_header_offset(skb, offset)

PATCH Arnaldo Carvalho de Melo 2 participants 3 messages Oct 5, 2004

Subsystems (5)
Networking Network drivers s390 ATM +1 more subsystems
lore
Share & tools
lore
#0 lore raw

Hi David,

Please consider pulling from:

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

Now there are 14 outstanding changesets in this tree.

Regards,

- Arnaldo

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

[email protected], 2004-10-05 17:05:20-03:00, [email protected]
[SKBUFF] Introduce skb_set_link_header_offset(skb, offset)

 drivers/net/loopback.c       |    2 +-
 drivers/net/myri_sbus.c      |    2 +-
 drivers/s390/net/qeth_main.c |    2 +-
 include/linux/skbuff.h       |    6 ++++++
 net/atm/br2684.c             |    2 +-
 5 files changed, 10 insertions(+), 4 deletions(-)
drivers/net/loopback.c +1 -1
diff -Nru a/drivers/net/loopback.c b/drivers/net/loopback.c
@@ -85,7 +85,7 @@
 		if (!nskb)
 			break;
 		skb_reserve(nskb, 32);
-		nskb->mac.raw = nskb->data - ETH_HLEN;
+		skb_set_link_header_offset(nskb, -ETH_HLEN);
 		nskb->nh.raw = nskb->data;
 		iph = nskb->nh.iph;
 		memcpy(nskb->data, skb->nh.raw, doffset);
drivers/net/myri_sbus.c +1 -1
diff -Nru a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
@@ -374,7 +374,7 @@
 	struct ethhdr *eth;
 	unsigned char *rawp;
 	
-	skb->mac.raw = (((unsigned char *)skb->data) + MYRI_PAD_LEN);
+	skb_set_link_header_offset(skb, MYRI_PAD_LEN);
 	skb_pull(skb, dev->hard_header_len);
 	eth = eth_hdr(skb);
 	
drivers/s390/net/qeth_main.c +1 -1
diff -Nru a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
@@ -2173,7 +2173,7 @@
 	struct iphdr *ip_hdr;
 
 	QETH_DBF_TEXT(trace,5,"skbfake");
-	skb->mac.raw = skb->data - QETH_FAKE_LL_LEN;
+	skb_set_link_header_offset(skb, -QETH_FAKE_LL_LEN);
 	/* this is a fake ethernet header */
 	fake_hdr = eth_hdr(skb);
 
include/linux/skbuff.h +6 -0
diff -Nru a/include/linux/skbuff.h b/include/linux/skbuff.h
@@ -295,6 +295,12 @@
 	skb->mac.raw = skb->data;
 }
 
+static inline void skb_set_link_header_offset(struct sk_buff *skb,
+					      const int offset)
+{
+	skb->mac.raw = skb->data + offset;
+}
+
 static inline int skb_valid_link_header(const struct sk_buff *skb,
 					const int hdrlen)
 {
net/atm/br2684.c +1 -1
diff -Nru a/net/atm/br2684.c b/net/atm/br2684.c
@@ -460,7 +460,7 @@
 	/* FIXME: tcpdump shows that pointer to mac header is 2 bytes earlier,
 	   than should be. What else should I set? */
 	skb_pull(skb, plen);
-	skb->mac.raw = ((char *) (skb->data)) - ETH_HLEN;
+	skb_set_link_header_offset(skb, -ETH_HLEN);
 	skb->pkt_type = PACKET_HOST;
 #ifdef CONFIG_BR2684_FAST_TRANS
 	skb->protocol = ((u16 *) skb->data)[-1];
#1 lore raw
Quoted 7 lines · On Tue, 05 Oct 2004 17:09:08 -0300 Arnaldo Carvalho de Melo…

Hi David,

Please consider pulling from:

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

Now there are 14 outstanding changesets in this tree.

Slow down. :-)

There are bugs in your earlier changesets which are going to make it hard for me to pull this tree in. Let's work one or two changesets at a time, not 14 ok? :-)

First bug, in ChangeSet 1.2032, drivers/net/wireless/orinoco.c

You change "skb->mac.raw + ETH_ALEN" into "eth_hdr(skb)->h_source". That can't be right since orinoco_spy_gather() expects a pointer for that argument.

Same error in the drivers/net/wireless/wavelan.c change in ChangeSet 1.2032, replacing skb->mac.raw (a pointer) with eth_hdr(skb)->h_dest in the call to wv_packet_info. And then "skb->mac.raw + WAVELAN_ADDR_SIZE" into "eth_hdr(skb)->h_source" in the call to wl_spy_gather().

The same errors occur all the changes to drivers/net/wireless/wavelan_cs.c of the same ChangeSet.

Please start to submit this stuff in smaller pieces and fix the above bugs, thanks.

#2 lore raw
Quoted 6 lines · David S. Miller
Quoted 2 lines · On Tue, 05 Oct 2004 17:09:08 -0300 Arnaldo Carvalho de Melo…

Hi David,

Quoted 8 lines
Quoted 5 lines

Please consider pulling from:

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

Now there are 14 outstanding changesets in this tree.

Slow down. :-)

Oh, flow control! :-)

Quoted 7 lines

There are bugs in your earlier changesets which are going to make it hard for me to pull this tree in. Let's work one or two changesets at a time, not 14 ok? :-)

First bug, in ChangeSet 1.2032, drivers/net/wireless/orinoco.c

Quoted 8 lines

You change "skb->mac.raw + ETH_ALEN" into "eth_hdr(skb)->h_source". That can't be right since orinoco_spy_gather() expects a pointer for that argument.

Same error in the drivers/net/wireless/wavelan.c change in ChangeSet 1.2032, replacing skb->mac.raw (a pointer) with eth_hdr(skb)->h_dest in the call to wv_packet_info.

humm, puzzled, isn't eth_hdr(skb)->h_dest a pointer of the same tipe (unsigned char *), that points to same place as skb->mac.raw? :-)

But perhaps the guy wanted the whole link header, I got confused because afterwards it uses the ETH_ALEN offset, meaning that it wanted now the second struct ethhdr field,

lemme look again at this code...

Nope, you're right, seems to be the 802.11 three adresses stuff, done in an ad-hoc confusing way, my mistake.

Quoted 2 lines

Please start to submit this stuff in smaller pieces and fix the above bugs, thanks.

mmkay sir!

Best Regards,

- Arnaldo