From: Stephen Hemminger <shemminger@osdl.org>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: Linus Torvalds <torvalds@osdl.org>,
"David S. Miller" <davem@davemloft.net>,
Jeff Garzik <jeff@garzik.org>,
netdev@vger.kernel.org
Subject: [RFT] netpoll: fully initialize skb
Date: Wed, 18 Oct 2006 20:04:21 -0700 [thread overview]
Message-ID: <20061018200421.79877ced@localhost.localdomain> (raw)
In-Reply-To: <20061018154915.324900d6@freekitty>
This stops the
protocol 0000 is buggy, dev eth0
messages from occurring when netpoll decides to queue packets.
It fully initializes the protocol fields.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
If you want to wait on including it, I intend to rollup all the netpoll
patches into a patchbomb tomorrow.
--- netpoll.orig/net/core/netpoll.c
+++ netpoll/net/core/netpoll.c
@@ -335,13 +335,13 @@ void netpoll_send_udp(struct netpoll *np
memcpy(skb->data, msg, len);
skb->len += len;
- udph = (struct udphdr *) skb_push(skb, sizeof(*udph));
+ skb->h.uh = udph = (struct udphdr *) skb_push(skb, sizeof(*udph));
udph->source = htons(np->local_port);
udph->dest = htons(np->remote_port);
udph->len = htons(udp_len);
udph->check = 0;
- iph = (struct iphdr *)skb_push(skb, sizeof(*iph));
+ skb->nh.iph = iph = (struct iphdr *)skb_push(skb, sizeof(*iph));
/* iph->version = 4; iph->ihl = 5; */
put_unaligned(0x45, (unsigned char *)iph);
@@ -357,8 +357,8 @@ void netpoll_send_udp(struct netpoll *np
iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
-
- eth->h_proto = htons(ETH_P_IP);
+ skb->mac.raw = skb->data;
+ skb->protocol = eth->h_proto = htons(ETH_P_IP);
memcpy(eth->h_source, np->local_mac, 6);
memcpy(eth->h_dest, np->remote_mac, 6);
prev parent reply other threads:[~2006-10-19 3:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.64.0610152043060.3962@g5.osdl.org>
[not found] ` <20061017170147.08edc149@freekitty>
[not found] ` <Pine.LNX.4.64.0610171712050.3962@g5.osdl.org>
[not found] ` <20061017190321.0414fb38@dads-laptop>
[not found] ` <Pine.LNX.4.64.0610172129320.3962@g5.osdl.org>
[not found] ` <20061017214830.07cb89bb@dads-laptop>
[not found] ` <Pine.LNX.4.64.0610180932500.3962@g5.osdl.org>
[not found] ` <Pine.LNX.4.64.0610181002390.3962@g5.osdl.org>
[not found] ` <Pine.LNX.4.64.0610181014230.3962@g5.osdl.org>
[not found] ` <20061018125629.5f480ff7@dxpl.pdx.osdl.net>
[not found] ` <Pine.LNX.4.64.0610181310040.3962@g5.osdl.org>
[not found] ` <20061018144553.6a40e0a4@dxpl.pdx.osdl.net>
[not found] ` <Pine.LNX.4.64.0610181501490.3962@g5.osdl.org>
2006-10-18 22:49 ` netpoll causes malformed protocol message Stephen Hemminger
2006-10-19 3:04 ` Stephen Hemminger [this message]
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=20061018200421.79877ced@localhost.localdomain \
--to=shemminger@osdl.org \
--cc=davem@davemloft.net \
--cc=jeff@garzik.org \
--cc=netdev@vger.kernel.org \
--cc=torvalds@osdl.org \
/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).