mac地址顺序

时间:2012-11-12 10:02:34

标签: mac-address endianness

我在ifconfig -a中找到了我的网络设备的MAC地址 - HWaddr 00:1a:92:9c:9b:bb

我如何在代码中与此地址相关联?

struct ethhdr {
        unsigned char   h_dest[ETH_ALEN];       /* destination eth addr */
        unsigned char   h_source[ETH_ALEN];     /* source ether addr    */
        __be16          h_proto;                /* packet type ID field */
} __attribute__((packed));

我正在努力写信给h_dest

memcpy(eth->h_dest,dest_mac,ETH_ALEN);

但我不知道我必须通过MAC地址值传递字节和位数的顺序。

1 个答案:

答案 0 :(得分:0)

它们应该是从左到右的顺序,所以h_dest[0] = 0x00