Skip to contentSkip to conversation

Mac address in network stack.

DISCUSSION Rasmus Bøg Hansen 1 participant 1 message Oct 29, 2005

lore
Share & tools
lore
#0 lore raw

Hi

I am trying to adapt a sched module (WRR, a sched class and qdisc) to the 2.6 kernel. It was originally coded for 2.2 and classified hosts by their mac address. Later it got classification for IP and with 2.4 MAC support was deactivated as this apparently was done in another way in 2.4. I am now trying to reimplement the MAC support but have run into trouble...

In 2.2 the mac address of the sender and receiver of the packet was found by eg.:

memcpy(addr,skb->mac.ethernet->h_source,ETH_ALEN); memcpy(addr,skb->mac.ethernet->h_dest,ETH_ALEN);

This was apparently possible only when running in bridging mode. In the 2.6 kernel this seems to be able to do by eg.:

memcpy(addr,eth_hdr(skb)->h_source, ETH_ALEN);
memcpy(addr,eth_hdr(skb)->h_dest, ETH_ALEN);

However eth_hdr() seems to return a NULL pointer (really a pointer to skb->mac.raw), even when running in bridge mode.

I see this as a sign that the mac address is not available in this layer of the network stack. Is this true or am I just trying to fetch the MAC address in the wrong way?

Thanks in advance
/Rasmus

Signature · 4 lines
-- [ Rasmus "Møffe" Bøg Hansen ] ---------------------------------------
If there are no stupid questions, then what kind of questions do stupid
people ask? Do they get smart just in time to ask questions?
----------------------------------------------[ moffe at zz9 dot dk ] --