What is the purpose of net_device.uc_promisc field?
why struct net_device
has a field uc_promisc
? How this field开发者_Go百科 is used?
Thank you all!
When a device that doesn't support unicast filtering has to listen to several unicast addresses, it is put on promiscous mode, according to dev->uc_count
and dev->uc_promisc
. Check the __dev_set_rx_mode()
function.
Many devices implement ndo_set_rx_mode()
, and set their unicast (and multicast) filters via ndo_set_rx_mode()
. For devices that don't implement that, Linux sets the device to promiscuous mode, and keeps track of that fact with dev->uc_promisc
.
So there are several flags for promiscuous mode:
dev->flags & IFF_PROMISC
means the device is in promiscuous mode.dev->gflags & IFF_PROMISC
means the user has requested promiscuous mode.dev->uc_promisc
means promiscuous mode has been enabled (actually, its reference count has been incremented) due to the need to listen to additional unicast address in a device that doesn't implementndo_set_rx_mode()
.
It sounds like it could be a way of enabling (or tracking the enabled/disabled status of) promiscuous mode on the device.
精彩评论