On Tue, 02.12.14 01:50, Tom Gundersen (tome...@kemper.freedesktop.org) wrote:
> > +/* IEEE Organizationally Unique Identifier vendor string */ > +static int ieee_oui(struct udev_hwdb *hwdb, struct ether_addr *mac, char > **ret) { > + struct udev_list_entry *entry; > + char *description; > + char str[32]; Shouldnt this be "4 + 6*2 + 1"? > + > + /* skip commonly misused 00:00:00 (Xerox) prefix */ > + if (memcmp(mac, "\0\0\0", 3) == 0) > + return -EINVAL; > + > + snprintf(str, sizeof(str), "OUI:%02X%02X%02X%02X%02X%02X", > mac->ether_addr_octet[0], mac->ether_addr_octet[1], mac->ether_addr_octet[2], > + > mac->ether_addr_octet[3], mac->ether_addr_octet[4], mac->ether_addr_octet[5]); > + Hmm, maybe we should have a new set of macros for this, similar to SD_ID128_FORMAT_STR and SD_ID128_FORMAT_VAL? > + udev_list_entry_foreach(entry, > udev_hwdb_get_properties_list_entry(hwdb, str, 0)) > + if (strcmp(udev_list_entry_get_name(entry), > "ID_OUI_FROM_DATABASE") == 0) { > + description = > strdup(udev_list_entry_get_value(entry)); > + if (!description) > + return -ENOMEM; > + > + *ret = description; > + return 0; > + } Hmm, why not just call udev_device_get_property_value()? Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel