How can I obtain the MAC address of the NIC in the kernel? You can obtain the MAC address based on the NIC name.

Source: Internet
Author: User
Ww7109
(Stranger)
04-08-23
How can I obtain the MAC address of the NIC in the kernel? You can obtain the MAC address based on the NIC name.
Reply

ArticleOption:

Dl_dht
(Addict)
04-08-23
Re: How can I obtain the MAC address of the NIC in the kernel? You can obtain the MAC address based on the NIC name.[Re: ww7109]
Reply

Struct net_device * Dev = dev_get_by_name ("ethx ");
Dev-> dev_addr

--------------------
Jisheng moudian month, Renji Banqiao cream.

Article options:

Zhanrk
(Addict)
04-08-23 :22
Re: How can I obtain the MAC address of the NIC in the kernel? You can obtain the MAC address based on the NIC name.[Re: ww7109]
Reply

Generally, you need to read the nic eeprom to obtain the MAC address, such as the ne2k series.

--------------------
Http://jtager.sourceforge.net

Article options:

Aarecn
(Newbie)
04-08-24 11: 24
Re: How can I obtain the MAC address of the NIC in the kernel? You can obtain the MAC address based on the NIC name.[Re: ww7109]
Reply

Use Dev-> dev_addr in the kernel to obtain the MAC address.
The MAC address is stored in the EEPROM, And the MAC address of the NIC without the EEPROM is generally transmitted through command line or bootloader. Some chips or CPUs have separate registers to set the MAC address, but it is usually not used. this is because all sent packets are filled with the dev_addr address, except for some chips with network acceleration.

Article options:

Chfwang
(Newbie)
04-08-24
Re: How can I obtain the MAC address of the NIC in the kernel? You can obtain the MAC address based on the NIC name.[Re: zhanrk]
Reply

The driver that reads the MAC address from the EEPROM has already helped you,
So you can directly read the address in the dev structure.

Article options:

Ww7109
(Stranger)
04-08-24 21: 27
Re: How can I obtain the MAC address of the NIC in the kernel? You can obtain the MAC address based on the NIC name.[Re: dl_dht]
Reply

Thanks.

Article options:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.