On Thu, 2006-23-02 at 17:41 +0300, Alexey Kuznetsov wrote:

> After some thinking I suspect the deletion of this chunk could change 
> behaviour
> of some parts which do not use neighbour cache f.e. packet socket.
> 

Thanks Alexey, this was what i was worried about ;->

> 
> I think safer approach would be to move this chunk after if (daddr).
> And the possibility to remove this completely could be analyzed later.
> 

Ok, patch attached. Dave this also is needed for 2.6.16-rcXX.

Tested against a standard eth device (e1000) and tuntap.

cheers,
jamal


For ethernet-like netdevices, dont overwritte first packet's dst 
MAC address when it is already resolved

Signed-off-by: Jamal Hadi Salim <[EMAIL PROTECTED]>
---

diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 9890fd9..c971f14 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -95,6 +95,12 @@ int eth_header(struct sk_buff *skb, stru
                saddr = dev->dev_addr;
        memcpy(eth->h_source,saddr,dev->addr_len);
 
+       if(daddr)
+       {
+               memcpy(eth->h_dest,daddr,dev->addr_len);
+               return ETH_HLEN;
+       }
+       
        /*
         *      Anyway, the loopback-device should never use this function... 
         */
@@ -105,12 +111,6 @@ int eth_header(struct sk_buff *skb, stru
                return ETH_HLEN;
        }
        
-       if(daddr)
-       {
-               memcpy(eth->h_dest,daddr,dev->addr_len);
-               return ETH_HLEN;
-       }
-       
        return -ETH_HLEN;
 }
 

Reply via email to