]> err.no Git - linux-2.6/blobdiff - net/core/netpoll.c
Merge branch 'upstream-jeff' of git://git.kernel.org/pub/scm/linux/kernel/git/romieu...
[linux-2.6] / net / core / netpoll.c
index 250868f687627f1bbe6be8dc8f2da459e785b94b..b04d643fc3c704cf21619251713ca190f3986554 100644 (file)
@@ -215,10 +215,12 @@ static void zap_completion_queue(void)
                while (clist != NULL) {
                        struct sk_buff *skb = clist;
                        clist = clist->next;
-                       if (skb->destructor)
+                       if (skb->destructor) {
+                               atomic_inc(&skb->users);
                                dev_kfree_skb_any(skb); /* put this one back */
-                       else
+                       } else {
                                __kfree_skb(skb);
+                       }
                }
        }
 
@@ -360,8 +362,8 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
        eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
        skb_reset_mac_header(skb);
        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);
+       memcpy(eth->h_source, np->dev->dev_addr, ETH_ALEN);
+       memcpy(eth->h_dest, np->remote_mac, ETH_ALEN);
 
        skb->dev = np->dev;
 
@@ -388,9 +390,7 @@ static void arp_reply(struct sk_buff *skb)
        if (skb->dev->flags & IFF_NOARP)
                return;
 
-       if (!pskb_may_pull(skb, (sizeof(struct arphdr) +
-                                (2 * skb->dev->addr_len) +
-                                (2 * sizeof(u32)))))
+       if (!pskb_may_pull(skb, arp_hdr_len(skb->dev)))
                return;
 
        skb_reset_network_header(skb);
@@ -414,10 +414,11 @@ static void arp_reply(struct sk_buff *skb)
        memcpy(&tip, arp_ptr, 4);
 
        /* Should we ignore arp? */
-       if (tip != htonl(np->local_ip) || LOOPBACK(tip) || MULTICAST(tip))
+       if (tip != htonl(np->local_ip) ||
+           ipv4_is_loopback(tip) || ipv4_is_multicast(tip))
                return;
 
-       size = sizeof(struct arphdr) + 2 * (skb->dev->addr_len + 4);
+       size = arp_hdr_len(skb->dev);
        send_skb = find_skb(np, size + LL_RESERVED_SPACE(np->dev),
                            LL_RESERVED_SPACE(np->dev));
 
@@ -431,7 +432,7 @@ static void arp_reply(struct sk_buff *skb)
 
        /* Fill the device header for the ARP frame */
        if (dev_hard_header(send_skb, skb->dev, ptype,
-                           sha, np->local_mac,
+                           sha, np->dev->dev_addr,
                            send_skb->len) < 0) {
                kfree_skb(send_skb);
                return;
@@ -737,9 +738,6 @@ int netpoll_setup(struct netpoll *np)
                }
        }
 
-       if (is_zero_ether_addr(np->local_mac) && ndev->dev_addr)
-               memcpy(np->local_mac, ndev->dev_addr, 6);
-
        if (!np->local_ip) {
                rcu_read_lock();
                in_dev = __in_dev_get_rcu(ndev);