Home > OS >  Ask how to get the machine within Linux protocol stack MAC address?
Ask how to get the machine within Linux protocol stack MAC address?

Time:09-21

Switches, Linux system
In data capture within the protocol stack, if it is sent to the machine data is not processing,
So you need to get to "br0" MAC address comparing with the packet destination MAC judgment
In the protocol stack, please how to get the machine "br0" MAC??

CodePudding user response:

She had found her way, using dev_get_by_name (& amp; Init_net, "br0") can obtain the net_device structure, the inside of the dev_addr parameter is the MAC address

CodePudding user response:

and learning, this function has been used, until I saw this article know net_device structure contains the MAC address, knowledgeable, before trying to obtain the MAC address is to adopt this way, according to the incoming message destination IP address matches the machine after the IP access to its destination MAC, here would like to ask the building Lord, if the machine has multiple interfaces, such as eth0, eth1... , how can it at the kernel level for all interface?

CodePudding user response:

I go to, this is not the kernel source area?

CodePudding user response:

Add some content, the net_device structure of filling was conducted when performing netdev_add function, nic driver on the probe function should be over there

CodePudding user response:

Use function is_etherdev_addr can determine the purpose of the data table is MAC native MAC,
  • Related