On Wed, 2009-06-10 at 11:30 +0200, Jonas Eriksson wrote: > Looking through the driver API, I came across the > drv_lookup_by_mac_string. This function is prototyped in > internal.h, so I assume that it is a part of the public driver > API.
The drv_ is not, but there is a public function ncf_lookup_by_mac_string in netcf.h. > However, a problem may arise when multiple top-level interfaces > share mac addresses, as drv_lookup_by_mac_string only may return > one struct netcf_if *. This can occurr when using vlan > interfaces, e.g. eth0.2 and eth0.3, or if vlan ifs are not to be > considered top-level interfaces, the bridges or bonds that these > interfaces are a part of. I therefore recommend a switch to a > drv_list_interfaces-prototype for drv_lookup_by_mac_string. Yes, you are right .. it's a mess. So far I only had situations like a bridge and an enslaved physical NIC sharing a MAC address, and I made sure that the bridge, not the enslaved NIC is returned when you ask for an interface by NIC. > For reference: > int drv_list_interfaces(struct netcf *ncf, int maxnames, char **names); You are right - we need a slightly more complicated interface to cover those cases, something like int ncf_lookup_by_mac_string(struct netcf *, const char *mac, int maxifs, struct netcf_if **interfaces); where the return value gives the total number of toplevel interfaces that match the given MAC, the (randomly) first MAXIFS many are returned in INTERFACES. Does that sound better ? David _______________________________________________ netcf-devel mailing list netcf-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/netcf-devel