netpoll early ARP handling
PATCH 1/1 netpoll early ARP handling
Handle ARP requests while device is trapped before in_dev is initialized using netpoll config. Allows early kgdboe usage.
Quoted 1 line
From Stelian Pop <[email protected]>
%patch
net/core/netpoll.c +6 -13
@@ -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(-)
Signature · 1 line
Matt Mackall : http://www.selenic.com : Linux development and consulting
Jeff Garzik
Appliedapplied