From: Matt Mackall <mpm@selenic.com>
To: Andrew Morton <akpm@osdl.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Cc: Stelian Pop <stelian@popies.net>, Jeff Garzik <jgarzik@pobox.com>
Subject: [PATCH] netpoll early ARP handling
Date: Sat, 10 Apr 2004 15:33:02 -0500 [thread overview]
Message-ID: <20040410203302.GR6248@waste.org> (raw)
Handle ARP requests while device is trapped before in_dev is
initialized using netpoll config. Allows early kgdboe usage.
>From Stelian Pop <stelian@popies.net>
%patch
Index: mm/net/core/netpoll.c
===================================================================
--- mm.orig/net/core/netpoll.c 2004-04-10 15:06:57.000000000 -0500
+++ mm/net/core/netpoll.c 2004-04-10 15:15:25.000000000 -0500
@@ -231,9 +231,8 @@
static void arp_reply(struct sk_buff *skb)
{
- struct in_device *in_dev = (struct in_device *) skb->dev->ip_ptr;
struct arphdr *arp;
- unsigned char *arp_ptr, *sha, *tha;
+ unsigned char *arp_ptr;
int size, type = ARPOP_REPLY, ptype = ETH_P_ARP;
u32 sip, tip;
struct sk_buff *send_skb;
@@ -253,7 +252,7 @@
if (!np) return;
/* No arp on this interface */
- if (!in_dev || skb->dev->flags & IFF_NOARP)
+ if (skb->dev->flags & IFF_NOARP)
return;
if (!pskb_may_pull(skb, (sizeof(struct arphdr) +
@@ -270,21 +269,15 @@
arp->ar_op != htons(ARPOP_REQUEST))
return;
- arp_ptr= (unsigned char *)(arp+1);
- sha = arp_ptr;
- arp_ptr += skb->dev->addr_len;
+ arp_ptr = (unsigned char *)(arp+1) + skb->dev->addr_len;
memcpy(&sip, arp_ptr, 4);
- arp_ptr += 4;
- tha = arp_ptr;
- arp_ptr += skb->dev->addr_len;
+ arp_ptr += 4 + skb->dev->addr_len;
memcpy(&tip, arp_ptr, 4);
/* Should we ignore arp? */
- if (tip != in_dev->ifa_list->ifa_address ||
- LOOPBACK(tip) || MULTICAST(tip))
+ if (tip != htonl(np->local_ip) || LOOPBACK(tip) || MULTICAST(tip))
return;
-
size = sizeof(struct arphdr) + 2 * (skb->dev->addr_len + 4);
send_skb = find_skb(np, size + LL_RESERVED_SPACE(np->dev),
LL_RESERVED_SPACE(np->dev));
@@ -325,7 +318,7 @@
arp_ptr += np->dev->addr_len;
memcpy(arp_ptr, &tip, 4);
arp_ptr += 4;
- memcpy(arp_ptr, np->local_mac, np->dev->addr_len);
+ memcpy(arp_ptr, np->remote_mac, np->dev->addr_len);
arp_ptr += np->dev->addr_len;
memcpy(arp_ptr, &sip, 4);
%diffstat
netpoll.c | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
--
Matt Mackall : http://www.selenic.com : Linux development and consulting
next reply other threads:[~2004-04-10 20:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-10 20:33 Matt Mackall [this message]
2004-04-13 18:08 ` [PATCH] netpoll early ARP handling Jeff Garzik
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=20040410203302.GR6248@waste.org \
--to=mpm@selenic.com \
--cc=akpm@osdl.org \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stelian@popies.net \
/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.