The data items returned by netdev_get_devices() are "struct netdev *"s.
The code fixed up by this commit used them as "struct netdev_bsd *",
which happens to work because struct netdev happens to be at offset 0 in
each struct but it's better to do a proper cast in case someday
struct netdev gets moved to a nonzero offset.
Signed-off-by: Ben Pfaff <blp@nicira.com>
shash_init(&device_shash);
netdev_get_devices(&netdev_bsd_class, &device_shash);
SHASH_FOR_EACH (node, &device_shash) {
shash_init(&device_shash);
netdev_get_devices(&netdev_bsd_class, &device_shash);
SHASH_FOR_EACH (node, &device_shash) {
+ struct netdev *netdev = node->data;
+ dev = netdev_bsd_cast(netdev);
dev->cache_valid = 0;
netdev_bsd_changed(dev);
}
dev->cache_valid = 0;
netdev_bsd_changed(dev);
}
shash_init(&device_shash);
netdev_get_devices(&netdev_tap_class, &device_shash);
SHASH_FOR_EACH(node, &device_shash) {
shash_init(&device_shash);
netdev_get_devices(&netdev_tap_class, &device_shash);
SHASH_FOR_EACH(node, &device_shash) {
- struct netdev_bsd * const dev = node->data;
+ struct netdev *netdev = node->data;
+ struct netdev_bsd * const dev = netdev_bsd_cast(netdev);
if (!strcmp(dev->kernel_name, kernel_name)) {
shash_destroy(&device_shash);
if (!strcmp(dev->kernel_name, kernel_name)) {
shash_destroy(&device_shash);