Mac address in network stack.

From: Rasmus Bøg Hansen
Date: Sat Oct 29 2005 - 07:09:44 EST


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

--
-- [ 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 ] --

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/