mac address byte order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

In an ethernet driver, I am reading the mac address from  the device
and assigning the dev_addr field of a net_device structure. The
dev_addr[0] field is assigned the lowest byte and dev_addr[5] is
assigned the highest byte of the address.

This setup works fine. For example I can get an IP address via dhcp,
and the dhcp server knows the address as in 
high[5]:[4]:[3]:[2]:[1]:[0]low order.

The problem is when I type ifconfig, I see the mac address in the
reverse order of what it should look like, i.e.
high[0]:[1]:[2]:[3]:[4]:[5]low.

I first thought I had wrong assignment in dev_addr, so reversed the
order, e.g. dev_addr[0] having the highest and dev_addr[5] having the
lowest byte. Then dhcp fails because it's not a right address. Perhaps
the kernel's order is reverse of what the device thinks?

I think the anomaly in ifconfig's output can't be fixed because
eth_type_trans() compares the ethernet header with dev_addr, if
dev_addr is in the order ifconfig expects, compare_ether_addr() will
never match the order in real header with dev_addr. What do you think?

Thanks,
Bahadir

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux