Commit 02e0e212 authored by Kai Germaschewski's avatar Kai Germaschewski

NET: Do not use dev->hard_header_len in eth_header()

The actual return value of eth_header() is never used, only its sign.
So it does not make a difference if we return dev->hard_header_len or
ETH_HLEN, but the latter makes more sense as that is the number of bytes
we added to the front of the frame.

For 99% of the drivers, dev->hard_header_len == ETH_HLEN, so no difference
at all, but if a driver actually needs additional headroom and thus
has dev->hard_header_len > ETH_HLEN, the process of building the ethernet
header should not care at all. 
parent 3dcf3431
...@@ -103,16 +103,16 @@ int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, ...@@ -103,16 +103,16 @@ int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
if (dev->flags & (IFF_LOOPBACK|IFF_NOARP)) if (dev->flags & (IFF_LOOPBACK|IFF_NOARP))
{ {
memset(eth->h_dest, 0, dev->addr_len); memset(eth->h_dest, 0, dev->addr_len);
return(dev->hard_header_len); return ETH_HLEN;
} }
if(daddr) if(daddr)
{ {
memcpy(eth->h_dest,daddr,dev->addr_len); memcpy(eth->h_dest,daddr,dev->addr_len);
return dev->hard_header_len; return ETH_HLEN;
} }
return -dev->hard_header_len; return -ETH_HLEN;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment