diff options
author | Ben Pfaff <blp@nicira.com> | 2013-07-25 16:27:39 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-08-07 23:52:42 -0700 |
commit | 2f980d741737fd3296d8063d800753a2d77bd730 (patch) | |
tree | 771e3219c847a39d5f032c9c1cec8b683b9cd0fd /lib/netdev-linux.c | |
parent | 89608a13e3bee2bf92456033c1573014a7d939c3 (diff) |
netdev: Make netdev_get_devices() take a reference to each netdev.
This API change is necessary for thread safety, to be added in an upcoming
commit. Otherwise, the client would not be able to actually use any of
the returned netdevs because they could already have been destroyed.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
Diffstat (limited to 'lib/netdev-linux.c')
-rw-r--r-- | lib/netdev-linux.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index ba0d8633..5bbaf632 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -555,6 +555,7 @@ netdev_linux_cache_cb(const struct rtnetlink_link_change *change, get_flags(&dev->up, &flags); netdev_linux_changed(dev, flags, 0); + netdev_close(netdev); } shash_destroy(&device_shash); } @@ -1180,6 +1181,7 @@ netdev_linux_miimon_run(void) bool miimon; if (dev->miimon_interval <= 0 || !timer_expired(&dev->miimon_timer)) { + netdev_close(netdev); continue; } @@ -1190,6 +1192,7 @@ netdev_linux_miimon_run(void) } timer_set_duration(&dev->miimon_timer, dev->miimon_interval); + netdev_close(netdev); } shash_destroy(&device_shash); @@ -1210,6 +1213,7 @@ netdev_linux_miimon_wait(void) if (dev->miimon_interval > 0) { timer_wait(&dev->miimon_timer); } + netdev_close(netdev); } shash_destroy(&device_shash); } |