diff options
author | Luis R. Rodriguez <mcgrof@pogo.(none)> | 2007-11-11 21:47:23 -0500 |
---|---|---|
committer | Luis R. Rodriguez <mcgrof@pogo.(none)> | 2007-11-11 21:47:23 -0500 |
commit | 682166019ab0f0c98c3561c98d76cfbbb94bd3cd (patch) | |
tree | 74480b6bb0e31b18dd0059cd6a10efb499eda74b | |
parent | a1d38b2d6cb956b7958767dfc2170751aa593d22 (diff) | |
download | compat-wireless-2.6-old-682166019ab0f0c98c3561c98d76cfbbb94bd3cd.tar.gz |
Export eth_header() on compat.c.
Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
-rw-r--r-- | compat/compat.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/compat/compat.c b/compat/compat.c index 5a58c1f..4925b00 100644 --- a/compat/compat.c +++ b/compat/compat.c @@ -141,6 +141,59 @@ int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh) } EXPORT_SYMBOL(eth_header_cache); +/* 2.6.22 and 2.6.23 have eth_header() defined as extern in include/linux/etherdevice.h + * and actually defined in net/ethernet/eth.c but 2.6.24 exports it. Lets export it here */ + +/** + * eth_header - create the Ethernet header + * @skb: buffer to alter + * @dev: source device + * @type: Ethernet type field + * @daddr: destination address (NULL leave destination address) + * @saddr: source address (NULL use device source address) + * @len: packet length (<= skb->len) + * + * + * Set the protocol type. For a packet of type ETH_P_802_3 we put the length + * in here instead. It is up to the 802.2 layer to carry protocol information. + */ +int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, + void *daddr, void *saddr, unsigned len) +{ + struct ethhdr *eth = (struct ethhdr *)skb_push(skb, ETH_HLEN); + + if (type != ETH_P_802_3) + eth->h_proto = htons(type); + else + eth->h_proto = htons(len); + + /* + * Set the source hardware address. + */ + + if (!saddr) + 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... + */ + + if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) { + memset(eth->h_dest, 0, dev->addr_len); + return ETH_HLEN; + } + + return -ETH_HLEN; +} + +EXPORT_SYMBOL(eth_header); + /* 2.6.22 and 2.6.23 have eth_rebuild_header defined as extern in include/linux/etherdevice.h * and actually defined in net/ethernet/eth.c but 2.6.24 exports it. Lets export it here */ |